Tanto vario

This commit is contained in:
2022-01-25 11:14:15 +01:00
parent 7d771bf39b
commit cc7044c7de
101 changed files with 2570 additions and 1962 deletions

View File

@@ -551,6 +551,12 @@ public class Converters {
}
@BindingAdapter("visibility")
public static void bindViewVisibility(View view, boolean bool) {
view.setVisibility(bool ? View.VISIBLE : View.GONE);
}
@BindingAdapter({"reverse_visibility"})
public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) {
if (view.getTag(R.id.bound_observable) != bindableBoolean) {

View File

@@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
import androidx.databinding.ObservableArrayList;
import com.annimon.stream.Optional;
import com.annimon.stream.Stream;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
@@ -32,6 +33,7 @@ import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
import it.integry.integrywmsnative.core.utility.UtilityDate;
@@ -646,4 +648,58 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
});
}
public void versamentoAutomaticoUL(MtbColt sourceMtbColt, RunnableArgs<VersamentoAutomaticoULResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
for (int i = 0; i < sourceMtbColtClone.getMtbColr().size(); i++) {
sourceMtbColtClone.getMtbColr().get(i)
.setMtbAart(null)
.setMtbPartitaMag(null);
}
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.versamentoAutomaticoUL(sourceMtbColtClone).enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Response<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> response) {
analyzeAnswer(response, "versamentoAutomaticoUL", data -> {
var result = response.body().getDto();
List<MtbColr> allMtbColr = new ArrayList<>();
allMtbColr.addAll(result.getSuccess());
allMtbColr.addAll(result.getFailed());
List<String> codMarts = Stream.of(allMtbColr)
.map(x -> x.getCodMart().trim())
.toList();
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
for (var mtbColr : allMtbColr) {
MtbAart foundMtbAart = null;
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
.findFirst();
if(mtbAartOpt.isPresent()){
foundMtbAart = mtbAartOpt.get();
}
mtbColr.setMtbAart(foundMtbAart);
}
onComplete.run(result);
}, onFailed);
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
}
});
}
}

View File

@@ -10,6 +10,7 @@ import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
@@ -42,4 +43,7 @@ public interface ColliMagazzinoRESTConsumerService {
@POST("wms/assegnaLottoSuColloScarico")
Call<ServiceRESTResponse<MtbColt>> assegnaLottoSuColloScarico(@Body MtbColt mtbColt);
@POST("wms/versamentoAutomaticoUL")
Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> versamentoAutomaticoUL(@Body MtbColt mtbColt);
}

View File

@@ -0,0 +1,29 @@
package it.integry.integrywmsnative.core.rest.model;
import java.util.List;
import it.integry.integrywmsnative.core.model.MtbColr;
public class VersamentoAutomaticoULResponseDTO {
private List<MtbColr> success;
private List<MtbColr> failed;
public List<MtbColr> getSuccess() {
return success;
}
public VersamentoAutomaticoULResponseDTO setSuccess(List<MtbColr> success) {
this.success = success;
return this;
}
public List<MtbColr> getFailed() {
return failed;
}
public VersamentoAutomaticoULResponseDTO setFailed(List<MtbColr> failed) {
this.failed = failed;
return this;
}
}

View File

