[BUGFIX] Risolto problema di modifica/cancellazione riga in Accettazione
This commit is contained in:
parent
2e21982ea7
commit
38853e5514
@ -0,0 +1,28 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class UtilityBigDecimal {
|
||||
|
||||
public static boolean greaterThan(BigDecimal input, BigDecimal toCompareWith) {
|
||||
if(input == null) return false;
|
||||
if(toCompareWith == null) return false;
|
||||
|
||||
return input.compareTo(toCompareWith) > 0;
|
||||
}
|
||||
|
||||
public static boolean equalsTo(BigDecimal input, BigDecimal toCompareWith) {
|
||||
if(input == null) return false;
|
||||
if(toCompareWith == null) return false;
|
||||
|
||||
return input.compareTo(toCompareWith) == 0;
|
||||
}
|
||||
|
||||
public static boolean lowerThan(BigDecimal input, BigDecimal toCompareWith) {
|
||||
if(input == null) return false;
|
||||
if(toCompareWith == null) return false;
|
||||
|
||||
return input.compareTo(toCompareWith) < 0;
|
||||
}
|
||||
|
||||
}
|
||||
@ -72,4 +72,10 @@ public class UtilityString {
|
||||
return Html.fromHtml(String.format(UtilityResources.getString(stringId),params));
|
||||
}
|
||||
|
||||
|
||||
public static boolean equalsIgnoreCase(String val1, String val2) {
|
||||
return (val1 == null && val2 == null) ||
|
||||
(val1 != null && val1.equalsIgnoreCase(val2));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,12 +2,15 @@ package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.viewmodel;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.text.SpannableString;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.tfb.fbtoast.FBToast;
|
||||
|
||||
@ -36,6 +39,7 @@ import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
@ -88,7 +92,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
this.init();
|
||||
}
|
||||
|
||||
private void init(){
|
||||
private void init() {
|
||||
|
||||
currentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.fromInt(SettingsManager.i().userSession.defaultOrdinamentoPickingAccettazione);
|
||||
|
||||
@ -97,7 +101,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
mArticoliInColloBottomSheetViewModel.setOnItemEditedCallback(this::onRowEdited);
|
||||
|
||||
groupedOrdini = new ArrayList<>();
|
||||
for (OrdineAccettazioneDTO ordine : mOrders){
|
||||
for (OrdineAccettazioneDTO ordine : mOrders) {
|
||||
groupedOrdini.addAll(ordine.getOrdini());
|
||||
}
|
||||
|
||||
@ -115,9 +119,9 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
.distinctBy(x -> x)
|
||||
.toList();
|
||||
|
||||
if(foundGestioni != null) {
|
||||
if (foundGestioni != null) {
|
||||
|
||||
if(foundGestioni.size() == 1) {
|
||||
if (foundGestioni.size() == 1) {
|
||||
defaultGestioneOfUL = foundGestioni.get(0) == GestioneEnum.PRODUZIONE ? GestioneEnum.LAVORAZIONE : foundGestioni.get(0);
|
||||
} else {
|
||||
DialogSimpleMessageHelper.makeErrorDialog(mActivity, new SpannableString(mActivity.getString(R.string.error_multiple_gest)), null, () -> {
|
||||
@ -134,7 +138,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
}
|
||||
|
||||
|
||||
private void initRecyclerView(List<List<OrdineAccettazioneDTO.Riga>> groupedRighe){
|
||||
private void initRecyclerView(List<List<OrdineAccettazioneDTO.Riga>> groupedRighe) {
|
||||
//RecyclerView setup
|
||||
mActivity.bindings.accettazioneOrdineMainList.setHasFixedSize(true);
|
||||
|
||||
@ -152,8 +156,8 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
mActivity.bindings.accettazioneOrdineMainList.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
public void refreshOrderBy(boolean forceHiddenCheck){
|
||||
switch (currentOrderBy){
|
||||
public void refreshOrderBy(boolean forceHiddenCheck) {
|
||||
switch (currentOrderBy) {
|
||||
case COD_ART_FOR:
|
||||
groupedRighe = helper.getOrdiniRaggruppatiPerCodArtForn(groupedOrdini, forceHiddenCheck);
|
||||
break;
|
||||
@ -186,7 +190,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
}
|
||||
|
||||
public void removeListFilter() {
|
||||
for(int i = 0; i < groupedOrdini.size(); i++) {
|
||||
for (int i = 0; i < groupedOrdini.size(); i++) {
|
||||
groupedOrdini.get(i).setTempHidden(false);
|
||||
}
|
||||
|
||||
@ -194,9 +198,9 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
mActivity.bindings.filteredArtsInListExpandableLayout.collapse(true);
|
||||
}
|
||||
|
||||
public void recoverUL(MtbColt recoveredMtbColt){
|
||||
public void recoverUL(MtbColt recoveredMtbColt) {
|
||||
|
||||
for(int i = 0; i < recoveredMtbColt.getMtbColr().size(); i++){
|
||||
for (int i = 0; i < recoveredMtbColt.getMtbColr().size(); i++) {
|
||||
|
||||
MtbColr currentMtbColr = recoveredMtbColt.getMtbColr().get(i);
|
||||
|
||||
@ -215,7 +219,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
.toList();
|
||||
|
||||
|
||||
if(foundRows != null && foundRows.size() > 0){
|
||||
if (foundRows != null && foundRows.size() > 0) {
|
||||
OrdineAccettazioneDTO.Riga currentRow = foundRows.get(0);
|
||||
|
||||
currentRow.setHidden(false);
|
||||
@ -230,15 +234,13 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||
|
||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mActivity);
|
||||
|
||||
BarcodeManager.disable();
|
||||
if(UtilityBarcode.isEtichettaAnonima(data)){
|
||||
if(!thereIsAnOpenedUL()) this.executeEtichettaAnonima(data, progressDialog);
|
||||
if (UtilityBarcode.isEtichettaAnonima(data)) {
|
||||
if (!thereIsAnOpenedUL()) this.executeEtichettaAnonima(data, progressDialog);
|
||||
else {
|
||||
DialogSimpleMessageHelper.makeErrorDialog(
|
||||
mActivity,
|
||||
@ -248,11 +250,11 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
})
|
||||
.show();
|
||||
.show();
|
||||
}
|
||||
} else if(UtilityBarcode.isEtichetta128(data)) {
|
||||
} else if (UtilityBarcode.isEtichetta128(data)) {
|
||||
this.executeEtichettaEan128(data, progressDialog);
|
||||
} else if(UtilityBarcode.isEanPeso(data)){
|
||||
} else if (UtilityBarcode.isEanPeso(data)) {
|
||||
this.executeEtichettaEanPeso(data, progressDialog);
|
||||
} else {
|
||||
this.loadArticolo(data.getStringValue(), null, progressDialog);
|
||||
@ -264,8 +266,8 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
private void executeEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
||||
ColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), false, false, mtbColt -> {
|
||||
|
||||
if(mtbColt == null) {
|
||||
if(!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
||||
if (mtbColt == null) {
|
||||
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
||||
UtilityExceptions.defaultException(mActivity, new Exception("Per continuare scansiona un'etichetta dell'anno corrente"), progressDialog, false);
|
||||
BarcodeManager.enable();
|
||||
} else {
|
||||
@ -292,12 +294,12 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
|
||||
String barcodeProd = null;
|
||||
|
||||
if(ean128Model.Sscc != null) barcodeProd = ean128Model.Sscc;
|
||||
if(ean128Model.Gtin != null) barcodeProd = ean128Model.Gtin;
|
||||
if(ean128Model.Content != null) barcodeProd = ean128Model.Content;
|
||||
if (ean128Model.Sscc != null) barcodeProd = ean128Model.Sscc;
|
||||
if (ean128Model.Gtin != null) barcodeProd = ean128Model.Gtin;
|
||||
if (ean128Model.Content != null) barcodeProd = ean128Model.Content;
|
||||
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
if (barcodeProd.startsWith("0") || barcodeProd.startsWith("9")) {
|
||||
barcodeProd = barcodeProd.substring(1, barcodeProd.length());
|
||||
}
|
||||
@ -307,7 +309,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
}, ex-> {
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mActivity, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
@ -326,20 +328,19 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void loadArticolo(String barcodeProd, Ean128Model ean128Model, Dialog progressDialog) {
|
||||
if(barcodeProd.length() == 14) {
|
||||
if (barcodeProd.length() == 14) {
|
||||
// barcodeProd = UtilityBarcode.convertITF14toNeutral(barcodeProd);
|
||||
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
||||
}
|
||||
|
||||
ArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
|
||||
|
||||
if(mtbAartList != null && mtbAartList.size() > 0) {
|
||||
if (mtbAartList != null && mtbAartList.size() > 0) {
|
||||
|
||||
if(!thereIsAnOpenedUL()){
|
||||
if (!thereIsAnOpenedUL()) {
|
||||
|
||||
if(SettingsManager.iDB().isFlagCanAutoOpenNewULAccettazione()) {
|
||||
if (SettingsManager.iDB().isFlagCanAutoOpenNewULAccettazione()) {
|
||||
this.createNewUL(null, null, progressDialog, false, () -> {
|
||||
BarcodeManager.enable();
|
||||
this.searchArtInList(mtbAartList.get(0), ean128Model);
|
||||
@ -379,16 +380,16 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
|
||||
List<OrdineAccettazioneDTO.Riga> foundRowsList = Stream.of(groupedOrdini)
|
||||
.filter(x -> x.getMtbAart().getCodMart().equalsIgnoreCase(mtbAart.getCodMart()) &&
|
||||
(x.isHidden() != null && !x.isHidden()) && (x.isTempHidden() != null && !x.isTempHidden()))
|
||||
(x.isHidden() != null && !x.isHidden()) && (x.isTempHidden() != null && !x.isTempHidden()))
|
||||
.toList();
|
||||
|
||||
if(foundRowsList.size() == 0) {
|
||||
if (foundRowsList.size() == 0) {
|
||||
showNoArtFoundDialog();
|
||||
} else if(foundRowsList.size() == 1) {
|
||||
} else if (foundRowsList.size() == 1) {
|
||||
onOrdineRowDispatch(foundRowsList.get(0), ean128Model);
|
||||
} else {
|
||||
for(int i = 0; i < groupedOrdini.size(); i++) {
|
||||
if(!foundRowsList.contains(groupedOrdini.get(i))) {
|
||||
for (int i = 0; i < groupedOrdini.size(); i++) {
|
||||
if (!foundRowsList.contains(groupedOrdini.get(i))) {
|
||||
groupedOrdini.get(i).setTempHidden(true);
|
||||
}
|
||||
}
|
||||
@ -415,7 +416,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
|
||||
AlertDialog dialog = new AlertDialog.Builder(mActivity)
|
||||
.setTitle(mActivity.getText(R.string.action_orderBy))
|
||||
.setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, currentOrderBy.getVal(), (dialog12, which) -> {
|
||||
.setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, currentOrderBy.getVal(), (dialog12, which) -> {
|
||||
currentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.fromInt(which);
|
||||
SettingsManager.i().userSession.defaultOrdinamentoPickingAccettazione = which;
|
||||
})
|
||||
@ -433,7 +434,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
|
||||
mActivity.bindings.accettazioneOrdineInevasoFab.close(true);
|
||||
|
||||
if (progress == null){
|
||||
if (progress == null) {
|
||||
progress = UtilityProgress.createDefaultProgressDialog(mActivity);
|
||||
}
|
||||
|
||||
@ -448,7 +449,8 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
GestSetupRESTConsumer.getValue("PICKING", "SETUP", "DEFAULT_POSIZIONE_COLLI_ACCETTAZIONE", defaultPosAccettazioneDTO -> {
|
||||
|
||||
String defaultPosAccettazione = "";
|
||||
if(defaultPosAccettazioneDTO != null && !UtilityString.isNullOrEmpty(defaultPosAccettazioneDTO.value)) defaultPosAccettazione = defaultPosAccettazioneDTO.value;
|
||||
if (defaultPosAccettazioneDTO != null && !UtilityString.isNullOrEmpty(defaultPosAccettazioneDTO.value))
|
||||
defaultPosAccettazione = defaultPosAccettazioneDTO.value;
|
||||
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
mtbColt
|
||||
@ -458,11 +460,11 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
.setPosizione(defaultPosAccettazione)
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
|
||||
if(customNumCollo != null) {
|
||||
if (customNumCollo != null) {
|
||||
mtbColt.setNumCollo(customNumCollo);
|
||||
}
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(customSerCollo)) {
|
||||
if (!UtilityString.isNullOrEmpty(customSerCollo)) {
|
||||
mtbColt.setSerCollo(customSerCollo);
|
||||
}
|
||||
|
||||
@ -472,7 +474,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
if(codAnags != null && codAnags.size() == 1){
|
||||
if (codAnags != null && codAnags.size() == 1) {
|
||||
mtbColt.setCodAnag(codAnags.get(0));
|
||||
}
|
||||
|
||||
@ -482,7 +484,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
if(rifOrds != null && rifOrds.size() == 1){
|
||||
if (rifOrds != null && rifOrds.size() == 1) {
|
||||
mtbColt.setRifOrd(rifOrds.get(0));
|
||||
}
|
||||
|
||||
@ -492,7 +494,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
if(numDataOrds != null && numDataOrds.size() == 1){
|
||||
if (numDataOrds != null && numDataOrds.size() == 1) {
|
||||
mtbColt.setNumOrd(mOrders.get(0).getNumero());
|
||||
mtbColt.setDataOrd(mOrders.get(0).getData());
|
||||
|
||||
@ -519,9 +521,9 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
|
||||
finalProgress.dismiss();
|
||||
|
||||
FBToast.successToast(mActivity,mActivity.getResources().getString(R.string.data_saved) ,FBToast.LENGTH_SHORT);
|
||||
FBToast.successToast(mActivity, mActivity.getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||
|
||||
if(onComplete != null) onComplete.run();
|
||||
if (onComplete != null) onComplete.run();
|
||||
|
||||
}
|
||||
|
||||
@ -545,7 +547,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
}
|
||||
|
||||
|
||||
private void setULToCurrentContext(MtbColt mtbColt){
|
||||
private void setULToCurrentContext(MtbColt mtbColt) {
|
||||
isFabVisible.set(false);
|
||||
mArticoliInColloBottomSheetViewModel.mtbColt.set(mtbColt);
|
||||
}
|
||||
@ -574,14 +576,14 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
|
||||
@Override
|
||||
public void onColloClosed(Runnable onComplete, boolean shouldPrint) {
|
||||
if(thereIsAnOpenedUL()) {
|
||||
if (thereIsAnOpenedUL()) {
|
||||
|
||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(mActivity);
|
||||
progress.show();
|
||||
|
||||
if(thereIsAnyRowInUL()) {
|
||||
if (thereIsAnyRowInUL()) {
|
||||
updateDataFine(progress, () -> {
|
||||
if(shouldPrint) printCollo(progress, onComplete);
|
||||
if (shouldPrint) printCollo(progress, onComplete);
|
||||
else {
|
||||
postCloseOperations(onComplete);
|
||||
progress.dismiss();
|
||||
@ -592,7 +594,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
}
|
||||
|
||||
} else {
|
||||
if(onComplete != null) onComplete.run();
|
||||
if (onComplete != null) onComplete.run();
|
||||
}
|
||||
|
||||
}
|
||||
@ -621,7 +623,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
private void printCollo(Dialog progress, Runnable onComplete) {
|
||||
MtbColt currentMtbColt = mArticoliInColloBottomSheetViewModel.mtbColt.get();
|
||||
|
||||
if(currentMtbColt.getDisablePrint()){
|
||||
if (currentMtbColt.getDisablePrint()) {
|
||||
postCloseOperations(onComplete);
|
||||
progress.dismiss();
|
||||
return;
|
||||
@ -629,49 +631,49 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
|
||||
PrinterRESTConsumer.getAvailablePrinters(SettingsManager.i().userSession.depo.getCodMdep(), PrinterRESTConsumer.Type.SECONDARIA, value -> {
|
||||
|
||||
if(value.size() > 0) {
|
||||
try{
|
||||
if (value.size() > 0) {
|
||||
try {
|
||||
|
||||
|
||||
ReportManager.getRightReportNameByGestione(GestioneEnum.ACQUISTO, reportName -> {
|
||||
ReportManager.getRightReportNameByGestione(GestioneEnum.ACQUISTO, reportName -> {
|
||||
|
||||
PrinterRESTConsumer.printCollo(
|
||||
value.get(0),
|
||||
currentMtbColt,
|
||||
1, reportName, () -> {
|
||||
PrinterRESTConsumer.printCollo(
|
||||
value.get(0),
|
||||
currentMtbColt,
|
||||
1, reportName, () -> {
|
||||
|
||||
postCloseOperations(onComplete);
|
||||
progress.dismiss();
|
||||
postCloseOperations(onComplete);
|
||||
progress.dismiss();
|
||||
|
||||
}, ex -> {
|
||||
}, ex -> {
|
||||
|
||||
progress.dismiss();
|
||||
String errorMessage = ex.getMessage();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(
|
||||
mActivity,
|
||||
new SpannableString(errorMessage),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
() -> postCloseOperations(onComplete)).show();
|
||||
});
|
||||
progress.dismiss();
|
||||
String errorMessage = ex.getMessage();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(
|
||||
mActivity,
|
||||
new SpannableString(errorMessage),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
() -> postCloseOperations(onComplete)).show();
|
||||
});
|
||||
|
||||
}, ex -> UtilityExceptions.defaultException(mActivity, ex, progress)
|
||||
);
|
||||
} catch (Exception ex){
|
||||
UtilityExceptions.defaultException(mActivity, ex, progress);
|
||||
}
|
||||
} else {
|
||||
resetUL();
|
||||
isFabVisible.set(true);
|
||||
|
||||
progress.dismiss();
|
||||
String errorMessage = "Nessuna stampante configurata";
|
||||
DialogSimpleMessageHelper.makeWarningDialog(mActivity, new SpannableString(errorMessage), null, null).show();
|
||||
);
|
||||
} catch (Exception ex) {
|
||||
UtilityExceptions.defaultException(mActivity, ex, progress);
|
||||
}
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mActivity, ex, progress);
|
||||
});
|
||||
} else {
|
||||
resetUL();
|
||||
isFabVisible.set(true);
|
||||
|
||||
progress.dismiss();
|
||||
String errorMessage = "Nessuna stampante configurata";
|
||||
DialogSimpleMessageHelper.makeWarningDialog(mActivity, new SpannableString(errorMessage), null, null).show();
|
||||
}
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mActivity, ex, progress);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -683,7 +685,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
isFabVisible.set(true);
|
||||
|
||||
progress.dismiss();
|
||||
if(onComplete != null) onComplete.run();
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, ex -> UtilityExceptions.defaultException(mActivity, ex, progress));
|
||||
}
|
||||
|
||||
@ -699,7 +701,6 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void postCloseOperations(Runnable onComplete) {
|
||||
|
||||
MtbColt mtbColt = (MtbColt) getColloRef().clone();
|
||||
@ -708,18 +709,18 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
|
||||
isFabVisible.set(true);
|
||||
|
||||
if(mtbColt != null && mtbColt.getMtbColr() != null) {
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null) {
|
||||
for (int i = 0; i < mtbColt.getMtbColr().size(); i++) {
|
||||
|
||||
MtbColr currentRow = mtbColt.getMtbColr().get(i);
|
||||
|
||||
if(currentRow.getRigaOrd() != null) {
|
||||
if (currentRow.getRigaOrd() != null) {
|
||||
|
||||
for(int k = 0; k < this.groupedOrdini.size(); k++) {
|
||||
for (int k = 0; k < this.groupedOrdini.size(); k++) {
|
||||
|
||||
OrdineAccettazioneDTO.Riga x = this.groupedOrdini.get(k);
|
||||
|
||||
if(x.getQtaDaEvadere().floatValue() > 0 &&
|
||||
if (x.getQtaDaEvadere().floatValue() > 0 &&
|
||||
x.getMtbAart().getCodMart().equalsIgnoreCase(currentRow.getCodMart()) &&
|
||||
x.getCodJcom().equalsIgnoreCase(currentRow.getCodJcom()) &&
|
||||
x.getRigaOrd() == currentRow.getRigaOrd() &&
|
||||
@ -753,13 +754,13 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
removeListFilter();
|
||||
refreshOrderBy(true);
|
||||
|
||||
if(onComplete != null) onComplete.run();
|
||||
if (onComplete != null) onComplete.run();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrdineRowDispatch(final OrdineAccettazioneDTO.Riga item, Ean128Model ean128Model) {
|
||||
if(getColloRef() != null){
|
||||
if (getColloRef() != null) {
|
||||
|
||||
List<MtbColr> currentMtbColrs = getColloRef().getMtbColr();
|
||||
|
||||
@ -777,14 +778,13 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
float qtaEvasa = item.qtaRiservate + qtaEvasaInMtbColr;
|
||||
|
||||
|
||||
|
||||
BigDecimal qtaDaEvadere;
|
||||
|
||||
BigDecimal totalQtaDaEvadere = item.getQtaOrd().subtract(new BigDecimal(qtaEvasa)).subtract(item.getQtaEvasa());
|
||||
|
||||
BigDecimal qtaColliPedana = item.mtbAart.getColliPedana().multiply(item.mtbAart.getQtaCnf());
|
||||
|
||||
if(qtaColliPedana.floatValue() > 0 && qtaColliPedana.compareTo(totalQtaDaEvadere) <= 0) {
|
||||
if (qtaColliPedana.floatValue() > 0 && qtaColliPedana.compareTo(totalQtaDaEvadere) <= 0) {
|
||||
qtaDaEvadere = qtaColliPedana;
|
||||
} else {
|
||||
qtaDaEvadere = totalQtaDaEvadere;
|
||||
@ -799,15 +799,15 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
.setQtaEvasa(new BigDecimal(qtaEvasa))
|
||||
.setCanPartitaMagBeChanged(true);
|
||||
|
||||
if(ean128Model != null){
|
||||
if(!UtilityString.isNullOrEmpty(ean128Model.BatchLot)) {
|
||||
if (ean128Model != null) {
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.BatchLot)) {
|
||||
dto.setBatchLot(ean128Model.BatchLot);
|
||||
}
|
||||
|
||||
try {
|
||||
if(!UtilityString.isNullOrEmpty(ean128Model.BestBefore)){
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.BestBefore)) {
|
||||
dto.setDataScad(UtilityDate.recognizeDate(ean128Model.BestBefore));
|
||||
} else if(!UtilityString.isNullOrEmpty(ean128Model.Expiry)) {
|
||||
} else if (!UtilityString.isNullOrEmpty(ean128Model.Expiry)) {
|
||||
dto.setDataScad(UtilityDate.recognizeDate(ean128Model.Expiry));
|
||||
}
|
||||
|
||||
@ -816,13 +816,13 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
}
|
||||
|
||||
|
||||
if(ean128Model.Count != null && ean128Model.Count > 0) {
|
||||
if (ean128Model.Count != null && ean128Model.Count > 0) {
|
||||
//if(!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
dto.setQtaTot(new BigDecimal(ean128Model.Count));
|
||||
dto.setQtaTot(new BigDecimal(ean128Model.Count));
|
||||
|
||||
if(!item.getMtbAart().isFlagQtaCnfFissa()) {
|
||||
dto.setQtaCnf(new BigDecimal(ean128Model.Count));
|
||||
}
|
||||
if (!item.getMtbAart().isFlagQtaCnfFissa()) {
|
||||
dto.setQtaCnf(new BigDecimal(ean128Model.Count));
|
||||
}
|
||||
//} else {
|
||||
// dto.setQtaTot(new BigDecimal(ean128Model.Count));
|
||||
//}
|
||||
@ -832,7 +832,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
dto.setQtaTot(new BigDecimal(ean128Model.NetWeightKg));
|
||||
}
|
||||
|
||||
if(dto.getQtaTot() != null && dto.getQtaTot().floatValue() > 0 && dto.getNumCnf() != null && dto.getNumCnf() > 0) {
|
||||
if (dto.getQtaTot() != null && dto.getQtaTot().floatValue() > 0 && dto.getNumCnf() != null && dto.getNumCnf() > 0) {
|
||||
dto.setQtaCnf(dto.getQtaTot().divide(new BigDecimal(dto.getNumCnf())));
|
||||
}
|
||||
|
||||
@ -841,11 +841,11 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
dto.setShouldAskDataScad(true);
|
||||
}
|
||||
|
||||
DialogInputQuantity.makeBase(mActivity, dto, true, (quantityDTO, closeLU) -> onOrdineRowDispatched(item, quantityDTO, closeLU), null).show();
|
||||
DialogInputQuantity.makeBase(mActivity, dto, true, (quantityDTO, closeLU) -> onOrdineRowDispatched(item, quantityDTO, closeLU), null).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void onOrdineRowDispatched(OrdineAccettazioneDTO.Riga item, QuantityDTO quantityDTO, boolean closeLU){
|
||||
private void onOrdineRowDispatched(OrdineAccettazioneDTO.Riga item, QuantityDTO quantityDTO, boolean closeLU) {
|
||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(mActivity);
|
||||
|
||||
String gestioneRif = item.getGestioneOrdEnum() == GestioneEnum.PRODUZIONE ? "L" : item.getGestioneOrd();
|
||||
@ -863,7 +863,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
.setCodJcom(item.getCodJcom())
|
||||
.setRigaOrd(item.getRigaOrd());
|
||||
|
||||
if(!item.getMtbAart().isFlagQtaCnfFissa()) {
|
||||
if (!item.getMtbAart().isFlagQtaCnfFissa()) {
|
||||
mtbColr.setQtaCnf(quantityDTO.qtaCnf.getBigDecimal());
|
||||
}
|
||||
|
||||
@ -896,7 +896,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
FBToast.successToast(mActivity, mActivity.getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||
progress.dismiss();
|
||||
|
||||
if(closeLU) onColloClosed(null, true);
|
||||
if (closeLU) onColloClosed(null, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -908,7 +908,6 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
}
|
||||
|
||||
|
||||
|
||||
private MtbColt getColloRef() {
|
||||
return mArticoliInColloBottomSheetViewModel.mtbColt.get();
|
||||
}
|
||||
@ -919,33 +918,37 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
|
||||
private void onRowEdited(MtbColr oldValue, MtbColr newValue) {
|
||||
|
||||
if(getColloRef() != null) {
|
||||
|
||||
Dialog progress = UtilityProgress.createDefaultProgressDialog(mActivity);
|
||||
|
||||
MtbColr mtbColrToEditOfAccettazione = Stream.of(getColloRef().getMtbColr())
|
||||
.filter(x -> x.getQtaCol().compareTo(oldValue.getQtaCol()) == 0 &&
|
||||
x.getCodMart().equalsIgnoreCase(oldValue.getCodMart()) &&
|
||||
x.getPartitaMag().equalsIgnoreCase(oldValue.getPartitaMag()) &&
|
||||
x.getCodJcom().equalsIgnoreCase(oldValue.getCodJcom()))
|
||||
.findFirst()
|
||||
.get();
|
||||
|
||||
mtbColrToEditOfAccettazione
|
||||
.setQtaCol(newValue.getQtaCol());
|
||||
|
||||
ColliMagazzinoRESTConsumer.updateRiga(mtbColrToEditOfAccettazione, () -> {
|
||||
progress.dismiss();
|
||||
this.refreshOrderBy(false);
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mActivity, ex, progress);
|
||||
this.refreshOrderBy(false);
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
// if (getColloRef() != null) {
|
||||
//
|
||||
// Dialog progress = UtilityProgress.createDefaultProgressDialog(mActivity);
|
||||
//
|
||||
// Optional<MtbColr> optionalMtbColrToEditOfAccettazione = Stream.of(getColloRef().getMtbColr())
|
||||
// .filter(x -> UtilityBigDecimal.equalsTo(x.getQtaCol(), oldValue.getQtaCol()) &&
|
||||
// UtilityString.equalsIgnoreCase(x.getCodMart(), oldValue.getCodMart()) &&
|
||||
// UtilityString.equalsIgnoreCase(x.getPartitaMag(), oldValue.getPartitaMag()) &&
|
||||
// UtilityString.equalsIgnoreCase(x.getCodJcom(), oldValue.getCodJcom()))
|
||||
// .findFirst();
|
||||
//
|
||||
// if(optionalMtbColrToEditOfAccettazione.isPresent()) {
|
||||
// MtbColr mtbColrToEditOfAccettazione = optionalMtbColrToEditOfAccettazione.get();
|
||||
//
|
||||
// mtbColrToEditOfAccettazione
|
||||
// .setQtaCol(newValue.getQtaCol());
|
||||
//
|
||||
// ColliMagazzinoRESTConsumer.updateRiga(mtbColrToEditOfAccettazione, () -> {
|
||||
// progress.dismiss();
|
||||
// this.refreshOrderBy(false);
|
||||
// }, ex -> {
|
||||
// UtilityExceptions.defaultException(mActivity, ex, progress);
|
||||
// this.refreshOrderBy(false);
|
||||
// });
|
||||
//
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
//
|
||||
this.refreshOrderBy(false);
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -975,7 +978,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
|
||||
// } else {
|
||||
|
||||
this.refreshOrderBy(false);
|
||||
this.refreshOrderBy(false);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user