Risolto bug della chiusura del collo in vendita tramite tasto Back
This commit is contained in:
parent
17d2e7f980
commit
10c77362b8
@ -4,6 +4,9 @@ import androidx.databinding.ObservableArrayList;
|
|||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@ -471,7 +474,7 @@ public class MtbColt extends EntityBase implements Parcelable {
|
|||||||
return posizione;
|
return posizione;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColt setPosizione(String posizione) {
|
public MtbColt setPosizione(@Nullable String posizione) {
|
||||||
this.posizione = posizione;
|
this.posizione = posizione;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,9 @@ import it.integry.integrywmsnative.core.settings.SettingsManager;
|
|||||||
public class UtilityFirebase {
|
public class UtilityFirebase {
|
||||||
|
|
||||||
public static Trace getNewPerformanceTrace(String traceName) {
|
public static Trace getNewPerformanceTrace(String traceName) {
|
||||||
String username = SettingsManager.i().user.fullname ;
|
String username = SettingsManager.i().user != null && !UtilityString.isNullOrEmpty(SettingsManager.i().user.fullname) ?
|
||||||
|
SettingsManager.i().user.fullname :
|
||||||
|
"N / A";
|
||||||
|
|
||||||
Trace newTrace = FirebasePerformance.getInstance().newTrace(traceName);
|
Trace newTrace = FirebasePerformance.getInstance().newTrace(traceName);
|
||||||
|
|
||||||
|
|||||||
@ -528,18 +528,20 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onColloClosed() {
|
public void onColloClosed(Runnable onComplete) {
|
||||||
if(thereIsAnOpenedUL()) {
|
if(thereIsAnOpenedUL()) {
|
||||||
|
|
||||||
final ProgressDialog progress = UtilityProgress.createDefaultProgressDialog(mActivity);
|
final ProgressDialog progress = UtilityProgress.createDefaultProgressDialog(mActivity);
|
||||||
progress.show();
|
progress.show();
|
||||||
|
|
||||||
if(thereIsAnyRowInUL()) {
|
if(thereIsAnyRowInUL()) {
|
||||||
updateDataFine(progress, () -> printCollo(progress));
|
updateDataFine(progress, () -> printCollo(progress, onComplete));
|
||||||
} else {
|
} else {
|
||||||
deleteCollo(progress);
|
deleteCollo(progress, onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(onComplete != null) onComplete.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -565,11 +567,11 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printCollo(ProgressDialog progress) {
|
private void printCollo(ProgressDialog progress, Runnable onComplete) {
|
||||||
MtbColt currentMtbColt = mArticoliInColloBottomSheetViewModel.mtbColt.get();
|
MtbColt currentMtbColt = mArticoliInColloBottomSheetViewModel.mtbColt.get();
|
||||||
|
|
||||||
if(currentMtbColt.getDisablePrint() != null && currentMtbColt.getDisablePrint()){
|
if(currentMtbColt.getDisablePrint() != null && currentMtbColt.getDisablePrint()){
|
||||||
postCloseOperations();
|
postCloseOperations(onComplete);
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -589,7 +591,7 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
|
|||||||
currentMtbColt,
|
currentMtbColt,
|
||||||
1, reportName, () -> {
|
1, reportName, () -> {
|
||||||
|
|
||||||
postCloseOperations();
|
postCloseOperations(onComplete);
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
|
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
@ -602,7 +604,7 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
R.string.button_ignore_print,
|
R.string.button_ignore_print,
|
||||||
() -> postCloseOperations()).show();
|
() -> postCloseOperations(onComplete)).show();
|
||||||
});
|
});
|
||||||
|
|
||||||
}, ex -> UtilityExceptions.defaultException(mActivity, ex, progress)
|
}, ex -> UtilityExceptions.defaultException(mActivity, ex, progress)
|
||||||
@ -629,7 +631,7 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void deleteCollo(ProgressDialog progress) {
|
private void deleteCollo(ProgressDialog progress, Runnable onComplete) {
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumer.deleteCollo(mArticoliInColloBottomSheetViewModel.mtbColt.get(), () -> {
|
ColliMagazzinoRESTConsumer.deleteCollo(mArticoliInColloBottomSheetViewModel.mtbColt.get(), () -> {
|
||||||
mArticoliInColloBottomSheetViewModel.mtbColt.set(null);
|
mArticoliInColloBottomSheetViewModel.mtbColt.set(null);
|
||||||
@ -637,8 +639,8 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
|
|||||||
isFabVisible.set(true);
|
isFabVisible.set(true);
|
||||||
|
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
}, ex -> UtilityExceptions.defaultException(mActivity, ex, progress)
|
if(onComplete != null) onComplete.run();
|
||||||
);
|
}, ex -> UtilityExceptions.defaultException(mActivity, ex, progress));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -653,7 +655,7 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void postCloseOperations() {
|
private void postCloseOperations(Runnable onComplete) {
|
||||||
|
|
||||||
MtbColt mtbColt = mArticoliInColloBottomSheetViewModel.mtbColt.get();
|
MtbColt mtbColt = mArticoliInColloBottomSheetViewModel.mtbColt.get();
|
||||||
|
|
||||||
@ -682,6 +684,8 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
|
|||||||
removeListFilter();
|
removeListFilter();
|
||||||
refreshOrderBy(true);
|
refreshOrderBy(true);
|
||||||
|
|
||||||
|
if(onComplete != null) onComplete.run();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import java.math.BigDecimal;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.MainActivity;
|
import it.integry.integrywmsnative.MainActivity;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
@ -469,8 +470,8 @@ public class RettificaGiacenzeViewModel implements IRecyclerItemClicked<MtbColr>
|
|||||||
|
|
||||||
private void posizionaCollo(Runnable onComplete, Runnable onAbort, RunnableArgs<Exception> onFailed) {
|
private void posizionaCollo(Runnable onComplete, Runnable onAbort, RunnableArgs<Exception> onFailed) {
|
||||||
DialogAskPositionOfLU.makeBase(mContext, mtbColt.get(), mtbDepoPosizione -> {
|
DialogAskPositionOfLU.makeBase(mContext, mtbColt.get(), mtbDepoPosizione -> {
|
||||||
if(mtbDepoPosizione != null) {
|
if(mtbDepoPosizione != null && mtbColt.get() != null) {
|
||||||
mtbColt.get().setPosizione(mtbDepoPosizione.getPosizione());
|
Objects.requireNonNull(mtbColt.get()).setPosizione(mtbDepoPosizione.getPosizione());
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
} else {
|
} else {
|
||||||
onAbort.run();
|
onAbort.run();
|
||||||
|
|||||||
@ -118,7 +118,7 @@ public class MainVenditaFragment extends Fragment implements ITitledFragment, IS
|
|||||||
|
|
||||||
ButterKnife.bind(this, mBinding.getRoot());
|
ButterKnife.bind(this, mBinding.getRoot());
|
||||||
|
|
||||||
mWaterfallToolbar.setRecyclerView(mBinding.venditaMainList);
|
if(mWaterfallToolbar != null) mWaterfallToolbar.setRecyclerView(mBinding.venditaMainList);
|
||||||
|
|
||||||
return mBinding.getRoot();
|
return mBinding.getRoot();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,10 +72,11 @@ public class VenditaOrdineInevasoActivity extends AppCompatActivity {
|
|||||||
if(mArticoliInColloBottomSheetViewModel.isExpanded()){
|
if(mArticoliInColloBottomSheetViewModel.isExpanded()){
|
||||||
mArticoliInColloBottomSheetViewModel.collapse();
|
mArticoliInColloBottomSheetViewModel.collapse();
|
||||||
} else if(mVenditaOrdineInevasoViewModel.thereIsAnOpenedUL()) {
|
} else if(mVenditaOrdineInevasoViewModel.thereIsAnOpenedUL()) {
|
||||||
mArticoliInColloBottomSheetViewModel.closeCurrentUL();
|
mArticoliInColloBottomSheetViewModel.closeCurrentUL(() -> {
|
||||||
|
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||||
|
super.onBackPressed();
|
||||||
|
});
|
||||||
|
|
||||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
|
||||||
super.onBackPressed();
|
|
||||||
} else {
|
} else {
|
||||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
|
|||||||
@ -800,21 +800,21 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onColloClosed() {
|
public void onColloClosed(Runnable onComplete) {
|
||||||
if(thereIsAnOpenedUL()) {
|
if(thereIsAnOpenedUL()) {
|
||||||
final ProgressDialog progress = ProgressDialog.show(mActivity, mActivity.getText(R.string.waiting),
|
|
||||||
mActivity.getText(R.string.loading) + " ...", true);
|
|
||||||
|
|
||||||
|
final ProgressDialog progress = UtilityProgress.createDefaultProgressDialog(mActivity);
|
||||||
progress.show();
|
progress.show();
|
||||||
|
|
||||||
if(thereIsAnyRowInUL()) {
|
if(thereIsAnyRowInUL()) {
|
||||||
updateDataFine(progress, () -> distribuisciCollo(progress, (generatedMtbColts) -> printCollo(progress, generatedMtbColts)));
|
updateDataFine(progress, () -> distribuisciCollo(progress, (generatedMtbColts) -> printCollo(progress, generatedMtbColts, onComplete)));
|
||||||
} else {
|
} else {
|
||||||
if(mtbColtSessionID != null) ColliDataRecover.closeSession(mtbColtSessionID);
|
if(mtbColtSessionID != null) ColliDataRecover.closeSession(mtbColtSessionID);
|
||||||
deleteCollo(progress);
|
deleteCollo(progress, onComplete);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(onComplete != null) onComplete.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -853,7 +853,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printCollo(ProgressDialog progress, List<MtbColt> mtbColtsToPrint) {
|
private void printCollo(ProgressDialog progress, List<MtbColt> mtbColtsToPrint, Runnable onComplete) {
|
||||||
DialogAskShouldPrint.make(mActivity, "Packing List", shouldPrint -> {
|
DialogAskShouldPrint.make(mActivity, "Packing List", shouldPrint -> {
|
||||||
|
|
||||||
if(shouldPrint) {
|
if(shouldPrint) {
|
||||||
@ -864,7 +864,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
|||||||
if (value.size() > 0) {
|
if (value.size() > 0) {
|
||||||
try {
|
try {
|
||||||
cyclicPrint(mtbColtsToPrint.iterator(), value.get(0), () -> {
|
cyclicPrint(mtbColtsToPrint.iterator(), value.get(0), () -> {
|
||||||
postCloseOperations(mtbColtsToPrint);
|
postCloseOperations(mtbColtsToPrint, onComplete);
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
@ -875,17 +875,17 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
R.string.button_ignore_print,
|
R.string.button_ignore_print,
|
||||||
() -> postCloseOperations(mtbColtsToPrint)).show();
|
() -> postCloseOperations(mtbColtsToPrint, onComplete)).show();
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
UtilityExceptions.defaultException(mActivity, ex, progress);
|
UtilityExceptions.defaultException(mActivity, ex, progress);
|
||||||
postCloseOperations(mtbColtsToPrint);
|
postCloseOperations(mtbColtsToPrint, onComplete);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
String errorMessage = "Nessuna stampante configurata";
|
String errorMessage = "Nessuna stampante configurata";
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mActivity, new SpannableString(errorMessage), null, () -> postCloseOperations(mtbColtsToPrint)).show();
|
DialogSimpleMessageHelper.makeWarningDialog(mActivity, new SpannableString(errorMessage), null, () -> postCloseOperations(mtbColtsToPrint, onComplete)).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -895,7 +895,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
postCloseOperations(mtbColtsToPrint);
|
postCloseOperations(mtbColtsToPrint, onComplete);
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
@ -925,7 +925,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void deleteCollo(ProgressDialog progress) {
|
private void deleteCollo(ProgressDialog progress, Runnable onComplete) {
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumer.deleteCollo(mArticoliInColloBottomSheetViewModel.mtbColt.get(), () -> {
|
ColliMagazzinoRESTConsumer.deleteCollo(mArticoliInColloBottomSheetViewModel.mtbColt.get(), () -> {
|
||||||
mArticoliInColloBottomSheetViewModel.mtbColt.set(null);
|
mArticoliInColloBottomSheetViewModel.mtbColt.set(null);
|
||||||
@ -933,6 +933,9 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
|||||||
isFabVisible.set(true);
|
isFabVisible.set(true);
|
||||||
|
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
|
|
||||||
|
|
||||||
|
if(onComplete != null) onComplete.run();
|
||||||
}, ex -> UtilityExceptions.defaultException(mActivity, ex, progress)
|
}, ex -> UtilityExceptions.defaultException(mActivity, ex, progress)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -948,7 +951,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void postCloseOperations(List<MtbColt> generatedMtbColt) {
|
private void postCloseOperations(List<MtbColt> generatedMtbColt, Runnable onComplete) {
|
||||||
|
|
||||||
MtbColt mtbColt = mArticoliInColloBottomSheetViewModel.mtbColt.get();
|
MtbColt mtbColt = mArticoliInColloBottomSheetViewModel.mtbColt.get();
|
||||||
|
|
||||||
@ -983,6 +986,8 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
|||||||
|
|
||||||
removeListFilter();
|
removeListFilter();
|
||||||
refreshOrderBy(true);
|
refreshOrderBy(true);
|
||||||
|
|
||||||
|
if(onComplete != null) onComplete.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,6 @@ package it.integry.integrywmsnative.view.bottomsheet.interfaces;
|
|||||||
|
|
||||||
public interface IOnColloClosedCallback {
|
public interface IOnColloClosedCallback {
|
||||||
|
|
||||||
void onColloClosed();
|
void onColloClosed(Runnable onComplete);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -121,7 +121,11 @@ public class ArticoliInColloBottomSheetViewModel {
|
|||||||
|
|
||||||
|
|
||||||
public void closeCurrentUL(){
|
public void closeCurrentUL(){
|
||||||
if(onCloseColloCallback != null) onCloseColloCallback.onColloClosed();
|
closeCurrentUL(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void closeCurrentUL(Runnable onComplete){
|
||||||
|
if(onCloseColloCallback != null) onCloseColloCallback.onColloClosed(onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExpanded() {
|
public boolean isExpanded() {
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import device.common.DecodeResult;
|
import device.common.DecodeResult;
|
||||||
import device.common.ScanConst;
|
import device.common.ScanConst;
|
||||||
import device.sdk.ScanManager;
|
import device.sdk.ScanManager;
|
||||||
@ -91,9 +93,15 @@ public class PointMobileBarcodeReader implements BarcodeReaderInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(mDecodeResult != null) {
|
if(mDecodeResult != null) {
|
||||||
|
String stringValue = null;
|
||||||
|
|
||||||
|
if(mDecodeResult.decodeValue != null && mDecodeResult.decodeValue.length > 0) {
|
||||||
|
stringValue = new String(mDecodeResult.decodeValue, StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
BarcodeScanDTO barcodeScanDTO = new BarcodeScanDTO()
|
BarcodeScanDTO barcodeScanDTO = new BarcodeScanDTO()
|
||||||
.setByteValue(mDecodeResult.decodeValue)
|
.setByteValue(mDecodeResult.decodeValue)
|
||||||
.setStringValue(mDecodeResult.toString().replaceAll("\n", "").replaceAll("\r", "").trim())
|
.setStringValue(stringValue)
|
||||||
.setType(BarcodeType.fromInt(mDecodeResult.symType))
|
.setType(BarcodeType.fromInt(mDecodeResult.symType))
|
||||||
.setName(mDecodeResult.symName)
|
.setName(mDecodeResult.symName)
|
||||||
.setDecodingTime(mDecodeResult.decodeTimeMillisecond);
|
.setDecodingTime(mDecodeResult.decodeTimeMillisecond);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user