@@ -44,6 +44,7 @@ import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
import it.integry.integrywmsnative.core.report.ReportManager;
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
@@ -58,6 +59,7 @@ import it.integry.integrywmsnative.gest.accettazione_picking.dto.PickingObjectDT
import it.integry.integrywmsnative.gest.accettazione_picking.filters.AccettazionePickingFiltroOrdineViewModel;
import it.integry.integrywmsnative.gest.accettazione_picking.filters.FilterCodArtLayoutView;
import it.integry.integrywmsnative.gest.accettazione_picking.filters.FilterDescrLayoutView;
import it.integry.integrywmsnative.gest.accettazione_picking.filters.FilterPosizioneLayoutView;
import it.integry.integrywmsnative.gest.accettazione_picking.rest.RecoverMtbColt;
import it.integry.integrywmsnative.gest.accettazione_picking.ui.AccettazioneListAdapter;
import it.integry.integrywmsnative.gest.accettazione_picking.ui.AccettazioneListModel;
@@ -68,10 +70,12 @@ import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
import it.integry.integrywmsnative.ui.filter_chips.FilterChipView;
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentView;
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
import it.integry.integrywmsnative.view.dialogs.ask_should_versamento_automatico_ul.DialogAskShouldVersamentoAutomaticoULView;
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
import it.integry.integrywmsnative.view.dialogs.note_aggiuntive_lu.NoteAggiuntiveLUDialog;
import it.integry.integrywmsnative.view.dialogs.versamento_automatico_ul_done.DialogVersamentoAutomaticoULDoneView;
public class AccettazionePickingActivity extends BaseActivity implements AccettazionePickingViewModel.Listener, BottomSheetFragmentLUContentViewModel.Listener, BottomSheetFragmentLUContentView.Listener {
@@ -152,6 +156,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
mAppliedFilterViewModel.getCurrentCodArtPredicate().addOnPropertyChangedCallback(onPredicateChanged);
mAppliedFilterViewModel.getCurrentDescrPredicate().addOnPropertyChangedCallback(onPredicateChanged);
mAppliedFilterViewModel.getCurrentPosPredicate().addOnPropertyChangedCallback(onPredicateChanged);
List<FilterChipDTO> filterList = Stream.of(AccettazionePickingBindings.AVAILABLE_FILTERS.entrySet())
.map(Map.Entry::getValue)
@@ -171,6 +176,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
@Override
public void run() {
if (mAppliedFilterViewModel.getCurrentCodArtPredicate().get() == null) {
mViewModel.resetMatchedRows();
filterChipView.disableCloseIcon();
mBindings.filterChipsGroup.removeView(filterChipView);
@@ -192,6 +198,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
@Override
public void run() {
if (mAppliedFilterViewModel.getCurrentDescrPredicate().get() == null) {
mViewModel.resetMatchedRows();
filterChipView.disableCloseIcon();
mBindings.filterChipsGroup.removeView(filterChipView);
@@ -208,6 +215,28 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
});
filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentDescrPredicate().set(null));
break;
case AccettazionePickingBindings.POS_FILTER_ID:
mAppliedFilterViewModel.getCurrentPosPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
@Override
public void run() {
if (mAppliedFilterViewModel.getCurrentPosPredicate().get() == null) {
mViewModel.resetMatchedRows();
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.getCurrentPosPredicate().set(null));
break;
}
this.mBindings.filterChipsGroup.addView(filterChipView);
@@ -250,13 +279,25 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
.map(x -> x.getSitArtOrdDTO().getDescrizioneEstesaArt())
.toList());
break;
case AccettazionePickingBindings.POS_FILTER_ID:
((FilterPosizioneLayoutView) filterLayoutView)
.setAll(mAppliedFilterViewModel.getAllPos())
.setAvailable(mAppliedFilterViewModel.getAvailablePos())
.setOnFilterApplied(mAppliedFilterViewModel::setPosFilter)
.setPreselected(Stream.of(Objects.requireNonNull(mViewModel.getPickingList().getValue()))
.filter(mAppliedFilterViewModel.getCurrentPosPredicate().get() == null ?
x -> false :
mAppliedFilterViewModel.getCurrentPosPredicate().get())
.map(x -> x.getMtbAart().getPosizione())
.toList());
break;
}
filterLayoutView.show(getSupportFragmentManager(), "TAG");
}
@Override
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
@@ -288,7 +329,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
// Handle item selection
switch (item.getItemId()) {
case R.id.action_filter:
showOrderDialog();
showOrderByDialog();
return true;
default:
return super.onOptionsItemSelected(item);
@@ -326,7 +367,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
}
private void refreshList() {
this.onLoadingStarted();
//this.onLoadingStarted();
//new Thread(() -> {
@@ -346,7 +387,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
this.mAccettazioneMutableData.addAll(list);
this.noItemsToPick.set(!isThereAnyItemToPick(tmpList));
this.onLoadingEnded();
//this.onLoadingEnded();
});
}
@@ -388,7 +429,8 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
accettazioneListModel.setBadge2(String.valueOf(x.getSitArtOrdDTO().getNumOrd()));
accettazioneListModel.setDescrizione(x.getSitArtOrdDTO().getDescrizioneCommessa());
if(x.getMtbAart() != null) accettazioneListModel.setPosizione(x.getMtbAart().getPosizione());
if (x.getMtbAart() != null)
accettazioneListModel.setPosizione(x.getMtbAart().getPosizione());
//Calc Num CNF
BigDecimal numCnfEvasa = BigDecimal.ZERO;
@@ -452,7 +494,8 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
accettazioneListModel.setBadge2(String.valueOf(x.getSitArtOrdDTO().getNumOrd()));
accettazioneListModel.setDescrizione(x.getSitArtOrdDTO().getDescrizioneCommessa());
if(x.getMtbAart() != null) accettazioneListModel.setPosizione(x.getMtbAart().getPosizione());
if (x.getMtbAart() != null)
accettazioneListModel.setPosizione(x.getMtbAart().getPosizione());
//Calc Num CNF
BigDecimal numCnfEvasa = BigDecimal.ZERO;
@@ -667,8 +710,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
this.mViewModel.retrieveExistentLU(this::startListaBancaliRegistratiActivity);
}
private void showOrderDialog() {
private void showOrderByDialog() {
AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle(this.getText(R.string.action_orderBy))
.setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, mCurrentOrderBy.getVal(), (dialog12, which) -> {
@@ -680,7 +722,6 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
dialog.show();
}
public void startListaBancaliRegistratiActivity(ArrayList<RecoverMtbColt> mtbColts) {
Intent myIntent = ListaBancaliActivity.createIntent(this,
@@ -713,7 +754,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
null,
R.string.button_ignore_print,
onComplete)
.show(getSupportFragmentManager(), "tag");
.show(getSupportFragmentManager(), "tag");
}
@Override
@@ -741,9 +782,19 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
this.mViewModel.closeLU();
}
@Override
public void onVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete) {
runOnUiThread(() -> {
DialogAskShouldVersamentoAutomaticoULView.newInstance(onComplete)
.show(getSupportFragmentManager(), "tag");
});
}
@Override
public void onNoteAggiuntiveRequest(RunnableArgs<String> onComplete) {
NoteAggiuntiveLUDialog.make(this, onComplete::run, () -> onComplete.run(null)).show();
runOnUiThread(() -> {
NoteAggiuntiveLUDialog.make(this, onComplete).show();
});
}
@Override
@@ -798,44 +849,72 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
@Override
public void onRowSaved() {
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
runOnUiThread(() -> {
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
});
}
@Override
public void onFilterApplied(String newValue) {
this.mBindings.filteredArtsInListExpandableLayout.expand(true);
this.mBindings.descriptionFilterText.setText(!UtilityString.isNullOrEmpty(newValue) ? newValue : "");
public void onFilterCodMartApplied(String codMartToFilter) {
runOnUiThread(() -> {
var codMarts = new ArrayList<String>();
codMarts.add(codMartToFilter);
this.mAppliedFilterViewModel.setCodArtFilter(codMarts);
});
}
@Override
public void onFilterRemoved() {
mBindings.filteredArtsInListExpandableLayout.collapse(true);
public void onFilterPosizioneApplied(String posizioneToFilter) {
runOnUiThread(() -> {
var posizioni = new ArrayList<String>();
posizioni.add(posizioneToFilter);
this.mAppliedFilterViewModel.setPosFilter(posizioni);
});
}
@Override
public void onULVersata(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete) {
runOnUiThread(() -> {
DialogVersamentoAutomaticoULDoneView
.newInstance(versamentoAutomaticoULResponseDTO, onComplete)
.show(getSupportFragmentManager(), "tag");
});
}
@Override
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
String text = getResources().getString(R.string.alert_delete_mtb_colr);
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
null,
() -> onComplete.run(true),
() -> onComplete.run(false)
).show(getSupportFragmentManager(), "tag");
runOnUiThread(() -> {
String text = getResources().getString(R.string.alert_delete_mtb_colr);
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
null,
() -> onComplete.run(true),
() -> onComplete.run(false)
).show(getSupportFragmentManager(), "tag");
});
}
@Override
public void onLUOpened(MtbColt mtbColt) {
noLUPresent.set(false);
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
runOnUiThread(() -> {
noLUPresent.set(false);
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(mtbColt);
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(mtbColt);
});
}
@Override
public void onLUClosed() {
noLUPresent.set(true);
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(null);
runOnUiThread(() -> {
noLUPresent.set(true);
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(null);
if (this.mShouldCloseActivity) super.onBackPressed();
if (this.mShouldCloseActivity) super.onBackPressed();
});
}
@Override

View File

@@ -4,12 +4,14 @@ import java.util.HashMap;
import it.integry.integrywmsnative.gest.accettazione_picking.filters.FilterCodArtLayoutView;
import it.integry.integrywmsnative.gest.accettazione_picking.filters.FilterDescrLayoutView;
import it.integry.integrywmsnative.gest.accettazione_picking.filters.FilterPosizioneLayoutView;
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
public class AccettazionePickingBindings {
public static final int COD_ART_FILTER_ID = 0;
public static final int DESCR_FILTER_ID = 1;
public static final int POS_FILTER_ID = 2;
public static final HashMap<Integer, FilterChipDTO> AVAILABLE_FILTERS = new HashMap<>() {
{
@@ -24,6 +26,12 @@ public class AccettazionePickingBindings {
.setPosizione(1)
.setFilterChipText("Descrizione articolo")
.setFilterLayoutView(new FilterDescrLayoutView()));
put(POS_FILTER_ID, new FilterChipDTO()
.setID(POS_FILTER_ID)
.setPosizione(1)
.setFilterChipText("Posizione")
.setFilterLayoutView(new FilterPosizioneLayoutView()));
}};
}

View File

