Fix su codMdep non ricevuto nel caso di picking Extra Item in Spedizione
This commit is contained in:
parent
1c63908b3b
commit
4861c689d7
@ -192,6 +192,8 @@ dependencies {
|
||||
|
||||
//Barcode generator
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||
|
||||
implementation("org.javatuples:javatuples:1.2")
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@ -739,12 +739,12 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
public void addExtraItem() {
|
||||
handler.post(() -> {
|
||||
DialogScanArtView
|
||||
.newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, mtbColr) -> {
|
||||
.newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, mtbColt) -> {
|
||||
if (status == DialogConsts.Results.YES) {
|
||||
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColr);
|
||||
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColt);
|
||||
} catch (Exception e) {
|
||||
onError(e);
|
||||
}
|
||||
|
||||
@ -1224,7 +1224,7 @@ public class SpedizioneViewModel {
|
||||
return !stati.isEmpty() ? stati.get(0) : null;
|
||||
}
|
||||
|
||||
public void dispatchExtraItem(MtbAart mtbAart, Ean128Model ean128Model, MtbColr mtbColrToUse) throws Exception {
|
||||
public void dispatchExtraItem(MtbAart mtbAart, Ean128Model ean128Model, MtbColt refMtbColt) throws Exception {
|
||||
|
||||
PickingObjectDTO pickingObjectDTO = new PickingObjectDTO().setMtbAart(mtbAart).setTempPickData(PickDataDTO.fromEan128(ean128Model));
|
||||
|
||||
@ -1243,12 +1243,23 @@ public class SpedizioneViewModel {
|
||||
String partitaMag = null;
|
||||
LocalDate dataScad = null;
|
||||
|
||||
MtbColt refMtbColt = null;
|
||||
// MtbColt refMtbColt = null;
|
||||
|
||||
if (mtbColrToUse != null) {
|
||||
refMtbColt = new MtbColt().setDataCollo(mtbColrToUse.getDataColloD()).setSerCollo(mtbColrToUse.getSerCollo()).setNumCollo(mtbColrToUse.getNumCollo()).setGestione(mtbColrToUse.getGestione()).setMtbColr(new ObservableArrayList<>());
|
||||
if (refMtbColt != null && refMtbColt.getMtbColr() != null && !refMtbColt.getMtbColr().isEmpty()) {
|
||||
MtbColr mtbColrToUse = refMtbColt.getMtbColr().get(0);
|
||||
|
||||
refMtbColt.getMtbColr().add(mtbColrToUse);
|
||||
//Se il collo di riferimento non ha righe, lo creo al volo
|
||||
// refMtbColt = new MtbColt()
|
||||
// .setDataCollo(mtbColrToUse.getDataColloD())
|
||||
// .setSerCollo(mtbColrToUse.getSerCollo())
|
||||
// .setNumCollo(mtbColrToUse.getNumCollo())
|
||||
// .setGestione(mtbColrToUse.getGestione())
|
||||
//// .setCodMdep(mtbColrToUse.getCodMdepIn())
|
||||
//// .setPosizione(mtbColrToUse.getPosizioneIn())
|
||||
//// .setBarcodeUl(mtbColrToUse.getBarcodeUlIn())
|
||||
// .setMtbColr(new ObservableArrayList<>());
|
||||
//
|
||||
// refMtbColt.getMtbColr().add(mtbColrToUse);
|
||||
|
||||
pickingObjectDTO.setMtbAart(mtbColrToUse.getMtbAart()).setTempPickData(new PickDataDTO().setSourceMtbColt(refMtbColt));
|
||||
|
||||
|
||||
@ -4,15 +4,19 @@ import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import org.javatuples.Quartet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -27,6 +31,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgssss;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.databinding.DialogScanArtBinding;
|
||||
@ -38,6 +43,9 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
@Inject
|
||||
DialogScanArtViewModel mViewModel;
|
||||
|
||||
@Inject
|
||||
Handler handler;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private final boolean mForceOnlyUL;
|
||||
@ -46,15 +54,15 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
|
||||
private int mBarcodeScannerInstanceID;
|
||||
|
||||
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onPickingCompleted = null;
|
||||
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onPickingCompleted = null;
|
||||
private RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest = null;
|
||||
|
||||
|
||||
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||
return new DialogScanArtView(forceOnlyUL, onPickingCompleted, onMagazzinoAutomaticoPickingRequest);
|
||||
}
|
||||
|
||||
private DialogScanArtView(boolean forceOnlyUL, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onItemChoosed, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||
private DialogScanArtView(boolean forceOnlyUL, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onItemChoosed, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||
super();
|
||||
|
||||
mForceOnlyUL = forceOnlyUL;
|
||||
@ -122,9 +130,25 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, (status, mtbAart, ean128Model, mtbColrList) -> {
|
||||
executorService.execute(() -> {
|
||||
|
||||
var filteredMtbColrList = mtbColrList;
|
||||
try {
|
||||
|
||||
Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> result = this.mViewModel.processBarcodeDTO(data, pickMagazzinoAutomaticoPosizione -> {
|
||||
handler.post(() -> {
|
||||
this.onMagazzinoAutomaticoPickingRequest.run(pickMagazzinoAutomaticoPosizione);
|
||||
|
||||
this.onLoadingEnded();
|
||||
dismiss();
|
||||
});
|
||||
});
|
||||
|
||||
var status = result.getValue0();
|
||||
var mtbAart = result.getValue1();
|
||||
var ean128Model = result.getValue2();
|
||||
var mtbColt = result.getValue3();
|
||||
|
||||
List<MtbColr> filteredMtbColrList = mtbColt.getMtbColr();
|
||||
|
||||
if (mtbAart != null && filteredMtbColrList != null) {
|
||||
filteredMtbColrList = filteredMtbColrList.stream()
|
||||
@ -132,13 +156,21 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
if (filteredMtbColrList != null && filteredMtbColrList.size() > 1) {
|
||||
DialogChooseArtFromListaMtbColrView.make(getActivity(), filteredMtbColrList, mtbColrChose -> {
|
||||
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColrChose);
|
||||
|
||||
List<MtbColr> finalFilteredMtbColrList = filteredMtbColrList;
|
||||
handler.post(() -> {
|
||||
if (finalFilteredMtbColrList != null && finalFilteredMtbColrList.size() > 1) {
|
||||
DialogChooseArtFromListaMtbColrView.make(getActivity(), finalFilteredMtbColrList, mtbColrChose -> {
|
||||
|
||||
mtbColt.setMtbColr(new ObservableArrayList<>());
|
||||
mtbColt.getMtbColr().add(mtbColrChose);
|
||||
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColt);
|
||||
}).show();
|
||||
|
||||
} else if (filteredMtbColrList != null && filteredMtbColrList.size() == 1) {
|
||||
onPickingCompleted.run(status, mtbAart, ean128Model, filteredMtbColrList.get(0));
|
||||
} else if (finalFilteredMtbColrList != null && finalFilteredMtbColrList.size() == 1) {
|
||||
mtbColt.setMtbColr(new ObservableArrayList<>());
|
||||
mtbColt.getMtbColr().add(finalFilteredMtbColrList.get(0));
|
||||
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColt);
|
||||
|
||||
} else {
|
||||
onPickingCompleted.run(status, mtbAart, ean128Model, null);
|
||||
@ -148,11 +180,10 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
this.onLoadingEnded();
|
||||
|
||||
dismiss();
|
||||
}, pickMagazzinoAutomaticoPosizione -> {
|
||||
this.onMagazzinoAutomaticoPickingRequest.run(pickMagazzinoAutomaticoPosizione);
|
||||
|
||||
this.onLoadingEnded();
|
||||
dismiss();
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
onError(ex);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,22 +1,17 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.scan_art;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.javatuples.Quartet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.exception.EmptyLUException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
import it.integry.integrywmsnative.core.exception.ScannedPositionNotExistException;
|
||||
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgssss;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
@ -62,23 +57,23 @@ public class DialogScanArtViewModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||
public Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
|
||||
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
|
||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onPickingCompleted);
|
||||
return this.executeEtichettaLU(barcodeScanDTO.getStringValue());
|
||||
|
||||
} else if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
||||
//Cerco l'UL presente all'interno della posizione
|
||||
this.executeEtichettaPosizione(barcodeScanDTO.getStringValue(), onPickingCompleted, onMagazzinoAutomaticoPickingRequest);
|
||||
return this.executeEtichettaPosizione(barcodeScanDTO.getStringValue(), onMagazzinoAutomaticoPickingRequest);
|
||||
|
||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
this.executeEtichettaEan128(barcodeScanDTO, onPickingCompleted);
|
||||
return this.executeEtichettaEan128(barcodeScanDTO);
|
||||
|
||||
} else if (UtilityBarcode.isEanPeso(barcodeScanDTO) && !mForceOnlyUL) {
|
||||
this.executeEtichettaEanPeso(barcodeScanDTO, onPickingCompleted);
|
||||
return this.executeEtichettaEanPeso(barcodeScanDTO);
|
||||
|
||||
} else {
|
||||
this.loadArticolo(barcodeScanDTO.getStringValue(), null, onPickingCompleted);
|
||||
return this.loadArticolo(barcodeScanDTO.getStringValue(), null);
|
||||
|
||||
}
|
||||
// else {
|
||||
@ -87,9 +82,9 @@ public class DialogScanArtViewModel {
|
||||
}
|
||||
|
||||
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
var ean128Model = this.mBarcodeRESTConsumer.decodeEan128Synchronized(barcodeScanDTO);
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
String barcodeProd = null;
|
||||
|
||||
@ -100,109 +95,94 @@ public class DialogScanArtViewModel {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
this.executeEtichettaLU(ean128Model.Sscc, onComplete);
|
||||
} else if (!mForceOnlyUL) {
|
||||
return this.executeEtichettaLU(ean128Model.Sscc);
|
||||
|
||||
} else if (!mForceOnlyUL) {
|
||||
return this.loadArticolo(barcodeProd, ean128Model);
|
||||
|
||||
this.loadArticolo(barcodeProd, ean128Model, onComplete);
|
||||
} else {
|
||||
this.sendError(new Exception("Barcode non valido"));
|
||||
throw new Exception("Barcode non valido");
|
||||
}
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
this.sendError(new NoResultFromBarcodeException(barcodeProd));
|
||||
throw new NoResultFromBarcodeException(barcodeProd);
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
||||
|
||||
try {
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
Ean13PesoModel ean13PesoModel = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
|
||||
|
||||
this.loadArticolo(ean13PesoModel.getPrecode(), ean13PesoModel.toEan128(), onComplete);
|
||||
} catch (Exception ex) {
|
||||
this.sendError(ex);
|
||||
}
|
||||
return this.loadArticolo(ean13PesoModel.getPrecode(), ean13PesoModel.toEan128());
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaLU(String SSCC, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
||||
mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaLU(String SSCC) throws Exception {
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
|
||||
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
if (mtbColt.getSegno() != -1) {
|
||||
onComplete.run(DialogConsts.Results.YES, null, null, mtbColt.getMtbColr());
|
||||
} else this.sendError(new InvalidLUException());
|
||||
} else {
|
||||
this.sendError(new EmptyLUException());
|
||||
}
|
||||
if (mtbColt == null || mtbColt.getMtbColr() == null || mtbColt.getMtbColr().isEmpty())
|
||||
throw new NoLUFoundException();
|
||||
|
||||
if (mtbColt.getSegno() == -1) throw new InvalidLUException();
|
||||
|
||||
return new Quartet<>(DialogConsts.Results.YES, null, null, mtbColt);
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void executeEtichettaPosizione(String stringValue, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaPosizione(String stringValue, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
|
||||
MtbDepoPosizione foundPosizione = SettingsManager.iDB().getAvailablePosizioni().stream()
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(stringValue))
|
||||
.single();
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (foundPosizione == null) {
|
||||
if (foundPosizione == null)
|
||||
//Nessuna posizione trovata con questo barcode
|
||||
this.sendError(new ScannedPositionNotExistException());
|
||||
return;
|
||||
}
|
||||
throw new ScannedPositionNotExistException();
|
||||
|
||||
|
||||
if (foundPosizione.isMagazzinoAutomatico()) {
|
||||
//Eseguo picking da magazzino automatico
|
||||
onMagazzinoAutomaticoPickingRequest.run(foundPosizione);
|
||||
} else {
|
||||
this.executePosizione(foundPosizione, null, onComplete);
|
||||
}
|
||||
return this.executePosizione(foundPosizione, null);
|
||||
}
|
||||
|
||||
private void executePosizione(MtbDepoPosizione posizione, MtbAart articolo, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(posizione, mtbColtList -> {
|
||||
|
||||
if (mtbColtList == null || mtbColtList.isEmpty()) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
||||
onComplete.run(DialogConsts.Results.YES, articolo, null, mtbColt.getMtbColr());
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||
return null;
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executePosizione(MtbDepoPosizione posizione, MtbAart articolo) throws Exception {
|
||||
var mtbColtList = this.mPosizioniRESTConsumer.getBancaliInPosizioneSynchronized(posizione);
|
||||
|
||||
if (mtbColtList == null || mtbColtList.isEmpty())
|
||||
throw new NoLUFoundException();
|
||||
|
||||
if (mtbColtList.size() != 1) {
|
||||
throw new TooManyLUFoundInMonoLUPositionException();
|
||||
}
|
||||
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getByTestataSynchronized(mtbColtList.get(0), true, false);
|
||||
return new Quartet<>(DialogConsts.Results.YES, articolo, null, mtbColt);
|
||||
}
|
||||
|
||||
|
||||
private void loadArticolo(@NotNull String barcodeProd, Ean128Model ean128Model, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
||||
this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
|
||||
if (mtbAartList != null && !mtbAartList.isEmpty()) {
|
||||
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> loadArticolo(@NotNull String barcodeProd, Ean128Model ean128Model) throws Exception {
|
||||
var mtbAartList = this.mArticoloRESTConsumer.searchByBarcodeSynchronized(barcodeProd);
|
||||
|
||||
if (mtbAartList == null || mtbAartList.isEmpty())
|
||||
throw new NoResultFromBarcodeException(barcodeProd);
|
||||
|
||||
MtbAart firstArt = mtbAartList.get(0);
|
||||
MtbDepoPosizione firstArtPosition = UtilityPosizione.getFromCache(firstArt.getPosizione());
|
||||
|
||||
if (firstArtPosition != null && firstArtPosition.isFlagMonoCollo() && mForceOnlyUL) {
|
||||
this.executePosizione(firstArtPosition, firstArt, onComplete);
|
||||
} else if (!mForceOnlyUL) {
|
||||
onComplete.run(DialogConsts.Results.YES, mtbAartList.get(0), ean128Model, null);
|
||||
} else {
|
||||
this.sendError(new NoResultFromBarcodeException(barcodeProd));
|
||||
if (firstArtPosition != null && firstArtPosition.isFlagMonoCollo() && mForceOnlyUL)
|
||||
return this.executePosizione(firstArtPosition, firstArt);
|
||||
|
||||
if (!mForceOnlyUL)
|
||||
return new Quartet<>(DialogConsts.Results.YES, mtbAartList.get(0), ean128Model, null);
|
||||
|
||||
throw new NoResultFromBarcodeException(barcodeProd);
|
||||
}
|
||||
|
||||
} else {
|
||||
this.sendError(new NoResultFromBarcodeException(barcodeProd));
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
private void sendError(Exception ex) {
|
||||
if (this.mListener != null) mListener.onError(ex);
|
||||
}
|
||||
|
||||
public void setListener(Listener listener) {
|
||||
this.mListener = listener;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user