Fix su ean peso in DialogInputQuantity
This commit is contained in:
parent
b00cd1f097
commit
497bc54ebd
@ -70,7 +70,7 @@ public class DialogInputQuantityV2ViewModel {
|
||||
}
|
||||
|
||||
public void init() {
|
||||
if(this.initialNumCnf != null && this.initialQtaTot != null && this.initialQtaCnf != null) {
|
||||
if (this.initialNumCnf != null && this.initialQtaTot != null && this.initialQtaCnf != null) {
|
||||
this.internalNumCnf = this.initialNumCnf;
|
||||
this.internalQtaCnf = this.initialQtaCnf;
|
||||
this.internalQtaTot = this.initialQtaTot;
|
||||
@ -102,7 +102,7 @@ public class DialogInputQuantityV2ViewModel {
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
if(UtilityBarcode.isEanPeso(barcodeScanDTO)) {
|
||||
if (UtilityBarcode.isEanPeso(barcodeScanDTO)) {
|
||||
Ean13PesoModel ean13PesoModel;
|
||||
|
||||
try {
|
||||
@ -113,34 +113,36 @@ public class DialogInputQuantityV2ViewModel {
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.mtbAart.get() != null && this.mtbAart.get().getBarCode() != null && ean13PesoModel.getPrecode().contains(this.mtbAart.get().getBarCode())) {
|
||||
if (this.mtbAart.get() != null &&
|
||||
this.mtbAart.get().getBarCode() != null &&
|
||||
(ean13PesoModel.getPrecode().contains(this.mtbAart.get().getBarCode()) || this.mtbAart.get().getBarCode().contains(ean13PesoModel.getPrecode()))) {
|
||||
this.setQtaTot(BigDecimal.valueOf(ean13PesoModel.getPeso()));
|
||||
}
|
||||
|
||||
onComplete.run();
|
||||
} else if(UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
if(ean128Model == null) {
|
||||
if (ean128Model == null) {
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(ean128Model.BatchLot)) {
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.BatchLot)) {
|
||||
this.setPartitaMag(ean128Model.BatchLot);
|
||||
}
|
||||
|
||||
try {
|
||||
if(!UtilityString.isNullOrEmpty(ean128Model.BestBefore)){
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.BestBefore)) {
|
||||
this.setDataScad(UtilityDate.recognizeDate(ean128Model.BestBefore));
|
||||
} else if(!UtilityString.isNullOrEmpty(ean128Model.Expiry)) {
|
||||
} else if (!UtilityString.isNullOrEmpty(ean128Model.Expiry)) {
|
||||
this.setDataScad(UtilityDate.recognizeDate(ean128Model.Expiry));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
this.mListener.onError(ex);
|
||||
}
|
||||
|
||||
if(ean128Model.Count != null && ean128Model.Count > 0) {
|
||||
if (ean128Model.Count != null && ean128Model.Count > 0) {
|
||||
this.setNumCnf(BigDecimal.valueOf(ean128Model.Count));
|
||||
} else if (ean128Model.NetWeightKg != null && ean128Model.NetWeightKg > 0) {
|
||||
this.setQtaTot(BigDecimal.valueOf(ean128Model.NetWeightKg));
|
||||
@ -321,7 +323,7 @@ public class DialogInputQuantityV2ViewModel {
|
||||
}
|
||||
|
||||
public boolean validate() {
|
||||
if(this.internalQtaCnf == null || UtilityBigDecimal.equalsTo(this.internalQtaCnf, BigDecimal.ZERO)) {
|
||||
if (this.internalQtaCnf == null || UtilityBigDecimal.equalsTo(this.internalQtaCnf, BigDecimal.ZERO)) {
|
||||
|
||||
this.mListener.onError(new InvalidQtaCnfQuantityException());
|
||||
return false;
|
||||
@ -342,7 +344,7 @@ public class DialogInputQuantityV2ViewModel {
|
||||
return false;
|
||||
|
||||
} else if (!this.canOverflowOrderQuantity && UtilityBigDecimal.greaterThan(this.internalQtaTot, this.totalQtaOrd) &&
|
||||
this.mtbAart.get().isFlagQtaCnfFissaBoolean()) {
|
||||
this.mtbAart.get().isFlagQtaCnfFissaBoolean()) {
|
||||
|
||||
this.mListener.onError(new OverflowQtaTotOrderedQuantityException());
|
||||
return false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user