Migliorati errori letti dalle chiamate REST

This commit is contained in:
Giuseppe Scorrano 2025-01-24 18:09:27 +01:00
parent 716f6d4daa
commit a046e31412
49 changed files with 498 additions and 478 deletions

View File

@ -228,13 +228,13 @@ public class Ean128Service {
case SHIP_TO_POST -> model.ShipToPost = aiValue.toString();
case SHIP_TO_POST_ISO ->
model.ShipToPostISO = convertToIsoValueModel(aiValue.toString(), 0,
new Callable<String, String>() {
new Callable<>() {
@Override
public String call(String input) {
return input;
}
},
new CallableII<String, Integer, String>() {
new CallableII<>() {
@Override
public String call(String input, Integer input2) {
return input;
@ -300,7 +300,7 @@ public class Ean128Service {
T value = castFunc.call(splitFunc.call(sourceString.substring(3), numberOfDecimalDigits));
Ean128ISOValueModel<T> isoModel = new Ean128ISOValueModel<T>();
Ean128ISOValueModel<T> isoModel = new Ean128ISOValueModel<>();
isoModel.ISOCode = isoCode;
isoModel.Value = value;

View File

@ -1,14 +1,16 @@
package it.integry.integrywmsnative.core.menu;
import androidx.annotation.NonNull;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.StbMenu;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -16,15 +18,15 @@ public class MenuRESTConsumer extends _BaseRESTConsumer {
public void retrieveMenu(String rootCodOpz, RunnableArgs<StbMenu> onComplete, RunnableArgs<Exception> onFailed) {
MenuRESTConsumerService menuRESTConsumerService = RESTBuilder.getService(MenuRESTConsumerService.class);
menuRESTConsumerService.retrieveMenuConfig(rootCodOpz).enqueue(new Callback<>() {
menuRESTConsumerService.retrieveMenuConfig(rootCodOpz).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<StbMenu>> call, Response<ServiceRESTResponse<StbMenu>> response) {
analyzeAnswer(response, "retrieveMenu", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<StbMenu>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<StbMenu>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -103,7 +103,7 @@ public class MtbDepo extends EntityBase implements Parcelable {
return 0;
}
public static final Creator<MtbDepo> CREATOR = new Creator<MtbDepo>() {
public static final Creator<MtbDepo> CREATOR = new Creator<>() {
@Override
public MtbDepo createFromParcel(Parcel in) {
return new MtbDepo(in);

View File

@ -55,7 +55,7 @@ public class VtbDest extends EntityBase implements Parcelable {
return 0;
}
public static final Creator<VtbDest> CREATOR = new Creator<VtbDest>() {
public static final Creator<VtbDest> CREATOR = new Creator<>() {
@Override
public VtbDest createFromParcel(Parcel in) {
return new VtbDest(in);

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import com.annimon.stream.Stream;
import com.google.gson.reflect.TypeToken;
@ -17,6 +19,7 @@ import it.integry.integrywmsnative.core.model.MtbGrup;
import it.integry.integrywmsnative.core.model.MtbUntMis;
import it.integry.integrywmsnative.core.model.dto.StatoArticoloDTO;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.articolo.ArticoloDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.RetrieveArticoloByCodMartRequestDTO;
@ -27,7 +30,6 @@ import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarc
import it.integry.integrywmsnative.core.rest.model.articolo.UpdateBarcodeImballoRequestDTO;
import it.integry.integrywmsnative.core.utility.UtilityQuery;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -44,15 +46,15 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
articoloRESTConsumerService
.retrieveAvailableUntMis()
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbUntMis>> call, Response<ServiceRESTResponse<MtbUntMis>> response) {
analyzeAnswerList(response, "retrieveAvailableUntMis", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbUntMis>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<MtbUntMis>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -61,15 +63,15 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
articoloRESTConsumerService
.retrieveAvailableGruppiMerceologici()
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbGrup>> call, Response<ServiceRESTResponse<MtbGrup>> response) {
analyzeAnswerList(response, "retrieveAvailableGruppiMerceologici", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbGrup>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<MtbGrup>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -83,7 +85,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
articoloRESTConsumerService
.searchByBarcode(request)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> call, Response<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> response) {
analyzeAnswer(response, "searchByBarcode", (m) -> {
@ -92,8 +94,8 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -114,15 +116,15 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
articoloRESTConsumer
.getByCodMart(new RetrieveArticoloByCodMartRequestDTO()
.setCodMarts(codMarts))
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<MtbAart>>> call, Response<ServiceRESTResponse<List<MtbAart>>> response) {
analyzeAnswer(response, "getByCodMart", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<MtbAart>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<MtbAart>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@ -131,15 +133,15 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
public void getStatoPartita(String codMart, String partitaMag, RunnableArgs<List<StatoArticoloDTO>> onComplete, RunnableArgs<Exception> onFailed) {
ArticoloRESTConsumerService articoloRESTConsumer = RESTBuilder.getService(ArticoloRESTConsumerService.class);
articoloRESTConsumer.getStatoPartita(codMart, partitaMag).enqueue(new Callback<>() {
articoloRESTConsumer.getStatoPartita(codMart, partitaMag).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<StatoArticoloDTO>>> call, Response<ServiceRESTResponse<List<StatoArticoloDTO>>> response) {
analyzeAnswer(response, "getStatoPartita", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<StatoArticoloDTO>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<StatoArticoloDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@ -229,7 +231,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
articoloRESTConsumerService
.updateBarcodeImballo(request)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "updateBarcodeImballo", m -> {
@ -238,8 +240,8 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -253,7 +255,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
articoloRESTConsumerService
.saveArticolo(request)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<SaveArticoloResponseDTO>> call, Response<ServiceRESTResponse<SaveArticoloResponseDTO>> response) {
analyzeAnswer(response, "saveArticolo", data -> {
@ -262,8 +264,8 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<SaveArticoloResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<SaveArticoloResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,13 +1,15 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.Azienda;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -15,15 +17,15 @@ public class AziendaRESTConsumer extends _BaseRESTConsumer {
public void retrieveAzienda(RunnableArgs<Azienda> onComplete, RunnableArgs<Exception> onFailed) {
AziendaRESTConsumerService aziendaRESTConsumerService = RESTBuilder.getService(AziendaRESTConsumerService.class);
aziendaRESTConsumerService.retrieveDefaultAzienda().enqueue(new Callback<>() {
aziendaRESTConsumerService.retrieveDefaultAzienda().enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Azienda>> call, Response<ServiceRESTResponse<Azienda>> response) {
analyzeAnswer(response, "Retrieve default azienda", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Azienda>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Azienda>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
@ -7,6 +9,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliCaricoRESTConsumerInterface;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCRequestDTO;
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
@ -18,7 +21,6 @@ import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -28,15 +30,15 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
colliAccettazioneRESTConsumerService.createUDC(createUDCRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Response<ServiceRESTResponse<CreateUDCResponseDTO>> response) {
analyzeAnswer(response, "accettazione/createUDC", data -> onComplete.run(data.getMtbColt()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@ -47,15 +49,15 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
colliAccettazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Response<ServiceRESTResponse<CloseUDCResponseDTO>> response) {
analyzeAnswer(response, "accettazione/closeUDC", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -65,15 +67,15 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
colliAccettazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDCRowResponseDTO>> response) {
analyzeAnswer(response, "accettazione/insertUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -83,15 +85,15 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
colliAccettazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDCRowResponseDTO>> response) {
analyzeAnswer(response, "accettazione/editUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -101,15 +103,15 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
colliAccettazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "accettazione/deleteUDCRow", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -118,15 +120,15 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
colliAccettazioneRESTConsumerService.checkIfBarcodeUlAlreadyRegistered(barcodeUl)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
analyzeAnswer(response, "accettazione/checkIfBarcodeUlAlreadyRegistered", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import java.math.BigDecimal;
import javax.inject.Singleton;
@ -12,6 +14,7 @@ import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliCaricoRESTConsumerInterface;
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCRequestDTO;
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
@ -34,7 +37,6 @@ import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -52,15 +54,15 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.createUDC(createUDCRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Response<ServiceRESTResponse<CreateUDCResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/createUDC", data -> onComplete.run(data.getMtbColt()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -70,15 +72,15 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Response<ServiceRESTResponse<CloseUDCResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/closeUDC", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -88,15 +90,15 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDCRowResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/insertUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -106,15 +108,15 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDCRowResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/editUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -123,15 +125,15 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@ -142,15 +144,15 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/closeUDS", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -160,15 +162,15 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -177,15 +179,15 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -195,15 +197,15 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "lavorazione/deleteUDSRow", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -213,15 +215,15 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "lavorazione/deleteUDCRow", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -252,15 +254,15 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.createUDSFromArt(createUDSFromArtRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "lavorazione/createUDSFromArt", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,5 +1,6 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import androidx.databinding.ObservableArrayList;
import com.annimon.stream.Optional;
@ -29,6 +30,7 @@ import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
@ -46,7 +48,6 @@ import it.integry.integrywmsnative.core.utility.UtilityQuery;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavorazioneDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -82,7 +83,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setMtbPartitaMag(null));
}
this.mEntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback<MtbColt>() {
this.mEntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback<>() {
@Override
public void onSuccess(MtbColt value) {
if (onComplete != null) onComplete.run(value);
@ -285,7 +286,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull).enqueue(new Callback<>() {
colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
analyzeAnswer(response, "GetBySSCC", mtbColt -> {
@ -302,8 +303,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -385,27 +386,28 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata).enqueue(new Callback<ServiceRESTResponse<MtbColt>>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
analyzeAnswer(response, "getColloInGiac", mtbColt -> {
colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata)
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
analyzeAnswer(response, "getColloInGiac", mtbColt -> {
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
List<MtbColt> mtbColtList = new ArrayList<>();
mtbColtList.add(mtbColt);
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
} else {
onComplete.run(mtbColt);
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
List<MtbColt> mtbColtList = new ArrayList<>();
mtbColtList.add(mtbColt);
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
} else {
onComplete.run(mtbColt);
}
}, onFailed);
}
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
@Override
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) {
@ -426,7 +428,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService
.spostaUL(spostaUlRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "spostaUL", mtbColts -> {
@ -435,8 +437,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@ -461,7 +463,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService
.updateTipoUL(updateTipoULRequest)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "updateTipoUL", mtbColts -> {
@ -470,8 +472,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
@ -495,7 +497,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
public static void retrieveBasketColli(RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColliInBasket(SettingsManager.i().getUserSession().getDepo().getCodMdep()).enqueue(new Callback<ServiceRESTResponse<List<MtbColt>>>() {
colliMagazzinoRESTConsumerService.getColliInBasket(SettingsManager.i().getUserSession().getDepo().getCodMdep()).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<MtbColt>>> call, Response<ServiceRESTResponse<List<MtbColt>>> response) {
analyzeAnswer(response, "getColliInBasket", mtbColts -> {
@ -504,8 +506,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<MtbColt>>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<MtbColt>>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@ -524,15 +526,15 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
colliMagazzinoRESTConsumerService.creaRettificaCollo(
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
rettificaULDTO
).enqueue(new Callback<>() {
).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbColr>> call, Response<ServiceRESTResponse<MtbColr>> response) {
analyzeAnswer(response, "creaRettificaCollo", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbColr>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<MtbColr>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@ -556,7 +558,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setFlagForceUseRefs(flagForceUseRefs);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new Callback<>() {
colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> call, Response<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> response) {
analyzeAnswer(response, "spostaArtsTraUL", data -> {
@ -565,8 +567,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<SpostaArtsTraULResponseDTO>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}).start();
@ -582,7 +584,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone).enqueue(new Callback<>() {
colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
analyzeAnswer(response, "assegnaLottoSuColloScarico", data -> {
@ -591,8 +593,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@ -607,7 +609,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.versamentoAutomaticoUL(sourceMtbColtClone).enqueue(new Callback<>() {
colliMagazzinoRESTConsumerService.versamentoAutomaticoUL(sourceMtbColtClone).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Response<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> response) {
analyzeAnswer(response, "versamentoAutomaticoUL", data -> {
@ -644,8 +646,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@ -655,7 +657,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
sourceMtbColtClone.setMtbColr(new ObservableArrayList<>());
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.confirmGiacenzaUL(sourceMtbColtClone).enqueue(new Callback<>() {
colliMagazzinoRESTConsumerService.confirmGiacenzaUL(sourceMtbColtClone).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "confirmGiacenzaUL", data -> {
@ -665,8 +667,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@ -705,15 +707,15 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.canULBeDeleted(canULBeDeletedRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
analyzeAnswer(response, "generic/canULBeDeleted", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@ -723,15 +725,15 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.deleteUL(deleteULRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "generic/deleteUL", Void -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@ -746,15 +748,15 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.printUL(printULRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "generic/printUL", Void -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});

View File

@ -9,6 +9,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
@ -22,7 +23,6 @@ import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -33,15 +33,15 @@ public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements Co
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
analyzeAnswer(response, "spedizione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@ -51,15 +51,15 @@ public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements Co
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
analyzeAnswer(response, "spedizione/closeUDS", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@ -69,15 +69,15 @@ public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements Co
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
analyzeAnswer(response, "spedizione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -86,15 +86,15 @@ public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements Co
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) {
analyzeAnswer(response, "spedizione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -103,15 +103,15 @@ public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements Co
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "spedizione/deleteUDSRow", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@ -121,14 +121,14 @@ public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements Co
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.duplicateUDS(duplicateUDSRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull Response<ServiceRESTResponse<DuplicateUDSResponseDTO>> response) {
analyzeAnswer(response, "spedizione/duplicateUDS", onComplete, onFailed);
}
@Override
public void onFailure(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull Throwable t) {
public void onFailure(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(new Exception());
}
});

View File

@ -2,7 +2,6 @@ package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import java.util.Date;
import java.util.List;
import javax.inject.Singleton;
@ -10,11 +9,11 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.DtbDoct;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.LoadColliDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.documento.RetrieveDocumentoArtsResponseDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -23,30 +22,30 @@ public class DocumentRESTConsumer extends _BaseRESTConsumer {
public void createDocsFromColli(List<LoadColliDTO> listColli, RunnableArgs<List<DtbDoct>> onComplete, RunnableArgs<Exception> onFailed) {
DocumentiRESTConsumerService documentiRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
documentiRESTConsumerService.createDocsFromColli(listColli).enqueue(new Callback<>() {
documentiRESTConsumerService.createDocsFromColli(listColli).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<DtbDoct>>> call, Response<ServiceRESTResponse<List<DtbDoct>>> response) {
analyzeAnswer(response, "createDocsFromColli", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<DtbDoct>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<DtbDoct>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void createDocFromColli(LoadColliDTO loadColliDTO, RunnableArgs<DtbDoct> onComplete, RunnableArgs<Exception> onFailed) {
DocumentiRESTConsumerService documentiRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
documentiRESTConsumerService.createDocFromColli(loadColliDTO).enqueue(new Callback<>() {
documentiRESTConsumerService.createDocFromColli(loadColliDTO).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<DtbDoct>> call, Response<ServiceRESTResponse<DtbDoct>> response) {
analyzeAnswer(response, "createDocFromColli", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<DtbDoct>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<DtbDoct>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -54,15 +53,15 @@ public class DocumentRESTConsumer extends _BaseRESTConsumer {
public void checkDocument(String fornitore, String numDoc, String dataDoc, String tipoDoc, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
var inventarioRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
inventarioRESTConsumerService.checkDocument(fornitore, numDoc,tipoDoc, dataDoc)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(@NonNull Call<ServiceRESTResponse<Boolean>> call, @NonNull Response<ServiceRESTResponse<Boolean>> response) {
analyzeAnswer(response, "checkDocument", onComplete, onFailed);
}
@Override
public void onFailure(@NonNull Call<ServiceRESTResponse<Boolean>> call, @NonNull Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(@NonNull Call<ServiceRESTResponse<Boolean>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -70,15 +69,15 @@ public class DocumentRESTConsumer extends _BaseRESTConsumer {
public void loadDocumentAvailableArts(String codDtip, String codMgrp, String codAnagForn, RunnableArgs<RetrieveDocumentoArtsResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
var inventarioRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
inventarioRESTConsumerService.retrieveArts(codDtip, codMgrp, codAnagForn)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> response) {
analyzeAnswer(response, "loadDocumentoArts", onComplete, onFailed);
}
@Override
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.rest.consumers;
import android.util.Log;
import androidx.annotation.NonNull;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
@ -13,11 +15,11 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.EntityBase;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.EsitoType;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.utility.UtilityGson;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -33,7 +35,7 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
service
.processEntity(entityToSave)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
if (response.isSuccessful()) {
@ -59,9 +61,8 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
Log.e("EntityRESTConsumer", t.toString());
tmpFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, @NonNull final Exception e) {
tmpFailed.run(e);
}
});
@ -76,7 +77,7 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
Call<List<ServiceRESTResponse<JsonObject>>> request = service.processEntityList(singleTransaction, entitiesToSave);
request.enqueue(new Callback<>() {
request.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<List<ServiceRESTResponse<JsonObject>>> call, Response<List<ServiceRESTResponse<JsonObject>>> response) {
if (response.isSuccessful()) {
@ -112,9 +113,8 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<List<ServiceRESTResponse<JsonObject>>> call, Throwable t) {
Log.e("EntityRESTConsumer", t.toString());
tmpFailed.run(new Exception(t));
public void onFailure(Call<List<ServiceRESTResponse<JsonObject>>> call, @NonNull final Exception e) {
tmpFailed.run(e);
}
});
@ -126,7 +126,7 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
Call<ServiceRESTResponse<JsonObject>> request = service.processEntity(entityToSave);
request.enqueue(new Callback<>() {
request.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
if (response.isSuccessful()) {
@ -136,7 +136,7 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
Gson gson = UtilityGson.createObject();
List<JsonObject> jsons = response.body().getEntityList();
List<T> newList = new ArrayList<T>();
List<T> newList = new ArrayList<>();
if (jsons != null) {
for (int i = 0; i < jsons.size(); i++) {
@ -163,9 +163,8 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
Log.e("EntityRESTConsumer", t.toString());
callback.onFailed(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, @NonNull final Exception e) {
callback.onFailed(e);
}
});

View File

@ -1,6 +1,6 @@
package it.integry.integrywmsnative.core.rest.consumers;
import android.util.Log;
import androidx.annotation.NonNull;
import java.util.List;
import java.util.stream.Collectors;
@ -10,12 +10,11 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.StbGestSetup;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.GestSetupDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.settings.StbGestSetupReader;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -25,17 +24,15 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
service.getGestSetupValue(gestName, sectionName, keySection)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<GestSetupDTO>> call, Response<ServiceRESTResponse<GestSetupDTO>> response) {
analyzeAnswer(response, "GestSetup", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, Throwable t) {
Log.e("GestSetup", t.toString());
// UtilityLogger.errorMe(new Exception(t));
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@ -52,17 +49,15 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
public void getValue(String gestName, String sectionName, String keySection, String codMdep, RunnableArgs<GestSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
service.getGestSetupValue(gestName, sectionName, keySection, codMdep).enqueue(new Callback<ServiceRESTResponse<GestSetupDTO>>() {
service.getGestSetupValue(gestName, sectionName, keySection, codMdep).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<GestSetupDTO>> call, Response<ServiceRESTResponse<GestSetupDTO>> response) {
analyzeAnswer(response, "GestSetup", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, Throwable t) {
Log.e("PrintCollo", t.toString());
UtilityLogger.error(new Exception(t));
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<GestSetupDTO>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@ -82,7 +77,7 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
var stbGestSetups = stbGestSetupList.stream().map(x -> (StbGestSetup) x).collect(Collectors.toList());
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
service.getGestSetupValues(codMdep, stbGestSetups).enqueue(new Callback<>() {
service.getGestSetupValues(codMdep, stbGestSetups).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Response<ServiceRESTResponse<List<StbGestSetup>>> response) {
analyzeAnswer(response, "GestSetup", data -> {
@ -100,9 +95,8 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Throwable t) {
UtilityLogger.error(new Exception(t));
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<StbGestSetup>>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import com.annimon.stream.Optional;
import com.annimon.stream.Stream;
@ -13,13 +15,13 @@ import it.integry.integrywmsnative.core.model.MtbAart;
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationIncomingItemDto;
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationResponseDto;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.gest.prod_riposizionamento_da_prod.dto.ArtsInGiacenzaDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -34,7 +36,7 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
public void getGiacenzeInPosizione(MtbDepoPosizione posizione, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
giacenzaRESTConsumerService.retrieveAvailableItems(posizione.getPosizione()).enqueue(new Callback<>() {
giacenzaRESTConsumerService.retrieveAvailableItems(posizione.getPosizione()).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Response<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> response) {
analyzeAnswer(response, "getGiacenzeInPosizione", inventarioList -> {
@ -68,15 +70,15 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
public void getGiacenzeInPosizione(List<String> posizioni, boolean withTestataCollo, RunnableArgs<List<ArtsInGiacenzaDTO>> onComplete, RunnableArgs<Exception> onFailed) {
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
giacenzaRESTConsumerService.retrieveAvailableItems(posizioni, withTestataCollo).enqueue(new Callback<>() {
giacenzaRESTConsumerService.retrieveAvailableItems(posizioni, withTestataCollo).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> call, Response<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> response) {
analyzeAnswer(response, "getGiacenzeInPosizione", inventarioList -> {
@ -110,8 +112,8 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -122,7 +124,7 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
UtilityString.isNullOrEmpty(partitaMag) ?
giacenzaRESTConsumerService.retrieveAvailableItemsByArt(codMart) :
giacenzaRESTConsumerService.retrieveAvailableItemsByArt(codMart, partitaMag);
serviceRESTResponseCall.enqueue(new Callback<>() {
serviceRESTResponseCall.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Response<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> response) {
analyzeAnswer(response, "getGiacenzeByArticolo", inventarioList -> {
@ -153,8 +155,8 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -164,7 +166,7 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
giacenzaRESTConsumerService.retrieveInstantItemSituation(codMdep, codMart, partitaMag, codJcom)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, Response<ServiceRESTResponse<InstantItemSituationResponseDto>> response) {
analyzeAnswer(response, "getInstantItemSituation", data -> {
@ -174,8 +176,8 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -9,12 +9,12 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbInvent;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.inventario.InsertInventarioRequestDTO;
import it.integry.integrywmsnative.core.rest.model.inventario.RetrieveInventarioArtsResponseDTO;
import it.integry.integrywmsnative.core.rest.model.inventario.RetrieveInventarioResponseDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -24,15 +24,15 @@ public class InventarioRESTConsumer extends _BaseRESTConsumer {
public void loadInventario(long inventoryId, RunnableArgs<RetrieveInventarioResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
var inventarioRESTConsumerService = RESTBuilder.getService(InventarioRESTConsumerService.class);
inventarioRESTConsumerService.retrieve(inventoryId)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveInventarioResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveInventarioResponseDTO>> response) {
analyzeAnswer(response, "loadInventario", onComplete, onFailed);
}
@Override
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveInventarioResponseDTO>> call, @NonNull Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveInventarioResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -41,15 +41,15 @@ public class InventarioRESTConsumer extends _BaseRESTConsumer {
public void loadInventarioArts(long inventoryId, RunnableArgs<RetrieveInventarioArtsResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
var inventarioRESTConsumerService = RESTBuilder.getService(InventarioRESTConsumerService.class);
inventarioRESTConsumerService.retrieveArts(inventoryId)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveInventarioArtsResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveInventarioArtsResponseDTO>> response) {
analyzeAnswer(response, "loadInventarioArts", onComplete, onFailed);
}
@Override
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveInventarioArtsResponseDTO>> call, @NonNull Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(@NonNull Call<ServiceRESTResponse<RetrieveInventarioArtsResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -73,15 +73,15 @@ public class InventarioRESTConsumer extends _BaseRESTConsumer {
var inventarioRESTConsumerService = RESTBuilder.getService(InventarioRESTConsumerService.class, 300);
inventarioRESTConsumerService
.insert(inventarioToInsert.getIdInventario(), request)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "insertInventario", ignored -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});

View File

@ -1,15 +1,17 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPutItemsRequestDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -18,15 +20,15 @@ public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
public void pickItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = RESTBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
magazzinoAutomaticoRESTConsumerService.pickItems(posizione.getPosizione(), magazzinoAutomaticoPickItemsRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "magazzino-automatico/pickItems", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@ -36,15 +38,15 @@ public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
public void putItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPutItemsRequestDTO magazzinoAutomaticoPutItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = RESTBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
magazzinoAutomaticoRESTConsumerService.putItems(posizione.getPosizione(), magazzinoAutomaticoPutItemsRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "magazzino-automatico/putItems", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,15 +1,17 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.magazzino_buffer.MagazzinoBufferVersamentoMaterialeCloseRequestDTO;
import it.integry.integrywmsnative.core.rest.model.magazzino_buffer.MagazzinoBufferVersamentoMaterialeRequestDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -18,15 +20,15 @@ public class MagazzinoBufferRESTConsumer extends _BaseRESTConsumer {
public void isVersamentoStarted(MtbDepoPosizione posizione, MagazzinoBufferVersamentoMaterialeRequestDTO magazzinoBufferVersamentoMaterialeRequestDTO, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
MagazzinoBufferRESTConsumerService magazzinoBufferRESTConsumerService = RESTBuilder.getService(MagazzinoBufferRESTConsumerService.class);
magazzinoBufferRESTConsumerService.isVersamentoStarted(posizione.getPosizione(), magazzinoBufferVersamentoMaterialeRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
analyzeAnswer(response, "magazzino-buffer/isVersamentoStarted", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -34,15 +36,15 @@ public class MagazzinoBufferRESTConsumer extends _BaseRESTConsumer {
public void startVersamentoMateriale(MtbDepoPosizione posizione, MagazzinoBufferVersamentoMaterialeRequestDTO magazzinoBufferVersamentoMaterialeRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MagazzinoBufferRESTConsumerService magazzinoBufferRESTConsumerService = RESTBuilder.getService(MagazzinoBufferRESTConsumerService.class);
magazzinoBufferRESTConsumerService.startVersamentoMateriale(posizione.getPosizione(), magazzinoBufferVersamentoMaterialeRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "magazzino-buffer/startVersamentoMateriale", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -50,15 +52,15 @@ public class MagazzinoBufferRESTConsumer extends _BaseRESTConsumer {
public void endVersamentoMateriale(MtbDepoPosizione posizione, MagazzinoBufferVersamentoMaterialeCloseRequestDTO magazzinoBufferVersamentoMaterialeCloseRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MagazzinoBufferRESTConsumerService magazzinoBufferRESTConsumerService = RESTBuilder.getService(MagazzinoBufferRESTConsumerService.class);
magazzinoBufferRESTConsumerService.endVersamentoMateriale(posizione.getPosizione(), magazzinoBufferVersamentoMaterialeCloseRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "magazzino-buffer/endVersamentoMateriale", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -9,14 +9,13 @@ import java.util.concurrent.ExecutorService;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -33,15 +32,15 @@ public class MagazzinoRESTConsumer extends _BaseRESTConsumer {
public void saveTerminalinoWMS(SaveDTO saveDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MagazzinoRESTConsumerService service = RESTBuilder.getService(MagazzinoRESTConsumerService.class);
service.saveTerminalinoWMS(saveDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "saveTerminalinoWMS", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -69,15 +68,15 @@ public class MagazzinoRESTConsumer extends _BaseRESTConsumer {
public void retrieveAllPartitaMag(List<String> codMarts, Date dataScad, RunnableArgs<List<MtbPartitaMag>> onComplete, RunnableArgs<Exception> onFailed) {
MagazzinoRESTConsumerService service = RESTBuilder.getService(MagazzinoRESTConsumerService.class);
service.retrieveAllPartitaMag(codMarts, UtilityDate.formatDate(dataScad, UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH))
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(@NonNull Call<ServiceRESTResponse<List<MtbPartitaMag>>> call, @NonNull Response<ServiceRESTResponse<List<MtbPartitaMag>>> response) {
analyzeAnswer(response, "retrieveAllPartitaMag", onComplete, onFailed);
}
@Override
public void onFailure(@NonNull Call<ServiceRESTResponse<List<MtbPartitaMag>>> call, @NonNull Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(@NonNull Call<ServiceRESTResponse<List<MtbPartitaMag>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,10 +1,11 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.inject.Singleton;
@ -12,12 +13,11 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.JtbFasi;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.utility.UtilityDB;
import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavorazioneDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -33,15 +33,15 @@ public class MesRESTConsumer extends _BaseRESTConsumer {
MesRESTConsumerService mesRESTConsumerService = RESTBuilder.getService(MesRESTConsumerService.class);
mesRESTConsumerService.getOrdiniLavorazioneMateriale(codJfas, idMateriale)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, Response<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> response) {
analyzeAnswer(response, "getOrdiniLavorazioneMateriale", (m) -> onComplete.run(response.body().getDto()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -50,15 +50,15 @@ public class MesRESTConsumer extends _BaseRESTConsumer {
MesRESTConsumerService mesRESTConsumerService = RESTBuilder.getService(MesRESTConsumerService.class);
mesRESTConsumerService.getOrdiniLavorazione(null, flagEvaso, codJfas, codAnag)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, Response<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> response) {
analyzeAnswer(response, "getOrdiniLavorazione", (m) -> onComplete.run(response.body().getDto()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -68,15 +68,15 @@ public class MesRESTConsumer extends _BaseRESTConsumer {
MesRESTConsumerService mesRESTConsumerService = RESTBuilder.getService(MesRESTConsumerService.class);
mesRESTConsumerService.getOrdiniLavorazione(flagEvaso)
.enqueue(new Callback<ServiceRESTResponse<List<OrdineLavorazioneDTO>>>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, Response<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> response) {
analyzeAnswer(response, "getOrdiniLavorazione", (m) -> onComplete.run(response.body().getDto()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<OrdineLavorazioneDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import com.annimon.stream.Optional;
import com.annimon.stream.Stream;
import com.google.gson.reflect.TypeToken;
@ -21,17 +23,16 @@ import it.integry.integrywmsnative.core.model.MtbPartitaMag;
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.GetPickingListDTO;
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
import it.integry.integrywmsnative.core.utility.UtilityDB;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
import it.integry.integrywmsnative.core.utility.UtilityQuery;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -49,7 +50,7 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class, 90);
service
.getSuggestedPickingList(codMdep, sitArtOrdList)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<PickingObjectDTO>>> call, Response<ServiceRESTResponse<List<PickingObjectDTO>>> response) {
analyzeAnswer(response, "getSuggestedPickingList", pickingObjects -> {
@ -109,8 +110,8 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<PickingObjectDTO>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<PickingObjectDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@ -126,7 +127,7 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class);
service.getOrdiniInevasi(codMdep, gestione.getText())
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, Response<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> response) {
analyzeAnswer(response, "getOrdiniInevasi", responseDtoList -> {
@ -139,9 +140,8 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, Throwable t) {
Logger.e(t, "Errore durante il caricamento degli ordini di lavorazione");
if (onFailed != null) onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, @NonNull final Exception e) {
if (onFailed != null) onFailed.run(e);
}
});
}
@ -158,7 +158,7 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class, 90);
service.getArticoliFromOrdini(codMdep, getPickingListDTOs).enqueue(new Callback<>() {
service.getArticoliFromOrdini(codMdep, getPickingListDTOs).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, Response<ServiceRESTResponse<List<SitArtOrdDTO>>> response) {
analyzeAnswer(response, "retrieveListaArticoliFromOrdiniUscita", sitArtOrds -> {
@ -173,9 +173,8 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, Throwable t) {
UtilityLogger.error(new Exception(t));
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.rest.consumers;
import android.util.Log;
import androidx.annotation.NonNull;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
@ -14,14 +16,13 @@ import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
import it.integry.integrywmsnative.core.data_store.db.view_model.OrdiniAcquistoGrigliaDTO;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.ArtDTO;
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.OrdineDTO;
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -36,7 +37,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
public void retrieveArticoli(String codAlis, String codMdep, RunnableArgs<OrdiniAcquistoGrigliaDTO> onSuccess, RunnableArgs<Exception> onFailed) {
PVOrdiniAcquistoRESTConsumerService ordiniARestService = RESTBuilder.getService(PVOrdiniAcquistoRESTConsumerService.class, 300);
ordiniARestService.retrieveArticoli(codAlis, codMdep, null)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> call, Response<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> response) {
var startTime = new Date().getTime();
@ -47,8 +48,8 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -56,7 +57,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
public void retrieveArticolo(String codAlis, String codMdep, String barcode, RunnableArgs<OrdiniAcquistoGrigliaDTO> onSuccess, RunnableArgs<Exception> onFailed) {
PVOrdiniAcquistoRESTConsumerService ordiniARestService = RESTBuilder.getService(PVOrdiniAcquistoRESTConsumerService.class, 300);
ordiniARestService.retrieveArticoli(codAlis, codMdep, barcode)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> call, Response<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> response) {
var startTime = new Date().getTime();
@ -67,8 +68,8 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<OrdiniAcquistoGrigliaDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -91,7 +92,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
PVOrdiniAcquistoRESTConsumerService ordiniARestService = RESTBuilder.getService(PVOrdiniAcquistoRESTConsumerService.class, 300);
ordiniARestService.save(codMdep, saveDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
var startTime = new Date().getTime();
@ -113,10 +114,8 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
Log.e("saveOrdine", t.toString());
UtilityLogger.error(new Exception(t));
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
@ -12,10 +14,10 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.utility.UtilityDB;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -31,7 +33,7 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer {
String codMdep = null;
PosizioniRESTConsumerService posizioniRESTConsumerService = RESTBuilder.getService(PosizioniRESTConsumerService.class);
posizioniRESTConsumerService.getAvailablePosizioni(codMdep).enqueue(new Callback<>() {
posizioniRESTConsumerService.getAvailablePosizioni(codMdep).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<MtbDepoPosizione>>> call, Response<ServiceRESTResponse<List<MtbDepoPosizione>>> response) {
analyzeAnswer(response, "getAvailablePosizioni", (m) -> {
@ -40,8 +42,8 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<MtbDepoPosizione>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<MtbDepoPosizione>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,6 +1,6 @@
package it.integry.integrywmsnative.core.rest.consumers;
import android.util.Log;
import androidx.annotation.NonNull;
import com.annimon.stream.Stream;
@ -10,20 +10,18 @@ import java.util.List;
import javax.inject.Singleton;
import it.integry.integrywmsnative.BuildConfig;
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.report.ReportType;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.JasperDTO;
import it.integry.integrywmsnative.core.rest.model.JasperPairDTO;
import it.integry.integrywmsnative.core.rest.model.ReportTypeDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.gest.spedizione.model.PrintOrderCloseDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -40,7 +38,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
String printerTypeStr = printerType != null ? printerType.toString() : null;
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
printerService.getAvailablePrinters(codMdep, printerTypeStr).enqueue(new Callback<>() {
printerService.getAvailablePrinters(codMdep, printerTypeStr).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<String>>> call, Response<ServiceRESTResponse<List<String>>> response) {
analyzeAnswer(response, "GetAvailablePrinters", printerList -> {
@ -50,10 +48,8 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<String>>> call, Throwable t) {
Log.e("GetAvailablePrinters", t.toString());
UtilityLogger.error(new Exception(t));
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<String>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -68,7 +64,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
printerService
.printCollo(testataColloToPrint)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "printCollo", data -> {
@ -77,10 +73,8 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
if (t.getMessage().contains("Printer not found")) {
onFailed.run(new NoPrintersFoundException());
} else onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -101,7 +95,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
printerService
.processPrintReport(printerName, quantity, jasperDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "printReport", data -> {
@ -110,10 +104,8 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
if (t.getMessage().contains("Printer not found")) {
onFailed.run(new NoPrintersFoundException());
} else onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -131,7 +123,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
printerService
.printReportType(reportTypeDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "printReportType", data -> {
@ -140,10 +132,8 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
if (t.getMessage().contains("Printer not found")) {
onFailed.run(new NoPrintersFoundException());
} else onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -164,7 +154,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class, 240);
Call<ServiceRESTResponse<Object>> callable = printerService.printClosedOrders(codMdep, dto);
callable.enqueue(new Callback<>() {
callable.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "printCollo", data -> {
@ -173,10 +163,8 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
if (t.getMessage().contains("Printer not found")) {
onFailed.run(new NoPrintersFoundException());
} else onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull;
import com.annimon.stream.Stream;
import com.google.gson.JsonObject;
@ -9,10 +11,10 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.gest.prod_linee_produzione.dto.ProdLineStatusDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -21,7 +23,7 @@ public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
public void avviaLineaDiProduzione(String codJfas, Integer hrNum, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class);
Call<ServiceRESTResponse<JsonObject>> callable = restService.avviaLineaDiProduzione(codJfas, hrNum);
callable.enqueue(new Callback<>() {
callable.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
analyzeAnswer(response, "avviaLineaDiProduzione", data -> {
@ -30,8 +32,8 @@ public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -39,7 +41,7 @@ public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
public void arrestaLineaDiProduzione(String codJfas, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class);
Call<ServiceRESTResponse<JsonObject>> callable = restService.arrestaLineaDiProduzione(codJfas);
callable.enqueue(new Callback<>() {
callable.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
analyzeAnswer(response, "arrestaLineaDiProduzione", data -> {
@ -48,8 +50,8 @@ public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -57,7 +59,7 @@ public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
public void avviaProduzioneArticoloSuLinea(String codJfas, String codMart, String partitaMag, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class, 300);
Call<ServiceRESTResponse<JsonObject>> callable = restService.avviaProduzioneArticoloSuLinea(codJfas, codMart, partitaMag);
callable.enqueue(new Callback<>() {
callable.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
analyzeAnswer(response, "avviaProduzioneArticoloSuLinea", data -> {
@ -66,8 +68,8 @@ public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -75,15 +77,15 @@ public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
public void getStatoLinee(String codMdep, RunnableArgs<List<ProdLineStatusDTO>> onComplete, RunnableArgs<Exception> onFailed) {
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class);
Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> callable = restService.getStatoLinee(codMdep);
callable.enqueue(new Callback<>() {
callable.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> call, Response<ServiceRESTResponse<List<ProdLineStatusDTO>>> response) {
analyzeAnswer(response, "getStatoLinee", onComplete::run, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -92,7 +94,7 @@ public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
public void getLineDetails(ProdLineStatusDTO lineaProd, RunnableArgs<ProdLineStatusDTO> onComplete, RunnableArgs<Exception> onFailed) {
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class);
Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> callable = restService.getStatoLinee(lineaProd.getCodMdepLav());
callable.enqueue(new Callback<>() {
callable.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> call, Response<ServiceRESTResponse<List<ProdLineStatusDTO>>> response) {
analyzeAnswer(response, "getLineDetails", (lines) -> {
@ -102,8 +104,8 @@ public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,15 +1,15 @@
package it.integry.integrywmsnative.core.rest.consumers;
import com.orhanobut.logger.Logger;
import androidx.annotation.NonNull;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.produzione.CaricoProdFinDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -22,7 +22,7 @@ public class ProduzioneRESTConsumer extends _BaseRESTConsumer{
ProduzioneRESTConsumerService service = RESTBuilder.getService(ProduzioneRESTConsumerService.class);
service.caricoProdFin(caricoProdFin)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "caricoProdFin", Void -> onComplete.run(), ex -> {
@ -31,9 +31,8 @@ public class ProduzioneRESTConsumer extends _BaseRESTConsumer{
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
Logger.e(t, "caricoProdFin");
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -3,24 +3,24 @@ package it.integry.integrywmsnative.core.rest.consumers;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import com.google.gson.Gson;
import com.orhanobut.logger.Logger;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.reflect.Type;
import java.net.ConnectException;
import java.util.List;
import javax.inject.Singleton;
import it.integry.integrywmsnative.BuildConfig;
import it.integry.integrywmsnative.core.CommonConst;
import it.integry.integrywmsnative.core.exception.InvalidConnectionException;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
@ -31,7 +31,6 @@ import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityGson;
import it.integry.integrywmsnative.core.utility.UtilityString;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -41,15 +40,15 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
public void retrieveUpdatesInfo(final RunnableArgs<LatestAppVersionInfoDTO> onSuccess, final RunnableArgs<Exception> onFailed) {
SystemRESTConsumerService systemRESTConsumerService = RESTBuilder.getService(SystemRESTConsumerService.class);
systemRESTConsumerService.retrieveUpdatesInfo()
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<LatestAppVersionInfoDTO> call, Response<LatestAppVersionInfoDTO> response) {
analyzeAnswerGeneric(response, "updates", onSuccess, onFailed);
}
@Override
public void onFailure(Call<LatestAppVersionInfoDTO> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<LatestAppVersionInfoDTO> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -61,15 +60,15 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
SystemRESTConsumerService systemRESTConsumerService = RESTBuilder.getService(SystemRESTConsumerService.class);
systemRESTConsumerService.registerDevice(registerDeviceRequestDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "device/register", Void -> onSuccess.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
@ -82,7 +81,7 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
service
.processSql(nativeSqlDTO)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "ProcessSql", o -> {
@ -100,13 +99,8 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
Logger.e(t, "ProcessSQL");
if (t instanceof ConnectException)
onFailed.run(new InvalidConnectionException(RESTBuilder.getDefaultHost(), RESTBuilder.getDefaultPort(), t));
else
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -114,16 +108,15 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
public void getAvailableCodMdeps(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
service.getAvailableCodMdeps().enqueue(new Callback<>() {
service.getAvailableCodMdeps().enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> call, Response<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> response) {
analyzeAnswer(response, "CodMdepsAvailable", onSuccess, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> call, final Throwable t) {
Log.e("CodMdepsAvailable", t.toString());
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -161,16 +154,16 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
public void sendMail(MailRequestDTO mailDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
service.sendMail(mailDTO).enqueue(new Callback<>() {
service.sendMail(mailDTO).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<String>> call, Response<ServiceRESTResponse<String>> response) {
if (onComplete != null) onComplete.run();
}
@Override
public void onFailure(Call<ServiceRESTResponse<String>> call, Throwable t) {
public void onFailure(Call<ServiceRESTResponse<String>> call, @NonNull final Exception e) {
if (onFailed != null) {
onFailed.run(new Exception(t));
onFailed.run(e);
}
}
});

View File

@ -0,0 +1,27 @@
package it.integry.integrywmsnative.core.rest.handler;
import androidx.annotation.NonNull;
import java.net.ConnectException;
import it.integry.integrywmsnative.core.exception.InvalidConnectionException;
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import retrofit2.Call;
import retrofit2.Callback;
public abstract class ManagedErrorCallback<T> implements Callback<T> {
@Override
public void onFailure(Call<T> call, Throwable t) {
if (t instanceof ConnectException connectException) {
t = new InvalidConnectionException(RESTBuilder.getDefaultHost(), RESTBuilder.getDefaultPort(), connectException);
} else if (t.getMessage() != null && t.getMessage().contains("Printer not found")) {
t = new NoPrintersFoundException();
}
onFailure(call, (Exception) t);
}
public abstract void onFailure(Call<T> call, @NonNull final Exception e);
}

View File

@ -219,7 +219,7 @@ public class Stash {
Type type = new GenericType(tClass);
return (ArrayList<T>) gson.fromJson(data, type);
}
return new ArrayList<T>();
return new ArrayList<>();
}
//clear single value

View File

@ -6,7 +6,7 @@ import androidx.lifecycle.Observer;
public class UtilityLiveData {
public static <T> void observeOnce(final LiveData<T> liveData, final Observer<T> observer) {
liveData.observeForever(new Observer<T>() {
liveData.observeForever(new Observer<>() {
@Override
public void onChanged(T t) {
liveData.removeObserver(this);

View File

@ -15,7 +15,7 @@ import java.util.regex.Pattern;
*/
public class UtilityString {
private static final Map<String, String> DATE_FORMAT_REGEXPS = new HashMap<String, String>() {{
private static final Map<String, String> DATE_FORMAT_REGEXPS = new HashMap<>() {{
//-----------------------------------------------------------------------------------------
//giorno-mese-giorno

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest;
import androidx.annotation.NonNull;
import java.util.List;
import javax.inject.Singleton;
@ -7,6 +9,7 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoArticoliAccettazioneBollaRequestDTO;
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.RetrieveElencoArticoliAccettazioneBollaResponseDTO;
@ -14,7 +17,6 @@ import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.Retri
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.SitBollaAccettazioneDTO;
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.TestataBollaAccettazioneDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -24,15 +26,15 @@ public class BolleAccettazioneRESTConsumer extends _BaseRESTConsumer {
public void retrieveBolleDaAccettare(RunnableArgs<List<TestataBollaAccettazioneDTO>> onComplete, RunnableArgs<Exception> onFailed) {
BolleAccettazioneRESTConsumerService service = RESTBuilder.getService(BolleAccettazioneRESTConsumerService.class);
service.retrieveElencoBolle()
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<RetrieveElencoBolleAccettazioneResponseDTO>> call, Response<ServiceRESTResponse<RetrieveElencoBolleAccettazioneResponseDTO>> response) {
analyzeAnswer(response, "retrieveBolleDaAccettare", data -> onComplete.run(data.getBolleDaAccettare()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<RetrieveElencoBolleAccettazioneResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<RetrieveElencoBolleAccettazioneResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -44,15 +46,15 @@ public class BolleAccettazioneRESTConsumer extends _BaseRESTConsumer {
.setBolle(bolle);
service.retrievePickingListBolle(request)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<RetrieveElencoArticoliAccettazioneBollaResponseDTO>> call, Response<ServiceRESTResponse<RetrieveElencoArticoliAccettazioneBollaResponseDTO>> response) {
analyzeAnswer(response, "retrievePickingListBolle", data -> onComplete.run(data.getSitArticoli()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<RetrieveElencoArticoliAccettazioneBollaResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<RetrieveElencoArticoliAccettazioneBollaResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.gest.accettazione_bolla_picking.rest;
import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.List;
@ -7,15 +9,15 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.TestataBollaAccettazioneDTO;
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
import it.integry.integrywmsnative.gest.accettazione_bolla_picking.dto.RetrieveAlreadyRegisteredULAccettazioneBollaRequestDTO;
import it.integry.integrywmsnative.gest.accettazione_bolla_picking.dto.RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -33,7 +35,7 @@ public class AccettazioneBollaPickingRESTConsumer extends _BaseRESTConsumer {
.setBolle(bolle);
service.retrieveAlreadyRegisteredUDC(request)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO>> call, Response<ServiceRESTResponse<RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO>> response) {
analyzeAnswer(response, "retrieveAlreadyRegisteredUDC",
@ -42,8 +44,8 @@ public class AccettazioneBollaPickingRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<RetrieveAlreadyRegisteredULAccettazioneBollaResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.gest.accettazione_ordini_elenco.rest;
import androidx.annotation.NonNull;
import com.annimon.stream.Stream;
import java.util.List;
@ -9,13 +11,12 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
import it.integry.integrywmsnative.gest.accettazione_ordini_elenco.dto.GetPickingListAccettazioneDTO;
import it.integry.integrywmsnative.gest.accettazione_ordini_elenco.dto.OrdineAccettazioneInevasoDTO;
import it.integry.integrywmsnative.gest.accettazione_ordini_elenco.dto.SitArtOrdDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -24,15 +25,15 @@ public class OrdiniAccettazioneRESTConsumer extends _BaseRESTConsumer {
public void getOrdiniInevasi(String codMdep, RunnableArgs<List<OrdineAccettazioneInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
OrdiniAccettazioneRESTConsumerService service = RESTBuilder.getService(OrdiniAccettazioneRESTConsumerService.class);
service.listOrdiniInevasi(codMdep, "A").enqueue(new Callback<>() {
service.listOrdiniInevasi(codMdep, "A").enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> call, Response<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> response) {
analyzeAnswer(response, "getOrdiniInevasi", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -47,16 +48,15 @@ public class OrdiniAccettazioneRESTConsumer extends _BaseRESTConsumer {
.toList();
OrdiniAccettazioneRESTConsumerService service = RESTBuilder.getService(OrdiniAccettazioneRESTConsumerService.class);
service.getArticoliFromOrdiniAccettazione(getPickingListDTOs).enqueue(new Callback<ServiceRESTResponse<List<SitArtOrdDTO>>>() {
service.getArticoliFromOrdiniAccettazione(getPickingListDTOs).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, Response<ServiceRESTResponse<List<SitArtOrdDTO>>> response) {
analyzeAnswer(response, "retrieveListaArticoliFromOrdiniAccettazione", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, Throwable t) {
UtilityLogger.error(new Exception(t));
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.gest.accettazione_ordini_picking.rest;
import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.List;
@ -11,12 +13,12 @@ import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.gest.accettazione_ordini_elenco.dto.OrdineAccettazioneInevasoDTO;
import it.integry.integrywmsnative.gest.accettazione_ordini_picking.dto.RetrieveAlreadyRegisteredULAccettazioneOrdineRequestDTO;
import it.integry.integrywmsnative.gest.accettazione_ordini_picking.dto.RetrieveAlreadyRegisteredULAccettazioneOrdineResponseDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -36,7 +38,7 @@ public class AccettazioneOrdiniPickingRESTConsumer extends _BaseRESTConsumer {
.setOrdini(ordiniToShow);
service.retrieveAlreadyRegisteredUDC(request)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<RetrieveAlreadyRegisteredULAccettazioneOrdineResponseDTO>> call, Response<ServiceRESTResponse<RetrieveAlreadyRegisteredULAccettazioneOrdineResponseDTO>> response) {
analyzeAnswer(response, "retrieveAlreadyRegisteredUDC",
@ -45,8 +47,8 @@ public class AccettazioneOrdiniPickingRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<RetrieveAlreadyRegisteredULAccettazioneOrdineResponseDTO>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<RetrieveAlreadyRegisteredULAccettazioneOrdineResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -6,17 +6,16 @@ import java.util.List;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.exception.RestException;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DocInterniSetupDTO;
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.RetrieveLottiDTO;
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.SaveDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -30,15 +29,15 @@ public class DocInterniRESTConsumer extends _BaseRESTConsumer {
public void getDocInterniSetup(RunnableArgs<DocInterniSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
DocInterniRESTConsumerService service = RESTBuilder.getService(DocInterniRESTConsumerService.class);
service.getSetupDocInterni().enqueue(new Callback<>() {
service.getSetupDocInterni().enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<DocInterniSetupDTO>> call, Response<ServiceRESTResponse<DocInterniSetupDTO>> response) {
analyzeAnswer(response, "getSetupDocInterni", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<DocInterniSetupDTO>> call, Throwable t) {
onFailed.run(new RestException(t.getMessage()));
public void onFailure(Call<ServiceRESTResponse<DocInterniSetupDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -46,15 +45,15 @@ public class DocInterniRESTConsumer extends _BaseRESTConsumer {
public void retrieveLotti(String codProd, RunnableArgs<List<RetrieveLottiDTO>> onComplete, RunnableArgs<Exception> onFailed) {
DocInterniRESTConsumerService service = RESTBuilder.getService(DocInterniRESTConsumerService.class);
service.retrieveLotti(codProd)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(@NonNull Call<ServiceRESTResponse<List<RetrieveLottiDTO>>> call, @NonNull Response<ServiceRESTResponse<List<RetrieveLottiDTO>>> response) {
analyzeAnswer(response, "retrieveLotti", onComplete, onFailed);
}
@Override
public void onFailure(@NonNull Call<ServiceRESTResponse<List<RetrieveLottiDTO>>> call, @NonNull Throwable t) {
onFailed.run(new RestException(t.getMessage()));
public void onFailure(@NonNull Call<ServiceRESTResponse<List<RetrieveLottiDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,6 +1,6 @@
package it.integry.integrywmsnative.gest.login.rest;
import android.util.Log;
import androidx.annotation.NonNull;
import javax.inject.Singleton;
@ -8,12 +8,12 @@ import it.integry.integrywmsnative.core.CommonConst;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.gest.login.dto.LoginAziendaDTO;
import it.integry.integrywmsnative.gest.login.dto.LoginResponseDTO;
import it.integry.integrywmsnative.gest.login.dto.LoginRequestDTO;
import it.integry.integrywmsnative.gest.login.dto.LoginResponseDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -27,16 +27,15 @@ public class LoginRESTConsumer extends _BaseRESTConsumer {
int port = CommonConst.Login.Azienda.port;
LoginRESTConsumerService service = RESTBuilder.getService(LoginRESTConsumerService.class, protocol, host, port, false, true);
service.loginAzienda(codAzienda).enqueue(new Callback<>() {
service.loginAzienda(codAzienda).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<LoginAziendaDTO>> call, Response<ServiceRESTResponse<LoginAziendaDTO>> response) {
analyzeAnswer(response, "LoginAzienda", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<LoginAziendaDTO>> call, Throwable t) {
Log.e("LoginAzienda", t.toString());
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<LoginAziendaDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -49,7 +48,7 @@ public class LoginRESTConsumer extends _BaseRESTConsumer {
.setUsername(username)
.setPassword(password);
service.login(loginRequestDTO).enqueue(new Callback<>() {
service.login(loginRequestDTO).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<LoginResponseDTO>> call, Response<ServiceRESTResponse<LoginResponseDTO>> response) {
@ -57,9 +56,8 @@ public class LoginRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<LoginResponseDTO>> call, final Throwable t) {
Log.e("Login", t.toString());
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<LoginResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.gest.ordini_uscita_elenco.rest;
import androidx.annotation.NonNull;
import java.util.List;
import javax.inject.Singleton;
@ -10,9 +12,9 @@ import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -27,7 +29,7 @@ public class OrdiniUscitaElencoRESTConsumer extends _BaseRESTConsumer {
testataCollo.getGestione(),
GestioneEnum.VENDITA.getText(),
codMdep)
.enqueue(new Callback<ServiceRESTResponse<List<DtbOrdt>>>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<DtbOrdt>>> call, Response<ServiceRESTResponse<List<DtbOrdt>>> response) {
analyzeAnswer(response, "getOrdiniFromCommessaCollo", (m) -> {
@ -36,8 +38,8 @@ public class OrdiniUscitaElencoRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<DtbOrdt>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<DtbOrdt>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.rest;
import androidx.annotation.NonNull;
import com.annimon.stream.Stream;
import java.util.List;
@ -9,14 +11,13 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
import it.integry.integrywmsnative.gest.accettazione_ordini_elenco.dto.GetPickingListAccettazioneDTO;
import it.integry.integrywmsnative.gest.accettazione_ordini_elenco.dto.OrdineAccettazioneInevasoDTO;
import it.integry.integrywmsnative.gest.accettazione_ordini_elenco.dto.SitArtOrdDTO;
import it.integry.integrywmsnative.gest.accettazione_ordini_elenco.rest.OrdiniAccettazioneRESTConsumerService;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -24,15 +25,15 @@ public class ProdOrdineProduzioneRESTConsumer extends _BaseRESTConsumer {
public void getOrdiniInevasi(String codMdep, RunnableArgs<List<OrdineAccettazioneInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
OrdiniAccettazioneRESTConsumerService service = RESTBuilder.getService(OrdiniAccettazioneRESTConsumerService.class);
service.listOrdiniInevasi(codMdep, "P").enqueue(new Callback<>() {
service.listOrdiniInevasi(codMdep, "P").enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> call, Response<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> response) {
analyzeAnswer(response, "getOrdiniInevasi", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -47,16 +48,15 @@ public class ProdOrdineProduzioneRESTConsumer extends _BaseRESTConsumer {
.toList();
OrdiniAccettazioneRESTConsumerService service = RESTBuilder.getService(OrdiniAccettazioneRESTConsumerService.class);
service.getArticoliFromOrdiniAccettazione(getPickingListDTOs).enqueue(new Callback<>() {
service.getArticoliFromOrdiniAccettazione(getPickingListDTOs).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, Response<ServiceRESTResponse<List<SitArtOrdDTO>>> response) {
analyzeAnswer(response, "retrieveListaArticoliFromOrdiniProduzione", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, Throwable t) {
UtilityLogger.error(new Exception(t));
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest;
import androidx.annotation.NonNull;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
@ -11,15 +13,13 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoBufferRESTConsumerService;
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.utility.UtilityDB;
import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dto.ProdFabbisognoLineeProdDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -35,7 +35,7 @@ public class ProdFabbisognoLineeProdRESTConsumer extends _BaseRESTConsumer {
public void loadFabbisogno(String numOrd, String codMdep, RunnableArgs<List<ProdFabbisognoLineeProdDTO>> onComplete, RunnableArgs<Exception> onFailed) {
ProdFabbisognoLineeProdRESTConsumerService prodFabbisognoLineeProdRESTConsumerService = RESTBuilder.getService(ProdFabbisognoLineeProdRESTConsumerService.class);
prodFabbisognoLineeProdRESTConsumerService.loadFabbisogno(numOrd, codMdep)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<ProdFabbisognoLineeProdDTO>>> call,
Response<ServiceRESTResponse<List<ProdFabbisognoLineeProdDTO>>> response) {
@ -43,8 +43,8 @@ public class ProdFabbisognoLineeProdRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<ProdFabbisognoLineeProdDTO>>> call, Throwable t) {
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<ProdFabbisognoLineeProdDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -360,15 +360,14 @@ public class ProdRientroMerceOrderDetailFragment extends BaseFragment implements
public Drawable getOrderStatusIcon() {
if (currentOrder.getValue() != null) {
switch (currentOrder.getValue().getStatoEnum()) {
case IN_CORSO:
return ContextCompat.getDrawable(requireActivity(), R.drawable.ic_play_circle_filled_24dp);
case PAUSA:
return ContextCompat.getDrawable(requireActivity(), R.drawable.ic_pause_circle_filled_24dp);
case PROGRAMMATO:
default:
return ContextCompat.getDrawable(requireActivity(), R.drawable.ic_clock_circle_outline_24dp);
}
return switch (currentOrder.getValue().getStatoEnum()) {
case IN_CORSO ->
ContextCompat.getDrawable(requireActivity(), R.drawable.ic_play_circle_filled_24dp);
case PAUSA ->
ContextCompat.getDrawable(requireActivity(), R.drawable.ic_pause_circle_filled_24dp);
default ->
ContextCompat.getDrawable(requireActivity(), R.drawable.ic_clock_circle_outline_24dp);
};
} else
return ContextCompat.getDrawable(requireActivity(), R.drawable.ic_clock_circle_outline_24dp);
}

View File

@ -1,10 +1,10 @@
package it.integry.integrywmsnative.gest.prod_rientro_merce.order_detail.rest;
import androidx.annotation.NonNull;
import androidx.databinding.ObservableArrayList;
import com.annimon.stream.Stream;
import com.google.gson.reflect.TypeToken;
import com.orhanobut.logger.Logger;
import java.lang.reflect.Type;
import java.util.ArrayList;
@ -21,13 +21,13 @@ import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.utility.UtilityDB;
import it.integry.integrywmsnative.core.utility.UtilityQuery;
import it.integry.integrywmsnative.gest.prod_rientro_merce.order_detail.rest.dto.ImportColliDaProduzioneRequestDTO;
import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavorazioneDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -113,7 +113,7 @@ public class ProdRientroMerceOrderDetailRESTConsumer extends _BaseRESTConsumer {
ProdRientroMerceOrderDetailRESTConsumerService service = RESTBuilder.getService(ProdRientroMerceOrderDetailRESTConsumerService.class);
service.importColliDaProduzione(Collections.singletonList(importColliDaProduzioneRequestDTO))
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
analyzeAnswerList(response, "importColliDaProduzione", mtbColt -> {
@ -124,9 +124,8 @@ public class ProdRientroMerceOrderDetailRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, Throwable t) {
Logger.e(t, "importColliDaProduzione");
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}
@ -134,7 +133,7 @@ public class ProdRientroMerceOrderDetailRESTConsumer extends _BaseRESTConsumer {
public void deleteColloDaProduzione(MtbColt mtbColtToDelete, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ProdRientroMerceOrderDetailRESTConsumerService service = RESTBuilder.getService(ProdRientroMerceOrderDetailRESTConsumerService.class);
service.deleteColloDaProduzione(mtbColtToDelete).enqueue(new Callback<ServiceRESTResponse<Object>>() {
service.deleteColloDaProduzione(mtbColtToDelete).enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "deleteColloDaProduzione", mtbColt -> {
@ -145,9 +144,8 @@ public class ProdRientroMerceOrderDetailRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
Logger.e(t, "deleteColloDaProduzione");
onFailed.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
}

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.gest.rettifica_giacenze.rest;
import androidx.annotation.NonNull;
import com.annimon.stream.Stream;
import com.google.gson.reflect.TypeToken;
@ -16,6 +18,7 @@ import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.SaveDocFromPickingRequestDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.gest.rettifica_giacenze.dto.FornitoreDTO;
@ -24,7 +27,6 @@ import it.integry.integrywmsnative.gest.rettifica_giacenze.dto.SearchArticoloByB
import it.integry.integrywmsnative.gest.rettifica_giacenze.dto.SearchArticoloByCodArtFornOrDescrizioneRequestDTO;
import it.integry.integrywmsnative.gest.rettifica_giacenze.dto.SearchArticoloByCodArtFornOrDescrizioneResponseDTO;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
@ -53,7 +55,7 @@ public class RettificaGiacenzeRESTConsumer extends _BaseRESTConsumer {
service.searchByCodArtFornOrDescrizione(new SearchArticoloByCodArtFornOrDescrizioneRequestDTO()
.setCodAlis(codAlis)
.setCodArtFornOrDescrizione(codArtForOrDescr))
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<SearchArticoloByCodArtFornOrDescrizioneResponseDTO>>> call,
Response<ServiceRESTResponse<List<SearchArticoloByCodArtFornOrDescrizioneResponseDTO>>> response) {
@ -61,8 +63,8 @@ public class RettificaGiacenzeRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<SearchArticoloByCodArtFornOrDescrizioneResponseDTO>>> call, Throwable t) {
onError.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<SearchArticoloByCodArtFornOrDescrizioneResponseDTO>>> call, @NonNull final Exception e) {
onError.run(e);
}
});
@ -75,7 +77,7 @@ public class RettificaGiacenzeRESTConsumer extends _BaseRESTConsumer {
final RettificaGiacenzeRESTConsumerService service = RESTBuilder.getService(RettificaGiacenzeRESTConsumerService.class);
service.searchByCodMartOrBarcode(new SearchArticoloByBarcodeOrCodMartRequestDTO()
.setCodMartOrBarcode(codMartOrBarcodeOrDescr))
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<SearchArticoloByBarcodeOrCodMartResponseDTO>>> call,
Response<ServiceRESTResponse<List<SearchArticoloByBarcodeOrCodMartResponseDTO>>> response) {
@ -96,8 +98,8 @@ public class RettificaGiacenzeRESTConsumer extends _BaseRESTConsumer {
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<SearchArticoloByBarcodeOrCodMartResponseDTO>>> call, Throwable t) {
onError.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<List<SearchArticoloByBarcodeOrCodMartResponseDTO>>> call, @NonNull final Exception e) {
onError.run(e);
}
});
}
@ -110,15 +112,15 @@ public class RettificaGiacenzeRESTConsumer extends _BaseRESTConsumer {
final RettificaGiacenzeRESTConsumerService service = RESTBuilder.getService(RettificaGiacenzeRESTConsumerService.class);
service.saveDocFromPickingPvm(request)
.enqueue(new Callback<>() {
.enqueue(new ManagedErrorCallback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswerList(response, "saveDocFromPickingPvm", data -> onComplete.run(), onError);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
onError.run(new Exception(t));
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onError.run(e);
}
});
}

View File

@ -5,10 +5,6 @@ import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Michal on 04/08/16.
* Responsible for updating the handle / bubble position when user scrolls the {@link android.support.v7.widget.RecyclerView}.
*/
public class RecyclerViewScrollListener extends RecyclerView.OnScrollListener {
private final FastScroller scroller;

View File

@ -8,7 +8,7 @@ public class TracciamentoImballoDTO {
private final ObservableField<String> codTcol = new ObservableField<>();
private final ObservableField<String> descrizione = new ObservableField<>();
private final ObservableField<String> codMart = new ObservableField<>();
private final ObservableField<Integer> qta = new ObservableField<Integer>();
private final ObservableField<Integer> qta = new ObservableField<>();
private final ObservableBoolean editable = new ObservableBoolean(true);

View File

@ -1158,6 +1158,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/add_unit"
android:layout_marginStart="8dp"
app:icon="@drawable/ic_add_24dp"
app:singleClick="@{() -> view.addSingleUnitButtonClick()}" />

View File

@ -178,7 +178,7 @@
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{&quot;#&quot; + mtbColr.numColloRif + &quot; (&quot; + mtbColr.serCollo + &quot;)&quot;}"
android:text="@{&quot;#&quot; + mtbColr.numColloRif + &quot; (&quot; + mtbColr.serColloRif + &quot;)&quot;}"
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
android:singleLine="true"
android:ellipsize="end"
@ -187,7 +187,7 @@
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{GestioneToTextConverter.convert(mtbColr.gestioneEnum)}"
android:text="@{GestioneToTextConverter.convert(mtbColr.gestioneRifEnum)}"
android:textAppearance="@style/TextAppearance.Material3.BodySmall"
android:textColor="?attr/colorOutline"
tools:text="Lavorazione"/>

View File

@ -739,6 +739,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/add_unit"
android:layout_marginStart="8dp"
app:icon="@drawable/ic_add_24dp"
app:singleClick="@{() -> view.addSingleUnitButtonClick()}" />

View File

@ -380,8 +380,8 @@
<string name="cod_alis_name">Griglia: </string>
<string name="seleziona_crea_ordine_a_pv">Seleziona / Crea ordine</string>
<string name="add">Aggiungi</string>
<string name="add_lu">Aggiungi pedana</string>
<string name="add_unit">Aggiungi unità</string>
<string name="add_lu">Agg. pedana</string>
<string name="add_unit">Agg. unità</string>
<string name="action_close">Chiudi</string>
<string name="close_and_export">Chiudi ed esporta ordine</string>
<string name="close_and_exit">Chiudi ordine</string>

View File

@ -40,7 +40,7 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
@Override
public boolean isRightAdapter() {
String model = Build.MODEL;
List<String> compatibleModels = new ArrayList<String>();
List<String> compatibleModels = new ArrayList<>();
compatibleModels.add("EDA50");
compatibleModels.add("EDA51");
compatibleModels.add("EDA52");