Merge branch 'develop' into feature/FastPickingSpedizione
# Conflicts: # app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumer.java # app/src/main/java/it/integry/integrywmsnative/gest/picking_libero/PickingLiberoFragment.java # app/src/main/java/it/integry/integrywmsnative/view/dialogs/input_quantity_v2/DialogInputQuantityV2View.java
This commit is contained in:
commit
e5a4cf59c4
@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
def appVersionCode = 475
|
def appVersionCode = 476
|
||||||
def appVersionName = '1.44.06'
|
def appVersionName = '1.44.07'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@ -598,7 +599,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -111,9 +111,14 @@ public class UtilityString {
|
|||||||
public static boolean isNullOrEmpty(String stringToCheck){
|
public static boolean isNullOrEmpty(String stringToCheck){
|
||||||
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) {
|
||||||
|
|||||||
@ -367,7 +367,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||||
.setOnComplete(resultDTO -> {
|
.setOnComplete(resultDTO -> {
|
||||||
if(resultDTO == null || resultDTO.isAborted()) {
|
if(resultDTO == null || resultDTO.isAborted()) {
|
||||||
this.onLoadingEnded();
|
onComplete.run(null, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,10 +378,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, resultDTO.isShouldCloseLu());
|
onComplete.run(pickedQuantityDTO, resultDTO.isShouldCloseLu());
|
||||||
})
|
})
|
||||||
.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,26 +197,38 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
final List<MagazzinoAutomaticoPickItemRequestDTO> magazzinoAutomaticoPickItemRequestDTOList = new ArrayList<>();
|
if (selectedMtbColrs == null) {
|
||||||
for (MtbColr selectedArt : selectedMtbColrs) {
|
this.sendOnLoadingEnded();
|
||||||
MagazzinoAutomaticoPickItemRequestDTO itemDto = new MagazzinoAutomaticoPickItemRequestDTO(selectedArt.getCodMart())
|
return;
|
||||||
.setQtaTot(selectedArt.getQtaCol())
|
}
|
||||||
.setNumCnf(selectedArt.getNumCnf())
|
|
||||||
.setUntMis(selectedArt.getUntMis());
|
|
||||||
|
|
||||||
magazzinoAutomaticoPickItemRequestDTOList.add(itemDto);
|
final List<MagazzinoAutomaticoPickItemRequestDTO> magazzinoAutomaticoPickItemRequestDTOList = new ArrayList<>();
|
||||||
}
|
for (MtbColr selectedArt : selectedMtbColrs) {
|
||||||
|
MagazzinoAutomaticoPickItemRequestDTO itemDto = new MagazzinoAutomaticoPickItemRequestDTO(selectedArt.getCodMart())
|
||||||
|
.setQtaTot(selectedArt.getQtaCol())
|
||||||
|
.setNumCnf(selectedArt.getNumCnf())
|
||||||
|
.setUntMis(selectedArt.getUntMis());
|
||||||
|
|
||||||
var magazzinoAutomaticoPickRequest = new MagazzinoAutomaticoPickItemsRequestDTO()
|
magazzinoAutomaticoPickItemRequestDTOList.add(itemDto);
|
||||||
.setShouldCreateUDS(true)
|
}
|
||||||
.setDefaultGestioneOfNewUDS(mDefaultGestione.getText())
|
|
||||||
.setItemsToPick(magazzinoAutomaticoPickItemRequestDTOList);
|
|
||||||
|
|
||||||
mMagazzinoAutomaticoRESTConsumer.pickItems(mtbDepoPosizione,
|
var magazzinoAutomaticoPickRequest = new MagazzinoAutomaticoPickItemsRequestDTO()
|
||||||
magazzinoAutomaticoPickRequest, onComplete, this::sendError);
|
.setShouldCreateUDS(true)
|
||||||
}, this::sendOnLoadingEnded);
|
.setDefaultGestioneOfNewUDS(mDefaultGestione.getText())
|
||||||
|
.setItemsToPick(magazzinoAutomaticoPickItemRequestDTOList);
|
||||||
|
|
||||||
|
mMagazzinoAutomaticoRESTConsumer.pickItems(mtbDepoPosizione,
|
||||||
|
magazzinoAutomaticoPickRequest, onComplete, this::sendError);
|
||||||
|
|
||||||
|
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());
|
||||||
|
|
||||||
if (!pickedAarts.isEmpty()) {
|
List<MtbColr> pickedAarts = this.sendArtSelectionRequest(mtbColrsToPick, mtbAart);
|
||||||
askQuantities(pickedAarts.iterator(), destNewMtbColr, () -> {
|
|
||||||
if (!destNewMtbColr.isEmpty()) {
|
|
||||||
|
|
||||||
if(this.mDefaultCommessa != null)
|
if (pickedAarts == null) {
|
||||||
destNewMtbColr.forEach(x -> x.setCodJcom(this.mDefaultCommessa.getCodJcom()));
|
this.sendOnLoadingEnded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MtbColt clonedTestata = (MtbColt) sourceMtbColt.clone();
|
List<MtbColr> mtbColrsToMove = new ArrayList<>();
|
||||||
clonedTestata.getMtbColr().clear();
|
|
||||||
clonedTestata.getMtbColr().addAll(destNewMtbColr);
|
|
||||||
|
|
||||||
mColliMagazzinoRESTConsumer.spostaArtsTraUL(clonedTestata,
|
if (!pickedAarts.isEmpty()) {
|
||||||
|
for (var pickedArt : pickedAarts) {
|
||||||
|
var mtbColr = askSingleQuantity(pickedArt);
|
||||||
|
|
||||||
|
if (mtbColr != null)
|
||||||
|
mtbColrsToMove.add(mtbColr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mtbColrsToMove.isEmpty()) {
|
||||||
|
|
||||||
|
if (this.mDefaultCommessa != null)
|
||||||
|
mtbColrsToMove.forEach(x -> x.setCodJcom(this.mDefaultCommessa.getCodJcom()));
|
||||||
|
|
||||||
|
MtbColt clonedSourceTestata = (MtbColt) sourceMtbColt.clone();
|
||||||
|
clonedSourceTestata.getMtbColr().clear();
|
||||||
|
clonedSourceTestata.getMtbColr().addAll(mtbColrsToMove);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
onComplete.run();
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
}
|
}
|
||||||
}, onComplete);
|
|
||||||
} else {
|
} else {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
this.sendError(e);
|
||||||
}
|
}
|
||||||
}, this::sendOnLoadingEnded);
|
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void askQuantities(Iterator<MtbColr> sourceMtbColrs, List<MtbColr> destMtbColr, Runnable onComplete, Runnable onAbort) {
|
private MtbColr askSingleQuantity(MtbColr mtbColr) throws InterruptedException {
|
||||||
if (sourceMtbColrs.hasNext()) {
|
|
||||||
askSingleQuantity(sourceMtbColrs.next(), mtbColr -> {
|
|
||||||
destMtbColr.add(mtbColr);
|
|
||||||
askQuantities(sourceMtbColrs, destMtbColr, onComplete, onAbort);
|
|
||||||
}, onAbort);
|
|
||||||
} else {
|
|
||||||
onComplete.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete, Runnable onAbort) {
|
|
||||||
|
|
||||||
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,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user