Compare commits

...

10 Commits

Author SHA1 Message Date
fb6a68e6d4 Merge branch 'feature/RefactoringGestioneColli' into master-beta
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-12-09 13:33:01 +01:00
fd15235e6e Merge branch 'develop' into feature/RefactoringGestioneColli 2025-12-09 13:32:38 +01:00
a88ddab405 Finish v1.50.00(549) 2025-12-09 13:32:22 +01:00
9fb18215e3 Finish v1.50.00(549)
All checks were successful
WMS - Android (New)/pipeline/head This commit looks good
2025-12-09 13:32:21 +01:00
2e3af6d1b3 -> v1.50.00 (549) 2025-12-09 13:32:09 +01:00
ac38aaeea7 Merge branch 'develop' into feature/RefactoringGestioneColli 2025-12-09 13:22:56 +01:00
ade18170ee Completati controlli anomalie ul 2025-12-09 13:09:22 +01:00
cc89441f0a Gestite anomalie ul in VersamentoMerce e Spedizione 2025-12-09 12:34:13 +01:00
f612e1c402 Iniziato refactor servizio getColloByBarcode per mostrare le anomalie ul 2025-12-09 11:04:39 +01:00
663d172edf Aggiornato AGP 8.13.1 2025-12-05 17:30:32 +01:00
29 changed files with 414 additions and 146 deletions

View File