@@ -42,11 +42,13 @@ import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsume
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.core.utility.UtilityThread;
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
import it.integry.integrywmsnative.gest.accettazione_picking.dto.HistoryMtbAartDTO;
@@ -243,6 +245,10 @@ public class AccettazionePickingViewModel {
this.executeEtichettaEanPeso(barcodeScanDTO, onComplete);
} else if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
//Applico filtro per posizione
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
//Cerco tramite etichetta ean 128 (che può indicarmi un articolo o una UL)
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
@@ -293,6 +299,15 @@ public class AccettazionePickingViewModel {
}, this::sendError);
}
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
var optionalPos = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
.findFirst();
this.sendFilterPosizioneApplied(optionalPos.get().getPosizione());
onComplete.run();
}
private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) {
if (barcodeProd.length() == 14) {
@@ -332,16 +347,14 @@ public class AccettazionePickingViewModel {
} else if (matchedRows.size() == 1) {
this.dispatchOrdineRow(matchedRows.get(0));
} else {
List<PickingObjectDTO> pickingList = mPickingList.getValue();
//So che il codMart sarà solo 1
var firstCodMart = Stream.of(matchedRows)
.map(x -> x.getSitArtOrdDTO().getCodMart())
.distinct()
.findFirst()
.get();
for (int i = 0; i < pickingList.size(); i++) {
if (!matchedRows.contains(pickingList.get(i))) {
pickingList.get(i).setHidden(true);
}
}
this.sendFilterApplied(null);
this.getPickingList().postValue(pickingList);
this.sendFilterCodMartApplied(firstCodMart);
}
}
@@ -571,64 +584,67 @@ public class AccettazionePickingViewModel {
public void saveNewRow(PickingObjectDTO pickingObjectDTO, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, Date dataScad, boolean shouldCloseLU) {
this.sendOnLoadingStarted();
String gestioneRif = pickingObjectDTO.getSitArtOrdDTO().getGestioneEnum() == GestioneEnum.PRODUZIONE ? "L" : pickingObjectDTO.getSitArtOrdDTO().getGestione();
UtilityThread.executeParallel(() -> {
final MtbColr mtbColr = new MtbColr()
.setCodMart(pickingObjectDTO.getMtbAart().getCodMart())
.setPartitaMag(partitaMag)
.setDataScadPartita(dataScad)
.setQtaCol(qtaTot)
.setQtaCnf(qtaCnf)
.setNumCnf(numCnf)
.setGestioneRif(gestioneRif)
.setCodJcom(pickingObjectDTO.getSitArtOrdDTO().getCodJcom())
.setDescrizione(pickingObjectDTO.getMtbAart().getDescrizioneEstesa())
.setDatetimeRow(UtilityDate.getDateInstance())
.setDataOrd(pickingObjectDTO.getSitArtOrdDTO().getDataOrd())
.setNumOrd(pickingObjectDTO.getSitArtOrdDTO().getNumOrd())
.setRigaOrd(pickingObjectDTO.getSitArtOrdDTO().getRigaOrd());
String gestioneRif = pickingObjectDTO.getSitArtOrdDTO().getGestioneEnum() == GestioneEnum.PRODUZIONE ? "L" : pickingObjectDTO.getSitArtOrdDTO().getGestione();
final MtbColr mtbColr = new MtbColr()
.setCodMart(pickingObjectDTO.getMtbAart().getCodMart())
.setPartitaMag(partitaMag)
.setDataScadPartita(dataScad)
.setQtaCol(qtaTot)
.setQtaCnf(qtaCnf)
.setNumCnf(numCnf)
.setGestioneRif(gestioneRif)
.setCodJcom(pickingObjectDTO.getSitArtOrdDTO().getCodJcom())
.setDescrizione(pickingObjectDTO.getMtbAart().getDescrizioneEstesa())
.setDatetimeRow(UtilityDate.getDateInstance())
.setDataOrd(pickingObjectDTO.getSitArtOrdDTO().getDataOrd())
.setNumOrd(pickingObjectDTO.getSitArtOrdDTO().getNumOrd())
.setRigaOrd(pickingObjectDTO.getSitArtOrdDTO().getRigaOrd());
this.addHistoryItem(mtbColr);
this.addHistoryItem(mtbColr);
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.UPDATE);
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.UPDATE);
cloneMtbColt.setMtbColr(new ObservableArrayList<>());
cloneMtbColt.getMtbColr().add((MtbColr) mtbColr.clone());
cloneMtbColt.setMtbColr(new ObservableArrayList<>());
cloneMtbColt.getMtbColr().add((MtbColr) mtbColr.clone());
if (UtilityBigDecimal.equalsTo(numCnf, BigDecimal.ZERO) && UtilityBigDecimal.equalsTo(qtaTot, BigDecimal.ZERO)) {
resetMatchedRows();
this.sendOnLoadingEnded();
if (UtilityBigDecimal.equalsTo(numCnf, BigDecimal.ZERO) && UtilityBigDecimal.equalsTo(qtaTot, BigDecimal.ZERO)) {
resetMatchedRows();
this.sendOnLoadingEnded();
if (shouldCloseLU) closeLU();
return;
}
if (shouldCloseLU) closeLU();
return;
}
mColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, value -> {
mColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, value -> {
mtbColr
.setDataCollo(value.getDataColloS())
.setNumCollo(value.getNumCollo())
.setGestione(value.getGestione())
.setSerCollo(value.getSerCollo())
.setRiga(value.getMtbColr().get(value.getMtbColr().size() - 1).getRiga())
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
.setMtbAart(pickingObjectDTO.getMtbAart());
mtbColr
.setDataCollo(value.getDataColloS())
.setNumCollo(value.getNumCollo())
.setGestione(value.getGestione())
.setSerCollo(value.getSerCollo())
.setRiga(value.getMtbColr().get(value.getMtbColr().size() - 1).getRiga())
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
.setMtbAart(pickingObjectDTO.getMtbAart());
pickingObjectDTO.getWithdrawMtbColrs().add(mtbColr);
mCurrentMtbColt.getMtbColr().add(mtbColr);
pickingObjectDTO.getWithdrawMtbColrs().add(mtbColr);
mCurrentMtbColt.getMtbColr().add(mtbColr);
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
resetMatchedRows();
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
resetMatchedRows();
this.sendOnRowSaved();
this.sendOnLoadingEnded();
this.sendOnRowSaved();
this.sendOnLoadingEnded();
if (shouldCloseLU) closeLU();
}, this::sendError);
if (shouldCloseLU) closeLU();
}, this::sendError);
}, false);
}
@@ -772,19 +788,40 @@ public class AccettazionePickingViewModel {
} else {
mColliMagazzinoRESTConsumer.updateDataFine(mCurrentMtbColt, () -> {
if (!mCurrentMtbColt.getDisablePrint()) {
printCollo(this::postCloseOperations);
} else {
postCloseOperations();
}
Runnable onVersamentoCompleted = () -> {
if (!mCurrentMtbColt.getDisablePrint()) {
printCollo(this::postCloseOperations);
} else {
postCloseOperations();
}
this.sendLUClosed();
this.sendOnLoadingEnded();
};
sendVersamentoAutomaticoULRequest(response -> {
if (response) {
versaAutomaticamenteUL(onVersamentoCompleted);
} else {
onVersamentoCompleted.run();
}
});
this.sendLUClosed();
this.sendOnLoadingEnded();
}, this::sendError);
}
}, this::sendError);
}
public void versaAutomaticamenteUL(Runnable onComplete) {
if (mCurrentMtbColt == null) return;
mColliMagazzinoRESTConsumer.versamentoAutomaticoUL(mCurrentMtbColt, versamentoResult -> {
this.notifyVersamentoAutomaticoResult(versamentoResult, onComplete);
}, this::sendError);
}
private void printCollo(Runnable onComplete) {
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
cloneMtbColt.setGestione(cloneMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE ? GestioneEnum.PRODUZIONE : cloneMtbColt.getGestioneEnum());
@@ -816,12 +853,10 @@ public class AccettazionePickingViewModel {
public void resetMatchedRows() {
for (PickingObjectDTO pickingObjectDTO : this.mPickingList.getValue()) {
pickingObjectDTO
.setTempPickData(null)
.setHidden(false);
.setTempPickData(null);
}
this.mPickingList.postValue(this.mPickingList.getValue());
this.sendFilterRemoved();
}
private void addHistoryItem(@NonNull MtbColr mtbColr) {
@@ -857,6 +892,10 @@ public class AccettazionePickingViewModel {
if (this.mListener != null) mListener.onLoadingEnded();
}
private void sendVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete) {
if (this.mListener != null) this.mListener.onVersamentoAutomaticoULRequest(onComplete);
}
private void sendOnNoteAggiuntiveRequest(RunnableArgs<String> onComplete) {
if (this.mListener != null) this.mListener.onNoteAggiuntiveRequest(onComplete);
}
@@ -925,26 +964,32 @@ public class AccettazionePickingViewModel {
if (this.mListener != null) mListener.onRowSaved();
}
private void sendFilterApplied(String newValue) {
if (this.mListener != null) mListener.onFilterApplied(newValue);
private void sendFilterCodMartApplied(String codMart) {
if (this.mListener != null) mListener.onFilterCodMartApplied(codMart);
}
private void sendFilterRemoved() {
if (this.mListener != null) mListener.onFilterRemoved();
private void sendFilterPosizioneApplied(String posizione) {
if (this.mListener != null) mListener.onFilterPosizioneApplied(posizione);
}
private void sendMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
if (this.mListener != null) mListener.onMtbColrDeleteRequest(onComplete);
}
public AccettazionePickingViewModel setListeners(AccettazionePickingViewModel.Listener
listener) {
private void notifyVersamentoAutomaticoResult(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete) {
if (this.mListener != null)
mListener.onULVersata(versamentoAutomaticoULResponseDTO, onComplete);
}
public AccettazionePickingViewModel setListeners(AccettazionePickingViewModel.Listener listener) {
this.mListener = listener;
return this;
}
public interface Listener extends ILoadingListener, ILUPrintListener, ILUBaseOperationsListener {
void onVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete);
void onNoteAggiuntiveRequest(RunnableArgs<String> onComplete);
void onError(Exception ex);
@@ -969,9 +1014,11 @@ public class AccettazionePickingViewModel {
boolean canOverflowQuantity,
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
void onFilterApplied(String newValue);
void onFilterCodMartApplied(String codMartToFilter);
void onFilterRemoved();
void onFilterPosizioneApplied(String posizioneToFilter);
void onULVersata(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete);
}

View File

@@ -9,12 +9,14 @@ import com.annimon.stream.function.Predicate;
import java.util.List;
import java.util.Objects;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.gest.accettazione_picking.dto.PickingObjectDTO;
public class AccettazionePickingFiltroOrdineViewModel {
private final ObservableField<Predicate<PickingObjectDTO>> currentCodArtPredicate = new ObservableField<>();
private final ObservableField<Predicate<PickingObjectDTO>> currentDescrPredicate = new ObservableField<>();
private final ObservableField<Predicate<PickingObjectDTO>> currentPosPredicate = new ObservableField<>();
private List<PickingObjectDTO> initialOrderList;
@@ -30,7 +32,6 @@ public class AccettazionePickingFiltroOrdineViewModel {
}
public void setCodArtFilter(List<String> codArts) {
if (codArts == null || codArts.isEmpty()) currentCodArtPredicate.set(null);
else {
@@ -47,18 +48,28 @@ public class AccettazionePickingFiltroOrdineViewModel {
}
public void setPosFilter(List<String> pos) {
if (pos == null || pos.isEmpty()) currentPosPredicate.set(null);
else {
currentPosPredicate.set(o -> o.getMtbAart() != null && o.getMtbAart().getPosizione() == null ? pos.contains(null) : pos.contains(o.getMtbAart().getPosizione()));
}
}
public void applyAllTests() {
List<PickingObjectDTO> returnList = null;
if (currentCodArtPredicate.get() == null &&
currentDescrPredicate.get() == null) {
currentDescrPredicate.get() == null &&
currentPosPredicate.get() == null) {
returnList = this.initialOrderList;
} else {
Stream<PickingObjectDTO> tmpStream = Stream.of(this.initialOrderList)
.filter(x ->
(currentCodArtPredicate.get() == null || (currentCodArtPredicate.get().test(x))) &&
(currentDescrPredicate.get() == null || (currentDescrPredicate.get().test(x)))
(currentDescrPredicate.get() == null || (currentDescrPredicate.get().test(x))) &&
(currentPosPredicate.get() == null || (currentPosPredicate.get().test(x)))
);
returnList = tmpStream.toList();
@@ -75,6 +86,10 @@ public class AccettazionePickingFiltroOrdineViewModel {
return currentDescrPredicate;
}
public ObservableField<Predicate<PickingObjectDTO>> getCurrentPosPredicate() {
return currentPosPredicate;
}
public List<String> getAllCodArts() {
return Stream
.of(Objects.requireNonNull(initialOrderList))
@@ -87,12 +102,14 @@ public class AccettazionePickingFiltroOrdineViewModel {
public List<String> getAvailableCodArts() {
if (currentDescrPredicate.get() == null) {
if (currentDescrPredicate.get() == null &&
currentPosPredicate.get() == null) {
return getAllCodArts();
} else {
return Stream.of(this.initialOrderList)
.filter(x ->
(currentDescrPredicate.get() == null || (currentDescrPredicate.get().test(x)))
(currentDescrPredicate.get() == null || (currentDescrPredicate.get().test(x))) &&
(currentPosPredicate.get() == null || (currentPosPredicate.get().test(x)))
)
.map(x -> x.getSitArtOrdDTO().getCodMart())
.distinct()
@@ -112,12 +129,14 @@ public class AccettazionePickingFiltroOrdineViewModel {
public List<String> getAvailableDescrs() {
if (currentCodArtPredicate.get() == null) {
if (currentCodArtPredicate.get() == null &&
currentPosPredicate.get() == null) {
return getAllDescrs();
} else {
return Stream.of(this.initialOrderList)
.filter(x ->
(currentCodArtPredicate.get() == null || (currentCodArtPredicate.get().test(x)))
(currentCodArtPredicate.get() == null || (currentCodArtPredicate.get().test(x))) &&
(currentPosPredicate.get() == null || (currentPosPredicate.get().test(x)))
)
.map(x -> x.getSitArtOrdDTO().getDescrizioneEstesaArt())
.distinct()
@@ -125,4 +144,31 @@ public class AccettazionePickingFiltroOrdineViewModel {
}
}
public List<String> getAllPos() {
return Stream
.of(Objects.requireNonNull(initialOrderList))
.filter(x -> x.getMtbAart() != null && x.getMtbAart().getPosizione() != null)
.sortBy(x -> UtilityString.isNull(x.getMtbAart().getPosizione(), "000000"))
.map(x -> x.getMtbAart().getPosizione() != null ? x.getMtbAart().getPosizione() : null)
.distinct()
.toList();
}
public List<String> getAvailablePos() {
if (currentCodArtPredicate.get() == null &&
currentDescrPredicate.get() == null) {
return getAllPos();
} else {
return Stream.of(this.initialOrderList)
.filter(x ->
(currentCodArtPredicate.get() == null || (currentCodArtPredicate.get().test(x))) &&
(currentDescrPredicate.get() == null || (currentDescrPredicate.get().test(x)))
)
.map(x -> x.getMtbAart().getPosizione())
.distinct()
.toList();
}
}
}

View File

@@ -0,0 +1,186 @@
package it.integry.integrywmsnative.gest.accettazione_picking.filters;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.MutableLiveData;
import com.annimon.stream.ComparatorCompat;
import com.annimon.stream.Stream;
import com.ravikoradiya.liveadapter.LiveAdapter;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import it.integry.integrywmsnative.BR;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.di.BindableBoolean;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.utility.UtilityBoolean;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.databinding.LayoutFilterPosizioneBinding;
import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView;
public class FilterPosizioneLayoutView extends FilterLayoutView {
protected LayoutFilterPosizioneBinding mBindings;
private List<String> all;
private List<String> available;
private List<String> preselected = new ArrayList<>();
private List<String> hidden = new ArrayList<>();
private final MutableLiveData<List<ListModel>> listModel = new MutableLiveData<>();
private RunnableArgs<List<String>> onFilterApplied;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_posizione, container, false);
this.mBindings.setView(this);
refreshList();
this.setSearchView(this.mBindings.searchView, newFilter -> {
hidden = Stream.of(all)
.filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)) &&
!x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)))
.toList();
refreshList();
});
new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item)
.map(ListModel.class, R.layout.layout_filter_posizione__list_item)
.into(this.mBindings.recyclerview);
return mBindings.getRoot();
}
public void onConfirm() {
if (onFilterApplied == null) return;
this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue()))
.filter(x -> x.selected.get())
.map(x -> x.originalModel)
.toList());
dismiss();
}
private void refreshList() {
ComparatorCompat<ListModel> c =
ComparatorCompat
.chain(new ComparatorCompat<ListModel>((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get())))
.thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get())))
.thenComparing(new ComparatorCompat<>((x, y) ->
UtilityString.isNull(y.getOriginalModel(), "000000").compareToIgnoreCase(UtilityString.isNull(x.getOriginalModel(), "000000"))))
.reversed();
listModel.setValue(Stream.of(getAll())
.filter(x -> !hidden.contains(x))
.map(x -> {
var selectedBoolean = new BindableBoolean(preselected.contains(x));
selectedBoolean.addOnPropertyChangedCallback(() -> {
if (selectedBoolean.get()) preselected.add(x);
else preselected.remove(x);
});
return new ListModel()
.setSelected(selectedBoolean)
.setEnabled(new BindableBoolean(available.contains(x)))
.setOriginalModel(x);
})
.sorted(c)
.toList());
}
public List<String> getAll() {
return all;
}
public FilterPosizioneLayoutView setAll(List<String> all) {
this.all = all;
return this;
}
public List<String> getAvailable() {
return available;
}
public FilterPosizioneLayoutView setAvailable(List<String> available) {
this.available = available;
return this;
}
public List<String> getPreselected() {
return preselected;
}
public FilterPosizioneLayoutView setPreselected(List<String> preselected) {
this.preselected = preselected;
return this;
}
public RunnableArgs<List<String>> getOnFilterApplied() {
return onFilterApplied;
}
public FilterPosizioneLayoutView setOnFilterApplied(RunnableArgs<List<String>> onFilterApplied) {
this.onFilterApplied = onFilterApplied;
return this;
}
public List<String> getHidden() {
return hidden;
}
public FilterPosizioneLayoutView setHidden(List<String> hidden) {
this.hidden = hidden;
return this;
}
public static class ListModel {
private BindableBoolean selected = new BindableBoolean();
private BindableBoolean enabled = new BindableBoolean();
private String originalModel;
public BindableBoolean getSelected() {
return selected;
}
public ListModel setSelected(BindableBoolean selected) {
this.selected = selected;
return this;
}
public BindableBoolean getEnabled() {
return enabled;
}
public ListModel setEnabled(BindableBoolean enabled) {
this.enabled = enabled;
return this;
}
public String getOriginalModel() {
return originalModel;
}
public ListModel setOriginalModel(String originalModel) {
this.originalModel = originalModel;
return this;
}
}
}

View File

@@ -851,8 +851,10 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
private void initMtbGrupsCache(Runnable onComplete) {
var codMgrpArts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrderList().getValue()))
.flatMap(x -> Stream.of(x.getAvailableClassMerc()))
.flatMap(x -> Stream.of(x.getAvailableClassMerc() != null ? x.getAvailableClassMerc() : new ArrayList<>()))
.map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp)
.withoutNulls()
.distinct()
.toList();
this.mArticoloRESTConsumer.getArtsGroups(codMgrpArts, mtbGrupCache -> {

View File

@@ -648,7 +648,10 @@ public class VenditaFiltroOrdiniViewModel {
public List<MtbGrup> getAllGruppoMerc(List<MtbGrup> mtbGrupFullList) {
var codMgrp = Stream.of(initialOrderList)
.flatMap(ordiniUscitaElencoDTO -> Stream.of(ordiniUscitaElencoDTO.getAvailableClassMerc()))
.flatMap(ordiniUscitaElencoDTO ->
Stream.of(ordiniUscitaElencoDTO.getAvailableClassMerc() != null ?
ordiniUscitaElencoDTO.getAvailableClassMerc() :
new ArrayList<>()))
.map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp)
.withoutNulls()
.distinct()

View File

@@ -276,8 +276,8 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
}
@Override
public void onNoteAggiuntiveRequired(RunnableArgs<String> onComplete, Runnable onAbort) {
NoteAggiuntiveLUDialog.make(this, onComplete, onAbort).show();
public void onNoteAggiuntiveRequired(RunnableArgs<String> onComplete) {
NoteAggiuntiveLUDialog.make(this, onComplete).show();
}
@Override

View File

@@ -185,9 +185,6 @@ public class PickingResiViewModel {
}, this::sendError);
}, () -> {
this.sendLUClosed();
this.sendOnLoadingEnded();
});
}
}, this::sendError);
@@ -720,8 +717,8 @@ public class PickingResiViewModel {
return mPickingList;
}
private void sendOnNoteAggiuntiveRequired(RunnableArgs<String> onComplete, Runnable onAbort) {
if (this.mListener != null) this.mListener.onNoteAggiuntiveRequired(onComplete, onAbort);
private void sendOnNoteAggiuntiveRequired(RunnableArgs<String> onComplete) {
if (this.mListener != null) this.mListener.onNoteAggiuntiveRequired(onComplete);
}
private void sendOnLoadingStarted() {
@@ -798,7 +795,7 @@ public class PickingResiViewModel {
public interface Listener extends ILUPrintListener, ILoadingListener, ILUBaseOperationsListener {
void onNoteAggiuntiveRequired(RunnableArgs<String> onComplete, Runnable onAbort);
void onNoteAggiuntiveRequired(RunnableArgs<String> onComplete);
void onError(Exception ex);

View File

@@ -82,7 +82,7 @@ public class PickingResiRESTConsumer {
if(onComplete != null) onComplete.run(values);
}
} else onComplete.run(new ArrayList<>());
}, onFailed);

View File

@@ -174,7 +174,7 @@ public class SpedizioneViewModel {
private void getEmptyPickingList(List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<PickingObjectDTO>> onComplete) {
List<String> codMarts = Stream.of(sitArtOrdList)
.map(SitArtOrdDTO::getCodMart)
.map(x -> x.getCodMart().trim())
.toList();
this.mArticoloRESTConsumer.getByCodMarts(codMarts, listMtbAarts -> {
@@ -183,7 +183,7 @@ public class SpedizioneViewModel {
MtbAart mtbAart = null;
for (MtbAart mtbAartItem : listMtbAarts) {
if (mtbAartItem.getCodMart().equalsIgnoreCase(sitArtOrdDTO.getCodMart())) {
if (mtbAartItem.getCodMart().trim().equalsIgnoreCase(sitArtOrdDTO.getCodMart().trim())) {
mtbAart = mtbAartItem;
break;
}

View File

@@ -0,0 +1,333 @@
package it.integry.integrywmsnative.ui.expandablelayout;
import static it.integry.integrywmsnative.ui.expandablelayout.ExpandableLayout.State.COLLAPSED;
import static it.integry.integrywmsnative.ui.expandablelayout.ExpandableLayout.State.COLLAPSING;
import static it.integry.integrywmsnative.ui.expandablelayout.ExpandableLayout.State.EXPANDED;
import static it.integry.integrywmsnative.ui.expandablelayout.ExpandableLayout.State.EXPANDING;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Interpolator;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import it.integry.integrywmsnative.R;
public class ExpandableLayout extends FrameLayout {
public interface State {
int COLLAPSED = 0;
int COLLAPSING = 1;
int EXPANDING = 2;
int EXPANDED = 3;
}
public static final String KEY_SUPER_STATE = "super_state";
public static final String KEY_EXPANSION = "expansion";
public static final int HORIZONTAL = 0;
public static final int VERTICAL = 1;
private static final int DEFAULT_DURATION = 300;
private int duration = DEFAULT_DURATION;
private float parallax;
private float expansion;
private int orientation;
private int state;
private Interpolator interpolator = new FastOutSlowInInterpolator();
private ValueAnimator animator;
private ExpandableLayout.OnExpansionUpdateListener listener;
public ExpandableLayout(Context context) {
this(context, null);
}
public ExpandableLayout(Context context, AttributeSet attrs) {
super(context, attrs);
if (attrs != null) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ExpandableLayout);
duration = a.getInt(R.styleable.ExpandableLayout_el_duration, DEFAULT_DURATION);
expansion = a.getBoolean(R.styleable.ExpandableLayout_el_expanded, false) ? 1 : 0;
orientation = a.getInt(R.styleable.ExpandableLayout_android_orientation, VERTICAL);
parallax = a.getFloat(R.styleable.ExpandableLayout_el_parallax, 1);
a.recycle();
state = expansion == 0 ? COLLAPSED : EXPANDED;
setParallax(parallax);
}
}
@Override
protected Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
Bundle bundle = new Bundle();
expansion = isExpanded() ? 1 : 0;
bundle.putFloat(KEY_EXPANSION, expansion);
bundle.putParcelable(KEY_SUPER_STATE, superState);
return bundle;
}
@Override
protected void onRestoreInstanceState(Parcelable parcelable) {
Bundle bundle = (Bundle) parcelable;
expansion = bundle.getFloat(KEY_EXPANSION);
state = expansion == 1 ? EXPANDED : COLLAPSED;
Parcelable superState = bundle.getParcelable(KEY_SUPER_STATE);
super.onRestoreInstanceState(superState);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = getMeasuredWidth();
int height = getMeasuredHeight();
int size = orientation == LinearLayout.HORIZONTAL ? width : height;
setVisibility(expansion == 0 && size == 0 ? GONE : VISIBLE);
int expansionDelta = size - Math.round(size * expansion);
if (parallax > 0) {
float parallaxDelta = expansionDelta * parallax;
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
if (orientation == HORIZONTAL) {
int direction = -1;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1 && getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
direction = 1;
}
child.setTranslationX(direction * parallaxDelta);
} else {
child.setTranslationY(-parallaxDelta);
}
}
}
if (orientation == HORIZONTAL) {
setMeasuredDimension(width - expansionDelta, height);
} else {
setMeasuredDimension(width, height - expansionDelta);
}
}
@Override
protected void onConfigurationChanged(Configuration newConfig) {
if (animator != null) {
animator.cancel();
}
super.onConfigurationChanged(newConfig);
}
/**
* Get expansion state
*
* @return one of {@link ExpandableLayout.State}
*/
public int getState() {
return state;
}
public boolean isExpanded() {
return state == EXPANDING || state == EXPANDED;
}
public void toggle() {
toggle(true);
}
public void toggle(boolean animate) {
if (isExpanded()) {
collapse(animate);
} else {
expand(animate);
}
}
public void expand() {
expand(true);
}
public void expand(boolean animate) {
setExpanded(true, animate);
}
public void collapse() {
collapse(true);
}
public void collapse(boolean animate) {
setExpanded(false, animate);
}
/**
* Convenience method - same as calling setExpanded(expanded, true)
*/
public void setExpanded(boolean expand) {
setExpanded(expand, true);
}
public void setExpanded(boolean expand, boolean animate) {
if (expand == isExpanded()) {
return;
}
int targetExpansion = expand ? 1 : 0;
if (animate) {
animateSize(targetExpansion);
} else {
setExpansion(targetExpansion);
}
}
public int getDuration() {
return duration;
}
public void setInterpolator(Interpolator interpolator) {
this.interpolator = interpolator;
}
public void setDuration(int duration) {
this.duration = duration;
}
public float getExpansion() {
return expansion;
}
public void setExpansion(float expansion) {
if (this.expansion == expansion) {
return;
}
// Infer state from previous value
float delta = expansion - this.expansion;
if (expansion == 0) {
state = COLLAPSED;
} else if (expansion == 1) {
state = EXPANDED;
} else if (delta < 0) {
state = COLLAPSING;
} else if (delta > 0) {
state = EXPANDING;
}
setVisibility(state == COLLAPSED ? GONE : VISIBLE);
this.expansion = expansion;
requestLayout();
if (listener != null) {
listener.onExpansionUpdate(expansion, state);
}
}
public float getParallax() {
return parallax;
}
public void setParallax(float parallax) {
// Make sure parallax is between 0 and 1
parallax = Math.min(1, Math.max(0, parallax));
this.parallax = parallax;
}
public int getOrientation() {
return orientation;
}
public void setOrientation(int orientation) {
if (orientation < 0 || orientation > 1) {
throw new IllegalArgumentException("Orientation must be either 0 (horizontal) or 1 (vertical)");
}
this.orientation = orientation;
}
public void setOnExpansionUpdateListener(ExpandableLayout.OnExpansionUpdateListener listener) {
this.listener = listener;
}
private void animateSize(int targetExpansion) {
if (animator != null) {
animator.cancel();
animator = null;
}
setLayerType(View.LAYER_TYPE_HARDWARE, null);
animator = ValueAnimator.ofFloat(expansion, targetExpansion);
animator.setInterpolator(interpolator);
animator.setDuration(duration);
animator.addUpdateListener(valueAnimator -> setExpansion((float) valueAnimator.getAnimatedValue()));
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
setLayerType(View.LAYER_TYPE_NONE, null);
}
});
animator.addListener(new ExpandableLayout.ExpansionListener(targetExpansion));
animator.start();
}
public interface OnExpansionUpdateListener {
/**
* Callback for expansion updates
*
* @param expansionFraction Value between 0 (collapsed) and 1 (expanded) representing the the expansion progress
* @param state One of {@link ExpandableLayout.State} repesenting the current expansion state
*/
void onExpansionUpdate(float expansionFraction, int state);
}
private class ExpansionListener implements Animator.AnimatorListener {
private int targetExpansion;
private boolean canceled;
public ExpansionListener(int targetExpansion) {
this.targetExpansion = targetExpansion;
}
@Override
public void onAnimationStart(Animator animation) {
state = targetExpansion == 0 ? COLLAPSING : EXPANDING;
}
@Override
public void onAnimationEnd(Animator animation) {
if (!canceled) {
state = targetExpansion == 0 ? COLLAPSED : EXPANDED;
setExpansion(targetExpansion);
}
}
@Override
public void onAnimationCancel(Animator animation) {
canceled = true;
}
@Override
public void onAnimationRepeat(Animator animation) {
}
}
}

