Finish v1.49.03(547)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
This commit is contained in:
commit
db246e6a94
@ -11,8 +11,8 @@ apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 546
|
||||
def appVersionName = '1.49.02'
|
||||
def appVersionCode = 547
|
||||
def appVersionName = '1.49.03'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
|
||||
@ -56,7 +56,6 @@ import it.integry.integrywmsnative.core.sound.SoundAlertService;
|
||||
import it.integry.integrywmsnative.core.update.UpdatesManager;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.login.rest.AuthenticationRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
|
||||
@ -263,12 +262,6 @@ public class MainApplicationModule {
|
||||
return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer, executorService);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ProdFabbisognoLineeProdRESTConsumer providesProdFabbisognoLineeProdRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new ProdFabbisognoLineeProdRESTConsumer(restBuilder, systemRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
DocInterniRESTConsumer provideDocInterniRESTConsumer(RESTBuilder restBuilder, MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||
|
||||
@ -132,7 +132,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
var codMarts = codMartToFind.parallelStream()
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
var response = articoloRESTConsumer
|
||||
.getByCodMart(new RetrieveArticoloByCodMartRequestDTO()
|
||||
@ -197,17 +197,6 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
return this.systemRESTConsumer.processSqlSynchronized("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList);
|
||||
}
|
||||
|
||||
public void getArtsGroups(List<String> groupsToFind, RunnableArgs<List<MtbGrup>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var data = getArtsGroupsSynchronized(groupsToFind);
|
||||
if (onComplete != null) onComplete.run(data);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public List<MtbUntMis> getUntMisArtsSynchronized(List<String> inputUntMis) throws Exception {
|
||||
List<HashMap<String, Object>> whereCondList = inputUntMis.parallelStream()
|
||||
|
||||
@ -66,21 +66,14 @@ public class MesRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public void getOrdiniLavorazione(String flagEvaso, RunnableArgs<List<OrdineLavorazioneDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public List<OrdineLavorazioneDTO> getOrdiniLavorazioneSynchronized(String flagEvaso) throws Exception {
|
||||
MesRESTConsumerService mesRESTConsumerService = restBuilder.getService(MesRESTConsumerService.class);
|
||||
|
||||
mesRESTConsumerService.getOrdiniLavorazione(flagEvaso)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, Response<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> response) {
|
||||
analyzeAnswer(response, "getOrdiniLavorazione", (m) -> onComplete.run(response.body().getDto()), onFailed);
|
||||
}
|
||||
var response = mesRESTConsumerService.getOrdiniLavorazione(flagEvaso)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "mes_v2/getOrdiniLavorazione");
|
||||
return data;
|
||||
}
|
||||
|
||||
public void getLineeProduzione(String codJfasParent, RunnableArgs<List<JtbFasi>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
@ -11,7 +11,6 @@ import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||
import com.ravikoradiya.liveadapter.Type;
|
||||
|
||||
@ -56,6 +55,7 @@ import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.prod_fabbiso
|
||||
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
||||
import it.integry.integrywmsnative.ui.filter_chips.FilterChipView;
|
||||
import it.integry.integrywmsnative.ui.filter_chips.filters.FilterNumeroOrdineLayoutView;
|
||||
import kotlin.Unit;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
@ -119,20 +119,39 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
mViewModel.init();
|
||||
|
||||
this.onLoadingStarted();
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
mViewModel.init();
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception ex) {
|
||||
this.onError(ex);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
mViewModel.getOrdiniList().observe(getViewLifecycleOwner(), data -> {
|
||||
mBindings.emptyView.setVisibility(data == null || data.isEmpty() ? View.VISIBLE : View.GONE);
|
||||
|
||||
this.onLoadingStarted();
|
||||
this.initMtbGrupsCache(() -> {
|
||||
this.initJtbComtCache(this::onLoadingEnded);
|
||||
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.initMtbGrupsCache();
|
||||
this.initJtbComtCache();
|
||||
this.onLoadingEnded();
|
||||
|
||||
handler.post(() -> {
|
||||
mFilterViewModel.init(mViewModel.getOrdiniList().getValue());
|
||||
this.refreshList(null);
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
this.onError(ex);
|
||||
}
|
||||
});
|
||||
|
||||
mFilterViewModel.init(mViewModel.getOrdiniList().getValue());
|
||||
this.refreshList(null);
|
||||
});
|
||||
|
||||
var itemTypeHeader = new Type<GroupTitleModel, FragmentProdFabbisognoLineeTitleItemBinding>(R.layout.fragment_prod_fabbisogno_linee_title_item, BR.item);
|
||||
@ -142,13 +161,13 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
||||
var item = x.getBinding().getItem();
|
||||
item.getSelected().set(!item.getSelected().get());
|
||||
|
||||
Stream.of(mProdFabbisognoItemModel)
|
||||
mProdFabbisognoItemModel.stream()
|
||||
.filter(y -> y instanceof ProdFabbisognoLineeItemModelDto && ((ProdFabbisognoLineeItemModelDto) y).getOrdineLavorazioneDTO().getCodJfas().equals(item.getTitle()))
|
||||
.forEach(y -> {
|
||||
((ProdFabbisognoLineeItemModelDto) y).getSelected().set(item.selected.get());
|
||||
});
|
||||
|
||||
fabVisible.set(Stream.of(mProdFabbisognoItemModel)
|
||||
fabVisible.set(mProdFabbisognoItemModel.stream()
|
||||
.filter(y -> y instanceof ProdFabbisognoLineeItemModelDto)
|
||||
.anyMatch(y -> ((ProdFabbisognoLineeItemModelDto) y).getSelected().get()));
|
||||
|
||||
@ -159,7 +178,7 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
||||
var item = x.getBinding().getItem();
|
||||
item.getSelected().set(!item.getSelected().get());
|
||||
|
||||
fabVisible.set(Stream.of(mProdFabbisognoItemModel)
|
||||
fabVisible.set(mProdFabbisognoItemModel.stream()
|
||||
.filter(y -> y instanceof ProdFabbisognoLineeItemModelDto)
|
||||
.anyMatch(y -> ((ProdFabbisognoLineeItemModelDto) y).getSelected().get()));
|
||||
|
||||
@ -169,6 +188,10 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
||||
new LiveAdapter(mProdFabbisognoItemModel)
|
||||
.map(GroupTitleModel.class, itemTypeHeader)
|
||||
.map(ProdFabbisognoLineeItemModelDto.class, itemType)
|
||||
.onNoData(noData -> {
|
||||
mBindings.emptyView.setVisibility(noData ? View.VISIBLE : View.GONE);
|
||||
return Unit.INSTANCE;
|
||||
})
|
||||
.into(this.mBindings.inventarioList);
|
||||
}
|
||||
|
||||
@ -191,10 +214,6 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
||||
|
||||
private List<Object> convertDataModelToListModel(List<ProdFabbisognoLineeItemModelDto> itemModel) {
|
||||
|
||||
Stream.of(itemModel)
|
||||
.sorted(Comparator.comparing(x -> x.getOrdineLavorazioneDTO().getCodJfas()))
|
||||
.toList();
|
||||
|
||||
List<Object> listaFinale = new ArrayList<>();
|
||||
String currentGroup = null;
|
||||
|
||||
@ -224,10 +243,10 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
||||
mFilterViewModel.getCurrentNumOrdsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||
mFilterViewModel.getCurrentGruppoMercPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||
|
||||
List<FilterChipDTO> filterList = Stream.of(ProdFabbisognoLineeProdBindings.AVAILABLE_FILTERS.entrySet())
|
||||
List<FilterChipDTO> filterList = ProdFabbisognoLineeProdBindings.AVAILABLE_FILTERS.entrySet().stream()
|
||||
.map(Map.Entry::getValue)
|
||||
.sortBy(FilterChipDTO::getPosizione)
|
||||
.toList();
|
||||
.sorted(Comparator.comparing(FilterChipDTO::getPosizione))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (FilterChipDTO filterChipDTO : filterList) {
|
||||
|
||||
@ -303,11 +322,11 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
||||
.setAllNumOrds(mFilterViewModel.getAllNumOrds())
|
||||
.setAvailableNumOrds(mFilterViewModel.getAvailableNumOrds())
|
||||
.setOnFilterApplied(mFilterViewModel::setNumOrdFilter)
|
||||
.setPreSelectedNumOrds(Stream.of(Objects.requireNonNull(mViewModel.getOrdiniList().getValue()))
|
||||
.setPreSelectedNumOrds(Objects.requireNonNull(mViewModel.getOrdiniList().getValue()).stream()
|
||||
.filter(mFilterViewModel.getCurrentNumOrdsPredicate().get() == null ?
|
||||
x -> false : Objects.requireNonNull(mFilterViewModel.getCurrentNumOrdsPredicate().get()))
|
||||
.map(x -> x.getOrdineLavorazioneDTO().getNumOrd())
|
||||
.toList());
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
case ProdFabbisognoLineeProdBindings.MGRP_FILTER_ID ->
|
||||
((FilterGruppoMercLayoutView) filterLayoutView)
|
||||
@ -322,42 +341,36 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
||||
|
||||
}
|
||||
|
||||
private void initMtbGrupsCache(Runnable onComplete) {
|
||||
var codMgrpArts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrdiniList().getValue()))
|
||||
.flatMap(x -> Stream.of(x.getOrdineLavorazioneDTO().getAvailableClassMerc() != null ?
|
||||
x.getOrdineLavorazioneDTO().getAvailableClassMerc() : new ArrayList<>()))
|
||||
private void initMtbGrupsCache() throws Exception {
|
||||
var codMgrpArts = Objects.requireNonNull(this.mViewModel.getOrdiniList().getValue()).stream()
|
||||
.flatMap(x ->
|
||||
(x.getOrdineLavorazioneDTO().getAvailableClassMerc() != null ?
|
||||
x.getOrdineLavorazioneDTO().getAvailableClassMerc() : new ArrayList<OrdineLavorazioneDTO.AvailableClassMerc>()).stream())
|
||||
.map(OrdineLavorazioneDTO.AvailableClassMerc::getCodMgrp)
|
||||
.withoutNulls()
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
|
||||
this.mArticoloRESTConsumer.getArtsGroups(codMgrpArts, mtbGrupCache -> {
|
||||
this.mtbGrupCache = mtbGrupCache;
|
||||
onComplete.run();
|
||||
}, this::onError);
|
||||
this.mtbGrupCache = this.mArticoloRESTConsumer.getArtsGroupsSynchronized(codMgrpArts);
|
||||
}
|
||||
|
||||
private void initJtbComtCache(Runnable onComplete) {
|
||||
private void initJtbComtCache() throws Exception {
|
||||
if (this.mViewModel.getOrdiniList().getValue() == null) {
|
||||
this.jtbComtCache = new ArrayList<>();
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
var jtbComts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrdiniList().getValue()))
|
||||
.flatMap(x -> Stream.of(x.getOrdineLavorazioneDTO().getCodJcom()))
|
||||
.distinct().withoutNulls()
|
||||
.toList();
|
||||
var jtbComts = Objects.requireNonNull(this.mViewModel.getOrdiniList().getValue()).stream()
|
||||
.map(x -> x.getOrdineLavorazioneDTO().getCodJcom())
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (jtbComts.isEmpty()) {
|
||||
this.jtbComtCache = new ArrayList<>();
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
|
||||
this.mCommessaRESTConsumer.getJtbComts(jtbComts, jtbComtCache -> {
|
||||
this.jtbComtCache = jtbComtCache;
|
||||
onComplete.run();
|
||||
}, this::onError);
|
||||
this.jtbComtCache = this.mCommessaRESTConsumer.getJtbComtsSynchronized(jtbComts);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -383,27 +396,34 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
||||
.map(x -> String.valueOf(((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getNumOrd()))
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
LocalDate dataInizio = Stream.of(mProdFabbisognoItemModel)
|
||||
LocalDate dataInizio = mProdFabbisognoItemModel.stream()
|
||||
.filter(x -> x instanceof ProdFabbisognoLineeItemModelDto && ((ProdFabbisognoLineeItemModelDto) x).selected.get())
|
||||
.map(x -> ((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getDataOrd())
|
||||
.min(Comparator.naturalOrder())
|
||||
.orElse(null);
|
||||
|
||||
LocalDate dataFine = Stream.of(mProdFabbisognoItemModel)
|
||||
LocalDate dataFine = mProdFabbisognoItemModel.stream()
|
||||
.filter(x -> x instanceof ProdFabbisognoLineeItemModelDto && ((ProdFabbisognoLineeItemModelDto) x).selected.get())
|
||||
.map(x -> ((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getDataOrd())
|
||||
.max(Comparator.naturalOrder())
|
||||
.orElse(null);
|
||||
|
||||
List<MtbGrup> listMtbGrup = Stream.of(mProdFabbisognoItemModel)
|
||||
List<MtbGrup> listMtbGrup = mProdFabbisognoItemModel.stream()
|
||||
.filter(x -> x instanceof ProdFabbisognoLineeItemModelDto && ((ProdFabbisognoLineeItemModelDto) x).selected.get())
|
||||
.flatMap(x -> Stream.of(((ProdFabbisognoLineeItemModelDto) x).getSelectedMtbGrup()))
|
||||
.toList();
|
||||
.flatMap(x -> ((ProdFabbisognoLineeItemModelDto) x).getSelectedMtbGrup().stream())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
this.mViewModel.loadFabbisogno(ordini, codMdep, dataInizio, dataFine, onCompleteData -> {
|
||||
startPickingActivity(listMtbGrup, onCompleteData);
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
onLoadingStarted();
|
||||
var fabbisognoData = this.mViewModel.loadFabbisogno(ordini, codMdep, dataInizio, dataFine);
|
||||
onLoadingEnded();
|
||||
|
||||
startPickingActivity(listMtbGrup, fabbisognoData);
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void startPickingActivity(List<MtbGrup> listMtbGrup, List<ProdFabbisognoLineeProdDTO> fabbisognoList) {
|
||||
@ -414,10 +434,10 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
||||
.map(x -> String.valueOf(((ProdFabbisognoLineeItemModelDto) x).getOrdineLavorazioneDTO().getNumOrd()))
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
Stream<ProdFabbisognoLineeProdDTO> streamSitArtOrd = Stream.of(fabbisognoList);
|
||||
java.util.stream.Stream<ProdFabbisognoLineeProdDTO> streamSitArtOrd = fabbisognoList.stream();
|
||||
|
||||
streamSitArtOrd = listMtbGrup != null && !listMtbGrup.isEmpty() ?
|
||||
streamSitArtOrd.filter(x -> Stream.of(listMtbGrup).anyMatch(y -> y.getCodMgrp().equalsIgnoreCase(x.getCodMgrp()))) :
|
||||
streamSitArtOrd.filter(x -> listMtbGrup.stream().anyMatch(y -> y.getCodMgrp().equalsIgnoreCase(x.getCodMgrp()))) :
|
||||
streamSitArtOrd;
|
||||
|
||||
List<SitArtOrdDTO> sitArtOrdDTOS = streamSitArtOrd.map(x -> {
|
||||
@ -439,7 +459,7 @@ public class ProdFabbisognoLineeProdFragment extends BaseFragment implements ITi
|
||||
|
||||
return sitArtOrdDTO;
|
||||
})
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
|
||||
boolean divideByGrpMerc = SettingsManager.iDB().isGroupPoductionByCommodityGroup();
|
||||
|
||||
|
||||
@ -3,14 +3,12 @@ package it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
@ -35,47 +33,41 @@ public class ProdFabbisognoLineeProdViewModel {
|
||||
this.mMesRESTConsumer = mesRESTConsumer;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
public void init() throws Exception {
|
||||
loadData();
|
||||
}
|
||||
|
||||
public void loadData() {
|
||||
this.sendOnLoadingStarted();
|
||||
public void loadData() throws Exception {
|
||||
|
||||
this.mMesRESTConsumer.getOrdiniLavorazione("I", ordini -> {
|
||||
var ordini = this.mMesRESTConsumer.getOrdiniLavorazioneSynchronized("I");
|
||||
|
||||
List<ProdFabbisognoLineeItemModelDto> itemModel = Stream.of(ordini)
|
||||
.filter(x -> x.getCodMdep().equals(SettingsManager.i().getUserSession().getDepo().getCodMdep()))
|
||||
.map(ord -> new ProdFabbisognoLineeItemModelDto()
|
||||
.setOrdineLavorazioneDTO(ord)
|
||||
)
|
||||
.sorted(Comparator.comparing(x -> x.getOrdineLavorazioneDTO().getCodJfas()))
|
||||
.toList();
|
||||
List<ProdFabbisognoLineeItemModelDto> itemModel = ordini.stream()
|
||||
.filter(x -> x.getCodMdep().equals(SettingsManager.i().getUserSession().getDepo().getCodMdep()))
|
||||
.map(ord ->
|
||||
new ProdFabbisognoLineeItemModelDto()
|
||||
.setOrdineLavorazioneDTO(ord)
|
||||
)
|
||||
.sorted(Comparator.comparing(x -> x.getOrdineLavorazioneDTO().getCodJfas()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
ordiniList.postValue(itemModel);
|
||||
this.sendOnLoadingEnded();
|
||||
}, this::sendError);
|
||||
ordiniList.postValue(itemModel);
|
||||
}
|
||||
|
||||
public LiveData<List<ProdFabbisognoLineeItemModelDto>> getOrdiniList() {
|
||||
return ordiniList;
|
||||
}
|
||||
|
||||
public void loadFabbisogno(String ordini, String codMdep, LocalDate dataInizio, LocalDate dataFine, RunnableArgs<List<ProdFabbisognoLineeProdDTO>> onComplete) {
|
||||
this.sendOnLoadingStarted();
|
||||
public List<ProdFabbisognoLineeProdDTO> loadFabbisogno(String ordini, String codMdep, LocalDate dataInizio, LocalDate dataFine) throws Exception {
|
||||
|
||||
this.mProdFabbisognoLineeProdRESTConsumer.loadFabbisogno(ordini, codMdep, jtbFasi -> {
|
||||
if (jtbFasi == null) jtbFasi = new ArrayList<>();
|
||||
var jtbFasi = this.mProdFabbisognoLineeProdRESTConsumer.loadFabbisognoSynchronized(ordini, codMdep);
|
||||
if (jtbFasi == null) jtbFasi = new ArrayList<>();
|
||||
|
||||
Stream.of(jtbFasi)
|
||||
.forEach(x -> {
|
||||
x.setDataInizio(dataInizio);
|
||||
x.setDataFine(dataFine);
|
||||
});
|
||||
jtbFasi.forEach(x -> {
|
||||
x.setDataInizio(dataInizio);
|
||||
x.setDataFine(dataFine);
|
||||
});
|
||||
|
||||
this.sendOnLoadingEnded();
|
||||
onComplete.run(jtbFasi);
|
||||
}, this::sendError);
|
||||
return jtbFasi;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,12 +3,11 @@ package it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.filters;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.annimon.stream.function.Predicate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||
@ -45,9 +44,11 @@ public class ProdFabbisognoLineeProdFilterViewModel {
|
||||
this.selectedMtbGrup = new ArrayList<>();
|
||||
} else {
|
||||
this.selectedMtbGrup = mtbGrupList;
|
||||
var mtbGrups = Stream.of(mtbGrupList).map(MtbGrup::getCodMgrp).toList();
|
||||
var mtbGrups = mtbGrupList.stream()
|
||||
.map(MtbGrup::getCodMgrp)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
currentGruppoMercPredicate.set(x -> Stream.of(x.getOrdineLavorazioneDTO().getAvailableClassMerc())
|
||||
currentGruppoMercPredicate.set(x -> x.getOrdineLavorazioneDTO().getAvailableClassMerc().stream()
|
||||
.anyMatch(y -> mtbGrups.contains(y.getCodMgrp())));
|
||||
}
|
||||
}
|
||||
@ -59,16 +60,19 @@ public class ProdFabbisognoLineeProdFilterViewModel {
|
||||
currentGruppoMercPredicate.get() == null) {
|
||||
returnList = this.initialList;
|
||||
} else {
|
||||
returnList = Stream.of(this.initialList)
|
||||
returnList = this.initialList.stream()
|
||||
.filter(x -> (currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||
).map(x -> x.setSelectedMtbGrup(this.selectedMtbGrup)).toList();
|
||||
)
|
||||
.map(x -> x.setSelectedMtbGrup(this.selectedMtbGrup))
|
||||
.collect(Collectors.toList());
|
||||
;
|
||||
}
|
||||
|
||||
this.currentList.setValue(returnList);
|
||||
}
|
||||
|
||||
public ObservableField<Predicate<ProdFabbisognoLineeItemModelDto>> getCurrentNumOrdsPredicate() {
|
||||
public ObservableField<java.util.function.Predicate<ProdFabbisognoLineeItemModelDto>> getCurrentNumOrdsPredicate() {
|
||||
return currentNumOrdsPredicate;
|
||||
}
|
||||
|
||||
@ -87,11 +91,11 @@ public class ProdFabbisognoLineeProdFilterViewModel {
|
||||
public List<Integer> getAvailableNumOrds() {
|
||||
if (currentGruppoMercPredicate.get() == null) return getAllNumOrds();
|
||||
else {
|
||||
return Stream.of(this.initialList)
|
||||
return this.initialList.stream()
|
||||
.filter(x -> (currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))))
|
||||
.map(x -> x.getOrdineLavorazioneDTO().getNumOrd())
|
||||
.distinct()
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,43 +104,41 @@ public class ProdFabbisognoLineeProdFilterViewModel {
|
||||
}
|
||||
|
||||
public List<MtbGrup> getAllGruppoMerc(List<MtbGrup> mtbGrupFullList) {
|
||||
var codMgrp = Stream.of(initialList)
|
||||
var codMgrp = initialList.stream()
|
||||
.flatMap(x ->
|
||||
Stream.of(x.getOrdineLavorazioneDTO().getAvailableClassMerc() != null ?
|
||||
(x.getOrdineLavorazioneDTO().getAvailableClassMerc() != null ?
|
||||
x.getOrdineLavorazioneDTO().getAvailableClassMerc() :
|
||||
new ArrayList<>()))
|
||||
new ArrayList<OrdineLavorazioneDTO.AvailableClassMerc>()).stream())
|
||||
.map(OrdineLavorazioneDTO.AvailableClassMerc::getCodMgrp)
|
||||
.withoutNulls()
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return Stream.of(Objects.requireNonNull(mtbGrupFullList))
|
||||
.filter(x -> codMgrp.contains(x.getCodMgrp()))
|
||||
return Objects.requireNonNull(mtbGrupFullList).stream()
|
||||
.filter(x -> x != null && codMgrp.contains(x.getCodMgrp()))
|
||||
.distinct()
|
||||
.withoutNulls()
|
||||
.sortBy(MtbGrup::getDescrizione)
|
||||
.toList();
|
||||
.sorted(Comparator.comparing(MtbGrup::getDescrizione))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<MtbGrup> getAvailableGruppoMerc(List<MtbGrup> mtbGrupFullList){
|
||||
if (currentNumOrdsPredicate.get() == null){
|
||||
public List<MtbGrup> getAvailableGruppoMerc(List<MtbGrup> mtbGrupFullList) {
|
||||
if (currentNumOrdsPredicate.get() == null) {
|
||||
return getAllGruppoMerc(mtbGrupFullList);
|
||||
} else {
|
||||
List<String> availableCodMgrups = Stream.of(this.initialList)
|
||||
List<String> availableCodMgrups = this.initialList.stream()
|
||||
.filter(x ->
|
||||
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x)))
|
||||
)
|
||||
.flatMap(x -> Stream.of(x.getOrdineLavorazioneDTO().getAvailableClassMerc()))
|
||||
.flatMap(x -> x.getOrdineLavorazioneDTO().getAvailableClassMerc().stream())
|
||||
.map(OrdineLavorazioneDTO.AvailableClassMerc::getCodMgrp)
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
return Stream.of(Objects.requireNonNull(mtbGrupFullList))
|
||||
.filter(x -> availableCodMgrups.contains(x.getCodMgrp()))
|
||||
return Objects.requireNonNull(mtbGrupFullList).stream()
|
||||
.filter(x -> x != null && availableCodMgrups.contains(x.getCodMgrp()))
|
||||
.distinct()
|
||||
.withoutNulls()
|
||||
.sortBy(MtbGrup::getDescrizione)
|
||||
.toList();
|
||||
.sorted(Comparator.comparing(MtbGrup::getDescrizione))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,26 +1,21 @@
|
||||
package it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.JtbFasi;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dto.ProdFabbisognoLineeProdDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class ProdFabbisognoLineeProdRESTConsumer extends _BaseRESTConsumer {
|
||||
@ -28,32 +23,25 @@ public class ProdFabbisognoLineeProdRESTConsumer extends _BaseRESTConsumer {
|
||||
private final RESTBuilder restBuilder;
|
||||
private final SystemRESTConsumer systemRESTConsumer;
|
||||
|
||||
@Inject
|
||||
public ProdFabbisognoLineeProdRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
public void loadFabbisogno(String numOrd, String codMdep, RunnableArgs<List<ProdFabbisognoLineeProdDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public List<ProdFabbisognoLineeProdDTO> loadFabbisognoSynchronized(String numOrd, String codMdep) throws Exception {
|
||||
ProdFabbisognoLineeProdRESTConsumerService prodFabbisognoLineeProdRESTConsumerService = restBuilder.getService(ProdFabbisognoLineeProdRESTConsumerService.class);
|
||||
prodFabbisognoLineeProdRESTConsumerService.loadFabbisogno(numOrd, codMdep)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<ProdFabbisognoLineeProdDTO>>> call,
|
||||
Response<ServiceRESTResponse<List<ProdFabbisognoLineeProdDTO>>> response) {
|
||||
analyzeAnswer(response, "retrieveFabbisogno", onComplete, onFailed);
|
||||
}
|
||||
var response = prodFabbisognoLineeProdRESTConsumerService.loadFabbisogno(numOrd, codMdep)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<ProdFabbisognoLineeProdDTO>>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "approvvigionamento/retrieveFabbisogno");
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
public void loadFabbisogno(String codMart, String ordini, Date startDate, Date endDate, String codMdep, RunnableArgs<List<ProdFabbisognoLineeProdDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
String sql = "SELECT DISTINCT cod_jfas\n" +
|
||||
public ArrayList<JtbFasi> loadCodJfasOfFabbisognoSynchronized(String codMart, String ordini, LocalDate startDate, LocalDate endDate, String codMdep) throws Exception {
|
||||
String sql = "SELECT DISTINCT jtb_fasi.cod_jfas, jtb_fasi.descrizione\n" +
|
||||
"FROM (SELECT DENSE_RANK() OVER (PARTITION BY dtb_ordt.gestione, dtb_ordt.data_ord, dtb_ordt.num_ord ORDER BY dtb_ord_steps.data_iniz DESC) AS row_n,\n" +
|
||||
" dtb_ord_steps.*\n" +
|
||||
" FROM dtb_ord_steps\n" +
|
||||
@ -71,11 +59,12 @@ public class ProdFabbisognoLineeProdRESTConsumer extends _BaseRESTConsumer {
|
||||
" AND dtb_ordt.num_ord IN ( " + ordini + " )\n" +
|
||||
" AND dtb_ordt.data_ord BETWEEN " + UtilityDB.valueToString(startDate) + " AND " + UtilityDB.valueToString(endDate) + "\n" +
|
||||
" AND dtb_ordr.cod_mart = " + UtilityDB.valueToString(codMart) + ") t\n" +
|
||||
"INNER JOIN jtb_fasi ON t.cod_jfas = jtb_fasi.cod_jfas\n" +
|
||||
"WHERE t.row_n = 1";
|
||||
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<ProdFabbisognoLineeProdDTO>>() {}.getType();
|
||||
this.systemRESTConsumer.processSql(sql, typeOfObjectsList, onComplete, onFailed);
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<JtbFasi>>() {}.getType();
|
||||
return this.systemRESTConsumer.processSqlSynchronized(sql, typeOfObjectsList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -119,6 +119,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
private boolean mFlagShowCodForn;
|
||||
private boolean mDivideByGrpMerc;
|
||||
private boolean mEnableQuantityReset;
|
||||
private boolean mIsApprovLinee;
|
||||
private int mBarcodeScannerInstanceID = -1;
|
||||
|
||||
private ArrayList<SitArtOrdDTO> mSitArtOrd;
|
||||
|
||||
@ -128,6 +128,7 @@ public class SpedizioneViewModel {
|
||||
private boolean mEnableQuantityReset;
|
||||
private boolean mUseQtaOrd;
|
||||
private boolean mUseColliPedana;
|
||||
private boolean mIsApprovLinee = false;
|
||||
private boolean mIsOrdTrasf = false;
|
||||
|
||||
private MtbColt mCurrentMtbColt = null;
|
||||
@ -187,7 +188,19 @@ public class SpedizioneViewModel {
|
||||
}
|
||||
|
||||
|
||||
public void init(String codMdep, boolean enableGiacenza, boolean enableCheckPartitaMag, boolean shouldAskPesoLU, boolean canOverflowOrderQuantity, List<SitArtOrdDTO> pickingList, List<OrdineUscitaInevasoDTO> testateOrdini, GestioneEnum gestioneCol, int segnoCol, Integer defaultCausaleUL, boolean enableQuantityReset, boolean useQtaOrd, boolean useColliPedana) {
|
||||
public void init(String codMdep,
|
||||
boolean enableGiacenza,
|
||||
boolean enableCheckPartitaMag,
|
||||
boolean shouldAskPesoLU,
|
||||
boolean canOverflowOrderQuantity,
|
||||
List<SitArtOrdDTO> pickingList,
|
||||
List<OrdineUscitaInevasoDTO> testateOrdini,
|
||||
GestioneEnum gestioneCol,
|
||||
int segnoCol,
|
||||
Integer defaultCausaleUL,
|
||||
boolean enableQuantityReset,
|
||||
boolean useQtaOrd,
|
||||
boolean useColliPedana) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
this.mDefaultCodMdep = codMdep;
|
||||
@ -221,6 +234,8 @@ public class SpedizioneViewModel {
|
||||
this.mDefaultSegnoCol = segnoCol;
|
||||
|
||||
this.initDefaultVars();
|
||||
|
||||
this.mIsApprovLinee = this.mColliScaricoRESTConsumer instanceof ColliLavorazioneRESTConsumer && mDefaultSegnoCol == 1;
|
||||
}
|
||||
|
||||
private void getPartitaMagList(List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<MtbPartitaMag>> onComplete) {
|
||||
@ -1746,9 +1761,11 @@ public class SpedizioneViewModel {
|
||||
|
||||
var filledMtbColts = this.mColliMagazzinoRESTConsumer.fillMtbAartsOfMtbColtsSynchronized(generatedMtbColts);
|
||||
|
||||
var positionedMtbColts = this.askPositionChange(filledMtbColts);
|
||||
|
||||
this.askPrint((shouldPrint && SettingsManager.iDB().isFlagPrintEtichetteOnLUClose()), positionedMtbColts);
|
||||
List<MtbColt> positionedMtbColts = this.askPositionChange(filledMtbColts);
|
||||
|
||||
if (!mIsApprovLinee)
|
||||
this.askPrint((shouldPrint && SettingsManager.iDB().isFlagPrintEtichetteOnLUClose()), positionedMtbColts);
|
||||
|
||||
postCloseOperations(positionedMtbColts);
|
||||
|
||||
@ -1773,7 +1790,7 @@ public class SpedizioneViewModel {
|
||||
//.setPrintSSCC(shouldPrint)
|
||||
.setOrderCodMdep(codMdep);
|
||||
|
||||
if (this.mColliScaricoRESTConsumer instanceof ColliLavorazioneRESTConsumer && !mIsOrdTrasf) {
|
||||
if (this.mColliScaricoRESTConsumer instanceof ColliLavorazioneRESTConsumer && !mIsOrdTrasf && !mIsApprovLinee) {
|
||||
closeUDSRequestDto.setCriterioDistribuzione(CriterioDistribuzioneEnum.FASE);
|
||||
|
||||
var codAnag = mTestateOrdini.stream()
|
||||
|
||||
@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -15,19 +16,20 @@ import androidx.databinding.DataBindingUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.model.JtbFasi;
|
||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.databinding.DialogRowInfoProdFabbisognoLineeProdBinding;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dto.ProdFabbisognoLineeProdDTO;
|
||||
import it.integry.integrywmsnative.gest.spedizione.ui.SpedizioneListModel;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.BaseDialogRowInfoView;
|
||||
import it.integry.integrywmsnative.gest.spedizione.ui.SpedizioneListModel;
|
||||
|
||||
public class DialogRowInfoProdFabbisognoLineeProdView extends BaseDialogRowInfoView implements DialogRowInfoProdFabbisognoLineeProdViewModel.Listener {
|
||||
|
||||
@ -35,6 +37,9 @@ public class DialogRowInfoProdFabbisognoLineeProdView extends BaseDialogRowInfoV
|
||||
@Inject
|
||||
DialogRowInfoProdFabbisognoLineeProdViewModel mViewModel;
|
||||
|
||||
@Inject
|
||||
Handler handler;
|
||||
|
||||
private Context mContext;
|
||||
private DialogRowInfoProdFabbisognoLineeProdBinding mBindings;
|
||||
|
||||
@ -70,27 +75,45 @@ public class DialogRowInfoProdFabbisognoLineeProdView extends BaseDialogRowInfoV
|
||||
|
||||
SitArtOrdDTO sitArtOrdDTO = getSpedizioneListModel().getOriginalModel().getSitArtOrdDTO();
|
||||
|
||||
this.mViewModel.getFabbisognoList().removeObservers(this);
|
||||
this.mViewModel.getFabbisognoList().observe(this, this::onFabbisognoListLoaded);
|
||||
this.mViewModel.getLineeProdList().removeObservers(this);
|
||||
this.mViewModel.getLineeProdList().observe(this, this::onLineeProdLoaded);
|
||||
|
||||
this.onLoadingStarted();
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewModel.init(
|
||||
sitArtOrdDTO.getCodMart(),
|
||||
sitArtOrdDTO.getCodMdep(),
|
||||
(String) sitArtOrdDTO.getExtraInfo().get("ordini"),
|
||||
(LocalDate) sitArtOrdDTO.getExtraInfo().get("dataInizio"),
|
||||
(LocalDate) sitArtOrdDTO.getExtraInfo().get("dataFine"));
|
||||
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
|
||||
this.mViewModel.init(
|
||||
sitArtOrdDTO.getCodMart(),
|
||||
sitArtOrdDTO.getCodMdep(),
|
||||
(String) sitArtOrdDTO.getExtraInfo().get("ordini"),
|
||||
(Date) sitArtOrdDTO.getExtraInfo().get("dataInizio"),
|
||||
(Date) sitArtOrdDTO.getExtraInfo().get("dataFine"));
|
||||
}
|
||||
|
||||
private void onFabbisognoListLoaded(List<ProdFabbisognoLineeProdDTO> fabbisognoList) {
|
||||
private void onLineeProdLoaded(List<JtbFasi> fabbisognoList) {
|
||||
for (int i = 0; i < fabbisognoList.size(); i++) {
|
||||
String currentKey = fabbisognoList.get(i).getCodJfas();
|
||||
|
||||
ViewGroup.LayoutParams lparams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
TextView tv = new TextView(this.mContext);
|
||||
tv.setLayoutParams(lparams);
|
||||
tv.setText(currentKey);
|
||||
|
||||
this.mBindings.contentView.addView(tv);
|
||||
View inflatedLayout= getLayoutInflater().inflate(R.layout.dialog_row_info_prod_fabbisogno_linee_prod__linea_prod__list_item, null, false);
|
||||
|
||||
inflatedLayout.setLayoutParams(lparams);
|
||||
inflatedLayout.setTag(currentKey);
|
||||
|
||||
TextView tvDescription = inflatedLayout.findViewById(R.id.description);
|
||||
tvDescription.setText(fabbisognoList.get(i).getDescrizione());
|
||||
|
||||
TextView tvCode = inflatedLayout.findViewById(R.id.code);
|
||||
tvCode.setText(fabbisognoList.get(i).getCodJfas());
|
||||
|
||||
this.mBindings.contentView.addView(inflatedLayout);
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,13 +125,17 @@ public class DialogRowInfoProdFabbisognoLineeProdView extends BaseDialogRowInfoV
|
||||
|
||||
@Override
|
||||
public void onLoadingStarted() {
|
||||
this.mBindings.loadingView.setVisibility(View.VISIBLE);
|
||||
this.mBindings.contentView.setVisibility(View.GONE);
|
||||
handler.post(() -> {
|
||||
this.mBindings.loadingView.setVisibility(View.VISIBLE);
|
||||
this.mBindings.contentView.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingEnded() {
|
||||
this.mBindings.loadingView.setVisibility(View.GONE);
|
||||
this.mBindings.contentView.setVisibility(View.VISIBLE);
|
||||
handler.post(() -> {
|
||||
this.mBindings.loadingView.setVisibility(View.GONE);
|
||||
this.mBindings.contentView.setVisibility(View.VISIBLE);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,18 +2,18 @@ package it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.prod_fabbis
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dto.ProdFabbisognoLineeProdDTO;
|
||||
import it.integry.integrywmsnative.core.model.JtbFasi;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
|
||||
|
||||
public class DialogRowInfoProdFabbisognoLineeProdViewModel {
|
||||
|
||||
private final ProdFabbisognoLineeProdRESTConsumer mProdFabbisognoLineeProdRESTConsumer;
|
||||
|
||||
private final MutableLiveData<List<ProdFabbisognoLineeProdDTO>> mFabbisognoList = new MutableLiveData<>();
|
||||
private final MutableLiveData<List<JtbFasi>> mLineeProdList = new MutableLiveData<>();
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
@ -23,18 +23,15 @@ public class DialogRowInfoProdFabbisognoLineeProdViewModel {
|
||||
}
|
||||
|
||||
|
||||
public void init(String codMart, String codMdep, String ordni, Date startDate, Date endDate) {
|
||||
this.sendOnLoadingStarted();
|
||||
public void init(String codMart, String codMdep, String ordni, LocalDate startDate, LocalDate endDate) throws Exception {
|
||||
|
||||
this.mProdFabbisognoLineeProdRESTConsumer.loadFabbisogno(codMart, ordni, startDate, endDate, codMdep, fabbisognoList -> {
|
||||
this.mFabbisognoList.postValue(fabbisognoList);
|
||||
this.sendOnLoadingEnded();
|
||||
}, this::sendError);
|
||||
var lineeProd = this.mProdFabbisognoLineeProdRESTConsumer.loadCodJfasOfFabbisognoSynchronized(codMart, ordni, startDate, endDate, codMdep);
|
||||
this.mLineeProdList.postValue(lineeProd);
|
||||
}
|
||||
|
||||
|
||||
public MutableLiveData<List<ProdFabbisognoLineeProdDTO>> getFabbisognoList() {
|
||||
return mFabbisognoList;
|
||||
public MutableLiveData<List<JtbFasi>> getLineeProdList() {
|
||||
return mLineeProdList;
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
|
||||
@ -134,7 +134,7 @@
|
||||
tools:text="28 maggio 2021" />
|
||||
|
||||
<TextView
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{`Ordine #`+ view.currentOrder.numOrd}"
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
|
||||
@ -62,7 +62,7 @@
|
||||
android:id="@+id/title_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:text="@string/production_line"
|
||||
android:gravity="center_horizontal"/>
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:text="Si è verificato un problema"
|
||||
android:gravity="center_horizontal"/>
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="0dp">
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
|
||||
<ScrollView
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:focusable="false"
|
||||
android:clickable="false">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toStartOf="@id/code"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="false"
|
||||
android:layout_marginEnd="4dp"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
tools:text="Linea prod" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/code"
|
||||
style="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:textColor="?colorOnPrimaryContainer"
|
||||
android:background="@drawable/bg_checked_layout"
|
||||
android:backgroundTint="?colorPrimaryContainer"
|
||||
android:paddingHorizontal="6dp"
|
||||
android:paddingVertical="2dp"
|
||||
tools:text="01" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</layout>
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
@ -47,7 +48,8 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/dialog_switch_user_depo__list_item" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
android:id="@+id/title_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:text="@string/dialog_vendita_filtro_avanzato"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_marginBottom="12dp"/>
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
android:id="@+id/title_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:text="@string/dialog_vendita_filtro_avanzato"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_marginBottom="12dp"/>
|
||||
|
||||
@ -39,8 +39,7 @@
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:background="@color/full_white">
|
||||
android:paddingEnd="8dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkbox"
|
||||
@ -80,7 +79,6 @@
|
||||
tools:text="n. 39 del 27 ott 2017"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="#000"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_alignParentStart="true"
|
||||
style="@style/TextAppearance.Material3.BodyMedium"
|
||||
|
||||
@ -84,7 +84,6 @@
|
||||
android:id="@+id/filter_chips"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/gray_050"
|
||||
android:scrollbars="none">
|
||||
|
||||
<com.google.android.material.chip.ChipGroup
|
||||
@ -102,7 +101,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fadeScrollbars="true"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/fragment_prod_fabbisogno_linee_list_single_item"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
@ -128,7 +128,7 @@
|
||||
tools:text="28 maggio 2021" />
|
||||
|
||||
<TextView
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{`Ordine #`+ view.currentOrder.numOrd}"
|
||||
|
||||
@ -8,19 +8,9 @@
|
||||
<style name="TextViewMaterial.Dialog">
|
||||
</style>
|
||||
|
||||
<style name="TextViewMaterial.Dialog.HeadlineText">
|
||||
<item name="android:textColor">#1C1B1F</item>
|
||||
<item name="android:textSize">24sp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextViewMaterial.Dialog.SupportingText">
|
||||
<item name="android:textColor">#57535D</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextViewMaterial.Dialog.Button">
|
||||
<item name="android:textColor">#6750A4</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
Loading…
x
Reference in New Issue
Block a user