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.Parcelable;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -471,7 +474,7 @@ public class MtbColt extends EntityBase implements Parcelable {
|
||||
return posizione;
|
||||
}
|
||||
|
||||
public MtbColt setPosizione(String posizione) {
|
||||
public MtbColt setPosizione(@Nullable String posizione) {
|
||||
this.posizione = posizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -8,7 +8,9 @@ import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
public class UtilityFirebase {
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@ -528,18 +528,20 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onColloClosed() {
|
||||
public void onColloClosed(Runnable onComplete) {
|
||||
if(thereIsAnOpenedUL()) {
|
||||
|
||||
final ProgressDialog progress = UtilityProgress.createDefaultProgressDialog(mActivity);
|
||||
progress.show();
|
||||
|
||||
if(thereIsAnyRowInUL()) {
|
||||
updateDataFine(progress, () -> printCollo(progress));
|
||||
updateDataFine(progress, () -> printCollo(progress, onComplete));
|
||||
} 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();
|
||||
|
||||
if(currentMtbColt.getDisablePrint() != null && currentMtbColt.getDisablePrint()){
|
||||
postCloseOperations();
|
||||
postCloseOperations(onComplete);
|
||||
progress.dismiss();
|
||||
return;
|
||||
}
|
||||
@ -589,7 +591,7 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
|
||||
currentMtbColt,
|
||||
1, reportName, () -> {
|
||||
|
||||
postCloseOperations();
|
||||
postCloseOperations(onComplete);
|
||||
progress.dismiss();
|
||||
|
||||
}, ex -> {
|
||||
@ -602,7 +604,7 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
() -> postCloseOperations()).show();
|
||||
() -> postCloseOperations(onComplete)).show();
|
||||
});
|
||||
|
||||
}, 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(), () -> {
|
||||
mArticoliInColloBottomSheetViewModel.mtbColt.set(null);
|
||||
@ -637,8 +639,8 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
|
||||
isFabVisible.set(true);
|
||||
|
||||
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();
|
||||
|
||||
@ -682,6 +684,8 @@ public class AccettazioneOnOrdineAccettazioneInevasoViewModel implements IOnColl
|
||||
removeListFilter();
|
||||
refreshOrderBy(true);
|
||||
|
||||
if(onComplete != null) onComplete.run();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -22,6 +22,7 @@ import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import it.integry.integrywmsnative.MainActivity;
|
||||
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) {
|
||||
DialogAskPositionOfLU.makeBase(mContext, mtbColt.get(), mtbDepoPosizione -> {
|
||||
if(mtbDepoPosizione != null) {
|
||||
mtbColt.get().setPosizione(mtbDepoPosizione.getPosizione());
|
||||
if(mtbDepoPosizione != null && mtbColt.get() != null) {
|
||||
Objects.requireNonNull(mtbColt.get()).setPosizione(mtbDepoPosizione.getPosizione());
|
||||
onComplete.run();
|
||||
} else {
|
||||
onAbort.run();
|
||||
|
||||
@ -118,7 +118,7 @@ public class MainVenditaFragment extends Fragment implements ITitledFragment, IS
|
||||
|
||||
ButterKnife.bind(this, mBinding.getRoot());
|
||||
|
||||
mWaterfallToolbar.setRecyclerView(mBinding.venditaMainList);
|
||||
if(mWaterfallToolbar != null) mWaterfallToolbar.setRecyclerView(mBinding.venditaMainList);
|
||||
|
||||
return mBinding.getRoot();
|
||||
}
|
||||
|
||||
@ -72,10 +72,11 @@ public class VenditaOrdineInevasoActivity extends AppCompatActivity {
|
||||
if(mArticoliInColloBottomSheetViewModel.isExpanded()){
|
||||
mArticoliInColloBottomSheetViewModel.collapse();
|
||||
} else if(mVenditaOrdineInevasoViewModel.thereIsAnOpenedUL()) {
|
||||
mArticoliInColloBottomSheetViewModel.closeCurrentUL();
|
||||
|
||||
mArticoliInColloBottomSheetViewModel.closeCurrentUL(() -> {
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
super.onBackPressed();
|
||||
});
|
||||
|
||||
} else {
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
super.onBackPressed();
|
||||
|
||||
@ -800,21 +800,21 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onColloClosed() {
|
||||
public void onColloClosed(Runnable onComplete) {
|
||||
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();
|
||||
|
||||
if(thereIsAnyRowInUL()) {
|
||||
updateDataFine(progress, () -> distribuisciCollo(progress, (generatedMtbColts) -> printCollo(progress, generatedMtbColts)));
|
||||
updateDataFine(progress, () -> distribuisciCollo(progress, (generatedMtbColts) -> printCollo(progress, generatedMtbColts, onComplete)));
|
||||
} else {
|
||||
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 -> {
|
||||
|
||||
if(shouldPrint) {
|
||||
@ -864,7 +864,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
||||
if (value.size() > 0) {
|
||||
try {
|
||||
cyclicPrint(mtbColtsToPrint.iterator(), value.get(0), () -> {
|
||||
postCloseOperations(mtbColtsToPrint);
|
||||
postCloseOperations(mtbColtsToPrint, onComplete);
|
||||
progress.dismiss();
|
||||
}, ex -> {
|
||||
progress.dismiss();
|
||||
@ -875,17 +875,17 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
() -> postCloseOperations(mtbColtsToPrint)).show();
|
||||
() -> postCloseOperations(mtbColtsToPrint, onComplete)).show();
|
||||
});
|
||||
|
||||
} catch (Exception ex) {
|
||||
UtilityExceptions.defaultException(mActivity, ex, progress);
|
||||
postCloseOperations(mtbColtsToPrint);
|
||||
postCloseOperations(mtbColtsToPrint, onComplete);
|
||||
}
|
||||
} else {
|
||||
progress.dismiss();
|
||||
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 {
|
||||
postCloseOperations(mtbColtsToPrint);
|
||||
postCloseOperations(mtbColtsToPrint, onComplete);
|
||||
progress.dismiss();
|
||||
}
|
||||
}).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(), () -> {
|
||||
mArticoliInColloBottomSheetViewModel.mtbColt.set(null);
|
||||
@ -933,6 +933,9 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
||||
isFabVisible.set(true);
|
||||
|
||||
progress.dismiss();
|
||||
|
||||
|
||||
if(onComplete != null) onComplete.run();
|
||||
}, 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();
|
||||
|
||||
@ -983,6 +986,8 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
||||
|
||||
removeListFilter();
|
||||
refreshOrderBy(true);
|
||||
|
||||
if(onComplete != null) onComplete.run();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,6 +2,6 @@ package it.integry.integrywmsnative.view.bottomsheet.interfaces;
|
||||
|
||||
public interface IOnColloClosedCallback {
|
||||
|
||||
void onColloClosed();
|
||||
void onColloClosed(Runnable onComplete);
|
||||
|
||||
}
|
||||
|
||||
@ -121,7 +121,11 @@ public class ArticoliInColloBottomSheetViewModel {
|
||||
|
||||
|
||||
public void closeCurrentUL(){
|
||||
if(onCloseColloCallback != null) onCloseColloCallback.onColloClosed();
|
||||
closeCurrentUL(null);
|
||||
}
|
||||
|
||||
public void closeCurrentUL(Runnable onComplete){
|
||||
if(onCloseColloCallback != null) onCloseColloCallback.onColloClosed(onComplete);
|
||||
}
|
||||
|
||||
public boolean isExpanded() {
|
||||
|
||||
@ -5,6 +5,8 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import device.common.DecodeResult;
|
||||
import device.common.ScanConst;
|
||||
import device.sdk.ScanManager;
|
||||
@ -91,9 +93,15 @@ public class PointMobileBarcodeReader implements BarcodeReaderInterface {
|
||||
}
|
||||
|
||||
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()
|
||||
.setByteValue(mDecodeResult.decodeValue)
|
||||
.setStringValue(mDecodeResult.toString().replaceAll("\n", "").replaceAll("\r", "").trim())
|
||||
.setStringValue(stringValue)
|
||||
.setType(BarcodeType.fromInt(mDecodeResult.symType))
|
||||
.setName(mDecodeResult.symName)
|
||||
.setDecodingTime(mDecodeResult.decodeTimeMillisecond);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user