Finish v1.46.03(491)

This commit is contained in:
Giuseppe Scorrano 2025-04-08 15:54:56 +02:00
commit 6f202c0c7a
5 changed files with 106 additions and 87 deletions

View File

@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
android {
def appVersionCode = 488
def appVersionName = '1.46.00'
def appVersionCode = 491
def appVersionName = '1.46.03'
signingConfigs {
release {

View File

@ -631,9 +631,15 @@ public class MtbColt extends EntityBase {
@Override
public EntityBase clone() {
return clone(true);
}
public MtbColt clone(boolean withMtbColr) {
MtbColt mtbColt = (MtbColt) super.clone();
mtbColt.setMtbColr(new ObservableArrayList<>());
if(!withMtbColr) return mtbColt;
this.getMtbColr().stream()
.map(MtbColr::new) //Genera un clone
.forEach(mtbColr -> {

View File

@ -305,8 +305,8 @@ public class AccettazioneBollaPickingViewModel {
private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) {
this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
if (mtbAartList != null && mtbAartList.size() > 0) {
this.searchArtFromAnag(mtbAartList.get(0), pickData, onComplete);
if (mtbAartList != null && !mtbAartList.isEmpty()) {
this.searchArtFromAnag(mtbAartList.get(0), pickData, null, onComplete);
} else {
this.manageUnknownBarcode(barcodeProd, onComplete);
}
@ -315,28 +315,41 @@ public class AccettazioneBollaPickingViewModel {
}
private void searchArtFromAnag(MtbAart mtbAart, PickDataDTO pickData, Runnable onComplete) {
private void searchArtFromAnag(MtbAart mtbAart, PickDataDTO pickData, ArrayList<MtbAart> previousSearchedArts, Runnable onComplete) {
if (previousSearchedArts == null) previousSearchedArts = new ArrayList<>();
if (previousSearchedArts.contains(mtbAart)) {
manageNoArtFound(mtbAart, pickData);
return;
}
previousSearchedArts.add(mtbAart);
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 = pickingList == null ? new ArrayList<>() :
pickingList.stream()
.filter(x -> UtilityString.equalsIgnoreCase(mtbAart.getCodMart(), x.getSitBollaAccettazione().getCodMart()))
.collect(Collectors.toList());
for (PickingObjectDTO pickingObjectDTO : matchPickingObject) {
pickingObjectDTO.setTempPickData(pickData);
}
this.loadMatchedRows(matchPickingObject, mtbAart, pickData);
this.loadMatchedRows(matchPickingObject, mtbAart, pickData, previousSearchedArts);
onComplete.run();
}
private void loadMatchedRows(List<PickingObjectDTO> matchedRows, MtbAart mtbAart, PickDataDTO pickDataDTO) {
private void loadMatchedRows(List<PickingObjectDTO> matchedRows, MtbAart mtbAart, PickDataDTO pickDataDTO, ArrayList<MtbAart> previousSearchedArts) {
if (matchedRows == null || matchedRows.isEmpty()) {
this.sendOnLoadingStarted();
this.mArticoloRESTConsumer.findIfIsKit(mtbAart, mtbAartFind -> {
if (mtbAartFind == null){
this.sendOnLoadingEnded();
if (mtbAartFind == null) {
manageNoArtFound(mtbAart, pickDataDTO);
} else {
searchArtFromAnag(mtbAartFind, pickDataDTO, () -> {});
searchArtFromAnag(mtbAartFind, pickDataDTO, previousSearchedArts, () -> {
});
}
}, this::sendError);
} else if (matchedRows.size() == 1) {
@ -442,7 +455,7 @@ public class AccettazioneBollaPickingViewModel {
dispatchBollaRow(pickingObjectDTO);
}
public void dispatchBollaRow(final PickingObjectDTO pickingObjectDTO){
public void dispatchBollaRow(final PickingObjectDTO pickingObjectDTO) {
dispatchBollaRow(pickingObjectDTO, false);
}
@ -554,7 +567,7 @@ public class AccettazioneBollaPickingViewModel {
UtilityBigDecimal.greaterThan(initialNumCnf, pickingObjectDTO.getMtbAart().getColliPedana())) {
initialNumCnf = pickingObjectDTO.getMtbAart().getColliPedana();
initialQtaTot = initialNumCnf.multiply(initialQtaCnf);
} else if(UtilityBigDecimal.greaterThan(initialNumCnf, BigDecimal.ONE) && pickingObjectDTO.getMtbAart().isFlagQtaCnfFissaBoolean()) {
} else if (UtilityBigDecimal.greaterThan(initialNumCnf, BigDecimal.ONE) && pickingObjectDTO.getMtbAart().isFlagQtaCnfFissaBoolean()) {
initialNumCnf = BigDecimal.ONE;
initialQtaTot = initialNumCnf.multiply(initialQtaCnf);
}
@ -577,7 +590,7 @@ public class AccettazioneBollaPickingViewModel {
}
}
if (!longClick){
if (!longClick) {
this.sendOnItemDispatched(
pickingObjectDTO,
pickingObjectDTO.getMtbAart(),
@ -694,7 +707,7 @@ public class AccettazioneBollaPickingViewModel {
mtbColrToEdit.getDataScadPartita(),
true,
pickedQuantityDTO -> {
if(pickedQuantityDTO == null)
if (pickedQuantityDTO == null)
return;
this.saveEditedRow(mtbColrToEdit,
@ -809,7 +822,7 @@ public class AccettazioneBollaPickingViewModel {
int listCount = pickingList != null ? pickingList.size() : 0;
int anomalie = listCount > 0 ? listCount - mtbColr.size() : 0;
if (anomalie == 0){
if (anomalie == 0) {
closeUdc(closeUDCRequestDTO);
} else {
onConfirmAnomalie(anomalie, canBeClose -> {
@ -824,7 +837,7 @@ public class AccettazioneBollaPickingViewModel {
}, this::sendError);
}
private void closeUdc(CloseUDCRequestDTO closeUDCRequestDTO){
private void closeUdc(CloseUDCRequestDTO closeUDCRequestDTO) {
mColliCaricoRESTConsumer.closeUDC(closeUDCRequestDTO, closeUDCResponse -> {
Runnable onVersamentoCompleted = () -> {
@ -1060,7 +1073,7 @@ public class AccettazioneBollaPickingViewModel {
return this;
}
private void onConfirmAnomalie(int anomalie, RunnableArgs<Boolean> onConfirm){
private void onConfirmAnomalie(int anomalie, RunnableArgs<Boolean> onConfirm) {
if (this.mListener != null) mListener.onConfirmAnomalie(anomalie, onConfirm);
}

View File

@ -30,7 +30,6 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILUBaseOperationsListener;
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
import it.integry.integrywmsnative.core.model.CommonModelConsts;
import it.integry.integrywmsnative.core.model.JtbComt;
import it.integry.integrywmsnative.core.model.MtbAart;
import it.integry.integrywmsnative.core.model.MtbColr;
@ -40,6 +39,7 @@ import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
import it.integry.integrywmsnative.core.model.VtbDest;
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
@ -56,7 +56,10 @@ import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.Magazzin
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
@ -619,42 +622,25 @@ public class PickingLiberoViewModel {
public void saveNewRow(PickingObjectDTO pickingObjectDTO, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) throws Exception {
final MtbColr mtbColr = new MtbColr()
.setCodMart(pickingObjectDTO.getMtbAart().getCodMart())
.setPartitaMag(partitaMag)
.setDataScadPartita(dataScad)
.setQtaCol(qtaTot)
.setQtaCnf(qtaCnf)
.setNumCnf(numCnf)
.setDescrizione(pickingObjectDTO.getMtbAart().getDescrizioneEstesa())
.setDatetimeRow(UtilityDate.getDateInstance())
.setCodJcom(this.mDefaultCommessa.getCodJcom());
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.UPDATE);
cloneMtbColt.setMtbColr(new ObservableArrayList<>());
cloneMtbColt.getMtbColr().add((MtbColr) mtbColr.clone());
if (UtilityBigDecimal.equalsTo(numCnf, BigDecimal.ZERO) && UtilityBigDecimal.equalsTo(qtaTot, BigDecimal.ZERO)) {
this.sendOnLoadingEnded();
return;
}
var value = mColliMagazzinoRESTConsumer.saveColloSynchronized(cloneMtbColt);
var insertUdsRowRequest = new InsertUDSRowRequestDTO()
.setCodMart(pickingObjectDTO.getMtbAart().getCodMart())
.setPartitaMag(partitaMag)
.setDataScad(dataScad)
.setQtaTot(qtaTot)
.setQtaCnf(qtaCnf)
.setNumCnf(numCnf)
.setCodJcom(this.mDefaultCommessa.getCodJcom())
.setTargetMtbColt(mCurrentMtbColt.clone(false));
mtbColr
.setDataCollo(value.getDataColloS())
.setNumCollo(value.getNumCollo())
.setGestione(value.getGestione())
.setSerCollo(value.getSerCollo())
.setRiga(value.getMtbColr().get(value.getMtbColr().size() - 1).getRiga())
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
.setMtbAart(pickingObjectDTO.getMtbAart());
MtbColr savedMtbColr = mColliScaricoRESTConsumer.insertUDSRowSynchronized(insertUdsRowRequest);
savedMtbColr.setMtbAart(pickingObjectDTO.getMtbAart());
mCurrentMtbColt.getMtbColr().add(mtbColr);
mCurrentMtbColt.getMtbColr().add(savedMtbColr);
this.sendOnRowSaved();
@ -662,6 +648,41 @@ public class PickingLiberoViewModel {
}
private void executeDepositChangeIfNeeded(MtbColt refMtbColt) throws Exception {
//Considero solo la prima UDC scansionata
boolean shouldChangeCodMdep = refMtbColt != null && !refMtbColt.getCodMdep().equalsIgnoreCase(mCurrentMtbColt.getCodMdep()) &&
mCurrentMtbColt.getMtbColr().isEmpty();
String newCodMdep = shouldChangeCodMdep ? refMtbColt.getCodMdep() : null;
if (shouldChangeCodMdep) {
mColliMagazzinoRESTConsumer.spostaUlSynchronized(mCurrentMtbColt, newCodMdep, null, false);
mCurrentMtbColt.setCodMdep(newCodMdep);
}
}
private void executeTipoUlChangeIfNeeded(MtbColt refMtbColt) throws Exception {
boolean shouldChangeCodTcol = refMtbColt != null && refMtbColt.getCodTcol() != null &&
!refMtbColt.getCodTcol().equalsIgnoreCase(mCurrentMtbColt.getCodTcol()) &&
mCurrentMtbColt.getMtbColr().isEmpty();
String newTipoUL = shouldChangeCodTcol ? refMtbColt.getCodTcol() : null;
ObservableMtbTcol newMtbTcol = SettingsManager.iDB().getInternalImballi().stream()
.filter(x -> x.getCodTcol().equalsIgnoreCase(newTipoUL))
.findFirst()
.orElse(null);
if (!UtilityString.isNullOrEmpty(newTipoUL) && newMtbTcol == null) {
throw new Exception("Impossibile riconoscere il tipo UL " + newTipoUL);
}
if (shouldChangeCodTcol && newMtbTcol != null) {
mColliMagazzinoRESTConsumer.updateTipoULSynchronized(mCurrentMtbColt, newMtbTcol.getCodTcol());
mCurrentMtbColt.setCodTcol(newMtbTcol.getCodTcol());
}
}
private MtbColt loadRifULFromMtbColr(MtbColr mtbColr) throws Exception {
//Se ho dei riferimenti ad una UL devo leggere la QTA ancora disponibile sulla Ul
if (mtbColr != null &&
@ -765,36 +786,25 @@ public class PickingLiberoViewModel {
private void saveEditedRow(MtbColr mtbColrToUpdate, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) throws Exception {
this.sendOnLoadingStarted();
MtbColr mtbColrClone = (MtbColr) mtbColrToUpdate.clone();
mtbColrClone.setMtbAart(null)
.setMtbPartitaMag(null);
MtbColt mtbColt = new MtbColt()
.setNumCollo(mtbColrToUpdate.getNumCollo())
.setDataCollo(mtbColrToUpdate.getDataColloS())
.setSerCollo(mtbColrToUpdate.getSerCollo())
.setGestione(mtbColrToUpdate.getGestione())
.setMtbColr(new ObservableArrayList<>());
mtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
var editUDSRowRequest = new EditUDSRowRequestDTO()
.setSourceMtbColr(mtbColrClone)
.setNewNumCnf(numCnf)
.setNewQtaCnf(qtaCnf)
.setNewQtaTot(qtaTot);
final MtbColr mtbColr = (MtbColr) mtbColrToUpdate.clone();
mtbColr.setOperation(CommonModelConsts.OPERATION.UPDATE);
mtbColr
.setNumCnf(numCnf)
.setQtaCnf(qtaCnf)
.setQtaCol(qtaTot)
.setPartitaMag(partitaMag)
.setDataScadPartita(dataScad)
.setDatetimeRow(UtilityDate.getDateInstance());
mColliScaricoRESTConsumer.editUDSRowSynchronized(editUDSRowRequest);
mtbColt.getMtbColr().add(mtbColr);
var value = this.mColliMagazzinoRESTConsumer.saveColloSynchronized(mtbColt);
mtbColr.setNumCnf(numCnf)
mtbColrToUpdate.setNumCnf(numCnf)
.setQtaCnf(qtaCnf)
.setQtaCol(qtaTot);
handler.post(() -> {
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToUpdate);
this.mCurrentMtbColt.getMtbColr().add(mtbColr);
this.mCurrentMtbColt.getMtbColr().add(mtbColrToUpdate);
});
this.sendOnRowSaved();
@ -807,21 +817,10 @@ public class PickingLiberoViewModel {
if (shouldDelete) {
this.sendOnLoadingStarted();
MtbColt mtbColt = new MtbColt()
.setNumCollo(mtbColrToDelete.getNumCollo())
.setDataCollo(mtbColrToDelete.getDataColloS())
.setSerCollo(mtbColrToDelete.getSerCollo())
.setGestione(mtbColrToDelete.getGestione())
.setMtbColr(new ObservableArrayList<>());
var deleteUdsRowRequest = new DeleteUDSRowRequestDTO()
.setMtbColrToDelete(mtbColrToDelete);
mtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
MtbColr mtbColr = (MtbColr) mtbColrToDelete.clone();
mtbColr.setOperation(CommonModelConsts.OPERATION.DELETE);
mtbColt.getMtbColr().add(mtbColr);
var value = this.mColliMagazzinoRESTConsumer.saveColloSynchronized(mtbColt);
mColliScaricoRESTConsumer.deleteUDSRowSynchronized(deleteUdsRowRequest);
handler.post(() -> {
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);

View File

@ -875,13 +875,14 @@ public class SpedizioneViewModel {
ObservableArrayList<MtbColr> cloneMtbColrs = cloneMtbColt.getMtbColr();
cloneMtbColt.getMtbColr().stream()
var toBeRemoved = cloneMtbColt.getMtbColr().stream()
.filter(x -> !(UtilityString.equalsIgnoreCase(x.getCodMart(), matchedObject.getSitArtOrdDTO().getCodMart()) &&
UtilityString.equalsIgnoreCase(x.getCodTagl(), matchedObject.getSitArtOrdDTO().getCodTagl()) &&
UtilityString.equalsIgnoreCase(x.getCodCol(), matchedObject.getSitArtOrdDTO().getCodCol()) &&
(!mEnableCheckPartitaMag || UtilityString.equalsIgnoreCase(x.getPartitaMag(), matchedObject.getSitArtOrdDTO().getPartitaMag()) ||
UtilityString.isNullOrEmpty(matchedObject.getSitArtOrdDTO().getPartitaMag()))))
.forEach(cloneMtbColrs::remove);
.collect(Collectors.toList());
cloneMtbColrs.removeAll(toBeRemoved);
cloneMtbColt.setMtbColr(cloneMtbColrs);