View File

@@ -0,0 +1,45 @@
package it.integry.integrywmsnative.ui.expandablelayout;
public class FastOutSlowInInterpolator extends LookupTableInterpolator {
/**
* Lookup table values sampled with x at regular intervals between 0 and 1 for a total of
* 201 points.
*/
private static final float[] VALUES = new float[] {
0.0000f, 0.0001f, 0.0002f, 0.0005f, 0.0009f, 0.0014f, 0.0020f,
0.0027f, 0.0036f, 0.0046f, 0.0058f, 0.0071f, 0.0085f, 0.0101f,
0.0118f, 0.0137f, 0.0158f, 0.0180f, 0.0205f, 0.0231f, 0.0259f,
0.0289f, 0.0321f, 0.0355f, 0.0391f, 0.0430f, 0.0471f, 0.0514f,
0.0560f, 0.0608f, 0.0660f, 0.0714f, 0.0771f, 0.0830f, 0.0893f,
0.0959f, 0.1029f, 0.1101f, 0.1177f, 0.1257f, 0.1339f, 0.1426f,
0.1516f, 0.1610f, 0.1707f, 0.1808f, 0.1913f, 0.2021f, 0.2133f,
0.2248f, 0.2366f, 0.2487f, 0.2611f, 0.2738f, 0.2867f, 0.2998f,
0.3131f, 0.3265f, 0.3400f, 0.3536f, 0.3673f, 0.3810f, 0.3946f,
0.4082f, 0.4217f, 0.4352f, 0.4485f, 0.4616f, 0.4746f, 0.4874f,
0.5000f, 0.5124f, 0.5246f, 0.5365f, 0.5482f, 0.5597f, 0.5710f,
0.5820f, 0.5928f, 0.6033f, 0.6136f, 0.6237f, 0.6335f, 0.6431f,
0.6525f, 0.6616f, 0.6706f, 0.6793f, 0.6878f, 0.6961f, 0.7043f,
0.7122f, 0.7199f, 0.7275f, 0.7349f, 0.7421f, 0.7491f, 0.7559f,
0.7626f, 0.7692f, 0.7756f, 0.7818f, 0.7879f, 0.7938f, 0.7996f,
0.8053f, 0.8108f, 0.8162f, 0.8215f, 0.8266f, 0.8317f, 0.8366f,
0.8414f, 0.8461f, 0.8507f, 0.8551f, 0.8595f, 0.8638f, 0.8679f,
0.8720f, 0.8760f, 0.8798f, 0.8836f, 0.8873f, 0.8909f, 0.8945f,
0.8979f, 0.9013f, 0.9046f, 0.9078f, 0.9109f, 0.9139f, 0.9169f,
0.9198f, 0.9227f, 0.9254f, 0.9281f, 0.9307f, 0.9333f, 0.9358f,
0.9382f, 0.9406f, 0.9429f, 0.9452f, 0.9474f, 0.9495f, 0.9516f,
0.9536f, 0.9556f, 0.9575f, 0.9594f, 0.9612f, 0.9629f, 0.9646f,
0.9663f, 0.9679f, 0.9695f, 0.9710f, 0.9725f, 0.9739f, 0.9753f,
0.9766f, 0.9779f, 0.9791f, 0.9803f, 0.9815f, 0.9826f, 0.9837f,
0.9848f, 0.9858f, 0.9867f, 0.9877f, 0.9885f, 0.9894f, 0.9902f,
0.9910f, 0.9917f, 0.9924f, 0.9931f, 0.9937f, 0.9944f, 0.9949f,
0.9955f, 0.9960f, 0.9964f, 0.9969f, 0.9973f, 0.9977f, 0.9980f,
0.9984f, 0.9986f, 0.9989f, 0.9991f, 0.9993f, 0.9995f, 0.9997f,
0.9998f, 0.9999f, 0.9999f, 1.0000f, 1.0000f
};
public FastOutSlowInInterpolator() {
super(VALUES);
}
}

