Iniziata migrazione del nuovo versamento materiali

This commit is contained in:
Giuseppe Scorrano 2025-04-09 09:29:44 +02:00
parent 1e9d048264
commit af64ca04f9
9 changed files with 321 additions and 107 deletions

View File

@ -66,6 +66,8 @@ public class MtbColt extends EntityBase {
private BigDecimal altezzaCm;
private String codJcom;
private String barcodeUl;
private final transient MutableLiveData<ObservableMtbTcol> mtbTCol = new MutableLiveData<>();
private Boolean disablePrint;
@ -544,6 +546,15 @@ public class MtbColt extends EntityBase {
return this;
}
public String getBarcodeUl() {
return barcodeUl;
}
public MtbColt setBarcodeUl(String barcodeUl) {
this.barcodeUl = barcodeUl;
return this;
}
public ObservableMtbTcol getMtbTCol() {
return mtbTCol.getValue();
}

View File

@ -114,8 +114,19 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
return this.mEntityRESTConsumer.processEntityListSynchronized(mtbColtsToSave, true, MtbColt.class);
}
public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var mtbColt = createColloScaricoDaCaricoSynchronized(sourceMtbColt, posizione);
if (onComplete != null) onComplete.run(mtbColt);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public MtbColt createColloScaricoDaCaricoSynchronized(MtbColt sourceMtbColt, MtbDepoPosizione posizione) throws Exception {
MtbColt newMtbColt = new MtbColt()
.initDefaultFields(GestioneEnum.LAVORAZIONE)
@ -164,7 +175,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
saveCollo(newMtbColt, onComplete, onFailed);
return saveColloSynchronized(newMtbColt);
}

View File

@ -8,6 +8,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiRequestDTO;
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiRequestDTO;
@Singleton
public class MaterialiRESTConsumer extends _BaseRESTConsumer {
@ -43,4 +44,27 @@ public class MaterialiRESTConsumer extends _BaseRESTConsumer {
});
}
public void makeSynchronousVersaRequest(VersaMaterialiRequestDTO request) throws Exception {
var materialiRESTConsumerService = restBuilder.getService(MaterialiRESTConsumerService.class);
var response = materialiRESTConsumerService.versa(request)
.execute();
var data = analyzeAnswer(response, "versaMateriali");
// if (data == null) return null;
// return data.getUpdatedMtbColtScarico();
}
public void makeVersaRequest(VersaMaterialiRequestDTO request, final Runnable onComplete, final RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
makeSynchronousVersaRequest(request);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
}

View File

