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 { android {
def appVersionCode = 488 def appVersionCode = 491
def appVersionName = '1.46.00' def appVersionName = '1.46.03'
signingConfigs { signingConfigs {
release { release {

View File

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

View File

@ -305,8 +305,8 @@ public class AccettazioneBollaPickingViewModel {
private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) { private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) {
this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> { this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
if (mtbAartList != null && mtbAartList.size() > 0) { if (mtbAartList != null && !mtbAartList.isEmpty()) {
this.searchArtFromAnag(mtbAartList.get(0), pickData, onComplete); this.searchArtFromAnag(mtbAartList.get(0), pickData, null, onComplete);
} else { } else {
this.manageUnknownBarcode(barcodeProd, onComplete); 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(); final List<PickingObjectDTO> pickingList = mPickingList.getValue();
List<PickingObjectDTO> matchPickingObject = Stream.of(pickingList) List<PickingObjectDTO> matchPickingObject = pickingList == null ? new ArrayList<>() :
pickingList.stream()
.filter(x -> UtilityString.equalsIgnoreCase(mtbAart.getCodMart(), x.getSitBollaAccettazione().getCodMart())) .filter(x -> UtilityString.equalsIgnoreCase(mtbAart.getCodMart(), x.getSitBollaAccettazione().getCodMart()))
.toList(); .collect(Collectors.toList());
for (PickingObjectDTO pickingObjectDTO : matchPickingObject) { for (PickingObjectDTO pickingObjectDTO : matchPickingObject) {
pickingObjectDTO.setTempPickData(pickData); pickingObjectDTO.setTempPickData(pickData);
} }
this.loadMatchedRows(matchPickingObject, mtbAart, pickData); this.loadMatchedRows(matchPickingObject, mtbAart, pickData, previousSearchedArts);
onComplete.run(); 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()) { if (matchedRows == null || matchedRows.isEmpty()) {
this.sendOnLoadingStarted();
this.mArticoloRESTConsumer.findIfIsKit(mtbAart, mtbAartFind -> { this.mArticoloRESTConsumer.findIfIsKit(mtbAart, mtbAartFind -> {
this.sendOnLoadingEnded();
if (mtbAartFind == null) { if (mtbAartFind == null) {
manageNoArtFound(mtbAart, pickDataDTO); manageNoArtFound(mtbAart, pickDataDTO);
} else { } else {
searchArtFromAnag(mtbAartFind, pickDataDTO, () -> {}); searchArtFromAnag(mtbAartFind, pickDataDTO, previousSearchedArts, () -> {
});
} }
}, this::sendError); }, this::sendError);
} else if (matchedRows.size() == 1) { } else if (matchedRows.size() == 1) {

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.expansion.RunnableArgss;
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILUBaseOperationsListener; import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILUBaseOperationsListener;
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener; 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.JtbComt;
import it.integry.integrywmsnative.core.model.MtbAart; import it.integry.integrywmsnative.core.model.MtbAart;
import it.integry.integrywmsnative.core.model.MtbColr; 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.VtbDest;
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO; import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
import it.integry.integrywmsnative.core.model.dto.PickDataDTO; 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.model.secondary.GestioneEnum;
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;
@ -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.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO; 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.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.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.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityBarcode; import it.integry.integrywmsnative.core.utility.UtilityBarcode;
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal; 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 { 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)) { if (UtilityBigDecimal.equalsTo(numCnf, BigDecimal.ZERO) && UtilityBigDecimal.equalsTo(qtaTot, BigDecimal.ZERO)) {
this.sendOnLoadingEnded(); this.sendOnLoadingEnded();
return; 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 MtbColr savedMtbColr = mColliScaricoRESTConsumer.insertUDSRowSynchronized(insertUdsRowRequest);
.setDataCollo(value.getDataColloS()) savedMtbColr.setMtbAart(pickingObjectDTO.getMtbAart());
.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());
mCurrentMtbColt.getMtbColr().add(mtbColr); mCurrentMtbColt.getMtbColr().add(savedMtbColr);
this.sendOnRowSaved(); 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 { private MtbColt loadRifULFromMtbColr(MtbColr mtbColr) throws Exception {
//Se ho dei riferimenti ad una UL devo leggere la QTA ancora disponibile sulla Ul //Se ho dei riferimenti ad una UL devo leggere la QTA ancora disponibile sulla Ul
if (mtbColr != null && 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 { private void saveEditedRow(MtbColr mtbColrToUpdate, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) throws Exception {
this.sendOnLoadingStarted(); this.sendOnLoadingStarted();
MtbColr mtbColrClone = (MtbColr) mtbColrToUpdate.clone();
mtbColrClone.setMtbAart(null)
.setMtbPartitaMag(null);
MtbColt mtbColt = new MtbColt() var editUDSRowRequest = new EditUDSRowRequestDTO()
.setNumCollo(mtbColrToUpdate.getNumCollo()) .setSourceMtbColr(mtbColrClone)
.setDataCollo(mtbColrToUpdate.getDataColloS()) .setNewNumCnf(numCnf)
.setSerCollo(mtbColrToUpdate.getSerCollo()) .setNewQtaCnf(qtaCnf)
.setGestione(mtbColrToUpdate.getGestione()) .setNewQtaTot(qtaTot);
.setMtbColr(new ObservableArrayList<>());
mtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
final MtbColr mtbColr = (MtbColr) mtbColrToUpdate.clone(); mColliScaricoRESTConsumer.editUDSRowSynchronized(editUDSRowRequest);
mtbColr.setOperation(CommonModelConsts.OPERATION.UPDATE);
mtbColr
.setNumCnf(numCnf)
.setQtaCnf(qtaCnf)
.setQtaCol(qtaTot)
.setPartitaMag(partitaMag)
.setDataScadPartita(dataScad)
.setDatetimeRow(UtilityDate.getDateInstance());
mtbColt.getMtbColr().add(mtbColr); mtbColrToUpdate.setNumCnf(numCnf)
var value = this.mColliMagazzinoRESTConsumer.saveColloSynchronized(mtbColt);
mtbColr.setNumCnf(numCnf)
.setQtaCnf(qtaCnf) .setQtaCnf(qtaCnf)
.setQtaCol(qtaTot); .setQtaCol(qtaTot);
handler.post(() -> { handler.post(() -> {
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToUpdate); this.mCurrentMtbColt.getMtbColr().remove(mtbColrToUpdate);
this.mCurrentMtbColt.getMtbColr().add(mtbColr); this.mCurrentMtbColt.getMtbColr().add(mtbColrToUpdate);
}); });
this.sendOnRowSaved(); this.sendOnRowSaved();
@ -807,21 +817,10 @@ public class PickingLiberoViewModel {
if (shouldDelete) { if (shouldDelete) {
this.sendOnLoadingStarted(); this.sendOnLoadingStarted();
MtbColt mtbColt = new MtbColt() var deleteUdsRowRequest = new DeleteUDSRowRequestDTO()
.setNumCollo(mtbColrToDelete.getNumCollo()) .setMtbColrToDelete(mtbColrToDelete);
.setDataCollo(mtbColrToDelete.getDataColloS())
.setSerCollo(mtbColrToDelete.getSerCollo())
.setGestione(mtbColrToDelete.getGestione())
.setMtbColr(new ObservableArrayList<>());
mtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP); mColliScaricoRESTConsumer.deleteUDSRowSynchronized(deleteUdsRowRequest);
MtbColr mtbColr = (MtbColr) mtbColrToDelete.clone();
mtbColr.setOperation(CommonModelConsts.OPERATION.DELETE);
mtbColt.getMtbColr().add(mtbColr);
var value = this.mColliMagazzinoRESTConsumer.saveColloSynchronized(mtbColt);
handler.post(() -> { handler.post(() -> {
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete); this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);

View File

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