Finish v1.45.02(484)

This commit is contained in:
Giuseppe Scorrano 2025-03-18 12:17:23 +01:00
commit c99e32998b
4 changed files with 145 additions and 92 deletions

View File

@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
android { android {
def appVersionCode = 483 def appVersionCode = 484
def appVersionName = '1.45.01' def appVersionName = '1.45.02'
signingConfigs { signingConfigs {
release { release {

View File

@ -5,6 +5,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.text.Html; import android.text.Html;
import android.text.SpannableString; import android.text.SpannableString;
import android.view.Gravity; import android.view.Gravity;
@ -96,6 +97,9 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
@Inject @Inject
DialogInputQuantityV2View mDialogInputQuantityV2View; DialogInputQuantityV2View mDialogInputQuantityV2View;
@Inject
Handler handler;
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel; private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
private final ObservableArrayList<SpedizioneListModel> mSpedizioneMutableData = new ObservableArrayList<>(); private final ObservableArrayList<SpedizioneListModel> mSpedizioneMutableData = new ObservableArrayList<>();
@ -715,30 +719,36 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
}; };
public void addExtraItem() { public void addExtraItem() {
DialogScanArtView handler.post(() -> {
.newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, mtbColr) -> { DialogScanArtView
if (status == DialogConsts.Results.YES) { .newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, mtbColr) -> {
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColr); if (status == DialogConsts.Results.YES) {
} this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColr);
}, pickMagazzinoAutomaticoPosizione -> { }
this.onLoadingStarted(); }, pickMagazzinoAutomaticoPosizione -> {
this.mViewmodel.executeEmptyMagazzinoAutomaticoRequest(pickMagazzinoAutomaticoPosizione, this::onLoadingEnded); this.onLoadingStarted();
}) this.mViewmodel.executeEmptyMagazzinoAutomaticoRequest(pickMagazzinoAutomaticoPosizione, this::onLoadingEnded);
.show(getSupportFragmentManager(), "tag"); })
.show(getSupportFragmentManager(), "tag");
});
} }
public void startManualSearch() { public void startManualSearch() {
BarcodeManager.disable(); handler.post(() -> {
DialogSimpleInputHelper.makeInputDialog(this, "Inserisci il codice a barre", codice -> { BarcodeManager.disable();
DialogSimpleInputHelper.makeInputDialog(this, "Inserisci il codice a barre", codice -> {
this.onScanSuccessful.run(new BarcodeScanDTO().setStringValue(codice).setType(BarcodeType.CODE128)); this.onScanSuccessful.run(new BarcodeScanDTO().setStringValue(codice).setType(BarcodeType.CODE128));
BarcodeManager.enable(); BarcodeManager.enable();
}, BarcodeManager::enable).show(); }, BarcodeManager::enable).show();
});
} }
public void removeListFilter() { public void removeListFilter() {
this.mViewmodel.resetMatchedRows(); handler.post(() -> {
this.mViewmodel.resetMatchedRows();
});
} }
@ -754,26 +764,30 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
public void trackPackaging() { public void trackPackaging() {
this.fabPopupMenu.dismiss(); handler.post(() -> {
this.fabPopupMenu.dismiss();
DialogTracciamentoImballiView.newInstance(imballiData -> { DialogTracciamentoImballiView.newInstance(imballiData -> {
if (imballiData != null && !imballiData.isEmpty()) { if (imballiData != null && !imballiData.isEmpty()) {
DialogAskVettoreView.newInstance(mViewmodel.getDefaultVettore(), vettoreData -> { DialogAskVettoreView.newInstance(mViewmodel.getDefaultVettore(), vettoreData -> {
mViewmodel.registraImballi(vettoreData, imballiData); mViewmodel.registraImballi(vettoreData, imballiData);
}) })
.show(getSupportFragmentManager(), DialogAskVettoreView.class.getName()); .show(getSupportFragmentManager(), DialogAskVettoreView.class.getName());
} }
}).show(getSupportFragmentManager(), DialogTracciamentoImballiView.class.getName()); }).show(getSupportFragmentManager(), DialogTracciamentoImballiView.class.getName());
});
} }
public void showCreatedUL() { public void showCreatedUL() {
this.fabPopupMenu.dismiss(); handler.post(() -> {
this.fabPopupMenu.dismiss();
ArrayList<MtbColt> createdMtbColts = this.mViewmodel.getCreatedMtbColts(); ArrayList<MtbColt> createdMtbColts = this.mViewmodel.getCreatedMtbColts();
Intent myIntent = ListaBancaliActivity.createIntent(this, createdMtbColts, true, false); Intent myIntent = ListaBancaliActivity.createIntent(this, createdMtbColts, true, false);
this.startActivityForResult(myIntent, PICK_UL_REQUEST); this.startActivityForResult(myIntent, PICK_UL_REQUEST);
});
} }
@ -785,50 +799,60 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
@Override @Override
public void onLUOpened(MtbColt mtbColt) { public void onLUOpened(MtbColt mtbColt) {
this.addExtraItemsEnabled.set(SettingsManager.iDB().isFlagCanAddExtraItemSpedizione()); handler.post(() -> {
noLUPresent.set(false); this.addExtraItemsEnabled.set(SettingsManager.iDB().isFlagCanAddExtraItemSpedizione());
noLUPresent.set(false);
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT) Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
.setBackgroundTint(getResources().getColor(R. color. green_500)) .setBackgroundTint(getResources().getColor(R.color.green_500))
.show(); .show();
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(mtbColt); this.mBottomSheetFragmentLUContentViewModel.setMtbColt(mtbColt);
});
} }
@Override @Override
public void onLUClosed() { public void onLUClosed() {
this.addExtraItemsEnabled.set(false); handler.post(() -> {
noLUPresent.set(true); this.addExtraItemsEnabled.set(false);
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(null); noLUPresent.set(true);
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(null);
if (this.mShouldCloseActivity) super.onBackPressed(); if (this.mShouldCloseActivity) super.onBackPressed();
});
} }
@Override @Override
public void onLUPesoRequired(String codTcol, BigDecimal netWeightKG, BigDecimal grossWeightKG, RunnableArgsss<String, BigDecimal, BigDecimal> onComplete) { public void onLUPesoRequired(String codTcol, BigDecimal netWeightKG, BigDecimal grossWeightKG, RunnableArgsss<String, BigDecimal, BigDecimal> onComplete) {
DialogInputPesoLUView.newInstance(null, new BigDecimal(50), new BigDecimal(55), (newCodTcol, newNetWeight, newGrossWeight) -> { handler.post(() -> {
onComplete.run(newCodTcol, netWeightKG, grossWeightKG); DialogInputPesoLUView.newInstance(null, new BigDecimal(50), new BigDecimal(55), (newCodTcol, newNetWeight, newGrossWeight) -> {
}) onComplete.run(newCodTcol, netWeightKG, grossWeightKG);
.show(getSupportFragmentManager(), "tag"); })
.show(getSupportFragmentManager(), "tag");
});
} }
@Override @Override
public void onLUSuccessullyPrinted() { public void onLUSuccessullyPrinted() {
Resources res = getResources(); handler.post(() -> {
String errorMessage = res.getText(R.string.alert_print_completed_message).toString(); Resources res = getResources();
DialogSimpleMessageView String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null) DialogSimpleMessageView
.show(getSupportFragmentManager(), "tag"); .makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
.show(getSupportFragmentManager(), "tag");
});
} }
@Override @Override
public void onLUPrintRequest(RunnableArgs<Boolean> onComplete) { public void onLUPrintRequest(RunnableArgs<Boolean> onComplete) {
DialogYesNoView.newInstance(getString(R.string.action_print), handler.post(() -> {
String.format(getString(R.string.message_print_packing_list), "Packing List"), DialogYesNoView.newInstance(getString(R.string.action_print),
result -> { String.format(getString(R.string.message_print_packing_list), "Packing List"),
onComplete.run(result == DialogConsts.Results.YES); result -> {
}) onComplete.run(result == DialogConsts.Results.YES);
.show(getSupportFragmentManager(), "dialog-print"); })
.show(getSupportFragmentManager(), "dialog-print");
});
} }
@Override @Override
@ -845,41 +869,49 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
@Override @Override
public void onFilterApplied(String newValue) { public void onFilterApplied(String newValue) {
this.mBindings.filteredArtsInListExpandableLayout.expand(true); handler.post(() -> {
this.mBindings.descriptionFilterText.setText(!UtilityString.isNullOrEmpty(newValue) ? newValue : ""); this.mBindings.filteredArtsInListExpandableLayout.expand(true);
this.mBindings.descriptionFilterText.setText(!UtilityString.isNullOrEmpty(newValue) ? newValue : "");
});
} }
@Override @Override
public void onFilterRemoved() { public void onFilterRemoved() {
this.mBindings.filteredArtsInListExpandableLayout.collapse(true); handler.post(() -> {
this.mBindings.descriptionFilterText.setText(""); this.mBindings.filteredArtsInListExpandableLayout.collapse(true);
this.mBindings.descriptionFilterText.setText("");
});
} }
@Override @Override
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) { public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
String text = getResources().getString(R.string.alert_delete_mtb_colr); handler.post(() -> {
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text), String text = getResources().getString(R.string.alert_delete_mtb_colr);
null, DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
() -> onComplete.run(true), null,
() -> onComplete.run(false) () -> onComplete.run(true),
) () -> onComplete.run(false)
.show(getSupportFragmentManager(), "tag"); )
.show(getSupportFragmentManager(), "tag");
});
} }
@Override @Override
public void onError(Exception ex, boolean useSnackbar) { public void onError(Exception ex, boolean useSnackbar) {
this.onLoadingEnded(); handler.post(() -> {
this.onLoadingEnded();
if (ex instanceof InvalidPesoKGException) { if (ex instanceof InvalidPesoKGException) {
UtilityToast.showToast(ex.getMessage()); UtilityToast.showToast(ex.getMessage());
} else { } else {
if(useSnackbar) if (useSnackbar)
Snackbar.make(mBindings.getRoot(), Objects.requireNonNull(ex.getMessage()), Snackbar.LENGTH_LONG).show(); Snackbar.make(mBindings.getRoot(), Objects.requireNonNull(ex.getMessage()), Snackbar.LENGTH_LONG).show();
else else
UtilityExceptions.defaultException(this, ex); UtilityExceptions.defaultException(this, ex);
} }
BarcodeManager.enable(); BarcodeManager.enable();
});
} }
@Override @Override
@ -1057,7 +1089,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
@Override @Override
public void onRowSaved() { public void onRowSaved() {
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT) Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
.setBackgroundTint(getResources().getColor(R. color. green_500)) .setBackgroundTint(getResources().getColor(R.color.green_500))
.show(); .show();
} }