@ -3,12 +3,16 @@ package it.integry.integrywmsnative.core.rest.consumers;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiRequestDTO;
import it.integry.integrywmsnative.core.rest.model.materiali.RecuperaMaterialiResponseDTO;
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiRequestDTO;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
public interface MaterialiRESTConsumerService {
@POST("wms/materiali/versa")
Call<ServiceRESTResponse<RecuperaMaterialiResponseDTO>> versa(@Body VersaMaterialiRequestDTO request);
@POST("wms/materiali/recupera")
Call<ServiceRESTResponse<RecuperaMaterialiResponseDTO>> recupera(@Body RecuperaMaterialiRequestDTO request);

View File

@ -0,0 +1,110 @@
package it.integry.integrywmsnative.core.rest.model.materiali;
import java.math.BigDecimal;
import java.time.LocalDate;
public class VersaMaterialiRequestDTO {
private String codMart;
private String partitaMag;
private BigDecimal numCnf;
private BigDecimal qtaCnf;
private BigDecimal qtaTot;
private Integer numCollo;
private LocalDate dataCollo;
private String gestione;
private String serCollo;
private String barcodeUl;
public String getCodMart() {
return codMart;
}
public VersaMaterialiRequestDTO setCodMart(String codMart) {
this.codMart = codMart;
return this;
}
public String getPartitaMag() {
return partitaMag;
}
public VersaMaterialiRequestDTO setPartitaMag(String partitaMag) {
this.partitaMag = partitaMag;
return this;
}
public BigDecimal getNumCnf() {
return numCnf;
}
public VersaMaterialiRequestDTO setNumCnf(BigDecimal numCnf) {
this.numCnf = numCnf;
return this;
}
public BigDecimal getQtaCnf() {
return qtaCnf;
}
public VersaMaterialiRequestDTO setQtaCnf(BigDecimal qtaCnf) {
this.qtaCnf = qtaCnf;
return this;
}
public BigDecimal getQtaTot() {
return qtaTot;
}
public VersaMaterialiRequestDTO setQtaTot(BigDecimal qtaTot) {
this.qtaTot = qtaTot;
return this;
}
public Integer getNumCollo() {
return numCollo;
}
public VersaMaterialiRequestDTO setNumCollo(Integer numCollo) {
this.numCollo = numCollo;
return this;
}
public LocalDate getDataCollo() {
return dataCollo;
}
public VersaMaterialiRequestDTO setDataCollo(LocalDate dataCollo) {
this.dataCollo = dataCollo;
return this;
}
public String getGestione() {
return gestione;
}
public VersaMaterialiRequestDTO setGestione(String gestione) {
this.gestione = gestione;
return this;
}
public String getSerCollo() {
return serCollo;
}
public VersaMaterialiRequestDTO setSerCollo(String serCollo) {
this.serCollo = serCollo;
return this;
}
public String getBarcodeUl() {
return barcodeUl;
}
public VersaMaterialiRequestDTO setBarcodeUl(String barcodeUl) {
this.barcodeUl = barcodeUl;
return this;
}
}

View File

@ -0,0 +1,4 @@
package it.integry.integrywmsnative.core.rest.model.materiali;
public class VersaMaterialiResponseDTO {
}

View File

@ -23,6 +23,7 @@ import java.util.List;
import javax.inject.Inject;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.integrywmsnative.MainApplication;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
@ -194,12 +195,26 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
private void initBarcodeReader() {
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(mViewModel::processBarcodeDTO)
.setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(this::onError));
BarcodeManager.enable(mBarcodeScannerInstanceID);
}
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
this.onLoadingStarted();
executorService.execute(() -> {
try {
this.mViewModel.processBarcodeDTO(data);
} catch (Exception e) {
onError(e);
}
});
this.onLoadingEnded();
};
// private void openLU() {
// DialogScanOrCreateLUView.newInstance(false, false, true, false, true, (mtbColt, created) -> {
// if (mtbColt == null) {
@ -223,13 +238,14 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
// }).show(requireActivity().getSupportFragmentManager(), "tag");
// }
private void choosePosition(RunnableArgs<MtbDepoPosizione> onComplete) {
private void choosePosition(RunnableArgss<Boolean, MtbDepoPosizione> onComplete) {
DialogAskPositionOfLUView.newInstance(false, (status, mtbDepoPosizione) -> {
if (status == DialogConsts.Results.ABORT) {
onComplete.run(false, null);
popMe();
} else {
onComplete.run(mtbDepoPosizione);
onComplete.run(true, mtbDepoPosizione);
}
})
@ -359,7 +375,7 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
}
@Override
public void onRequestChoosePosition(RunnableArgs<MtbDepoPosizione> onComplete) {
public void onRequestChoosePosition(RunnableArgss<Boolean, MtbDepoPosizione> onComplete) {
choosePosition(onComplete);
}

View File

@ -6,6 +6,7 @@ import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MaterialiRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
@ -18,8 +19,9 @@ public class ProdVersamentoMaterialeModule {
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
MesRESTConsumer mesRESTConsumer,
BarcodeRESTConsumer barcodeRESTConsumer,
ArticoloRESTConsumer articoloRESTConsumer) {
return new ProdVersamentoMaterialeViewModel(posizioniRESTConsumer, colliMagazzinoRESTConsumer, colliLavorazioneRESTConsumer, mesRESTConsumer, barcodeRESTConsumer, articoloRESTConsumer);
ArticoloRESTConsumer articoloRESTConsumer,
MaterialiRESTConsumer materialiRESTConsumer) {
return new ProdVersamentoMaterialeViewModel(posizioniRESTConsumer, colliMagazzinoRESTConsumer, colliLavorazioneRESTConsumer, mesRESTConsumer, barcodeRESTConsumer, articoloRESTConsumer, materialiRESTConsumer);
}
}

View File

@ -1,8 +1,8 @@
package it.integry.integrywmsnative.gest.prod_versamento_materiale;
import androidx.lifecycle.MutableLiveData;
import android.util.Pair;
import com.annimon.stream.Stream;
import androidx.lifecycle.MutableLiveData;
import org.jetbrains.annotations.NotNull;
@ -10,6 +10,8 @@ import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;
import javax.inject.Inject;
@ -18,7 +20,6 @@ import it.integry.integrywmsnative.core.exception.InvalidCodMdepException;
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
import it.integry.integrywmsnative.core.model.MtbAart;
@ -30,6 +31,7 @@ import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MaterialiRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
@ -50,6 +52,7 @@ public class ProdVersamentoMaterialeViewModel {
private final MesRESTConsumer mMesRESTConsumer;
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
private final ArticoloRESTConsumer mArticoloRESTConsumer;
private final MaterialiRESTConsumer mMaterialiRESTConsumer;
private boolean mFlagVersamentoDirettoProduzione;
@ -66,13 +69,15 @@ public class ProdVersamentoMaterialeViewModel {
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
MesRESTConsumer mesRESTConsumer,
BarcodeRESTConsumer barcodeRESTConsumer,
ArticoloRESTConsumer articoloRESTConsumer) {
ArticoloRESTConsumer articoloRESTConsumer,
MaterialiRESTConsumer mMaterialiRESTConsumer) {
this.mPosizioniRESTConsumer = posizioniRESTConsumer;
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
this.mColliLavorazioneRESTConsumer = colliLavorazioneRESTConsumer;
this.mMesRESTConsumer = mesRESTConsumer;
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
this.mArticoloRESTConsumer = articoloRESTConsumer;
this.mMaterialiRESTConsumer = mMaterialiRESTConsumer;
}
@ -81,7 +86,7 @@ public class ProdVersamentoMaterialeViewModel {
}
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) {
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception {
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
this.executeEtichettaPosizione(barcodeScanDTO);
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
@ -94,93 +99,91 @@ public class ProdVersamentoMaterialeViewModel {
}
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO) {
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO) throws Exception {
MtbDepoPosizione foundPosizione = SettingsManager.iDB().getAvailablePosizioni().stream()
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
.single();
.findFirst()
.orElse(null);
this.executePosizione(foundPosizione);
}
private void executePosizione(MtbDepoPosizione posizione) {
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 -> {
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
this.onLUOpened(mtbColt);
} else this.sendError(new InvalidCodMdepException());
}, this::sendError);
} else {
this.sendError(new TooManyLUFoundInMonoLUPositionException());
}
}, this::sendError);
}
private void executePosizione(MtbDepoPosizione posizione) throws Exception {
var mtbColtList = this.mPosizioniRESTConsumer.getBancaliInPosizioneSynchronized(posizione);
private void executeEtichettaLU(String sscc) {
this.mColliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, mtbColt -> {
if (mtbColtList == null || mtbColtList.isEmpty()) {
this.sendError(new NoLUFoundException());
} else if (mtbColtList.size() == 1) {
var mtbColt = this.mColliMagazzinoRESTConsumer.getByTestataSynchronized(mtbColtList.get(0), true, false);
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
boolean codMdepIsValid = SettingsManager.iDB().getAvailableCodMdep().stream()
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (codMdepIsValid) {
this.onLUOpened(mtbColt);
} else this.sendError(new InvalidCodMdepException());
} else
throw new InvalidCodMdepException();
}, this::sendError);
} else
throw new TooManyLUFoundInMonoLUPositionException();
}
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) {
mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
private void executeEtichettaLU(String sscc) throws Exception {
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
String barcodeProd = null;
boolean codMdepIsValid = SettingsManager.iDB().getAvailableCodMdep().stream()
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
barcodeProd = ean128Model.Content;
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
this.executeEtichettaLU(ean128Model.Sscc);
} else if (!UtilityString.isNullOrEmpty(barcodeProd)) {
this.loadArticolo(barcodeProd, ean128Model);
} else {
this.sendError(new NoLUFoundException());
}
} else {
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
this.sendError(new NoLUFoundException());
}
}, this::sendError);
if (codMdepIsValid) {
this.onLUOpened(mtbColt);
} else
throw new InvalidCodMdepException();
}
private void loadArticolo(String barcodeProd, Ean128Model ean128Model) {
mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
if (mtbAartList != null && !mtbAartList.isEmpty()) {
MtbAart articolo = mtbAartList.get(0);
this.dispatchArt(articolo, ean128Model);
} else {
this.sendError(new NoResultFromBarcodeException(barcodeProd));
}
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) throws Exception {
var ean128Model = mBarcodeRESTConsumer.decodeEan128Synchronized(barcodeScanDTO);
String barcodeProd = null;
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
barcodeProd = ean128Model.Content;
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
this.executeEtichettaLU(ean128Model.Sscc);
} else if (!UtilityString.isNullOrEmpty(barcodeProd)) {
this.loadArticolo(barcodeProd, ean128Model);
} else
throw new NoLUFoundException();
} else
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
throw new NoLUFoundException();
}
private void loadArticolo(String barcodeProd, Ean128Model ean128Model) throws Exception {
var mtbAartList = mArticoloRESTConsumer.searchByBarcodeSynchronized(barcodeProd);
if (mtbAartList != null && !mtbAartList.isEmpty()) {
MtbAart articolo = mtbAartList.get(0);
this.dispatchArt(articolo, ean128Model);
} else {
throw new NoResultFromBarcodeException(barcodeProd);
}
}, this::sendError);
}
@ -261,8 +264,6 @@ public class ProdVersamentoMaterialeViewModel {
}
this.sendOnItemDispatched(
pickingObjectDTO,
mtbAart,
@ -281,39 +282,58 @@ public class ProdVersamentoMaterialeViewModel {
true,
(pickedQuantityDTO, shouldCloseLU) -> {
this.sendRequestChoosePosition(mtbDepoPosizione -> {
var changePosizioneResult = this.sendRequestChoosePosition();
if (changePosizioneResult == null || !changePosizioneResult.first) {
return;
}
mColliLavorazioneRESTConsumer.createColloScaricoDaArticolo(mtbAart,
pickedQuantityDTO.getPartitaMag(),
changePosizioneResult.second,
pickedQuantityDTO.getQtaTot(),
pickedQuantityDTO.getQtaCnf(),
pickedQuantityDTO.getNumCnf(),
null, null,
this::sendOnDataSaved,
this::sendError);
mColliLavorazioneRESTConsumer.createColloScaricoDaArticolo(mtbAart,
pickedQuantityDTO.getPartitaMag(),
mtbDepoPosizione,
pickedQuantityDTO.getQtaTot(),
pickedQuantityDTO.getQtaCnf(),
pickedQuantityDTO.getNumCnf(),
null, null,
this::sendOnDataSaved,
this::sendError);
});
});
}
private void onLUOpened(MtbColt mtbColt) {
this.mtbColtMutableLiveData.setValue(mtbColt);
this.sendRequestChoosePosition(this::setPosizione);
private void onLUOpened(MtbColt mtbColt) throws Exception {
this.mtbColtMutableLiveData.postValue(mtbColt);
var posizioneResult = this.sendRequestChoosePosition();
if (posizioneResult == null || !posizioneResult.first) {
return;
}
this.setPosizione(posizioneResult.second);
}
public void setPosizione(MtbDepoPosizione mtbDepoPosizione) {
public void setPosizione(MtbDepoPosizione mtbDepoPosizione) throws Exception {
this.mtbDepoPosizioneMutableLiveData.postValue(mtbDepoPosizione);
MtbColt mtbColt = mtbColtMutableLiveData.getValue();
this.sendOnLoadingStarted();
if (mtbDepoPosizione != null && mtbDepoPosizione.isFlagLineaProduzione() && mtbColt != null) {
// mMaterialiRESTConsumer.makeVersaRequest(new VersaMaterialiRequestDTO()
// .setBarcodeUl(mtbColt.getBarcodeUl()), () -> {
//
// String a = "";
//
// }, this::sendError);
if (!mFlagVersamentoDirettoProduzione) {
createColloScarico(mtbDepoPosizione);
} else {
if (mtbColt.getMtbColr() == null || mtbColt.getMtbColr().size() <= 0) {
if (mtbColt.getMtbColr() == null || mtbColt.getMtbColr().isEmpty()) {
this.sendWarning("Il collo selezionato non presenta articoli versabili sulla linea.", this::sendRequestLUOpen);
return;
} else if (mtbColt.getMtbColr().size() > 1) {
@ -344,15 +364,13 @@ public class ProdVersamentoMaterialeViewModel {
}
}
private void createColloScarico(MtbDepoPosizione mtbDepoPosizione) {
private void createColloScarico(MtbDepoPosizione mtbDepoPosizione) throws Exception {
this.sendOnLoadingStarted();
this.mColliMagazzinoRESTConsumer.createColloScaricoDaCarico(mtbColtMutableLiveData.getValue(), mtbDepoPosizione,
generatedMtbColt -> {
this.sendOnLoadingEnded();
this.sendOnDataSaved();
}, this::sendError);
var generatedMtbColt = this.mColliMagazzinoRESTConsumer.createColloScaricoDaCaricoSynchronized(mtbColtMutableLiveData.getValue(), mtbDepoPosizione);
this.sendOnLoadingEnded();
this.sendOnDataSaved();
}
@ -426,8 +444,22 @@ public class ProdVersamentoMaterialeViewModel {
if (this.mListener != null) mListener.requestLUOpen();
}
private void sendRequestChoosePosition(RunnableArgs<MtbDepoPosizione> onComplete) {
if (this.mListener != null) mListener.onRequestChoosePosition(onComplete);
private Pair<Boolean, MtbDepoPosizione> sendRequestChoosePosition() {
final CountDownLatch latch = new CountDownLatch(1);
AtomicReference<Pair<Boolean, MtbDepoPosizione>> result = new AtomicReference<>();
if (this.mListener != null) mListener.onRequestChoosePosition((status, data) -> {
result.set(new Pair<>(status, data));
latch.countDown();
});
try {
latch.await(); // Attende che il dialog venga chiuso
return result.get();
} catch (InterruptedException e) {
this.sendError(e);
}
return null;
}
private void sendOnLoadingStarted() {
@ -492,7 +524,7 @@ public class ProdVersamentoMaterialeViewModel {
void requestLUOpen();
void onRequestChoosePosition(RunnableArgs<MtbDepoPosizione> onComplete);
void onRequestChoosePosition(RunnableArgss<Boolean, MtbDepoPosizione> onComplete);
void onItemDispatched(PickingObjectDTO pickingObjectDTO,
MtbAart mtbAart,