View File

@@ -0,0 +1,37 @@
package it.integry.integrywmsnative.ui.expandablelayout;
import android.view.animation.Interpolator;
abstract class LookupTableInterpolator implements Interpolator {
private final float[] mValues;
private final float mStepSize;
public LookupTableInterpolator(float[] values) {
mValues = values;
mStepSize = 1f / (mValues.length - 1);
}
@Override
public float getInterpolation(float input) {
if (input >= 1.0f) {
return 1.0f;
}
if (input <= 0f) {
return 0f;
}
// Calculate index - We use min with length - 2 to avoid IndexOutOfBoundsException when
// we lerp (linearly interpolate) in the return statement
int position = Math.min((int) (input * (mValues.length - 1)), mValues.length - 2);
// Calculate values to account for small offsets as the lookup table has discrete values
float quantized = position * mStepSize;
float diff = input - quantized;
float weight = diff / mStepSize;
// Linearly interpolate between the table values
return mValues[position] + weight * (mValues[position + 1] - mValues[position]);
}
}

View File

@@ -77,12 +77,14 @@ public class BottomSheetFragmentLUContentView extends BottomSheetFragmentBaseVie
this.mViewModel.getObservableMtbColt().addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
if(mViewModel.getObservableMtbColt().get() != null) {
var mtbColt = mViewModel.getObservableMtbColt().get();
if(mtbColt != null) {
initAdapter();
onMtbColrItemChanged();
mViewModel.getObservableMtbColt().get().getMtbColr().addOnListChangedCallback(new OnListGeneralChangedCallback() {
mtbColt.getMtbColr().addOnListChangedCallback(new OnListGeneralChangedCallback() {
@Override
public void onChanged(ObservableList sender) {
onMtbColrItemChanged();

View File

@@ -0,0 +1,75 @@
package it.integry.integrywmsnative.view.dialogs.ask_should_versamento_automatico_ul;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import org.jetbrains.annotations.NotNull;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.databinding.DialogAskShouldVersamentoAutomaticoUlBinding;
public class DialogAskShouldVersamentoAutomaticoULView extends BaseDialogFragment {
private RunnableArgs<Boolean> mOnDismiss;
private DialogAskShouldVersamentoAutomaticoUlBinding mBindings;
private boolean returnValue = false;
public static DialogAskShouldVersamentoAutomaticoULView newInstance(@NotNull RunnableArgs<Boolean> onDismiss) {
return new DialogAskShouldVersamentoAutomaticoULView(onDismiss);
}
private DialogAskShouldVersamentoAutomaticoULView(@NotNull RunnableArgs<Boolean> onDismiss) {
super();
this.mOnDismiss = onDismiss;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_ask_should_versamento_automatico_ul, container, false);
mBindings.setLifecycleOwner(this);
getDialog().setCanceledOnTouchOutside(false);
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
mBindings.setView(this);
return mBindings.getRoot();
}
@Override
public void onDismiss(@NonNull DialogInterface dialog) {
super.onDismiss(dialog);
if (mOnDismiss != null) {
this.mOnDismiss.run(returnValue);
}
}
public void confirm() {
this.returnValue = true;
dismiss();
}
public void abort() {
this.returnValue = false;
dismiss();
}
}

View File

@@ -10,21 +10,23 @@ import android.view.LayoutInflater;
import androidx.databinding.DataBindingUtil;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.utility.UtilityDialog;
import it.integry.integrywmsnative.databinding.DialogNoteAggiuntiveNuovaUlBinding;
public class NoteAggiuntiveLUDialog {
private Dialog mDialog;
public static Dialog make(Context context, final RunnableArgs<String> onComplete, final Runnable onAbort) {
return new NoteAggiuntiveLUDialog(context, onComplete, onAbort).mDialog;
public static Dialog make(Context context, final RunnableArgs<String> onComplete) {
return new NoteAggiuntiveLUDialog(context, onComplete).mDialog;
}
private NoteAggiuntiveLUDialog(Context context, final RunnableArgs<String> onComplete, final Runnable onAbort){
private NoteAggiuntiveLUDialog(Context context, final RunnableArgs<String> onComplete){
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
DialogNoteAggiuntiveNuovaUlBinding bindings = DataBindingUtil.inflate(inflater, R.layout.dialog_note_aggiuntive_nuova_ul, null, false);
mDialog = new Dialog(context);
mDialog.setContentView(bindings.getRoot());
@@ -32,17 +34,14 @@ public class NoteAggiuntiveLUDialog {
mDialog.setCancelable(false);
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
UtilityDialog.setTo90PercentWidth(context, mDialog);
bindings.buttonConfirm.setOnClickListener(v -> {
mDialog.dismiss();
if(onComplete != null) onComplete.run(bindings.additionalNotesText.getText().toString());
});
bindings.buttonAbort.setOnClickListener(v -> {
mDialog.dismiss();
if(onAbort != null) onAbort.run();
});
}
}

View File

@@ -0,0 +1,170 @@
package it.integry.integrywmsnative.view.dialogs.versamento_automatico_ul_done;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil;
import org.jetbrains.annotations.NotNull;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
import it.integry.integrywmsnative.core.utility.UtilityDialog;
import it.integry.integrywmsnative.databinding.DialogVersamentoAutomaticoUlDoneBinding;
public class DialogVersamentoAutomaticoULDoneView extends BaseDialogFragment {
public final VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO;
private final Runnable mOnDismiss;
private DialogVersamentoAutomaticoUlDoneBinding mBindings;
public static DialogVersamentoAutomaticoULDoneView newInstance(@NotNull VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, @NotNull Runnable onDismiss) {
return new DialogVersamentoAutomaticoULDoneView(versamentoAutomaticoULResponseDTO, onDismiss);
}
private DialogVersamentoAutomaticoULDoneView(@NotNull VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, @NotNull Runnable onDismiss) {
super();
this.versamentoAutomaticoULResponseDTO = versamentoAutomaticoULResponseDTO;
this.mOnDismiss = onDismiss;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_versamento_automatico_ul_done, container, false);
mBindings.setLifecycleOwner(this);
getDialog().setCanceledOnTouchOutside(false);
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
UtilityDialog.setTo95PercentWidth(requireContext(), this);
mBindings.setView(this);
this.initTitle();
this.initContent();
return mBindings.getRoot();
}
@Override
public void onDismiss(@NonNull DialogInterface dialog) {
super.onDismiss(dialog);
if (mOnDismiss != null) {
this.mOnDismiss.run();
}
}
private void initTitle() {
int colorBackgroundTitle = -1;
if (versamentoAutomaticoULResponseDTO.getFailed() == null || versamentoAutomaticoULResponseDTO.getFailed().isEmpty()) {
//SUCCESS
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.green_300);
} else {
//WARNING
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.yellow_600);
}
mBindings.base.setBackgroundColor(colorBackgroundTitle);
}
private void initContent() {
String text;
if (versamentoAutomaticoULResponseDTO.getFailed() == null || versamentoAutomaticoULResponseDTO.getFailed().isEmpty()) {
//SUCCESS
text = "Versamento completato con successo";
} else {
//WARNING
text = "Il sistema non è riuscito a versare <b>" + versamentoAutomaticoULResponseDTO.getFailed().size() +
" " + getResources().getQuantityString(R.plurals.articles, versamentoAutomaticoULResponseDTO.getFailed().size()) + "</b>";
}
mBindings.descriptionText.setText(Html.fromHtml(text));
// var notCompletedListAdapter = new BaseAdapter() {
//
// @Override
// public View getView(int position, View convertView, ViewGroup parent) {
//
// var mtbColr = versamentoAutomaticoULResponseDTO.getFailed().get(position);
//
// var inflater = LayoutInflater.from(requireContext());
// DialogVersamentoAutomaticoUlDoneNotCompletedListItemBinding binding = null;
//
// if(convertView == null) {
// binding = DataBindingUtil.inflate(inflater, R.layout.dialog_versamento_automatico_ul_done__not_completed_list_item, parent, false);
// } else {
// binding = DataBindingUtil.findBinding(convertView);
// }
//
// binding.setItem(mtbColr);
//
// convertView = binding.getRoot();
//
// //Setting qty with unt_mis
// if (!SettingsManager.iDB().isFlagForceAllToColli() && (mtbColr.getMtbAart() == null || mtbColr.getMtbAart().isFlagQtaCnfFissaBoolean())) {
// String text = UtilityNumber.decimalToString(mtbColr.getQtaCol());
//
//
// if (mtbColr.getMtbAart() != null) {
// text += !UtilityString.isNullOrEmpty(mtbColr.getMtbAart().getUntMis()) ? "\n" + mtbColr.getMtbAart().getUntMis() : "";
// }
//
// binding.qtaTextview.setText(text);
// } else {
// binding.qtaTextview.setText(UtilityNumber.decimalToString(mtbColr.getNumCnf()) + "\n" + UtilityResources.getString(R.string.unt_mis_col));
// }
//
// return convertView;
// }
//
// @Override
// public long getItemId(int position) {
// return position;
// }
//
// @Override
// public Object getItem(int position) {
// return position;
// }
//
// @Override
// public int getCount() {
// return versamentoAutomaticoULResponseDTO.getFailed().size();
// }
// };
//
//
// mBindings.detailsNotCompletedList.setAdapter(notCompletedListAdapter);
}
// public void toggleDetailVisibility() {
// mBindings.detailsContainer.toggle(true);
// }
}