View File

@ -1,5 +1,9 @@
package it.integry.integrywmsnative.gest.spedizione; package it.integry.integrywmsnative.gest.spedizione;
import android.os.Handler;
import java.util.concurrent.ExecutorService;
import dagger.Module; import dagger.Module;
import dagger.Provides; import dagger.Provides;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService; import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
@ -38,7 +42,9 @@ public class SpedizioneModule {
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer, ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer, MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer,
ImballiRESTConsumer imballiRESTConsumer, ImballiRESTConsumer imballiRESTConsumer,
MagazzinoRESTConsumer magazzinoRESTConsumer) { MagazzinoRESTConsumer magazzinoRESTConsumer,
ExecutorService executorService,
Handler handler) {
return new SpedizioneViewModel(articoloRESTConsumer, return new SpedizioneViewModel(articoloRESTConsumer,
barcodeRESTConsumer, barcodeRESTConsumer,
colliDataRecoverService, colliDataRecoverService,
@ -51,7 +57,9 @@ public class SpedizioneModule {
colliLavorazioneRESTConsumer, colliLavorazioneRESTConsumer,
magazzinoAutomaticoRESTConsumer, magazzinoAutomaticoRESTConsumer,
imballiRESTConsumer, imballiRESTConsumer,
magazzinoRESTConsumer); magazzinoRESTConsumer,
executorService,
handler);
} }
} }

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.gest.spedizione; package it.integry.integrywmsnative.gest.spedizione;
import android.os.Handler;
import androidx.databinding.ObservableArrayList; import androidx.databinding.ObservableArrayList;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
@ -14,6 +16,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.inject.Inject; import javax.inject.Inject;
@ -140,9 +143,13 @@ public class SpedizioneViewModel {
private final MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer; private final MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer;
private final ImballiRESTConsumer mImballiRESTConsumer; private final ImballiRESTConsumer mImballiRESTConsumer;
private final ExecutorService executorService;
private final Handler handler;
private ColliScaricoRESTConsumerInterface mColliScaricoRESTConsumer; private ColliScaricoRESTConsumerInterface mColliScaricoRESTConsumer;
private MagazzinoRESTConsumer magazzinoRESTConsumer; private MagazzinoRESTConsumer magazzinoRESTConsumer;
@Inject @Inject
public SpedizioneViewModel(ArticoloRESTConsumer articoloRESTConsumer, public SpedizioneViewModel(ArticoloRESTConsumer articoloRESTConsumer,
BarcodeRESTConsumer barcodeRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer,
@ -156,7 +163,9 @@ public class SpedizioneViewModel {
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer, ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer, MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer,
ImballiRESTConsumer imballiRESTConsumer, ImballiRESTConsumer imballiRESTConsumer,
MagazzinoRESTConsumer magazzinoRESTConsumer) { MagazzinoRESTConsumer magazzinoRESTConsumer,
ExecutorService executorService,
Handler handler) {
this.mArticoloRESTConsumer = articoloRESTConsumer; this.mArticoloRESTConsumer = articoloRESTConsumer;
this.mBarcodeRESTConsumer = barcodeRESTConsumer; this.mBarcodeRESTConsumer = barcodeRESTConsumer;
this.mColliDataRecoverService = colliDataRecoverService; this.mColliDataRecoverService = colliDataRecoverService;
@ -170,6 +179,8 @@ public class SpedizioneViewModel {
this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer; this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer;
this.mImballiRESTConsumer = imballiRESTConsumer; this.mImballiRESTConsumer = imballiRESTConsumer;
this.magazzinoRESTConsumer = magazzinoRESTConsumer; this.magazzinoRESTConsumer = magazzinoRESTConsumer;
this.executorService = executorService;
this.handler = handler;
} }
@ -674,7 +685,7 @@ public class SpedizioneViewModel {
this.executeEtichettaLU(ean128Model.Sscc, onComplete); this.executeEtichettaLU(ean128Model.Sscc, onComplete);
} else { } else {
if(SettingsManager.iDB().isFlagSpedizioneEnableManualPick()) { if (SettingsManager.iDB().isFlagSpedizioneEnableManualPick()) {
PickDataDTO pickDataDTO = PickDataDTO.fromEan128(ean128Model); PickDataDTO pickDataDTO = PickDataDTO.fromEan128(ean128Model);
this.loadArticolo(barcodeProd, pickDataDTO, onComplete); this.loadArticolo(barcodeProd, pickDataDTO, onComplete);
@ -1480,10 +1491,10 @@ public class SpedizioneViewModel {
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei //Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
if (removeFilters) if (removeFilters)
resetMatchedRows(); resetMatchedRows();
else else
//Refresh della lista forzato //Refresh della lista forzato
this.mPickingList.postValue(this.mPickingList.getValue()); this.mPickingList.postValue(this.mPickingList.getValue());
this.sendOnRowSaved(); this.sendOnRowSaved();
this.sendOnLoadingEnded(); this.sendOnLoadingEnded();
@ -1518,7 +1529,7 @@ public class SpedizioneViewModel {
.findFirst() .findFirst()
.orElse(null); .orElse(null);
if(!UtilityString.isNullOrEmpty(newTipoUL) && newMtbTcol == null) { if (!UtilityString.isNullOrEmpty(newTipoUL) && newMtbTcol == null) {
this.sendError(new Exception("Impossibile riconoscere il tipo UL " + newTipoUL)); this.sendError(new Exception("Impossibile riconoscere il tipo UL " + newTipoUL));
onComplete.run(); onComplete.run();
return; return;
@ -2015,12 +2026,14 @@ public class SpedizioneViewModel {
} }
public void resetMatchedRows() { public void resetMatchedRows() {
for (PickingObjectDTO pickingObjectDTO : this.mPickingList.getValue()) { handler.post(() -> {
pickingObjectDTO.setTempPickData(null).setHidden(false); for (PickingObjectDTO pickingObjectDTO : this.mPickingList.getValue()) {
} pickingObjectDTO.setTempPickData(null).setHidden(false);
}
this.mPickingList.postValue(this.mPickingList.getValue()); this.mPickingList.postValue(this.mPickingList.getValue());
this.sendFilterRemoved(); this.sendFilterRemoved();
});
} }
public void closeOrder() { public void closeOrder() {