Migliorata gestione caricamenti del Picking libero.
This commit is contained in:
parent
bc27355ed6
commit
e11e270101
@ -16,6 +16,8 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@ -311,15 +313,47 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void fillMtbAartsOfMtbColrs(List<MtbColr> mtbColrs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
|
List<String> codMarts = new ArrayList<>(mtbColrs.stream()
|
||||||
|
.map(MtbColr::getCodMart)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toUnmodifiableList()));
|
||||||
|
|
||||||
|
mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> {
|
||||||
|
|
||||||
|
if (arts != null && !arts.isEmpty()) {
|
||||||
|
for (MtbColr mtbColr : mtbColrs) {
|
||||||
|
|
||||||
|
MtbAart foundMtbAart = null;
|
||||||
|
|
||||||
|
List<MtbAart> mtbAartStream = arts.stream()
|
||||||
|
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (!mtbAartStream.isEmpty()) {
|
||||||
|
foundMtbAart = mtbAartStream.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
mtbColr.setMtbAart(foundMtbAart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onComplete.run(mtbColrs);
|
||||||
|
}, onFailed);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
List<String> codMarts = new ArrayList<>();
|
List<String> codMarts = new ArrayList<>();
|
||||||
|
|
||||||
for (MtbColt mtbColt : mtbColts) {
|
for (MtbColt mtbColt : mtbColts) {
|
||||||
codMarts.addAll(Stream.of(mtbColt.getMtbColr())
|
codMarts.addAll(mtbColt.getMtbColr().stream()
|
||||||
.map(MtbColr::getCodMart)
|
.map(MtbColr::getCodMart)
|
||||||
.withoutNulls()
|
.filter(Objects::nonNull)
|
||||||
.distinct()
|
.distinct()
|
||||||
.toList());
|
.collect(Collectors.toUnmodifiableList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -331,10 +365,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
MtbAart foundMtbAart = null;
|
MtbAart foundMtbAart = null;
|
||||||
|
|
||||||
List<MtbAart> mtbAartStream = Stream.of(arts)
|
List<MtbAart> mtbAartStream = arts.stream()
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart())).toList();
|
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (mtbAartStream != null && !mtbAartStream.isEmpty()) {
|
if (!mtbAartStream.isEmpty()) {
|
||||||
foundMtbAart = mtbAartStream.get(0);
|
foundMtbAart = mtbAartStream.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,7 +595,9 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> call, Response<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> response) {
|
public void onResponse(Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> call, Response<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> response) {
|
||||||
analyzeAnswer(response, "spostaArtsTraUL", data -> {
|
analyzeAnswer(response, "spostaArtsTraUL", data -> {
|
||||||
onComplete.run(data.getGeneratedMtbColr());
|
|
||||||
|
fillMtbAartsOfMtbColrs(data.getGeneratedMtbColr(), onComplete, onFailed);
|
||||||
|
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -112,8 +112,13 @@ public class UtilityString {
|
|||||||
return stringToCheck == null || stringToCheck.trim().isEmpty();
|
return stringToCheck == null || stringToCheck.trim().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String isNull(String stringToCheck, String alternativeString){
|
public static String isNull(String... strings) {
|
||||||
return isNullOrEmpty(stringToCheck) ? alternativeString : stringToCheck;
|
for (String string : strings) {
|
||||||
|
if (!isNullOrEmpty(string)) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String empty2null(String stringToCheck) {
|
public static String empty2null(String stringToCheck) {
|
||||||
|
|||||||
@ -373,10 +373,11 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
.setPartitaMag(resultDTO.getPartitaMag())
|
.setPartitaMag(resultDTO.getPartitaMag())
|
||||||
.setDataScad(resultDTO.getDataScad());
|
.setDataScad(resultDTO.getDataScad());
|
||||||
|
|
||||||
this.onLoadingStarted();
|
|
||||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||||
})
|
})
|
||||||
.setOnAbort(this::onLoadingEnded)
|
.setOnAbort(() -> {
|
||||||
|
onComplete.run(null, false);
|
||||||
|
})
|
||||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package it.integry.integrywmsnative.gest.picking_libero;
|
package it.integry.integrywmsnative.gest.picking_libero;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
import dagger.Provides;
|
import dagger.Provides;
|
||||||
|
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
||||||
@ -18,22 +21,27 @@ public class PickingLiberoModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
PickingLiberoViewModel providesPickingLiberoViewModel(ArticoloRESTConsumer articoloRESTConsumer,
|
PickingLiberoViewModel providesPickingLiberoViewModel(ExecutorService executorService,
|
||||||
|
ArticoloRESTConsumer articoloRESTConsumer,
|
||||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||||
PosizioniRESTConsumer posizioniRESTConsumer,
|
PosizioniRESTConsumer posizioniRESTConsumer,
|
||||||
GiacenzaRESTConsumer giacenzaRESTConsumer,
|
GiacenzaRESTConsumer giacenzaRESTConsumer,
|
||||||
MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer,
|
MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer,
|
||||||
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
|
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
|
||||||
ColliSpedizioneRESTConsumer colliSpedizioneRESTConsumer
|
ColliSpedizioneRESTConsumer colliSpedizioneRESTConsumer,
|
||||||
|
ColliDataRecoverService colliDataRecoverService
|
||||||
) {
|
) {
|
||||||
return new PickingLiberoViewModel(articoloRESTConsumer,
|
return new PickingLiberoViewModel(
|
||||||
|
executorService,
|
||||||
|
articoloRESTConsumer,
|
||||||
colliMagazzinoRESTConsumer,
|
colliMagazzinoRESTConsumer,
|
||||||
barcodeRESTConsumer,
|
barcodeRESTConsumer,
|
||||||
posizioniRESTConsumer,
|
posizioniRESTConsumer,
|
||||||
giacenzaRESTConsumer,
|
giacenzaRESTConsumer,
|
||||||
magazzinoAutomaticoRESTConsumer,
|
magazzinoAutomaticoRESTConsumer,
|
||||||
colliLavorazioneRESTConsumer,
|
colliLavorazioneRESTConsumer,
|
||||||
colliSpedizioneRESTConsumer);
|
colliSpedizioneRESTConsumer,
|
||||||
|
colliDataRecoverService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,12 +7,16 @@ import com.annimon.stream.Stream;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
|
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||||
import it.integry.integrywmsnative.core.exception.InvalidCodMdepException;
|
import it.integry.integrywmsnative.core.exception.InvalidCodMdepException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||||
@ -66,12 +70,14 @@ public class PickingLiberoViewModel {
|
|||||||
|
|
||||||
private MtbColt mCurrentMtbColt = null;
|
private MtbColt mCurrentMtbColt = null;
|
||||||
|
|
||||||
|
private final ExecutorService executorService;
|
||||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||||
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
||||||
private final GiacenzaRESTConsumer mGiacenzaRESTConsumer;
|
private final GiacenzaRESTConsumer mGiacenzaRESTConsumer;
|
||||||
private final MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer;
|
private final MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer;
|
||||||
|
private final ColliDataRecoverService mColliDataRecoverService;
|
||||||
|
|
||||||
private ColliScaricoRESTConsumerInterface mColliScaricoRESTConsumer;
|
private ColliScaricoRESTConsumerInterface mColliScaricoRESTConsumer;
|
||||||
private final ColliLavorazioneRESTConsumer mColliLavorazioneRESTConsumer;
|
private final ColliLavorazioneRESTConsumer mColliLavorazioneRESTConsumer;
|
||||||
@ -86,17 +92,21 @@ public class PickingLiberoViewModel {
|
|||||||
|
|
||||||
|
|
||||||
private Listener mListener;
|
private Listener mListener;
|
||||||
|
private Integer mMtbColtSessionID;
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public PickingLiberoViewModel(ArticoloRESTConsumer articoloRESTConsumer,
|
public PickingLiberoViewModel(ExecutorService executorService,
|
||||||
|
ArticoloRESTConsumer articoloRESTConsumer,
|
||||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||||
PosizioniRESTConsumer posizioniRESTConsumer,
|
PosizioniRESTConsumer posizioniRESTConsumer,
|
||||||
GiacenzaRESTConsumer giacenzaRESTConsumer,
|
GiacenzaRESTConsumer giacenzaRESTConsumer,
|
||||||
MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer,
|
MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer,
|
||||||
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
|
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
|
||||||
ColliSpedizioneRESTConsumer colliSpedizioneRESTConsumer) {
|
ColliSpedizioneRESTConsumer colliSpedizioneRESTConsumer,
|
||||||
|
ColliDataRecoverService colliDataRecoverService) {
|
||||||
|
this.executorService = executorService;
|
||||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||||
@ -105,6 +115,7 @@ public class PickingLiberoViewModel {
|
|||||||
this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer;
|
this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer;
|
||||||
this.mColliLavorazioneRESTConsumer = colliLavorazioneRESTConsumer;
|
this.mColliLavorazioneRESTConsumer = colliLavorazioneRESTConsumer;
|
||||||
this.mColliSpedizioneRESTConsumer = colliSpedizioneRESTConsumer;
|
this.mColliSpedizioneRESTConsumer = colliSpedizioneRESTConsumer;
|
||||||
|
this.mColliDataRecoverService = colliDataRecoverService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -186,7 +197,18 @@ public class PickingLiberoViewModel {
|
|||||||
.map(MvwSitArtUdcDetInventario::toMtbColr)
|
.map(MvwSitArtUdcDetInventario::toMtbColr)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
this.sendArtSelectionRequest(mtbColrs, null, selectedMtbColrs -> {
|
List<MtbColr> selectedMtbColrs = null;
|
||||||
|
try {
|
||||||
|
selectedMtbColrs = this.sendArtSelectionRequest(mtbColrs, null);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
this.sendError(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedMtbColrs == null) {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final List<MagazzinoAutomaticoPickItemRequestDTO> magazzinoAutomaticoPickItemRequestDTOList = new ArrayList<>();
|
final List<MagazzinoAutomaticoPickItemRequestDTO> magazzinoAutomaticoPickItemRequestDTOList = new ArrayList<>();
|
||||||
for (MtbColr selectedArt : selectedMtbColrs) {
|
for (MtbColr selectedArt : selectedMtbColrs) {
|
||||||
@ -205,7 +227,8 @@ public class PickingLiberoViewModel {
|
|||||||
|
|
||||||
mMagazzinoAutomaticoRESTConsumer.pickItems(mtbDepoPosizione,
|
mMagazzinoAutomaticoRESTConsumer.pickItems(mtbDepoPosizione,
|
||||||
magazzinoAutomaticoPickRequest, onComplete, this::sendError);
|
magazzinoAutomaticoPickRequest, onComplete, this::sendError);
|
||||||
}, this::sendOnLoadingEnded);
|
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
|
|
||||||
@ -382,6 +405,8 @@ public class PickingLiberoViewModel {
|
|||||||
|
|
||||||
|
|
||||||
mColliScaricoRESTConsumer.createUDS(createUDSRequest, mtbColt -> {
|
mColliScaricoRESTConsumer.createUDS(createUDSRequest, mtbColt -> {
|
||||||
|
mMtbColtSessionID = mColliDataRecoverService.startNewSession(mtbColt, null);
|
||||||
|
|
||||||
mtbColt
|
mtbColt
|
||||||
.setMtbColr(new ObservableArrayList<>());
|
.setMtbColr(new ObservableArrayList<>());
|
||||||
|
|
||||||
@ -526,6 +551,11 @@ public class PickingLiberoViewModel {
|
|||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
(pickedQuantityDTO, shouldCloseLU) -> {
|
||||||
|
if (pickedQuantityDTO == null) {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.saveNewRow(pickingObjectDTO,
|
this.saveNewRow(pickingObjectDTO,
|
||||||
pickedQuantityDTO.getNumCnf(),
|
pickedQuantityDTO.getNumCnf(),
|
||||||
pickedQuantityDTO.getQtaCnf(),
|
pickedQuantityDTO.getQtaCnf(),
|
||||||
@ -541,25 +571,40 @@ public class PickingLiberoViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void pickMerceULtoUL(MtbColt sourceMtbColt, MtbAart mtbAart, Runnable onComplete) {
|
private void pickMerceULtoUL(MtbColt sourceMtbColt, MtbAart mtbAart, Runnable onComplete) {
|
||||||
List<MtbColr> mtbColrsToPick = Stream.of(sourceMtbColt.getMtbColr())
|
executorService.execute(() -> {
|
||||||
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaCol(), BigDecimal.ZERO))
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
this.sendArtSelectionRequest(mtbColrsToPick, mtbAart, pickedAarts -> {
|
try {
|
||||||
List<MtbColr> destNewMtbColr = new ArrayList<>();
|
List<MtbColr> mtbColrsToPick = sourceMtbColt.getMtbColr().stream()
|
||||||
|
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaCol(), BigDecimal.ZERO))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<MtbColr> pickedAarts = this.sendArtSelectionRequest(mtbColrsToPick, mtbAart);
|
||||||
|
|
||||||
|
if (pickedAarts == null) {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MtbColr> mtbColrsToMove = new ArrayList<>();
|
||||||
|
|
||||||
if (!pickedAarts.isEmpty()) {
|
if (!pickedAarts.isEmpty()) {
|
||||||
askQuantities(pickedAarts.iterator(), destNewMtbColr, () -> {
|
for (var pickedArt : pickedAarts) {
|
||||||
if (!destNewMtbColr.isEmpty()) {
|
var mtbColr = askSingleQuantity(pickedArt);
|
||||||
|
|
||||||
|
if (mtbColr != null)
|
||||||
|
mtbColrsToMove.add(mtbColr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mtbColrsToMove.isEmpty()) {
|
||||||
|
|
||||||
if (this.mDefaultCommessa != null)
|
if (this.mDefaultCommessa != null)
|
||||||
destNewMtbColr.forEach(x -> x.setCodJcom(this.mDefaultCommessa.getCodJcom()));
|
mtbColrsToMove.forEach(x -> x.setCodJcom(this.mDefaultCommessa.getCodJcom()));
|
||||||
|
|
||||||
MtbColt clonedTestata = (MtbColt) sourceMtbColt.clone();
|
MtbColt clonedSourceTestata = (MtbColt) sourceMtbColt.clone();
|
||||||
clonedTestata.getMtbColr().clear();
|
clonedSourceTestata.getMtbColr().clear();
|
||||||
clonedTestata.getMtbColr().addAll(destNewMtbColr);
|
clonedSourceTestata.getMtbColr().addAll(mtbColrsToMove);
|
||||||
|
|
||||||
mColliMagazzinoRESTConsumer.spostaArtsTraUL(clonedTestata,
|
mColliMagazzinoRESTConsumer.spostaArtsTraUL(clonedSourceTestata,
|
||||||
this.mCurrentMtbColt, true, (generatedMtbColrs) -> {
|
this.mCurrentMtbColt, true, (generatedMtbColrs) -> {
|
||||||
|
|
||||||
mCurrentMtbColt.getMtbColr().addAll(generatedMtbColrs);
|
mCurrentMtbColt.getMtbColr().addAll(generatedMtbColrs);
|
||||||
@ -569,27 +614,24 @@ public class PickingLiberoViewModel {
|
|||||||
onComplete.run();
|
onComplete.run();
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
|
|
||||||
}
|
|
||||||
}, onComplete);
|
|
||||||
} else {
|
} else {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
}
|
this.sendOnLoadingEnded();
|
||||||
}, this::sendOnLoadingEnded);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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, onAbort);
|
|
||||||
}, onAbort);
|
|
||||||
} else {
|
} else {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
}
|
this.sendOnLoadingEnded();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete, Runnable onAbort) {
|
} catch (InterruptedException e) {
|
||||||
|
this.sendError(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private MtbColr askSingleQuantity(MtbColr mtbColr) throws InterruptedException {
|
||||||
|
|
||||||
MtbColt sourceMtbColt = new MtbColt()
|
MtbColt sourceMtbColt = new MtbColt()
|
||||||
.setNumCollo(mtbColr.getNumCollo())
|
.setNumCollo(mtbColr.getNumCollo())
|
||||||
@ -608,6 +650,8 @@ public class PickingLiberoViewModel {
|
|||||||
new PickDataDTO()
|
new PickDataDTO()
|
||||||
.setSourceMtbColt(sourceMtbColt));
|
.setSourceMtbColt(sourceMtbColt));
|
||||||
|
|
||||||
|
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||||
|
AtomicReference<MtbColr> result = new AtomicReference<>();
|
||||||
|
|
||||||
this.sendOnItemDispatched(
|
this.sendOnItemDispatched(
|
||||||
pickingObjectDTO,
|
pickingObjectDTO,
|
||||||
@ -627,6 +671,10 @@ public class PickingLiberoViewModel {
|
|||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
(pickedQuantityDTO, shouldCloseLU) -> {
|
||||||
|
if (pickedQuantityDTO == null) {
|
||||||
|
countDownLatch.countDown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mtbColr
|
mtbColr
|
||||||
.setPartitaMag(pickedQuantityDTO.getPartitaMag())
|
.setPartitaMag(pickedQuantityDTO.getPartitaMag())
|
||||||
@ -634,16 +682,21 @@ public class PickingLiberoViewModel {
|
|||||||
.setQtaCol(pickedQuantityDTO.getQtaTot())
|
.setQtaCol(pickedQuantityDTO.getQtaTot())
|
||||||
.setQtaCnf(pickedQuantityDTO.getQtaCnf())
|
.setQtaCnf(pickedQuantityDTO.getQtaCnf())
|
||||||
.setNumCnf(pickedQuantityDTO.getNumCnf())
|
.setNumCnf(pickedQuantityDTO.getNumCnf())
|
||||||
.setDatetimeRow(UtilityDate.getDateInstance());
|
.setDatetimeRow(UtilityDate.getDateInstance())
|
||||||
|
.setMtbAart(pickingObjectDTO.getMtbAart());
|
||||||
|
|
||||||
onComplete.run(mtbColr);
|
result.set(mtbColr);
|
||||||
|
countDownLatch.countDown();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
countDownLatch.await();
|
||||||
|
return result.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void saveNewRow(PickingObjectDTO pickingObjectDTO, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) {
|
public void saveNewRow(PickingObjectDTO pickingObjectDTO, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) {
|
||||||
new Thread(this::sendOnLoadingStarted).start();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
|
|
||||||
final MtbColr mtbColr = new MtbColr()
|
final MtbColr mtbColr = new MtbColr()
|
||||||
.setCodMart(pickingObjectDTO.getMtbAart().getCodMart())
|
.setCodMart(pickingObjectDTO.getMtbAart().getCodMart())
|
||||||
@ -772,8 +825,12 @@ public class PickingLiberoViewModel {
|
|||||||
mtbColrToUpdate.getDataScadPartita(),
|
mtbColrToUpdate.getDataScadPartita(),
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
(pickedQuantityDTO, shouldCloseLU) -> {
|
||||||
|
if (pickedQuantityDTO == null) {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.saveEditedRow(mtbColrToUpdate,
|
this.saveEditedRow(mtbColrToUpdate,
|
||||||
pickedQuantityDTO.getNumCnf(),
|
pickedQuantityDTO.getNumCnf(),
|
||||||
@ -872,6 +929,9 @@ public class PickingLiberoViewModel {
|
|||||||
mColliMagazzinoRESTConsumer.canULBeDeleted(mCurrentMtbColt, canBeDeleted -> {
|
mColliMagazzinoRESTConsumer.canULBeDeleted(mCurrentMtbColt, canBeDeleted -> {
|
||||||
if (canBeDeleted) {
|
if (canBeDeleted) {
|
||||||
deleteLU(() -> {
|
deleteLU(() -> {
|
||||||
|
if (mMtbColtSessionID != null)
|
||||||
|
this.mColliDataRecoverService.closeSession(mMtbColtSessionID);
|
||||||
|
|
||||||
this.sendLUClosed();
|
this.sendLUClosed();
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
|
|
||||||
@ -893,6 +953,9 @@ public class PickingLiberoViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.mColliScaricoRESTConsumer.closeUDS(closeUDSRequest, response -> {
|
this.mColliScaricoRESTConsumer.closeUDS(closeUDSRequest, response -> {
|
||||||
|
if (mMtbColtSessionID != null)
|
||||||
|
this.mColliDataRecoverService.closeSession(mMtbColtSessionID);
|
||||||
|
|
||||||
this.sendLUClosed();
|
this.sendLUClosed();
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
|
|
||||||
@ -951,9 +1014,21 @@ public class PickingLiberoViewModel {
|
|||||||
if (this.mListener != null) mListener.onLUCommessaRequired(onComplete, onAbort);
|
if (this.mListener != null) mListener.onLUCommessaRequired(onComplete, onAbort);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendArtSelectionRequest(List<MtbColr> mtbColrsToPick, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
private List<MtbColr> sendArtSelectionRequest(List<MtbColr> mtbColrsToPick, MtbAart mtbAart) throws InterruptedException {
|
||||||
|
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||||
|
AtomicReference<List<MtbColr>> result = new AtomicReference<>();
|
||||||
|
|
||||||
|
|
||||||
if (this.mListener != null)
|
if (this.mListener != null)
|
||||||
mListener.onArtSelectionRequest(mtbColrsToPick, mtbAart, onComplete, onAbort);
|
mListener.onArtSelectionRequest(mtbColrsToPick, mtbAart, mtbColrs -> {
|
||||||
|
result.set(mtbColrs);
|
||||||
|
countDownLatch.countDown();
|
||||||
|
}, countDownLatch::countDown);
|
||||||
|
else countDownLatch.countDown();
|
||||||
|
|
||||||
|
|
||||||
|
countDownLatch.await();
|
||||||
|
return result.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnItemDispatched(PickingObjectDTO pickingObjectDTO,
|
private void sendOnItemDispatched(PickingObjectDTO pickingObjectDTO,
|
||||||
@ -973,6 +1048,7 @@ public class PickingLiberoViewModel {
|
|||||||
boolean canPartitaMagBeChanged,
|
boolean canPartitaMagBeChanged,
|
||||||
boolean canLUBeClosed,
|
boolean canLUBeClosed,
|
||||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
||||||
|
|
||||||
if (this.mListener != null) mListener.onItemDispatched(pickingObjectDTO,
|
if (this.mListener != null) mListener.onItemDispatched(pickingObjectDTO,
|
||||||
mtbAart,
|
mtbAart,
|
||||||
initialNumCnf,
|
initialNumCnf,
|
||||||
|
|||||||
@ -74,7 +74,12 @@ public class DialogProgressView extends DialogFragment {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (!manager.isDestroyed() && !isAdded()) {
|
if (!manager.isDestroyed() && !isAdded()) {
|
||||||
//manager.executePendingTransactions();
|
try {
|
||||||
|
manager.executePendingTransactions();
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
//ignore
|
||||||
|
String a = "";
|
||||||
|
}
|
||||||
showNow(manager, "loading-dialog");
|
showNow(manager, "loading-dialog");
|
||||||
|
|
||||||
mBindings.progressBar.setIndeterminate(isIndeterminateProgress());
|
mBindings.progressBar.setIndeterminate(isIndeterminateProgress());
|
||||||
@ -91,7 +96,16 @@ public class DialogProgressView extends DialogFragment {
|
|||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
if (isAdded()) {
|
if (isAdded()) {
|
||||||
dismissAllowingStateLoss();
|
dismissAllowingStateLoss();
|
||||||
|
if (!getParentFragmentManager().isDestroyed()) {
|
||||||
|
try {
|
||||||
|
getParentFragmentManager().executePendingTransactions();
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
//ignore
|
||||||
|
String a = "";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -267,8 +267,7 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
|
|
||||||
if (validated) {
|
if (validated) {
|
||||||
this.mAbort = false;
|
this.mAbort = false;
|
||||||
dismiss();
|
dismiss(this.mViewModel.getResult(), false);
|
||||||
this.mOnComplete.run(this.mViewModel.getResult(), false);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -278,14 +277,29 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
this.mViewModel.validate(validated -> {
|
this.mViewModel.validate(validated -> {
|
||||||
if (validated) {
|
if (validated) {
|
||||||
this.mAbort = false;
|
this.mAbort = false;
|
||||||
dismiss();
|
dismiss(this.mViewModel.getResult(), true);
|
||||||
this.mOnComplete.run(this.mViewModel.getResult(), true);
|
|
||||||
} else {
|
} else {
|
||||||
this.onLoadingEnded();
|
this.onLoadingEnded();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dismiss() {
|
||||||
|
dismiss(null, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dismiss(DialogInputQuantityV2ResultDTO result, boolean shouldCloseLu) {
|
||||||
|
if (this.mOnComplete != null) {
|
||||||
|
if(result == null) {
|
||||||
|
mOnAbort.run();
|
||||||
|
} else {
|
||||||
|
this.mOnComplete.run(result, shouldCloseLu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user