@@ -11,8 +11,8 @@ apply plugin: 'com.google.gms.google-services'
android {
def appVersionCode = 548
def appVersionName = '1.49.04'
def appVersionCode = 549
def appVersionName = '1.50.00'
signingConfigs {
release {

View File

@@ -0,0 +1,9 @@
package it.integry.integrywmsnative.core.exception;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
public class AnomaliaUlException extends RuntimeException {
public AnomaliaUlException(GetColloInGiacResponseDTO colloInGiac) {
super(String.format("%s: %s", colloInGiac.getDescrizioneLivelloAnomalia(), colloInGiac.getDescrizioneAnomalia()));
}
}

View File

@@ -117,6 +117,18 @@ public class MtbColt extends EntityBase {
@SerializedName("ragSocCliente")
private String ragSocCliente;
@SerializedName("descrizioneAnomalia")
private String descrizioneAnomalia;
@SerializedName("descrizioneLivelloAnomalia")
private String descrizioneLivelloAnomalia;
@SerializedName("escludiPickingVendita")
private Boolean escludiPickingVendita;
@SerializedName("escludiPickingLavorazione")
private Boolean escludiPickingLavorazione;
@SerializedName("mtbColr")
private ObservableArrayList<MtbColr> mtbColr = new ObservableArrayList<>();
@@ -595,6 +607,42 @@ public class MtbColt extends EntityBase {
return this;
}
public String getDescrizioneAnomalia() {
return descrizioneAnomalia;
}
public MtbColt setDescrizioneAnomalia(String descrizioneAnomalia) {
this.descrizioneAnomalia = descrizioneAnomalia;
return this;
}
public String getDescrizioneLivelloAnomalia() {
return descrizioneLivelloAnomalia;
}
public MtbColt setDescrizioneLivelloAnomalia(String descrizioneLivelloAnomalia) {
this.descrizioneLivelloAnomalia = descrizioneLivelloAnomalia;
return this;
}
public Boolean getEscludiPickingVendita() {
return escludiPickingVendita;
}
public MtbColt setEscludiPickingVendita(Boolean escludiPickingVendita) {
this.escludiPickingVendita = escludiPickingVendita;
return this;
}
public Boolean getEscludiPickingLavorazione() {
return escludiPickingLavorazione;
}
public MtbColt setEscludiPickingLavorazione(Boolean escludiPickingLavorazione) {
this.escludiPickingLavorazione = escludiPickingLavorazione;
return this;
}
public String getCodJcom() {
return codJcom;
}

View File

@@ -41,6 +41,7 @@ import it.integry.integrywmsnative.core.rest.model.UpdateDepositoULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.UpdatePosizioneULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.PrintULRequestDTO;
@@ -265,55 +266,53 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
saveCollo(mtbColtToCreate, onComplete, onFailed);
}
public List<MtbColt> getBySsccListSynchronized(List<String> ssccList, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
if (ssccList == null || ssccList.isEmpty()) {
return null;
}
public List<GetColloInGiacResponseDTO> getBySsccListSynchronized(List<String> ssccList, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
if (ssccList == null || ssccList.isEmpty()) return null;
var requestData = new GetColliByBarcodesRequestDTO() {{
setBarcodes(ssccList);
setOnlyResiduo(onlyResiduo);
}};
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
var colloResponse = colliMagazzinoRESTConsumerService.getColliByBarcodes(requestData, throwExcIfNull)
.execute();
var mtbColts = analyzeAnswer(colloResponse, "GetBySSCCList");
var listResponseDto = analyzeAnswer(colloResponse, "GetBySSCCList");
if(mtbColts == null || mtbColts.isEmpty()) {
if (throwExcIfNull) {
if (listResponseDto == null || listResponseDto.isEmpty()) {
if (throwExcIfNull)
throw new Exception("Nessun collo trovato per i codici SSCC forniti");
}
return Collections.emptyList();
}
fillMtbAartsOfMtbColrsSynchronized(mtbColts.stream()
.flatMap(x -> x.getMtbColr().stream())
.collect(Collectors.toList()));
fillMtbAartsOfMtbColrsSynchronized(
listResponseDto.stream()
.flatMap(x -> x.getMtbColt().getMtbColr().stream())
.collect(Collectors.toList())
);
return mtbColts;
return listResponseDto;
}
public MtbColt getBySsccSynchronized(String ssccString, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
public GetColloInGiacResponseDTO getBySsccSynchronized(String ssccString, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
var colloResponse = colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull)
.execute();
var mtbColt = analyzeAnswer(colloResponse, "GetBySSCC");
var responseDto = analyzeAnswer(colloResponse, "GetBySSCC");
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
if (responseDto != null && responseDto.getMtbColt().getMtbColr() != null && !responseDto.getMtbColt().getMtbColr().isEmpty()) {
List<MtbColt> mtbColtList = new ArrayList<>();
mtbColtList.add(mtbColt);
mtbColtList.add(responseDto.getMtbColt());
var mtbColts = fillMtbAartsOfMtbColtsSynchronized(mtbColtList);
return mtbColts.get(0);
responseDto.setMtbColt(mtbColts.get(0));
}
return mtbColt;
return responseDto;
}
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<GetColloInGiacResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var mtbColt = getBySsccSynchronized(ssccString, onlyResiduo, throwExcIfNull);
@@ -367,7 +366,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
List<MtbAart> artList = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
if(artList == null )
if (artList == null)
artList = new ArrayList<>();
Map<String, MtbAart> mtbAartsMap = artList.parallelStream()

View File

@@ -14,6 +14,7 @@ import it.integry.integrywmsnative.core.rest.model.UpdateDepositoULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.UpdatePosizioneULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteULRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.PrintULRequestDTO;
@@ -26,10 +27,10 @@ import retrofit2.http.Query;
public interface ColliMagazzinoRESTConsumerService {
@POST("getColliByBarcodes")
Call<ServiceRESTResponse<List<MtbColt>>> getColliByBarcodes(@Body GetColliByBarcodesRequestDTO requestData, @Query("throwExcIfNull") boolean throwExcIfNull);
Call<ServiceRESTResponse<List<GetColloInGiacResponseDTO>>> getColliByBarcodes(@Body GetColliByBarcodesRequestDTO requestData, @Query("throwExcIfNull") boolean throwExcIfNull);
@POST("getColloByBarcode")
Call<ServiceRESTResponse<MtbColt>> getColloByBarcode(@Query("codBarreCollo") String sscc, @Query("onlyResiduo") boolean onlyResiduo, @Query("throwExcIfNull") boolean throwExcIfNull);
Call<ServiceRESTResponse<GetColloInGiacResponseDTO>> getColloByBarcode(@Query("codBarreCollo") String sscc, @Query("onlyResiduo") boolean onlyResiduo, @Query("throwExcIfNull") boolean throwExcIfNull);
@GET("getColliInBasket")
Call<ServiceRESTResponse<List<MtbColt>>> getColliInBasket(@Query("codMdep") String codMdep);

View File

@@ -0,0 +1,75 @@
package it.integry.integrywmsnative.core.rest.model.giacenza;
import com.google.gson.annotations.SerializedName;
import it.integry.integrywmsnative.core.model.MtbColt;
public class GetColloInGiacResponseDTO {
@SerializedName("mtbColt")
private MtbColt mtbColt;
@SerializedName("descrizioneAnomalia")
private String descrizioneAnomalia;
@SerializedName("descrizioneLivelloAnomalia")
private String descrizioneLivelloAnomalia;
@SerializedName("escludiPickingVendita")
private Boolean escludiPickingVendita;
@SerializedName("escludiPickingLavorazione")
private Boolean escludiPickingLavorazione;
public MtbColt getMtbColt() {
return mtbColt;
}
public GetColloInGiacResponseDTO setMtbColt(MtbColt mtbColt) {
this.mtbColt = mtbColt;
return this;
}
public String getMessageAnomalia() {
if (getDescrizioneAnomalia() == null && getDescrizioneLivelloAnomalia() == null)
return null;
return String.format("<b>%s:</b> %s", getDescrizioneLivelloAnomalia(), getDescrizioneAnomalia());
}
public String getDescrizioneAnomalia() {
return descrizioneAnomalia;
}
public GetColloInGiacResponseDTO setDescrizioneAnomalia(String descrizioneAnomalia) {
this.descrizioneAnomalia = descrizioneAnomalia;
return this;
}
public String getDescrizioneLivelloAnomalia() {
return descrizioneLivelloAnomalia;
}
public GetColloInGiacResponseDTO setDescrizioneLivelloAnomalia(String descrizioneLivelloAnomalia) {
this.descrizioneLivelloAnomalia = descrizioneLivelloAnomalia;
return this;
}
public Boolean getEscludiPickingVendita() {
return escludiPickingVendita;
}
public GetColloInGiacResponseDTO setEscludiPickingVendita(Boolean escludiPickingVendita) {
this.escludiPickingVendita = escludiPickingVendita;
return this;
}
public Boolean getEscludiPickingLavorazione() {
return escludiPickingLavorazione;
}
public GetColloInGiacResponseDTO setEscludiPickingLavorazione(Boolean escludiPickingLavorazione) {
this.escludiPickingLavorazione = escludiPickingLavorazione;
return this;
}
}

View File

@@ -202,9 +202,9 @@ public class AccettazioneBollaPickingViewModel {
}
private void executeEtichettaAnonimaNotOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), true, false, mtbColt -> {
mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), true, false, response -> {
if (mtbColt == null) {
if (response.getMtbColt() == null) {
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
this.sendError(new NotCurrentYearLUException());
} else {

View File

@@ -271,9 +271,9 @@ public class AccettazioneOrdiniPickingViewModel {
}
private void executeEtichettaAnonimaNotOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), true, false, mtbColt -> {
mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), true, false, response -> {
if (mtbColt == null) {
if (response.getMtbColt() == null) {
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
this.sendError(new NotCurrentYearLUException());
} else {

View File

@@ -16,6 +16,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
public class ListaBancaliViewModel {
@@ -57,7 +58,8 @@ public class ListaBancaliViewModel {
.map(MtbColt::getBarcodeUl)
.collect(Collectors.toUnmodifiableList());
return mColliMagazzinoRESTConsumer.getBySsccListSynchronized(ssccList, onlyResiduo, false);
var bySsccListSynchronized = mColliMagazzinoRESTConsumer.getBySsccListSynchronized(ssccList, onlyResiduo, false);
return bySsccListSynchronized.stream().map(GetColloInGiacResponseDTO::getMtbColt).toList();
}
private void sendOnLoadingStarted() {

View File

@@ -209,7 +209,8 @@ public class OrdiniUscitaElencoViewModel {
private void executeEtichettaLU(String SSCC, RunnableArgs<List<OrdiniUscitaElencoDTO>> onComplete) {
this.mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
this.mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, response -> {
var mtbColt = response.getMtbColt();
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {

View File

@@ -4,6 +4,7 @@ package it.integry.integrywmsnative.gest.picking_libero;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.text.Html;
import android.text.SpannableString;
import android.view.LayoutInflater;
import android.view.View;
@@ -325,6 +326,15 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
});
}
@Override
public void onWarning(String warningText, Runnable action) {
handler.post(() -> {
DialogSimpleMessageView
.makeWarningDialog(getContext(), new SpannableString(Html.fromHtml(warningText)), null, action)
.show();
});
}
@Override
public void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort) {
DialogAskClienteView.newInstance(onComplete, onAbort)

View File

@@ -20,6 +20,7 @@ import javax.inject.Inject;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
import it.integry.integrywmsnative.core.exception.AnomaliaUlException;
import it.integry.integrywmsnative.core.exception.InvalidCodMdepException;
import it.integry.integrywmsnative.core.exception.InvalidPositionException;
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
@@ -53,6 +54,7 @@ import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemRequestDTO;
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
@@ -190,7 +192,7 @@ public class PickingLiberoViewModel {
if (foundPosizione.isMagazzinoAutomatico()) {
//Eseguo picking da magazzino automatico
this.executeMagazzinoAutomatico(foundPosizione);
} else if(foundPosizione.isFlagMonoCollo()) {
} else if (foundPosizione.isFlagMonoCollo()) {
this.executePosizioneMonoUL(foundPosizione, null);
} else
throw new InvalidPositionException("impossibile gestire una posizione non MONO-UL in fase di picking");
@@ -243,7 +245,9 @@ public class PickingLiberoViewModel {
throw new NoLUFoundException();
}
} else if (barcodeUlInPosizione.size() == 1) {
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizione.get(0), true, false);
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizione.get(0), true, false);
this.checkAnomalieUl(response);
var mtbColt = response.getMtbColt();
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableDepos())
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
@@ -264,7 +268,9 @@ public class PickingLiberoViewModel {
}
private void executeEtichettaLU(String sscc) throws Exception {
var mtbColtScanned = mColliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
this.checkAnomalieUl(response);
var mtbColtScanned = response.getMtbColt();
if (mtbColtScanned == null) {
throw new NoLUFoundException();
@@ -694,12 +700,9 @@ public class PickingLiberoViewModel {
!UtilityString.isNullOrEmpty(mtbColr.getDataColloRifS()) &&
mtbColr.getNumColloRif() != null) {
MtbColt mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(
mtbColr.getBarcodeUlOut(),
true,
false);
return mtbColt;
return mColliMagazzinoRESTConsumer.getBySsccSynchronized(
mtbColr.getBarcodeUlOut(), true, false
).getMtbColt();
}
return null;
@@ -894,6 +897,16 @@ public class PickingLiberoViewModel {
this.mCurrentMtbColt = null;
}
private void checkAnomalieUl(GetColloInGiacResponseDTO colloInGiac) {
if (colloInGiac.getEscludiPickingVendita() && mDefaultGestione == GestioneEnum.VENDITA) {
this.sendError(new AnomaliaUlException(colloInGiac));
} else if (colloInGiac.getEscludiPickingLavorazione() && mDefaultGestione == GestioneEnum.LAVORAZIONE) {
this.sendError(new AnomaliaUlException(colloInGiac));
} else {
this.onWarning(colloInGiac.getMessageAnomalia(), () -> {
});
}
}
private void sendOnLoadingStarted() {
if (this.mListener != null) mListener.onLoadingStarted();
@@ -1042,15 +1055,20 @@ public class PickingLiberoViewModel {
if (this.mListener != null) mListener.onRowSaved();
}
private void onWarning(String warningText, Runnable action) {
if (this.mListener != null) mListener.onWarning(warningText, action);
}
public PickingLiberoViewModel setListener(Listener listener) {
this.mListener = listener;
return this;
}
public interface Listener extends ILoadingListener, ILUBaseOperationsListener {
void onError(Exception ex);
void onWarning(String warningText, Runnable action);
void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort);
void onLULineaProdRequired(RunnableArgs<DialogAskLineaProdResponse> onComplete, Runnable onAbort);

View File

@@ -304,7 +304,7 @@ public class PickingResiViewModel {
private void executeEtichettaAnonimaNotOpenedLU(BarcodeScanDTO barcodeScanDTO) throws Exception {
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeScanDTO.getStringValue(), true, false);
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeScanDTO.getStringValue(), true, false).getMtbColt();
if (mtbColt == null) {
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
@@ -328,9 +328,7 @@ public class PickingResiViewModel {
}
private void executeEtichettaLU(String SSCC) throws Exception {
MtbColt mtbColt = null;
mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false).getMtbColt();
if (mTipologiaReso == Tipologia.VENDITA) {
//Leggere i colli in cui ho barcode_ul_out uguale a SSCC scansionato (nel caso di reso da cliente)

View File

@@ -55,7 +55,8 @@ public class ProdDettaglioLineaViewModel {
}
private void handleSSCCBarcode(String sscc, Runnable onComplete) {
this.colliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, mtbColt -> {
this.colliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, response -> {
var mtbColt = response.getMtbColt();
if (mtbColt == null) {
this.sendError(new NoLUFoundException());
@@ -177,7 +178,7 @@ public class ProdDettaglioLineaViewModel {
mBarcodeRESTConsumer.decodeEan128(dto, (ean128) -> {
String codMart = ean128.Internal1;
String partitaMag = ean128.BatchLot;
if(prodLine == null) {
if (prodLine == null) {
this.sendError(new Exception("Impossibile leggere lo stato della linea"));
} else if (!prodLine.isStarted()) {

View File

@@ -89,7 +89,7 @@ public class ProdRecuperoMaterialeViewModel {
this.sendOnLoadingStarted();
Ean128Model ean128Model = this.mBarcodeRESTConsumer.decodeEan128Synchronized(barcodeScanDTO);
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(ean128Model.Sscc, true, false);
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(ean128Model.Sscc, true, false).getMtbColt();
this.sendOnLoadingEnded();
@@ -147,8 +147,6 @@ public class ProdRecuperoMaterialeViewModel {
}
public void onItemDispatched(HistoryVersamentoProdULDTO item, PickedQuantityDTO pickedQuantityDTO, MtbColt sourceMtbColt) {
mExecutorService.execute(() -> {
MtbColt mtbColt = sourceMtbColt;

View File

@@ -3,6 +3,8 @@ package it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.text.Html;
import android.text.SpannableString;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -48,6 +50,7 @@ import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
import it.integry.integrywmsnative.ui.filter_chips.FilterChipView;
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLUView;
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
public class ProdRiposizionamentoDaProdFragment extends BaseFragment implements ISearchableFragment, ITitledFragment, ProdRiposizionamentoDaProdViewModel.Listener {
@@ -362,4 +365,14 @@ public class ProdRiposizionamentoDaProdFragment extends BaseFragment implements
public void onDataSaved() {
mHandler.postDelayed(mRunnable, mInterval);
}
@Override
public void onWarning(String warningText, Runnable action) {
handler.post(() -> {
DialogSimpleMessageView
.makeWarningDialog(requireContext(),
new SpannableString(Html.fromHtml(warningText)), null, action)
.show();
});
}
}

View File

@@ -102,11 +102,16 @@ public class ProdRiposizionamentoDaProdViewModel {
}
private void executeEtichettaLU(String sscc, boolean isAnonima, Runnable onComplete) {
this.mColliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, mtbColt -> {
this.mColliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, response -> {
var mtbColt = response.getMtbColt();
if (mtbColt == null && !isAnonima) {
this.mSoundAlertService.warning();
this.sendError(new NoLUFoundException());
} else {
if (response.getDescrizioneAnomalia() != null)
this.onWarning(response.getMessageAnomalia(), () -> {});
List<MvwSitArtUdcDetInventario> mvwSitArtUdcDetInventario = Stream.of(Objects.requireNonNull(itemsInventario.getValue()))
.flatMap(item -> Stream.of(item.getMvwSitArtUdcDetInventarioDTO()))
.toList();
@@ -312,10 +317,16 @@ public class ProdRiposizionamentoDaProdViewModel {
this.mListener = listener;
}
public void onWarning(String warningText, Runnable action) {
if (this.mListener != null) mListener.onWarning(warningText, action);
}
public interface Listener extends ILoadingListener {
void onError(Exception ex);
void onWarning(String warningText, Runnable action);
void onInventoriesLoadingStarted();
void onInventoriesLoadingEnded();

View File

@@ -16,6 +16,7 @@ import java.util.concurrent.atomic.AtomicReference;
import javax.inject.Inject;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.integrywmsnative.core.exception.AnomaliaUlException;
import it.integry.integrywmsnative.core.exception.InvalidCodMdepException;
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
@@ -35,6 +36,7 @@ import it.integry.integrywmsnative.core.rest.consumers.MaterialiRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.core.rest.model.materiali.VersaMaterialiRequestDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
@@ -115,7 +117,9 @@ public class ProdVersamentoMaterialeViewModel {
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty()) {
throw new NoLUFoundException();
} else if (barcodeUlInPosizioneList.size() == 1) {
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
this.checkAnomaliaUl(response);
var mtbColt = response.getMtbColt();
boolean codMdepIsValid = SettingsManager.iDB().getAvailableDepos().stream()
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
@@ -131,7 +135,9 @@ public class ProdVersamentoMaterialeViewModel {
private void executeEtichettaLU(String sscc) throws Exception {
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
this.checkAnomaliaUl(response);
var mtbColt = response.getMtbColt();
boolean codMdepIsValid = SettingsManager.iDB().getAvailableDepos().stream()
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
@@ -419,6 +425,14 @@ public class ProdVersamentoMaterialeViewModel {
}, this::sendError);
}
private void checkAnomaliaUl(GetColloInGiacResponseDTO colloInGiac) {
if (colloInGiac.getEscludiPickingLavorazione()) {
this.sendError(new AnomaliaUlException(colloInGiac));
} else {
this.sendWarning(colloInGiac.getMessageAnomalia(), () -> {
});
}
}
public MutableLiveData<MtbColt> getMtbColtMutableLiveData() {
return mtbColtMutableLiveData;

View File

@@ -774,12 +774,12 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
public void addExtraItem() {
handler.post(() -> {
DialogScanArtView
.newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, mtbColt) -> {
.newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, colloInGiac) -> {
if (status == DialogConsts.Results.YES) {
executorService.execute(() -> {
try {
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColt);
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, colloInGiac);
} catch (Exception e) {
onError(e);
}
@@ -1033,6 +1033,15 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
});
}
@Override
public void onWarning(String warningText, Runnable action) {
handler.post(() -> {
DialogSimpleMessageView
.makeWarningDialog(this, new SpannableString(Html.fromHtml(warningText)), null, action)
.show();
});
}
@Override
public void onFullItemDispatched(PickingObjectDTO pickingObjectDTO,
MtbAart mtbAart,

View File

@@ -27,6 +27,7 @@ import javax.inject.Inject;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.integrywmsnative.core.CommonConst;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
import it.integry.integrywmsnative.core.exception.AnomaliaUlException;
import it.integry.integrywmsnative.core.exception.EmptyLUException;
import it.integry.integrywmsnative.core.exception.InvalidCodMdepException;
import it.integry.integrywmsnative.core.exception.InvalidLUException;
@@ -71,9 +72,11 @@ import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRE
import it.integry.integrywmsnative.core.rest.model.CriterioDistribuzioneEnum;
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
import it.integry.integrywmsnative.core.rest.model.GetColliByBarcodesRequestDTO;
import it.integry.integrywmsnative.core.rest.model.LoadColliDTO;
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.core.rest.model.imballi.ImballoQuantityDTO;
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemRequestDTO;
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
@@ -615,7 +618,9 @@ public class SpedizioneViewModel {
throw new NoLUFoundException();
}
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
this.checkAnomaliaUl(response);
var mtbColt = response.getMtbColt();
if (mtbColt.getSegno() != mDefaultSegnoCol) {
throw new InvalidLUException();
@@ -660,7 +665,9 @@ public class SpedizioneViewModel {
private void executeEtichettaAnonimaNotOpenedLU(BarcodeScanDTO barcodeScanDTO) throws Exception {
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeScanDTO.getStringValue(), true, false);
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeScanDTO.getStringValue(), true, false);
this.checkAnomaliaUl(response);
var mtbColt = response.getMtbColt();
if (mtbColt == null) {
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
@@ -710,7 +717,9 @@ public class SpedizioneViewModel {
throw new NoLUFoundException();
}
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
this.checkAnomaliaUl(response);
var mtbColt = response.getMtbColt();
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
@@ -727,7 +736,9 @@ public class SpedizioneViewModel {
}
private void executeEtichettaLU(String SSCC) throws Exception {
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
this.checkAnomaliaUl(response);
var mtbColt = response.getMtbColt();
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
if (mtbColt.getSegno() != -1) {
@@ -896,10 +907,10 @@ public class SpedizioneViewModel {
for (PickingObjectDTO pickingObject : pickingList) {
//Da verificare se il controllo per partita deve essere sempre effettuato
if (UtilityString.equalsIgnoreCase(x.getCodMart(), pickingObject.getSitArtOrdDTO().getCodMart()) &&
UtilityString.equalsIgnoreCase(x.getCodTagl(), pickingObject.getSitArtOrdDTO().getCodTagl()) &&
UtilityString.equalsIgnoreCase(x.getCodCol(), pickingObject.getSitArtOrdDTO().getCodCol()) &&
(!mEnableCheckPartitaMag || UtilityString.equalsIgnoreCase(x.getPartitaMag(), pickingObject.getSitArtOrdDTO().getPartitaMag()) || UtilityString.isNullOrEmpty(pickingObject.getSitArtOrdDTO().getPartitaMag()))) {
if (UtilityString.equalsIgnoreCase(x.getCodMart(), pickingObject.getSitArtOrdDTO().getCodMart()) &&
UtilityString.equalsIgnoreCase(x.getCodTagl(), pickingObject.getSitArtOrdDTO().getCodTagl()) &&
UtilityString.equalsIgnoreCase(x.getCodCol(), pickingObject.getSitArtOrdDTO().getCodCol()) &&
(!mEnableCheckPartitaMag || UtilityString.equalsIgnoreCase(x.getPartitaMag(), pickingObject.getSitArtOrdDTO().getPartitaMag()) || UtilityString.isNullOrEmpty(pickingObject.getSitArtOrdDTO().getPartitaMag()))) {
if (!matchPickingObject.contains(pickingObject)) {
matchPickingObject.add(pickingObject);
@@ -1282,7 +1293,8 @@ public class SpedizioneViewModel {
return !stati.isEmpty() ? stati.get(0) : null;
}
public void dispatchExtraItem(MtbAart mtbAart, Ean128Model ean128Model, MtbColt refMtbColt) throws Exception {
public void dispatchExtraItem(MtbAart mtbAart, Ean128Model ean128Model, GetColloInGiacResponseDTO colloInGiac) throws Exception {
this.checkAnomaliaUl(colloInGiac);
PickingObjectDTO pickingObjectDTO = new PickingObjectDTO().setMtbAart(mtbAart).setTempPickData(PickDataDTO.fromEan128(ean128Model));
@@ -1301,7 +1313,7 @@ public class SpedizioneViewModel {
String partitaMag = null;
LocalDate dataScad = null;
// MtbColt refMtbColt = null;
MtbColt refMtbColt = colloInGiac.getMtbColt();
if (refMtbColt != null && refMtbColt.getMtbColr() != null && !refMtbColt.getMtbColr().isEmpty()) {
MtbColr mtbColrToUse = refMtbColt.getMtbColr().get(0);
@@ -1525,7 +1537,7 @@ public class SpedizioneViewModel {
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 && !UtilityString.isNullOrEmpty(mtbColr.getGestioneRif()) && !UtilityString.isNullOrEmpty(mtbColr.getSerColloRif()) && !UtilityString.isNullOrEmpty(mtbColr.getDataColloRifS()) && mtbColr.getNumColloRif() != null) {
return mColliMagazzinoRESTConsumer.getBySsccSynchronized(mtbColr.getBarcodeUlOut(), true, false);
return mColliMagazzinoRESTConsumer.getBySsccSynchronized(mtbColr.getBarcodeUlOut(), true, false).getMtbColt();
}
return null;
}
@@ -1867,6 +1879,16 @@ public class SpedizioneViewModel {
return closeResponse.getGeneratedMtbColts();
}
private void checkAnomaliaUl(GetColloInGiacResponseDTO colloInGiac) {
if (colloInGiac.getEscludiPickingLavorazione() && mDefaultGestioneOfUL == GestioneEnum.LAVORAZIONE) {
this.sendError(new AnomaliaUlException(colloInGiac));
} else if (colloInGiac.getEscludiPickingVendita() && mDefaultGestioneOfUL == GestioneEnum.VENDITA) {
this.sendError(new AnomaliaUlException(colloInGiac));
} else {
this.onWarning(colloInGiac.getMessageAnomalia(), () -> {});
}
}
private List<MtbColt> validateTheUdsToBeDuplicated(List<MtbColt> mtbColtList) throws Exception {
var clonedLu = (MtbColt) this.mCurrentMtbColt.clone();
@@ -2077,7 +2099,7 @@ public class SpedizioneViewModel {
private void moveLUtoLU(List<MtbColt> sourceMtbColts, String destBarcodeUl) throws Exception {
for (MtbColt sourceMtbColt : sourceMtbColts) {
if(mIsApprovLinee) {
if (mIsApprovLinee) {
//Scambio i campi barcode_ul_in e barcode_ul_out per far funzionare il posizionamento dell'L+
sourceMtbColt.getMtbColr()
.forEach(x -> {
@@ -2354,8 +2376,11 @@ public class SpedizioneViewModel {
return this;
}
public interface Listener extends ILUPrintListener, ILoadingListener, ILUBaseOperationsListener {
private void onWarning(String warningText, Runnable action) {
if (mListener != null) mListener.onWarning(warningText, action);
}
public interface Listener extends ILUPrintListener, ILoadingListener, ILUBaseOperationsListener {
void onLUPesoRequired(String codTcol, BigDecimal netWeightKG, BigDecimal grossWeightKG, RunnableArgsss<String, BigDecimal, BigDecimal> onComplete);
void onFilterApplied(String newValue);
@@ -2364,6 +2389,8 @@ public class SpedizioneViewModel {
void onError(Exception ex, boolean useSnackbar);
void onWarning(String warningText, Runnable action);
void onFullItemDispatched(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 canOverflowOrderQuantity, boolean canBatchLotBeChanged, RunnableArgs<PickedQuantityDTO> onComplete, Runnable onAbort);
void onInfoAggiuntiveRequired(MtbColt currentMtbColt, RunnableArgss<String, ObservableMtbTcol> onComplete);

View File

@@ -26,6 +26,7 @@ import it.integry.integrywmsnative.core.model.secondary.TrasferimentoPedaneStatu
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.TrasferimentoPedaneRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
import it.integry.integrywmsnative.core.utility.UtilityLiveData;
import it.integry.integrywmsnative.core.utility.UtilityString;
@@ -109,17 +110,17 @@ public class TrasferimentoPedaneEditViewModel {
});
});
if (trasferimento.getStatusEnum() == TrasferimentoPedaneStatusEnum.APERTO) {
UtilityLiveData.observeOnce(rowsLiveData, rowList -> {
executorService.execute(() -> {
try {
checkDataConsistency(rowList);
} catch (Exception e) {
this.sendError(e);
}
if (trasferimento.getStatusEnum() == TrasferimentoPedaneStatusEnum.APERTO) {
UtilityLiveData.observeOnce(rowsLiveData, rowList -> {
executorService.execute(() -> {
try {
checkDataConsistency(rowList);
} catch (Exception e) {
this.sendError(e);
}
});
});
});
}
}
});
});
});
@@ -143,14 +144,16 @@ public class TrasferimentoPedaneEditViewModel {
if (!ssccList.isEmpty()) {
List<MtbColt> bySsccListSynchronized = colliMagazzinoRESTConsumer.getBySsccListSynchronized(ssccList, true, false);
cacheMtbColtList.addAll(bySsccListSynchronized);
var bySsccListSynchronized = colliMagazzinoRESTConsumer.getBySsccListSynchronized(ssccList, true, false);
List<MtbColt> mtbColtList = bySsccListSynchronized.stream().map(GetColloInGiacResponseDTO::getMtbColt).toList();
cacheMtbColtList.addAll(mtbColtList);
rowList
.stream()
.filter(x -> x.getDetailMtbColt() == null)
.forEach(row -> {
MtbColt mtbColtDetail = bySsccListSynchronized.stream()
MtbColt mtbColtDetail = mtbColtList.stream()
.filter(x -> x.getBarcodeUl().equals(row.getBarcodeUl()))
.findFirst()
.orElse(null);
@@ -200,7 +203,8 @@ public class TrasferimentoPedaneEditViewModel {
}
private void handleSSCCBarcode(String sscc) throws Exception {
var mtbColt = this.colliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
var mtbColt = this.colliMagazzinoRESTConsumer
.getBySsccSynchronized(sscc, true, false).getMtbColt();
if (defaultSourceCodMdep != null && !mtbColt.getCodMdep().equalsIgnoreCase(defaultSourceCodMdep))
throw new IllegalArgumentException("L'UL scansionata non appartiene al magazzino di partenza del trasferimento");

View File

@@ -74,7 +74,7 @@ public class UltimiArriviFornitoreViewModel {
private void executeEtichettaLU(String SSCC) throws Exception {
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false).getMtbColt();
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
if (mtbColt.getSegno() > 0) {

View File

@@ -146,8 +146,18 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
public void openLU() {
DialogScanOrCreateLUView.newInstance(true, false, true, false, true, scanOrCreateResult -> {
var colloInGiac = scanOrCreateResult.getColloInGiac();
var mtbColt = scanOrCreateResult.getMtbColt();
if (colloInGiac.getMessageAnomalia() != null) {
DialogSimpleMessageView.makeWarningDialog(requireContext(),
new SpannableString(
Html.fromHtml(colloInGiac.getMessageAnomalia())),
null, () -> {
}
).show();
}
if (scanOrCreateResult.isAborted() || scanOrCreateResult.getMtbColt() == null) {
((IPoppableActivity) getActivity()).pop();
} else if (((mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && mtbColt.getSegno().equals(+1)) ||
@@ -156,7 +166,7 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
executorService.execute(() -> {
this.onLoadingStarted();
try {
mViewModel.initUL(mtbColt);
mViewModel.initUL(colloInGiac);
this.onLoadingEnded();
} catch (Exception e) {
this.onError(e);

View File

@@ -37,6 +37,7 @@ import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsu
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPutItemsRequestDTO;
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
@@ -50,6 +51,7 @@ import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
public class VersamentoMerceViewModel {
private final MutableLiveData<MtbColt> mCurrentMtbColt = new MutableLiveData<>();
private final MutableLiveData<GetColloInGiacResponseDTO> mCurrentMtbColtWithAnomalia = new MutableLiveData<>();
private final MutableLiveData<List<SuggestedULPositionDTO>> mSuggestedULPositions = new MutableLiveData<>();
private Listener mListener;
@@ -69,16 +71,17 @@ public class VersamentoMerceViewModel {
this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer;
}
public void initUL(MtbColt mtbColt) throws Exception {
this.mCurrentMtbColt.postValue(mtbColt);
public void initUL(GetColloInGiacResponseDTO response) throws Exception {
this.mCurrentMtbColtWithAnomalia.postValue(response);
this.mCurrentMtbColt.postValue(response.getMtbColt());
refreshSuggestedULPositions(mtbColt);
refreshSuggestedULPositions(response.getMtbColt());
}
private void refreshSuggestedULPositions(MtbColt mtbColt) throws Exception {
List<SuggestedULPositionDTO> suggestedULPositionDTOS = this.mPosizioniRESTConsumer.suggestUlPositionSynchronized(mtbColt.getBarcodeUl());
// Handle the suggested positions if needed
if(suggestedULPositionDTOS == null || suggestedULPositionDTOS.isEmpty()) {
if (suggestedULPositionDTOS == null || suggestedULPositionDTOS.isEmpty()) {
// If no positions are suggested, we can either throw an exception or handle it gracefully
return;
}
@@ -159,12 +162,12 @@ public class VersamentoMerceViewModel {
private void executePosizioneMonocollo(MtbDepoPosizione foundPosizione) throws Exception {
var barcodeUlInPosizioneList = this.mPosizioniRESTConsumer.getBancaliInPosizioneSynchronized(foundPosizione);
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty()) {
throw new NoLUFoundException();
} else if (barcodeUlInPosizioneList.size() == 1) {
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(
barcodeUlInPosizioneList.get(0), true, false
).getMtbColt();
//TAKE HERE
boolean codMdepIsValid = SettingsManager.iDB().getAvailableDepos().stream()
@@ -174,11 +177,9 @@ public class VersamentoMerceViewModel {
pickMerceULtoUL(mtbColt);
} else throw new InvalidCodMdepException();
} else {
throw new TooManyLUFoundInMonoLUPositionException();
}
}
@@ -210,8 +211,9 @@ public class VersamentoMerceViewModel {
private void executeEtichettaLU(String sscc, boolean isAnonima) throws Exception {
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(
sscc, true, false
).getMtbColt();
if (mtbColt == null && !isAnonima) {
throw new NoLUFoundException();
@@ -249,9 +251,8 @@ public class VersamentoMerceViewModel {
this.sendOnLoadingStarted();
MtbColt sourceMtbColt = mCurrentMtbColt.getValue();
if (!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep())) {
if (!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep()))
throw new Exception("Impossibile spostare la merce tra UL di due depositi differenti");
}
List<MtbColr> mtbColrsToPick = sourceMtbColt.getMtbColr().stream()
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaCol(), BigDecimal.ZERO))

View File

@@ -34,6 +34,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.databinding.DialogScanArtBinding;
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_mtb_colr.DialogChooseArtFromListaMtbColrView;
@@ -54,15 +55,15 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
private int mBarcodeScannerInstanceID;
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onPickingCompleted = null;
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> onPickingCompleted = null;
private RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest = null;
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
return new DialogScanArtView(forceOnlyUL, onPickingCompleted, onMagazzinoAutomaticoPickingRequest);
}
private DialogScanArtView(boolean forceOnlyUL, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> onItemChoosed, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
private DialogScanArtView(boolean forceOnlyUL, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> onItemChoosed, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
super();
mForceOnlyUL = forceOnlyUL;
@@ -136,7 +137,7 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
try {
Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> result = this.mViewModel.processBarcodeDTO(data, pickMagazzinoAutomaticoPosizione -> {
Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> result = this.mViewModel.processBarcodeDTO(data, pickMagazzinoAutomaticoPosizione -> {
handler.post(() -> {
this.onMagazzinoAutomaticoPickingRequest.run(pickMagazzinoAutomaticoPosizione);
@@ -148,9 +149,9 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
var status = result.getValue0();
var mtbAart = result.getValue1();
var ean128Model = result.getValue2();
var mtbColt = result.getValue3();
var colloInGiac = result.getValue3();
List<MtbColr> filteredMtbColrList = mtbColt.getMtbColr();
List<MtbColr> filteredMtbColrList = colloInGiac.getMtbColt().getMtbColr();
if (mtbAart != null && filteredMtbColrList != null) {
filteredMtbColrList = filteredMtbColrList.stream()
@@ -164,15 +165,15 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
if (finalFilteredMtbColrList != null && finalFilteredMtbColrList.size() > 1) {
DialogChooseArtFromListaMtbColrView.make(getActivity(), finalFilteredMtbColrList, mtbColrChose -> {
mtbColt.setMtbColr(new ObservableArrayList<>());
mtbColt.getMtbColr().add(mtbColrChose);
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColt);
colloInGiac.getMtbColt().setMtbColr(new ObservableArrayList<>());
colloInGiac.getMtbColt().getMtbColr().add(mtbColrChose);
onPickingCompleted.run(status, mtbAart, ean128Model, colloInGiac);
}).show();
} else if (finalFilteredMtbColrList != null && finalFilteredMtbColrList.size() == 1) {
mtbColt.setMtbColr(new ObservableArrayList<>());
mtbColt.getMtbColr().add(finalFilteredMtbColrList.get(0));
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColt);
colloInGiac.getMtbColt().setMtbColr(new ObservableArrayList<>());
colloInGiac.getMtbColt().getMtbColr().add(finalFilteredMtbColrList.get(0));
onPickingCompleted.run(status, mtbAart, ean128Model, colloInGiac);
} else {
onPickingCompleted.run(status, mtbAart, ean128Model, null);

View File

@@ -21,6 +21,7 @@ import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTCo
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
@@ -57,7 +58,7 @@ public class DialogScanArtViewModel {
return this;
}
public Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
public Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
return this.executeEtichettaLU(barcodeScanDTO.getStringValue());
@@ -82,7 +83,7 @@ public class DialogScanArtViewModel {
}
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) throws Exception {
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) throws Exception {
var ean128Model = this.mBarcodeRESTConsumer.decodeEan128Synchronized(barcodeScanDTO);
@@ -109,27 +110,28 @@ public class DialogScanArtViewModel {
}
}
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO) throws Exception {
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO) throws Exception {
Ean13PesoModel ean13PesoModel = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
return this.loadArticolo(ean13PesoModel.getPrecode(), ean13PesoModel.toEan128());
}
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaLU(String SSCC) throws Exception {
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executeEtichettaLU(String SSCC) throws Exception {
var response = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
var mtbColt = response.getMtbColt();
if (mtbColt == null || mtbColt.getMtbColr() == null || mtbColt.getMtbColr().isEmpty())
throw new NoLUFoundException();
if (mtbColt.getSegno() == -1) throw new InvalidLUException();
return new Quartet<>(DialogConsts.Results.YES, null, null, mtbColt);
return new Quartet<>(DialogConsts.Results.YES, null, null, response);
}
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executeEtichettaPosizione(String stringValue, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executeEtichettaPosizione(String stringValue, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) throws Exception {
MtbDepoPosizione foundPosizione = SettingsManager.iDB().getAvailablePosizioni().stream()
.filter(x -> x.getPosizione().equalsIgnoreCase(stringValue))
.findFirst()
@@ -150,7 +152,7 @@ public class DialogScanArtViewModel {
return null;
}
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> executePosizione(MtbDepoPosizione posizione, MtbAart articolo) throws Exception {
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> executePosizione(MtbDepoPosizione posizione, MtbAart articolo) throws Exception {
var barcodeUlInPosizioneList = this.mPosizioniRESTConsumer.getBancaliInPosizioneSynchronized(posizione);
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty())
@@ -160,12 +162,12 @@ public class DialogScanArtViewModel {
throw new TooManyLUFoundInMonoLUPositionException();
}
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
return new Quartet<>(DialogConsts.Results.YES, articolo, null, mtbColt);
var response = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeUlInPosizioneList.get(0), true, false);
return new Quartet<>(DialogConsts.Results.YES, articolo, null, response);
}
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, MtbColt> loadArticolo(@NotNull String barcodeProd, Ean128Model ean128Model) throws Exception {
private Quartet<DialogConsts.Results, MtbAart, Ean128Model, GetColloInGiacResponseDTO> loadArticolo(@NotNull String barcodeProd, Ean128Model ean128Model) throws Exception {
var mtbAartList = this.mArticoloRESTConsumer.searchByBarcodeSynchronized(barcodeProd);
if (mtbAartList == null || mtbAartList.isEmpty())

View File

@@ -24,6 +24,7 @@ import it.integry.integrywmsnative.core.di.BindableBoolean;
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.databinding.DialogScanOrCreateLuBinding;
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLUView;
@@ -110,7 +111,7 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
mBindings.viewBasket.setOnClickListener(v -> {
new DialogBasketLUView(mtbColt -> {
onLUOpened(mtbColt, false);
onLUOpened(new GetColloInGiacResponseDTO().setMtbColt(mtbColt), false);
}).show(requireActivity().getSupportFragmentManager(), "tag");
});
@@ -180,30 +181,32 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
}
@Override
public void onLUOpened(MtbColt mtbColt, boolean created) {
this.openedMtbColt = mtbColt;
mOnComplete.run(Result.completed(mtbColt, created));
public void onLUOpened(GetColloInGiacResponseDTO colloInGiac, boolean created) {
this.openedMtbColt = colloInGiac.getMtbColt();
mOnComplete.run(Result.completed(colloInGiac, created));
dismiss();
}
public static class Result {
private final GetColloInGiacResponseDTO colloInGiac;
private final MtbColt mtbColt;
private final boolean newLU;
private boolean aborted = false;
private Result(MtbColt mtbColt, boolean isNewLU) {
this.mtbColt = mtbColt;
private Result(GetColloInGiacResponseDTO colloInGiac, boolean isNewLU) {
this.mtbColt = colloInGiac.getMtbColt();
this.colloInGiac = colloInGiac;
this.newLU = isNewLU;
}
public static Result completed(MtbColt mtbColt, boolean isNewLU) {
return new Result(mtbColt, isNewLU);
public static Result completed(GetColloInGiacResponseDTO colloInGiac, boolean isNewLU) {
return new Result(colloInGiac, isNewLU);
}
public static Result aborted() {
Result result = new Result(null, false);
Result result = new Result(new GetColloInGiacResponseDTO().setMtbColt(null), false);
result.aborted = true;
return result;
}
@@ -212,6 +215,10 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
return mtbColt;
}
public GetColloInGiacResponseDTO getColloInGiac() {
return colloInGiac;
}
public boolean isNewLU() {
return newLU;
}

View File

@@ -20,6 +20,7 @@ import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.giacenza.GetColloInGiacResponseDTO;
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
@@ -65,7 +66,7 @@ public class DialogScanOrCreateLUViewModel {
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
var createResponse = this.mColliLavorazioneRESTConsumer.synchronousCreateUDC(createUdcRequest);
this.sendOnLUOpened(createResponse, true);
this.sendOnLUCreated(createResponse);
}
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
@@ -98,9 +99,9 @@ public class DialogScanOrCreateLUViewModel {
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty()) {
this.sendError(new NoLUFoundException());
} else if (barcodeUlInPosizioneList.size() == 1) {
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeUlInPosizioneList.get(0), mShouldCheckResiduo, false, mtbColt -> {
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeUlInPosizioneList.get(0), mShouldCheckResiduo, false, response -> {
onComplete.run();
this.sendOnLUOpened(mtbColt, false);
this.sendOnLUOpened(response);
}, this::sendError);
} else {
this.sendError(new TooManyLUFoundInMonoLUPositionException());
@@ -111,7 +112,8 @@ public class DialogScanOrCreateLUViewModel {
private void executeEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false, mtbColt -> {
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false, response -> {
var mtbColt = response.getMtbColt();
if (mtbColt == null) {
if (mEnableCreation) {
@@ -131,7 +133,7 @@ public class DialogScanOrCreateLUViewModel {
this.mColliLavorazioneRESTConsumer.createUDC(createUdcRequest, createdMtbColt -> {
onComplete.run();
this.sendOnLUOpened(createdMtbColt, true);
this.sendOnLUCreated(createdMtbColt);
}, this::sendError);
} else {
this.sendError(new NoLUFoundException());
@@ -142,7 +144,7 @@ public class DialogScanOrCreateLUViewModel {
} else {
mtbColt.setDisablePrint(true);
onComplete.run();
this.sendOnLUOpened(mtbColt, false);
this.sendOnLUOpened(response);
}
}
@@ -155,10 +157,10 @@ public class DialogScanOrCreateLUViewModel {
if (ean128Model != null && !UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
this.mColliMagazzinoRESTConsumer.getBySSCC(ean128Model.Sscc, mShouldCheckResiduo, false, mtbColt -> {
this.mColliMagazzinoRESTConsumer.getBySSCC(ean128Model.Sscc, mShouldCheckResiduo, false, response -> {
var mtbColt = response.getMtbColt();
if (mtbColt != null) {
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
this.sendError(new AlreadyAttachedDocumentToLUException());
} else {
@@ -166,17 +168,16 @@ public class DialogScanOrCreateLUViewModel {
this.sendOnLUVenditaConfirmRequired(confirmed -> {
if (confirmed) {
onComplete.run();
this.sendOnLUOpened(mtbColt, false);
this.sendOnLUOpened(response);
} else {
onComplete.run();
}
});
} else {
onComplete.run();
this.sendOnLUOpened(mtbColt, false);
this.sendOnLUOpened(response);
}
}
} else {
var createUdcRequest = new CreateUDCRequestDTO()
.setBarcodeUl(ean128Model.Sscc)
@@ -184,7 +185,7 @@ public class DialogScanOrCreateLUViewModel {
this.mColliLavorazioneRESTConsumer.createUDC(createUdcRequest, createdMtbColt -> {
onComplete.run();
this.sendOnLUOpened(createdMtbColt, true);
this.sendOnLUCreated(createdMtbColt);
}, this::sendError);
}
@@ -217,8 +218,16 @@ public class DialogScanOrCreateLUViewModel {
if (this.mListener != null) mListener.onLUVenditaConfirmRequired(onConfirm);
}
private void sendOnLUOpened(MtbColt mtbColt, boolean created) {
if (this.mListener != null) mListener.onLUOpened(mtbColt, created);
private void sendOnLUCreated(MtbColt mtbColt) {
if (this.mListener != null) {
mListener.onLUOpened(
new GetColloInGiacResponseDTO().setMtbColt(mtbColt), true
);
}
}
private void sendOnLUOpened(GetColloInGiacResponseDTO colloInGiac) {
if (this.mListener != null) mListener.onLUOpened(colloInGiac, false);
}
private void sendOnLoadingStarted() {
@@ -241,7 +250,7 @@ public class DialogScanOrCreateLUViewModel {
void onLUVenditaConfirmRequired(RunnableArgs<Boolean> onConfirm);
void onLUOpened(MtbColt mtbColt, boolean created);
void onLUOpened(GetColloInGiacResponseDTO colloInGiac, boolean created);
void onError(Exception ex);

View File

@@ -3,7 +3,7 @@
buildscript {
ext {
kotlin_version = '2.1.0'
agp_version = '8.13.0'
agp_version = '8.13.1'
}
repositories {