Fixato tasto annulla in picking libero.
Fixata creazione UL in Picking Libero.
This commit is contained in:
parent
38f7be5076
commit
a2f719441f
@ -217,7 +217,22 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
ProgressDialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
BarcodeManager.disable();
|
||||
|
||||
if(!thereIsAnOpenedUL.get()) {
|
||||
createNewLU(null, null, progressDialog, () -> {
|
||||
executeEtichetteBehaviour(data, progressDialog);
|
||||
}, () -> {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
} else {
|
||||
executeEtichetteBehaviour(data, progressDialog);
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
private void executeEtichetteBehaviour(BarcodeScanDTO data, ProgressDialog progressDialog){
|
||||
if(UtilityBarcode.isEtichettaAnonima(data)){
|
||||
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
|
||||
this.executeEtichettaLU(data.getStringValue(), progressDialog);
|
||||
@ -229,8 +244,7 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaLU(String sscc, ProgressDialog progressDialog) {
|
||||
@ -341,6 +355,9 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
saveLU(clonedTestata);
|
||||
}
|
||||
|
||||
}, () -> {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
}, () -> {
|
||||
@ -350,21 +367,19 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
}
|
||||
|
||||
|
||||
private void askQuantities(Iterator<MtbColr> sourceMtbColrs, List<MtbColr> destMtbColr, Runnable onComplete){
|
||||
|
||||
private void askQuantities(Iterator<MtbColr> sourceMtbColrs, List<MtbColr> destMtbColr, Runnable onComplete, Runnable onAbort){
|
||||
if(sourceMtbColrs.hasNext()){
|
||||
|
||||
askSingleQuantity(sourceMtbColrs.next(), mtbColr -> {
|
||||
destMtbColr.add(mtbColr);
|
||||
askQuantities(sourceMtbColrs, destMtbColr, onComplete);
|
||||
});
|
||||
askQuantities(sourceMtbColrs, destMtbColr, onComplete, onAbort);
|
||||
}, onAbort);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete) {
|
||||
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete, Runnable onAbort) {
|
||||
DialogInputQuantity.DTO dto = new DialogInputQuantity.DTO()
|
||||
.setBatchLot(mtbColr.getPartitaMag())
|
||||
.setDataScad(mtbColr.getDataScadPartitaD())
|
||||
@ -378,13 +393,15 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
.setMaxQta(mtbColr.getQtaCol());
|
||||
|
||||
DialogInputQuantity.makeBase(mContext, dto, false, quantityDTO -> {
|
||||
mtbColr
|
||||
.setQtaCol(new BigDecimal(quantityDTO.qtaTot.get()))
|
||||
.setQtaCnf(new BigDecimal(quantityDTO.qtaCnf.get()))
|
||||
.setNumCnf(new BigDecimal(quantityDTO.numCnf.get()))
|
||||
.setDatetimeRow(new Date());
|
||||
if(quantityDTO != null) {
|
||||
mtbColr
|
||||
.setQtaCol(new BigDecimal(quantityDTO.qtaTot.get()))
|
||||
.setQtaCnf(new BigDecimal(quantityDTO.qtaCnf.get()))
|
||||
.setNumCnf(new BigDecimal(quantityDTO.numCnf.get()))
|
||||
.setDatetimeRow(new Date());
|
||||
|
||||
onComplete.run(mtbColr);
|
||||
onComplete.run(mtbColr);
|
||||
} else onAbort.run();
|
||||
}).show();
|
||||
}
|
||||
|
||||
@ -438,12 +455,13 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
|
||||
|
||||
public void createNewLU() {
|
||||
createNewLU(null, null, null);
|
||||
createNewLU(null, null, null, null, null);
|
||||
}
|
||||
|
||||
private void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
|
||||
private void createNewLU(Integer customNumCollo, String customSerCollo, ProgressDialog progressDialog, Runnable onComplete, Runnable onFailed) {
|
||||
|
||||
ProgressDialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
boolean shouldCloseProgress = progressDialog == null;
|
||||
final ProgressDialog progressDialogFinal = progressDialog == null ? UtilityProgress.createDefaultProgressDialog(mContext) : progressDialog;
|
||||
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
mtbColt .setGestione(GestioneEnum.VENDITA)
|
||||
@ -462,7 +480,7 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
savedMtbColt.setMtbColr(new ObservableArrayList<>());
|
||||
setULToCurrentContext(savedMtbColt);
|
||||
|
||||
progressDialog.dismiss();
|
||||
if(shouldCloseProgress) progressDialogFinal.dismiss();
|
||||
|
||||
new StatusBarAlert.Builder(mContext)
|
||||
.autoHide(true)
|
||||
@ -474,7 +492,10 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
|
||||
if(onComplete != null) onComplete.run();
|
||||
|
||||
}, ex -> UtilityExceptions.defaultException(mContext, ex, progressDialog));
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialogFinal);
|
||||
if(onFailed != null) onFailed.run();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -485,13 +506,15 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
this.mtbColt.set(mtbColt);
|
||||
}
|
||||
|
||||
|
||||
public void closeLU() {
|
||||
if(thereIsAnOpenedUL.get()) {
|
||||
final ProgressDialog progress = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
|
||||
if(thereIsAnyRowInUL.get()) {
|
||||
updateDataFine(progress, null); //() -> distribuisciCollo(progress, () -> printCollo(progress)));
|
||||
updateDataFine(progress, () -> {
|
||||
progress.dismiss();
|
||||
setULToCurrentContext(null);
|
||||
}); //() -> distribuisciCollo(progress, () -> printCollo(progress)));
|
||||
} else {
|
||||
deleteCollo(progress);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import android.app.AlertDialog;
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.ColorStateList;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.Observable;
|
||||
@ -251,7 +252,9 @@ public class DialogInputQuantity {
|
||||
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
|
||||
.setView(currentBinding.getRoot())
|
||||
.setPositiveButton(context.getText(R.string.confirm), null)
|
||||
.setNegativeButton(context.getText(R.string.abort), null);
|
||||
.setNegativeButton(context.getText(R.string.abort), (dialog, which) -> {
|
||||
dialogCallback.onResult(null);
|
||||
});
|
||||
|
||||
currentAlert = alertDialog.create();
|
||||
currentAlert.setCanceledOnTouchOutside(false);
|
||||
@ -275,8 +278,8 @@ public class DialogInputQuantity {
|
||||
}, 100);
|
||||
|
||||
Button positiveButton = currentAlert.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||
|
||||
positiveButton.setOnClickListener(view -> onConfirm(context, currentQuantityDto, dialogCallback));
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user