Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	app/src/main/java/it/integry/integrywmsnative/gest/accettazione_bolla_picking/AccettazioneBollaPickingViewModel.java
This commit is contained in:
Giuseppe Scorrano 2025-02-04 10:08:13 +01:00
commit 90e8ff128c
6 changed files with 346 additions and 88 deletions

View File

@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
android {
def appVersionCode = 466
def appVersionName = '1.43.01'
def appVersionCode = 467
def appVersionName = '1.43.02'
signingConfigs {
release {

View File

@ -100,6 +100,25 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
});
}
public void findIfIsKit(MtbAart mtbAart, RunnableArgs<MtbAart> onComplete, RunnableArgs<Exception> onFailed){
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
articoloRESTConsumerService
.findIfIsKit(mtbAart)
.enqueue(new Callback<>() {
@Override
public void onResponse(@NonNull Call<ServiceRESTResponse<MtbAart>> call, @NonNull Response<ServiceRESTResponse<MtbAart>> response) {
analyzeAnswer(response, "findIfIsKit", (m) -> {
onComplete.run(response.body().getDto());
}, onFailed);
}
@Override
public void onFailure(@NonNull Call<ServiceRESTResponse<MtbAart>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
public void getByCodMarts(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
getByCodMartsStatic(codMartToFind, onComplete, onFailed);

View File

@ -31,6 +31,9 @@ public interface ArticoloRESTConsumerService {
@POST("wms/articolo/searchByBarcode")
Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> searchByBarcode(@Body() SearchArticoloByBarcodeRequestDTO searchArticoloByBarcodeRequest);
@POST("wms/articolo/findIfIsKit")
Call<ServiceRESTResponse<MtbAart>> findIfIsKit(@Body MtbAart mtbAart);
@POST("wms/articolo/retrieveByCodMart")
Call<ServiceRESTResponse<List<MtbAart>>> getByCodMart(@Body RetrieveArticoloByCodMartRequestDTO retrieveArticoloByCodMartRequest);

View File

@ -19,6 +19,9 @@ public class SitBollaAccettazioneDTO {
private BigDecimal qtaDaAccettare;
private BigDecimal numCnfDaAccettare;
private boolean kit;
private boolean componente;
public int getNumDoc() {
return numDoc;
}
@ -126,4 +129,20 @@ public class SitBollaAccettazioneDTO {
this.numCnfDaAccettare = numCnfDaAccettare;
return this;
}
public boolean isKit() {
return kit;
}
public void setKit(boolean kit) {
this.kit = kit;
}
public boolean isComponente() {
return componente;
}
public void setComponente(boolean componente) {
this.componente = componente;
}
}

View File

@ -106,14 +106,20 @@ public class AccettazioneBollaPickingViewModel {
this.mBolle = bolle;
this.mUseQtaBolla = useQtaOrd;
List<SitBollaAccettazioneDTO> mSitArts = Stream.of(sitArts).filter(x -> UtilityBigDecimal.greaterThan(x.getQtaDaAccettare(), BigDecimal.ZERO)).toList();
List<SitBollaAccettazioneDTO> mSitArts = Stream.of(sitArts)
.filter(x ->
UtilityBigDecimal.greaterThan(x.getQtaDaAccettare(), BigDecimal.ZERO))
.toList();
getEmptyPickingList(mSitArts, this.mPickingList::postValue);
defaultGestioneOfUL = GestioneEnum.ACQUISTO;
var availableCodAnags = bolle.stream().map(TestataBollaAccettazioneDTO::getCodAnag).distinct().collect(Collectors.toList());
var availableCodAnags = bolle.stream()
.map(TestataBollaAccettazioneDTO::getCodAnag)
.distinct()
.collect(Collectors.toList());
defaultCodAnag = availableCodAnags.size() == 1 ? availableCodAnags.get(0) : null;
switch (defaultGestioneOfUL) {
@ -124,10 +130,13 @@ public class AccettazioneBollaPickingViewModel {
private void getEmptyPickingList(List<SitBollaAccettazioneDTO> sitBolleList, RunnableArgs<List<PickingObjectDTO>> onComplete) {
List<String> codMarts = Stream.of(sitBolleList).map(SitBollaAccettazioneDTO::getCodMart).toList();
List<String> codMarts = Stream.of(sitBolleList)
.map(SitBollaAccettazioneDTO::getCodMart)
.toList();
this.mArticoloRESTConsumer.getByCodMarts(codMarts, listMtbAarts -> {
List<PickingObjectDTO> pickingList = Stream.of(sitBolleList).map(sitBolla -> {
List<PickingObjectDTO> pickingList = Stream.of(sitBolleList)
.map(sitBolla -> {
MtbAart mtbAart = null;
for (MtbAart mtbAartItem : listMtbAarts) {
@ -137,8 +146,11 @@ public class AccettazioneBollaPickingViewModel {
}
}
return new PickingObjectDTO().setSitBollaAccettazione(sitBolla).setMtbAart(mtbAart);
}).toList();
return new PickingObjectDTO()
.setSitBollaAccettazione(sitBolla)
.setMtbAart(mtbAart);
})
.toList();
onComplete.run(pickingList);
}, this::sendError);
@ -201,7 +213,9 @@ public class AccettazioneBollaPickingViewModel {
try {
numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
this.createNewLU(numCollo, CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, true, onComplete);
this.createNewLU(
numCollo,
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, true, onComplete);
} catch (Exception ex) {
this.sendError(ex);
}
@ -214,7 +228,11 @@ public class AccettazioneBollaPickingViewModel {
}
private void processBarcodeNotOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
this.createNewLU(null, null, false, () -> processBarcodeAlreadyOpenedLU(barcodeScanDTO, onComplete));
this.createNewLU(
null,
null,
false,
() -> processBarcodeAlreadyOpenedLU(barcodeScanDTO, onComplete));
}
private void processBarcodeAlreadyOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
@ -277,7 +295,9 @@ public class AccettazioneBollaPickingViewModel {
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
var optionalPos = Stream.of(SettingsManager.iDB().getAvailablePosizioni()).filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue())).findFirst();
var optionalPos = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
.findFirst();
this.sendFilterPosizioneApplied(optionalPos.get().getPosizione());
onComplete.run();
@ -286,7 +306,7 @@ public class AccettazioneBollaPickingViewModel {
private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) {
this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
if (mtbAartList != null && !mtbAartList.isEmpty()) {
if (mtbAartList != null && mtbAartList.size() > 0) {
this.searchArtFromAnag(mtbAartList.get(0), pickData, onComplete);
} else {
this.manageUnknownBarcode(barcodeProd, onComplete);
@ -299,7 +319,9 @@ public class AccettazioneBollaPickingViewModel {
private void searchArtFromAnag(MtbAart mtbAart, PickDataDTO pickData, Runnable onComplete) {
final List<PickingObjectDTO> pickingList = mPickingList.getValue();
List<PickingObjectDTO> matchPickingObject = Stream.of(pickingList).filter(x -> UtilityString.equalsIgnoreCase(mtbAart.getCodMart(), x.getSitBollaAccettazione().getCodMart())).toList();
List<PickingObjectDTO> matchPickingObject = Stream.of(pickingList)
.filter(x -> UtilityString.equalsIgnoreCase(mtbAart.getCodMart(), x.getSitBollaAccettazione().getCodMart()))
.toList();
for (PickingObjectDTO pickingObjectDTO : matchPickingObject) {
pickingObjectDTO.setTempPickData(pickData);
@ -311,12 +333,22 @@ public class AccettazioneBollaPickingViewModel {
private void loadMatchedRows(List<PickingObjectDTO> matchedRows, MtbAart mtbAart, PickDataDTO pickDataDTO) {
if (matchedRows == null || matchedRows.isEmpty()) {
this.mArticoloRESTConsumer.findIfIsKit(mtbAart, mtbAartFind -> {
if (mtbAartFind == null){
manageNoArtFound(mtbAart, pickDataDTO);
} else {
searchArtFromAnag(mtbAartFind, pickDataDTO, () -> {});
}
}, this::sendError);
} else if (matchedRows.size() == 1) {
this.manageDispatchBollaRow(matchedRows.get(0));
} else {
//So che il codMart sarà solo 1
var firstCodMart = Stream.of(matchedRows).map(x -> x.getSitBollaAccettazione().getCodMart()).distinct().findFirst().get();
var firstCodMart = Stream.of(matchedRows)
.map(x -> x.getSitBollaAccettazione().getCodMart())
.distinct()
.findFirst()
.get();
this.sendFilterCodMartApplied(firstCodMart);
}
@ -327,7 +359,14 @@ public class AccettazioneBollaPickingViewModel {
if (SettingsManager.iDB().isFlagAccettazioneBollaCanAddUnknownBarcodes()) {
//TODO: Implementare popup che richiede delle note aggiuntive sul barcode scansionato
this.sendOnUnknownBarcodeScanned(barcode, notes -> {
this.manageDispatchBollaRow(new PickingObjectDTO().setMtbAart(new MtbAart().setDescrizione(notes).setDescrizioneEstesa(notes).setFlagTracciabilita("N").setFlagQtaCnfFissa("S").setQtaCnf(BigDecimal.ONE).setBarCode(barcode)));
this.manageDispatchBollaRow(new PickingObjectDTO()
.setMtbAart(new MtbAart()
.setDescrizione(notes)
.setDescrizioneEstesa(notes)
.setFlagTracciabilita("N")
.setFlagQtaCnfFissa("S")
.setQtaCnf(BigDecimal.ONE)
.setBarCode(barcode)));
onComplete.run();
}, onComplete);
} else {
@ -339,19 +378,29 @@ public class AccettazioneBollaPickingViewModel {
private void manageNoArtFound(MtbAart mtbAart, PickDataDTO pickDataDTO) {
if (SettingsManager.iDB().isFlagAccettazioneBollaCanAddUnknownItems()) {
this.manageDispatchBollaRow(new PickingObjectDTO().setMtbAart(mtbAart).setTempPickData(pickDataDTO));
} else this.sendError(new NoArtsFoundException());
this.manageDispatchBollaRow(new PickingObjectDTO()
.setMtbAart(mtbAart)
.setTempPickData(pickDataDTO));
} else
this.sendError(new NoArtsFoundException());
}
public void createNewLU(Integer customNumCollo, String customSerCollo, boolean disablePrint, Runnable onComplete) {
this.manageInfoAggiuntiveRequest((additionalNotes, tCol) -> {
final CreateUDCRequestDTO createUDCRequestDTO = new CreateUDCRequestDTO().setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep()).setAnnotazioni(additionalNotes).setCodTcol(tCol != null ? tCol.getCodTcol() : null).setNumCollo(customNumCollo).setSerCollo(customSerCollo).setCodAnag(defaultCodAnag);
final CreateUDCRequestDTO createUDCRequestDTO = new CreateUDCRequestDTO()
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep())
.setAnnotazioni(additionalNotes)
.setCodTcol(tCol != null ? tCol.getCodTcol() : null)
.setNumCollo(customNumCollo)
.setSerCollo(customSerCollo)
.setCodAnag(defaultCodAnag);
this.mColliCaricoRESTConsumer.createUDC(createUDCRequestDTO, createdUDS -> {
this.mCurrentMtbColt = createdUDS;
this.mCurrentMtbColt.setMtbColr(new ObservableArrayList<>()).setDisablePrint(disablePrint);
this.mCurrentMtbColt.setMtbColr(new ObservableArrayList<>())
.setDisablePrint(disablePrint);
if (onComplete != null) onComplete.run();
this.sendLUOpened(createdUDS);
@ -380,7 +429,13 @@ public class AccettazioneBollaPickingViewModel {
}
if (SettingsManager.iDB().isFlagAccettazioneBollaEnableFastPick()) {
this.saveNewRow(pickingObjectDTO, BigDecimal.ONE, pickingObjectDTO.getMtbAart().getQtaCnf(), pickingObjectDTO.getMtbAart().getQtaCnf(), partitaMag, null, false);
this.saveNewRow(pickingObjectDTO,
BigDecimal.ONE,
pickingObjectDTO.getMtbAart().getQtaCnf(),
pickingObjectDTO.getMtbAart().getQtaCnf(),
partitaMag,
null,
false);
return;
}
@ -392,13 +447,14 @@ public class AccettazioneBollaPickingViewModel {
dispatchBollaRow(pickingObjectDTO, false);
}
public void dispatchBollaRow(final PickingObjectDTO pickingObjectDTO, boolean executeImmediately) {
public void dispatchBollaRow(final PickingObjectDTO pickingObjectDTO, boolean longClick) {
if (this.mCurrentMtbColt == null) return;
AtomicBigDecimal numCnfWithdrawRows = new AtomicBigDecimal();
AtomicBigDecimal qtaColWithdrawRows = new AtomicBigDecimal();
pickingObjectDTO.getWithdrawMtbColrs().forEach(row -> {
Stream.of(pickingObjectDTO.getWithdrawMtbColrs())
.forEach(row -> {
numCnfWithdrawRows.addAndGet(row.getNumCnf());
qtaColWithdrawRows.addAndGet(row.getQtaCol());
});
@ -495,7 +551,8 @@ public class AccettazioneBollaPickingViewModel {
}
if (!this.mUseQtaBolla) {
if (UtilityBigDecimal.greaterThan(pickingObjectDTO.getMtbAart().getColliPedana(), BigDecimal.ZERO) && UtilityBigDecimal.greaterThan(initialNumCnf, pickingObjectDTO.getMtbAart().getColliPedana())) {
if (UtilityBigDecimal.greaterThan(pickingObjectDTO.getMtbAart().getColliPedana(), BigDecimal.ZERO) &&
UtilityBigDecimal.greaterThan(initialNumCnf, pickingObjectDTO.getMtbAart().getColliPedana())) {
initialNumCnf = pickingObjectDTO.getMtbAart().getColliPedana();
initialQtaTot = initialNumCnf.multiply(initialQtaCnf);
} else if(UtilityBigDecimal.greaterThan(initialNumCnf, BigDecimal.ONE) && pickingObjectDTO.getMtbAart().isFlagQtaCnfFissaBoolean()) {
@ -510,7 +567,10 @@ public class AccettazioneBollaPickingViewModel {
}
if (partitaMag == null && dataScad == null) {
HistoryMtbAartDTO historyMtbAartDTO = pickingObjectDTO.getMtbAart().getCodMart() != null ? this.getHistoryItemByCodMartIfExists(pickingObjectDTO.getMtbAart().getCodMart()) : this.getHistoryItemByBarcodeIfExists(pickingObjectDTO.getMtbAart().getBarCode());
HistoryMtbAartDTO historyMtbAartDTO =
pickingObjectDTO.getMtbAart().getCodMart() != null ?
this.getHistoryItemByCodMartIfExists(pickingObjectDTO.getMtbAart().getCodMart()) :
this.getHistoryItemByBarcodeIfExists(pickingObjectDTO.getMtbAart().getBarCode());
if (historyMtbAartDTO != null) {
partitaMag = historyMtbAartDTO.getPartitaMag();
@ -518,18 +578,48 @@ public class AccettazioneBollaPickingViewModel {
}
}
if (executeImmediately) {
this.saveNewRow(pickingObjectDTO, initialNumCnf, initialQtaCnf, initialQtaTot, partitaMag, dataScad, false);
} else {
this.sendOnItemDispatched(pickingObjectDTO, pickingObjectDTO.getMtbAart(), initialNumCnf, initialQtaCnf, initialQtaTot, qtaDaEvadere, numCnfDaEvadere, qtaCnfDaEvadere, qtaColDaPrelevare, numCnfDaPrelevare, qtaCnfDaPrelevare, null, null, null, partitaMag, dataScad, true, (pickedQuantityDTO, shouldCloseLU) -> {
this.saveNewRow(pickingObjectDTO, pickedQuantityDTO.getNumCnf(), pickedQuantityDTO.getQtaCnf(), pickedQuantityDTO.getQtaTot(), pickedQuantityDTO.getPartitaMag(), pickedQuantityDTO.getDataScad(), shouldCloseLU);
if (!longClick){
this.sendOnItemDispatched(
pickingObjectDTO,
pickingObjectDTO.getMtbAart(),
initialNumCnf, initialQtaCnf, initialQtaTot,
qtaDaEvadere,
numCnfDaEvadere,
qtaCnfDaEvadere,
qtaColDaPrelevare,
numCnfDaPrelevare,
qtaCnfDaPrelevare,
null,
null,
null,
partitaMag,
dataScad,
true,
(pickedQuantityDTO, shouldCloseLU) -> {
this.saveNewRow(pickingObjectDTO,
pickedQuantityDTO.getNumCnf(),
pickedQuantityDTO.getQtaCnf(),
pickedQuantityDTO.getQtaTot(),
pickedQuantityDTO.getPartitaMag(),
pickedQuantityDTO.getDataScad(),
shouldCloseLU);
});
} else {
this.saveNewRow(
pickingObjectDTO,
initialNumCnf,
initialQtaCnf,
initialQtaTot,
partitaMag,
dataScad,
false);
}
}
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) {
if (UtilityBigDecimal.equalsTo(numCnf, BigDecimal.ZERO) && UtilityBigDecimal.equalsTo(qtaTot, BigDecimal.ZERO)) {
resetMatchedRows();
@ -546,16 +636,31 @@ public class AccettazioneBollaPickingViewModel {
var sitBolla = pickingObjectDTO.getSitBollaAccettazione();
var firstAvailableBolla = mBolle.get(0);
var insertUDCRowRequestDto = new InsertUDCRowRequestDTO().setCodMart(pickingObjectDTO.getMtbAart().getCodMart()).setDescrizione(pickingObjectDTO.getMtbAart().getCodMart() == null ? pickingObjectDTO.getMtbAart().getDescrizione() : null).setBarcode(pickingObjectDTO.getMtbAart().getBarCode()).setQtaTot(qtaTot).setQtaCnf(qtaCnf).setNumCnf(numCnf).setPartitaMag(partitaMag)
var insertUDCRowRequestDto = new InsertUDCRowRequestDTO()
.setCodMart(pickingObjectDTO.getMtbAart().getCodMart())
.setDescrizione(pickingObjectDTO.getMtbAart().getCodMart() == null ? pickingObjectDTO.getMtbAart().getDescrizione() : null)
.setBarcode(pickingObjectDTO.getMtbAart().getBarCode())
.setQtaTot(qtaTot)
.setQtaCnf(qtaCnf)
.setNumCnf(numCnf)
.setPartitaMag(partitaMag)
// .setCodJcom(pickingObjectDTO.getSitBollaAccettazione().getCodJcom())
.setDataDoc(sitBolla != null ? sitBolla.getDataDoc() : firstAvailableBolla.getDataDoc()).setNumDoc(sitBolla != null ? sitBolla.getNumDoc() : firstAvailableBolla.getNumDoc()).setCodDtip(sitBolla != null ? sitBolla.getCodDtip() : firstAvailableBolla.getCodDtip()).setSerDoc(sitBolla != null ? sitBolla.getSerDoc() : firstAvailableBolla.getSerDoc()).setTargetMtbColt(clonedTargetMtbColt);
.setDataDoc(sitBolla != null ? sitBolla.getDataDoc() : firstAvailableBolla.getDataDoc())
.setNumDoc(sitBolla != null ? sitBolla.getNumDoc() : firstAvailableBolla.getNumDoc())
.setCodDtip(sitBolla != null ? sitBolla.getCodDtip() : firstAvailableBolla.getCodDtip())
.setSerDoc(sitBolla != null ? sitBolla.getSerDoc() : firstAvailableBolla.getSerDoc())
.setTargetMtbColt(clonedTargetMtbColt);
if (dataScad != null) insertUDCRowRequestDto.setDataScad(dataScad);
if (dataScad != null)
insertUDCRowRequestDto
.setDataScad(dataScad);
mColliCaricoRESTConsumer.insertUDCRow(insertUDCRowRequestDto, insertedMtbColr -> {
this.addHistoryItem(insertedMtbColr);
insertedMtbColr.setUntMis(pickingObjectDTO.getMtbAart().getUntMis()).setMtbAart(pickingObjectDTO.getMtbAart());
insertedMtbColr
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
.setMtbAart(pickingObjectDTO.getMtbAart());
pickingObjectDTO.getWithdrawMtbColrs().add(insertedMtbColr);
mCurrentMtbColt.getMtbColr().add(insertedMtbColr);
@ -573,32 +678,66 @@ public class AccettazioneBollaPickingViewModel {
}
public void dispatchRowEdit(MtbColr mtbColrToEdit) {
final PickingObjectDTO pickingObjectDTO = new PickingObjectDTO().setMtbAart(mtbColrToEdit.getMtbAart());
final PickingObjectDTO pickingObjectDTO = new PickingObjectDTO()
.setMtbAart(mtbColrToEdit.getMtbAart());
this.sendOnItemDispatched(pickingObjectDTO, pickingObjectDTO.getMtbAart(), mtbColrToEdit.getNumCnf(), mtbColrToEdit.getQtaCnf(), mtbColrToEdit.getQtaCol(), null, null, null, null, null, null, null, null, null, mtbColrToEdit.getPartitaMag(), mtbColrToEdit.getDataScadPartita(), true, (pickedQuantityDTO, shouldCloseLU) -> {
this.sendOnItemDispatched(
pickingObjectDTO,
pickingObjectDTO.getMtbAart(),
mtbColrToEdit.getNumCnf(),
mtbColrToEdit.getQtaCnf(),
mtbColrToEdit.getQtaCol(),
null,
null,
null,
null, null, null,
null, null, null,
mtbColrToEdit.getPartitaMag(),
mtbColrToEdit.getDataScadPartita(),
true,
(pickedQuantityDTO, shouldCloseLU) -> {
this.saveEditedRow(mtbColrToEdit, pickedQuantityDTO.getNumCnf(), pickedQuantityDTO.getQtaCnf(), pickedQuantityDTO.getQtaTot(), pickedQuantityDTO.getPartitaMag(), pickedQuantityDTO.getDataScad(), shouldCloseLU);
this.saveEditedRow(mtbColrToEdit,
pickedQuantityDTO.getNumCnf(),
pickedQuantityDTO.getQtaCnf(),
pickedQuantityDTO.getQtaTot(),
pickedQuantityDTO.getPartitaMag(),
pickedQuantityDTO.getDataScad(),
shouldCloseLU);
});
}
private void saveEditedRow(MtbColr mtbColrToUpdate, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) {
private void saveEditedRow(MtbColr mtbColrToUpdate, BigDecimal numCnf, BigDecimal
qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) {
this.sendOnLoadingStarted();
MtbColr mtbColrClone = (MtbColr) mtbColrToUpdate.clone();
mtbColrClone.setMtbAart(null).setMtbPartitaMag(null);
mtbColrClone.setMtbAart(null)
.setMtbPartitaMag(null);
var editUDCRowRequest = new EditUDCRowRequestDTO().setSourceMtbColr(mtbColrClone).setNewNumCnf(numCnf).setNewQtaCnf(qtaCnf).setNewQtaTot(qtaTot).setNewPartitaMag(partitaMag);
var editUDCRowRequest = new EditUDCRowRequestDTO()
.setSourceMtbColr(mtbColrClone)
.setNewNumCnf(numCnf)
.setNewQtaCnf(qtaCnf)
.setNewQtaTot(qtaTot)
.setNewPartitaMag(partitaMag);
if (dataScad != null) editUDCRowRequest.setNewDataScad(dataScad);
if (dataScad != null)
editUDCRowRequest
.setNewDataScad(dataScad);
this.mColliCaricoRESTConsumer.editUDCRow(editUDCRowRequest, (editedMtbColr) -> {
this.addHistoryItem(editedMtbColr);
Optional<PickingObjectDTO> pickingObjectDTO = Stream.of(this.mPickingList.getValue()).filter(x -> Stream.of(x.getWithdrawMtbColrs()).anyMatch(y -> y == mtbColrToUpdate)).findSingle();
Optional<PickingObjectDTO> pickingObjectDTO = Stream.of(this.mPickingList.getValue())
.filter(x -> Stream.of(x.getWithdrawMtbColrs()).anyMatch(y -> y == mtbColrToUpdate))
.findSingle();
editedMtbColr.setUntMis(mtbColrToUpdate.getUntMis()).setMtbAart(mtbColrToUpdate.getMtbAart());
editedMtbColr
.setUntMis(mtbColrToUpdate.getUntMis())
.setMtbAart(mtbColrToUpdate.getMtbAart());
if (pickingObjectDTO.isPresent()) {
pickingObjectDTO.get().getWithdrawMtbColrs().remove(mtbColrToUpdate);
@ -621,14 +760,19 @@ public class AccettazioneBollaPickingViewModel {
public void deleteRow(MtbColr mtbColrToDelete) {
this.sendMtbColrDeleteRequest(shouldDelete -> {
if (!shouldDelete) return;
if (!shouldDelete)
return;
this.sendOnLoadingStarted();
var deleteUDCRowRequest = new DeleteUDCRowRequestDTO().setMtbColrToDelete(mtbColrToDelete);
var deleteUDCRowRequest = new DeleteUDCRowRequestDTO()
.setMtbColrToDelete(mtbColrToDelete);
this.mColliCaricoRESTConsumer.deleteUDCRow(deleteUDCRowRequest, () -> {
Optional<PickingObjectDTO> pickingObjectDTO = Stream.of(this.mPickingList.getValue()).filter(x -> Stream.of(x.getWithdrawMtbColrs()).anyMatch(y -> y == mtbColrToDelete)).findSingle();
this.mColliCaricoRESTConsumer.deleteUDCRow(deleteUDCRowRequest,
() -> {
Optional<PickingObjectDTO> pickingObjectDTO = Stream.of(this.mPickingList.getValue())
.filter(x -> Stream.of(x.getWithdrawMtbColrs()).anyMatch(y -> y == mtbColrToDelete))
.findSingle();
if (pickingObjectDTO.isPresent()) {
pickingObjectDTO.get().getWithdrawMtbColrs().remove(mtbColrToDelete);
@ -656,7 +800,8 @@ public class AccettazioneBollaPickingViewModel {
this.sendOnLoadingEnded();
});
} else {
CloseUDCRequestDTO closeUDCRequestDTO = new CloseUDCRequestDTO().setMtbColt(mCurrentMtbColt);
CloseUDCRequestDTO closeUDCRequestDTO = new CloseUDCRequestDTO()
.setMtbColt(mCurrentMtbColt);
mColliCaricoRESTConsumer.closeUDC(closeUDCRequestDTO, closeUDCResponse -> {
Runnable onVersamentoCompleted = () -> {
@ -710,9 +855,11 @@ public class AccettazioneBollaPickingViewModel {
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
cloneMtbColt.setGestione(cloneMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE ? GestioneEnum.PRODUZIONE : cloneMtbColt.getGestioneEnum());
var printUDSRequestDto = new PrintULRequestDTO().setMtbColt(cloneMtbColt);
var printUDSRequestDto = new PrintULRequestDTO()
.setMtbColt(cloneMtbColt);
this.mColliMagazzinoRESTConsumer.printUL(printUDSRequestDto, onComplete, ex -> this.sendLUPrintError(ex, onComplete));
this.mColliMagazzinoRESTConsumer.printUL(printUDSRequestDto, onComplete,
ex -> this.sendLUPrintError(ex, onComplete));
}
private void postCloseOperations() {
@ -722,7 +869,8 @@ public class AccettazioneBollaPickingViewModel {
}
private void deleteLU(Runnable onComplete) {
DeleteULRequestDTO deleteULRequestDTO = new DeleteULRequestDTO().setMtbColt(this.mCurrentMtbColt);
DeleteULRequestDTO deleteULRequestDTO = new DeleteULRequestDTO()
.setMtbColt(this.mCurrentMtbColt);
mColliMagazzinoRESTConsumer.deleteUL(deleteULRequestDTO, () -> {
this.mCurrentMtbColt = null;
@ -733,7 +881,8 @@ public class AccettazioneBollaPickingViewModel {
public void resetMatchedRows() {
for (PickingObjectDTO pickingObjectDTO : this.mPickingList.getValue()) {
pickingObjectDTO.setTempPickData(null);
pickingObjectDTO
.setTempPickData(null);
}
this.mPickingList.postValue(this.mPickingList.getValue());
@ -747,23 +896,36 @@ public class AccettazioneBollaPickingViewModel {
}
private void addHistoryItem(@NonNull MtbColr mtbColr) {
Optional<HistoryMtbAartDTO> optional = Stream.of(this.mHistoryUsedAarts).filter(x -> (x.getCodMart() != null && x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart())) || (x.getCodMart() == null && x.getBarcode().equalsIgnoreCase(mtbColr.getCodBarre()))).findFirst();
Optional<HistoryMtbAartDTO> optional = Stream.of(this.mHistoryUsedAarts)
.filter(x -> (x.getCodMart() != null && x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart())) ||
(x.getCodMart() == null && x.getBarcode().equalsIgnoreCase(mtbColr.getCodBarre())))
.findFirst();
if (optional.isPresent()) {
optional.get().setPartitaMag(mtbColr.getPartitaMag()).setDataScad(mtbColr.getDataScadPartita());
optional.get()
.setPartitaMag(mtbColr.getPartitaMag())
.setDataScad(mtbColr.getDataScadPartita());
} else {
this.mHistoryUsedAarts.add(new HistoryMtbAartDTO().setCodMart(mtbColr.getCodMart()).setBarcode(mtbColr.getCodBarre()).setPartitaMag(mtbColr.getPartitaMag()).setDataScad(mtbColr.getDataScadPartita()));
this.mHistoryUsedAarts.add(new HistoryMtbAartDTO()
.setCodMart(mtbColr.getCodMart())
.setBarcode(mtbColr.getCodBarre())
.setPartitaMag(mtbColr.getPartitaMag())
.setDataScad(mtbColr.getDataScadPartita()));
}
}
private HistoryMtbAartDTO getHistoryItemByCodMartIfExists(@NonNull String codMart) {
Optional<HistoryMtbAartDTO> optional = Stream.of(this.mHistoryUsedAarts).filter(x -> x.getCodMart().equalsIgnoreCase(codMart)).findFirst();
Optional<HistoryMtbAartDTO> optional = Stream.of(this.mHistoryUsedAarts)
.filter(x -> x.getCodMart().equalsIgnoreCase(codMart))
.findFirst();
return optional.isPresent() ? optional.get() : null;
}
private HistoryMtbAartDTO getHistoryItemByBarcodeIfExists(@NonNull String barcode) {
Optional<HistoryMtbAartDTO> optional = Stream.of(this.mHistoryUsedAarts).filter(x -> x.getBarcode().equalsIgnoreCase(barcode)).findFirst();
Optional<HistoryMtbAartDTO> optional = Stream.of(this.mHistoryUsedAarts)
.filter(x -> x.getBarcode().equalsIgnoreCase(barcode))
.findFirst();
return optional.isPresent() ? optional.get() : null;
}
@ -804,9 +966,43 @@ public class AccettazioneBollaPickingViewModel {
if (this.mListener != null) mListener.onLUPrintError(ex, onComplete);
}
private void sendOnItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaOrd, BigDecimal totalNumCnfOrd, BigDecimal qtaCnfOrd, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String partitaMag, LocalDate dataScad, boolean canPartitaMagBeChanged, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
if (this.mListener != null)
mListener.onItemDispatched(pickingObjectDTO, mtbAart, initialNumCnf, initialQtaCnf, initialQtaTot, totalQtaOrd, totalNumCnfOrd, qtaCnfOrd, totalQtaToBeTaken, totalNumCnfToBeTaken, qtaCnfToBeTaken, totalQtaAvailable, totalNumCnfAvailable, qtaCnfAvailable, partitaMag, dataScad, canPartitaMagBeChanged, true, onComplete);
private void sendOnItemDispatched(PickingObjectDTO pickingObjectDTO,
MtbAart mtbAart,
BigDecimal initialNumCnf,
BigDecimal initialQtaCnf,
BigDecimal initialQtaTot,
BigDecimal totalQtaOrd,
BigDecimal totalNumCnfOrd,
BigDecimal qtaCnfOrd,
BigDecimal totalQtaToBeTaken,
BigDecimal totalNumCnfToBeTaken,
BigDecimal qtaCnfToBeTaken,
BigDecimal totalQtaAvailable,
BigDecimal totalNumCnfAvailable,
BigDecimal qtaCnfAvailable,
String partitaMag,
LocalDate dataScad,
boolean canPartitaMagBeChanged,
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
if (this.mListener != null) mListener.onItemDispatched(pickingObjectDTO,
mtbAart,
initialNumCnf,
initialQtaCnf,
initialQtaTot,
totalQtaOrd,
totalNumCnfOrd,
qtaCnfOrd,
totalQtaToBeTaken,
totalNumCnfToBeTaken,
qtaCnfToBeTaken,
totalQtaAvailable,
totalNumCnfAvailable,
qtaCnfAvailable,
partitaMag,
dataScad,
canPartitaMagBeChanged,
true,
onComplete);
}
@ -826,13 +1022,16 @@ public class AccettazioneBollaPickingViewModel {
if (this.mListener != null) mListener.onMtbColrDeleteRequest(onComplete);
}
private void notifyVersamentoAutomaticoResult(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete) {
private void notifyVersamentoAutomaticoResult(VersamentoAutomaticoULResponseDTO
versamentoAutomaticoULResponseDTO, Runnable onComplete) {
if (this.mListener != null)
mListener.onULVersata(versamentoAutomaticoULResponseDTO, onComplete);
}
private void sendOnUnknownBarcodeScanned(String barocde, RunnableArgs<String> onComplete, Runnable onAbort) {
if (this.mListener != null) mListener.onUnknownBarcodeScanned(barocde, onComplete, onAbort);
private void sendOnUnknownBarcodeScanned(String
barocde, RunnableArgs<String> onComplete, Runnable onAbort) {
if (this.mListener != null)
mListener.onUnknownBarcodeScanned(barocde, onComplete, onAbort);
}
public AccettazioneBollaPickingViewModel setListeners(Listener listener) {
@ -849,7 +1048,25 @@ public class AccettazioneBollaPickingViewModel {
void onError(Exception ex);
void onItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaOrd, BigDecimal totalNumCnfOrd, BigDecimal qtaCnfOrd, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String partitaMag, LocalDate dataScad, boolean canPartitaMagBeChanged, boolean canOverflowQuantity, RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
void onItemDispatched(PickingObjectDTO pickingObjectDTO,
MtbAart mtbAart,
BigDecimal initialNumCnf,
BigDecimal initialQtaCnf,
BigDecimal initialQtaTot,
BigDecimal totalQtaOrd,
BigDecimal totalNumCnfOrd,
BigDecimal qtaCnfOrd,
BigDecimal totalQtaToBeTaken,
BigDecimal totalNumCnfToBeTaken,
BigDecimal qtaCnfToBeTaken,
BigDecimal totalQtaAvailable,
BigDecimal totalNumCnfAvailable,
BigDecimal qtaCnfAvailable,
String partitaMag,
LocalDate dataScad,
boolean canPartitaMagBeChanged,
boolean canOverflowQuantity,
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
void onFilterCodMartApplied(String codMartToFilter);

View File

@ -77,8 +77,8 @@ public class AccettazioneBollaPickingListAdapter extends SectionedRecyclerViewAd
Collections.sort(listaOrdinata, (a, b) -> {
boolean condA = a.getQtaEvasa().subtract(a.getQtaTot()).floatValue() == 0;
boolean condB = b.getQtaEvasa().subtract(b.getQtaTot()).floatValue() == 0;
boolean condA = a.getQtaEvasa().floatValue() > 0;
boolean condB = b.getQtaEvasa().floatValue() > 0;
if (condA && !condB) {
return -1;