corretto filtro in dialogChooseArts e aggiunta possibilità di aprirlo con filtro già attivo
This commit is contained in:
parent
8e60aa0249
commit
c3884774e1
@ -289,9 +289,9 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArtSelectionRequest(List<MtbColr> mtbColrsToPick, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||
public void onArtSelectionRequest(List<MtbColr> mtbColrsToPick, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||
DialogChooseArtsFromListaArts
|
||||
.newInstance(mtbColrsToPick, onComplete, () -> {
|
||||
.newInstance(mtbColrsToPick, mtbAart, onComplete, () -> {
|
||||
onAbort.run();
|
||||
BarcodeManager.enable();
|
||||
})
|
||||
|
||||
@ -134,7 +134,7 @@ public class PickingLiberoViewModel {
|
||||
}
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
||||
pickMerceULtoUL(mtbColt, onComplete);
|
||||
pickMerceULtoUL(mtbColt, articolo, onComplete);
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||
@ -382,13 +382,16 @@ public class PickingLiberoViewModel {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void pickMerceULtoUL(MtbColt sourceMtbColt, Runnable onComplete) {
|
||||
pickMerceULtoUL(sourceMtbColt, null, onComplete);
|
||||
}
|
||||
|
||||
private void pickMerceULtoUL(MtbColt sourceMtbColt, MtbAart mtbAart, Runnable onComplete) {
|
||||
List<MtbColr> mtbColrsToPick = Stream.of(sourceMtbColt.getMtbColr())
|
||||
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaCol(), BigDecimal.ZERO))
|
||||
.toList();
|
||||
|
||||
this.sendArtSelectionRequest(mtbColrsToPick, pickedAarts -> {
|
||||
this.sendArtSelectionRequest(mtbColrsToPick, mtbAart, pickedAarts -> {
|
||||
List<MtbColr> destNewMtbColr = new ArrayList<>();
|
||||
|
||||
if (pickedAarts.size() > 0) {
|
||||
@ -809,9 +812,9 @@ public class PickingLiberoViewModel {
|
||||
if (this.mListener != null) mListener.onLUClienteRequired(onComplete, onAbort);
|
||||
}
|
||||
|
||||
private void sendArtSelectionRequest(List<MtbColr> mtbColrsToPick, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||
private void sendArtSelectionRequest(List<MtbColr> mtbColrsToPick, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||
if (this.mListener != null)
|
||||
mListener.onArtSelectionRequest(mtbColrsToPick, onComplete, onAbort);
|
||||
mListener.onArtSelectionRequest(mtbColrsToPick, mtbAart, onComplete, onAbort);
|
||||
}
|
||||
|
||||
private void sendOnItemDispatched(PickingObjectDTO pickingObjectDTO,
|
||||
@ -865,7 +868,7 @@ public class PickingLiberoViewModel {
|
||||
|
||||
void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort);
|
||||
|
||||
void onArtSelectionRequest(List<MtbColr> mtbColrsToPick, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort);
|
||||
void onArtSelectionRequest(List<MtbColr> mtbColrsToPick, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort);
|
||||
|
||||
void onItemDispatched(PickingObjectDTO pickingObjectDTO,
|
||||
MtbAart mtbAart,
|
||||
|
||||
@ -62,11 +62,23 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
private final List<DialogChooseArtsFromListaArtsItemModel> mDataset;
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
private Dialog mCurrentProgress;
|
||||
private MtbAart selectedArt;
|
||||
|
||||
public static DialogChooseArtsFromListaArts newInstance(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
return new DialogChooseArtsFromListaArts(listaMtbColr, onItemsChoosed, onAbort);
|
||||
}
|
||||
|
||||
public static DialogChooseArtsFromListaArts newInstance(List<MtbColr> listaMtbColr, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
DialogChooseArtsFromListaArts dialog = newInstance(listaMtbColr, onItemsChoosed, onAbort);
|
||||
dialog.setSelectedArt(mtbAart);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public void setSelectedArt(MtbAart mtbAart) {
|
||||
this.selectedArt = mtbAart;
|
||||
}
|
||||
|
||||
private DialogChooseArtsFromListaArts(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
super();
|
||||
|
||||
@ -125,6 +137,14 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
if (selectedArt != null) {
|
||||
this.loadArticolo(selectedArt.getBarCode(), null);
|
||||
}
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
mBindings.listaArts.setNestedScrollingEnabled(false);
|
||||
@ -229,8 +249,6 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||
@ -242,14 +260,15 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||
BarcodeManager.disable();
|
||||
|
||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(context);
|
||||
openProgress();
|
||||
|
||||
|
||||
if (UtilityBarcode.isEan13(data)) {
|
||||
this.loadArticolo(data.getStringValue(), null, progressDialog);
|
||||
this.loadArticolo(data.getStringValue(), null);
|
||||
} else if (UtilityBarcode.isEtichetta128(data)) {
|
||||
this.executeEtichettaEan128(data, progressDialog);
|
||||
this.executeEtichettaEan128(data);
|
||||
} else {
|
||||
progressDialog.dismiss();
|
||||
closeProgress();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
@ -257,7 +276,7 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
};
|
||||
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) {
|
||||
this.barcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
String barcodeProd = null;
|
||||
@ -271,11 +290,11 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin) || !UtilityString.isNullOrEmpty(ean128Model.Content)) {
|
||||
this.loadArticolo(barcodeProd, ean128Model, progressDialog);
|
||||
this.loadArticolo(barcodeProd, ean128Model);
|
||||
} else {
|
||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
closeProgress();
|
||||
});
|
||||
|
||||
}
|
||||
@ -285,18 +304,19 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
closeProgress();
|
||||
});
|
||||
|
||||
}
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(context, ex, progressDialog);
|
||||
closeProgress();
|
||||
UtilityExceptions.defaultException(context, ex);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void loadArticolo(String barcodeProd, Ean128Model ean128Model, Dialog progressDialog) {
|
||||
private void loadArticolo(String barcodeProd, Ean128Model ean128Model) {
|
||||
if (barcodeProd.length() == 14) {
|
||||
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
||||
}
|
||||
@ -310,19 +330,20 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
this.searchArtInList(mtbAartList.get(0), ean128Model);
|
||||
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
closeProgress();
|
||||
|
||||
} else {
|
||||
|
||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
closeProgress();
|
||||
});
|
||||
}
|
||||
|
||||
}, ex -> {
|
||||
closeProgress();
|
||||
BarcodeManager.enable();
|
||||
UtilityExceptions.defaultException(context, ex, progressDialog);
|
||||
UtilityExceptions.defaultException(context, ex);
|
||||
});
|
||||
}
|
||||
|
||||
@ -364,5 +385,20 @@ public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
this.dismiss();
|
||||
}
|
||||
|
||||
|
||||
protected void openProgress() {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
if (this.mCurrentProgress == null) {
|
||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void closeProgress() {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
if (mCurrentProgress != null) {
|
||||
mCurrentProgress.dismiss();
|
||||
mCurrentProgress = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user