Rimosse tutte le chiamate statiche a RESTBuilder
This commit is contained in:
parent
09c929803f
commit
56f14c064e
@ -116,6 +116,8 @@ import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.Dialog
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.DialogAskUnknownBarcodeNotesModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_vettore.DialogAskVettoreComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_vettore.DialogAskVettoreModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLUComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLUModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.bind_product_barcode_with_package.DialogBindProductBarcodeWithPackageComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.bind_product_barcode_with_package.DialogBindProductBarcodeWithPackageModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListComponent;
|
||||
@ -173,6 +175,7 @@ import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracc
|
||||
DialogInputLUProdModule.class,
|
||||
DialogScanArtModule.class,
|
||||
DialogScanOrCreateLUModule.class,
|
||||
DialogBasketLUModule.class,
|
||||
ProdFabbisognoLineeProdModule.class,
|
||||
VersamentoMerceModule.class,
|
||||
DialogAskMagazzinoProssimitaModule.class,
|
||||
@ -271,6 +274,8 @@ public interface MainApplicationComponent {
|
||||
|
||||
DialogScanOrCreateLUComponent.Factory dialogScanOrCreateLUComponent();
|
||||
|
||||
DialogBasketLUComponent.Factory dialogBasketLUComponent();
|
||||
|
||||
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
|
||||
|
||||
VersamentoMerceComponent.Factory versamentoMerceComponent();
|
||||
|
||||
@ -19,6 +19,7 @@ import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
||||
import it.integry.integrywmsnative.core.ean128.Ean128Service;
|
||||
import it.integry.integrywmsnative.core.menu.MenuRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.AziendaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
@ -49,6 +50,7 @@ import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.sound.SoundAlertService;
|
||||
import it.integry.integrywmsnative.core.update.UpdatesManager;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.login.rest.AuthRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
@ -94,8 +96,8 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase, systemRESTConsumer);
|
||||
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer, AuthRESTConsumer authRESTConsumer) {
|
||||
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase, systemRESTConsumer, authRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ -112,6 +114,13 @@ public class MainApplicationModule {
|
||||
return new Ean128Service();
|
||||
}
|
||||
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
RESTBuilder providesRESTBuilder() {
|
||||
return new RESTBuilder();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MenuService provideMenuService(MenuRESTConsumer menuRESTConsumer) {
|
||||
@ -138,20 +147,20 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
OrdiniRESTConsumer provideOrdiniRESTConsumer(SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||
return new OrdiniRESTConsumer(systemRESTConsumer, entityRESTConsumer);
|
||||
OrdiniRESTConsumer provideOrdiniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||
return new OrdiniRESTConsumer(restBuilder, systemRESTConsumer, entityRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
GestSetupRESTConsumer provideGestSetupRESTConsumer() {
|
||||
return new GestSetupRESTConsumer();
|
||||
GestSetupRESTConsumer provideGestSetupRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new GestSetupRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ArticoloRESTConsumer provideArticoloRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
return new ArticoloRESTConsumer(systemRESTConsumer);
|
||||
ArticoloRESTConsumer provideArticoloRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new ArticoloRESTConsumer(restBuilder, systemRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ -168,41 +177,42 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MenuRESTConsumer provideMenuRESTConsumer() {
|
||||
return new MenuRESTConsumer();
|
||||
MenuRESTConsumer provideMenuRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new MenuRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MagazzinoRESTConsumer provideMagazzinoRESTConsumer(ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new MagazzinoRESTConsumer(executorService, systemRESTConsumer);
|
||||
MagazzinoRESTConsumer provideMagazzinoRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new MagazzinoRESTConsumer(restBuilder, executorService, systemRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MesRESTConsumer provideMesRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
return new MesRESTConsumer(systemRESTConsumer);
|
||||
MesRESTConsumer provideMesRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new MesRESTConsumer(restBuilder, systemRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
EntityRESTConsumer provideEntityRESTConsumer() {
|
||||
return new EntityRESTConsumer();
|
||||
EntityRESTConsumer provideEntityRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new EntityRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(SystemRESTConsumer systemRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(RESTBuilder restBuilder,
|
||||
SystemRESTConsumer systemRESTConsumer,
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
EntityRESTConsumer entityRESTConsumer,
|
||||
SettingsManager settingsManager) {
|
||||
return new ColliMagazzinoRESTConsumer(systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer, settingsManager);
|
||||
return new ColliMagazzinoRESTConsumer(restBuilder, systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer, settingsManager);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
AziendaRESTConsumer provideAziendaRESTConsumer() {
|
||||
return new AziendaRESTConsumer();
|
||||
AziendaRESTConsumer provideAziendaRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new AziendaRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ -213,56 +223,56 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PrinterRESTConsumer providePrinterRESTConsumer() {
|
||||
return new PrinterRESTConsumer();
|
||||
PrinterRESTConsumer providePrinterRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new PrinterRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
SystemRESTConsumer provideSystemRESTConsumer() {
|
||||
return new SystemRESTConsumer();
|
||||
SystemRESTConsumer provideSystemRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new SystemRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PVOrdiniAcquistoRESTConsumer providesPVOrdiniAcquistoRESTConsumer(MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||
return new PVOrdiniAcquistoRESTConsumer(magazzinoRESTConsumer);
|
||||
PVOrdiniAcquistoRESTConsumer providesPVOrdiniAcquistoRESTConsumer(RESTBuilder restBuilder, MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||
return new PVOrdiniAcquistoRESTConsumer(restBuilder, magazzinoRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PosizioniRESTConsumer providesPosizioniRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
return new PosizioniRESTConsumer(systemRESTConsumer);
|
||||
PosizioniRESTConsumer providesPosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ProdFabbisognoLineeProdRESTConsumer providesProdFabbisognoLineeProdRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
return new ProdFabbisognoLineeProdRESTConsumer(systemRESTConsumer);
|
||||
ProdFabbisognoLineeProdRESTConsumer providesProdFabbisognoLineeProdRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new ProdFabbisognoLineeProdRESTConsumer(restBuilder, systemRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
DocInterniRESTConsumer provideDocInterniRESTConsumer(MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||
return new DocInterniRESTConsumer(magazzinoRESTConsumer);
|
||||
DocInterniRESTConsumer provideDocInterniRESTConsumer(RESTBuilder restBuilder, MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||
return new DocInterniRESTConsumer(restBuilder, magazzinoRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
GiacenzaRESTConsumer provideGiacenzaRESTConsumer(ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
return new GiacenzaRESTConsumer(articoloRESTConsumer);
|
||||
GiacenzaRESTConsumer provideGiacenzaRESTConsumer(RESTBuilder restBuilder, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
return new GiacenzaRESTConsumer(restBuilder, articoloRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ImballiRESTConsumer provideImballiRESTConsumer(ExecutorService executorService) {
|
||||
return new ImballiRESTConsumer(executorService);
|
||||
ImballiRESTConsumer provideImballiRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
return new ImballiRESTConsumer(restBuilder, executorService);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
VettoriRESTConsumer provideVettoriRESTConsumer(ExecutorService executorService) {
|
||||
return new VettoriRESTConsumer(executorService);
|
||||
VettoriRESTConsumer provideVettoriRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
return new VettoriRESTConsumer(restBuilder, executorService);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ -273,44 +283,44 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ProductionLinesRESTConsumer provideProductionLinesRESTConsumer() {
|
||||
return new ProductionLinesRESTConsumer();
|
||||
ProductionLinesRESTConsumer provideProductionLinesRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new ProductionLinesRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
DocumentRESTConsumer provideDocumentiRESTConsumer() {
|
||||
return new DocumentRESTConsumer();
|
||||
DocumentRESTConsumer provideDocumentiRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new DocumentRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ColliAccettazioneRESTConsumer provideColliAccettazioneRESTConsumer() {
|
||||
return new ColliAccettazioneRESTConsumer();
|
||||
ColliAccettazioneRESTConsumer provideColliAccettazioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new ColliAccettazioneRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer() {
|
||||
return new ColliSpedizioneRESTConsumer();
|
||||
ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new ColliSpedizioneRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer(SettingsManager settingsManager) {
|
||||
return new ColliLavorazioneRESTConsumer(settingsManager);
|
||||
ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer(RESTBuilder restBuilder, SettingsManager settingsManager) {
|
||||
return new ColliLavorazioneRESTConsumer(restBuilder, settingsManager);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer() {
|
||||
return new MagazzinoAutomaticoRESTConsumer();
|
||||
MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new MagazzinoAutomaticoRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MagazzinoBufferRESTConsumer provideMagazzinoBufferRESTConsumer() {
|
||||
return new MagazzinoBufferRESTConsumer();
|
||||
MagazzinoBufferRESTConsumer provideMagazzinoBufferRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new MagazzinoBufferRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@ -19,6 +19,7 @@ import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityThread;
|
||||
import it.integry.integrywmsnative.gest.login.rest.AuthRESTConsumer;
|
||||
|
||||
@Singleton
|
||||
public class MainContext {
|
||||
@ -27,14 +28,16 @@ public class MainContext {
|
||||
private final MenuService menuService;
|
||||
private final AppDatabase appDatabase;
|
||||
private final SystemRESTConsumer systemRESTConsumer;
|
||||
private final AuthRESTConsumer authRESTConsumer;
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer) {
|
||||
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer, AuthRESTConsumer authRESTConsumer) {
|
||||
this.applicationContext = applicationContext;
|
||||
this.menuService = menuService;
|
||||
this.appDatabase = appDatabase;
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
this.authRESTConsumer = authRESTConsumer;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
@ -46,14 +49,16 @@ public class MainContext {
|
||||
}
|
||||
|
||||
|
||||
this.initDeviceId(() -> {
|
||||
this.initDBData(() -> {
|
||||
this.initMenu(() -> {
|
||||
//this.initAuthSession(() -> {
|
||||
this.initDeviceId(() -> {
|
||||
this.initDBData(() -> {
|
||||
this.initMenu(() -> {
|
||||
|
||||
if (mListener != null) mListener.onContextInitialized();
|
||||
if (mListener != null) mListener.onContextInitialized();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
//});
|
||||
|
||||
|
||||
this.initServerStatusChecker();
|
||||
@ -61,6 +66,14 @@ public class MainContext {
|
||||
}
|
||||
|
||||
|
||||
private void initAuthSession(Runnable onComplete) {
|
||||
this.authRESTConsumer.me(obj -> {
|
||||
onComplete.run();
|
||||
}, ex -> {
|
||||
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
|
||||
});
|
||||
}
|
||||
|
||||
private void initDeviceId(Runnable onComplete) {
|
||||
if (SettingsManager.i().getUserSession().getDeviceId() != null) {
|
||||
onComplete.run();
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
public class UnauthorizedAccessException extends Exception {
|
||||
public UnauthorizedAccessException() {
|
||||
super("Accesso non autorizzato. Si prega di effettuare nuovamente l'accesso e riprovare");
|
||||
}
|
||||
}
|
||||
@ -14,8 +14,14 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class MenuRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public MenuRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void retrieveMenu(String rootCodOpz, RunnableArgs<StbMenu> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MenuRESTConsumerService menuRESTConsumerService = RESTBuilder.getService(MenuRESTConsumerService.class);
|
||||
MenuRESTConsumerService menuRESTConsumerService = restBuilder.getService(MenuRESTConsumerService.class);
|
||||
menuRESTConsumerService.retrieveMenuConfig(rootCodOpz).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<StbMenu>> call, Response<ServiceRESTResponse<StbMenu>> response) {
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package it.integry.integrywmsnative.core.rest;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import it.integry.integrywmsnative.gest.login.rest.AuthRESTConsumer;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class AuthInterceptor implements Interceptor {
|
||||
|
||||
private final AuthRESTConsumer authRESTConsumer;
|
||||
|
||||
public AuthInterceptor(AuthRESTConsumer authRESTConsumer) {
|
||||
this.authRESTConsumer = authRESTConsumer;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Response intercept(@NonNull Chain chain) throws IOException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -19,6 +19,7 @@ public class HttpInterceptor implements Interceptor {
|
||||
|
||||
final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB();
|
||||
final String ACCESS_TOKEN = SettingsManager.i().getUserSession().getAccessToken();
|
||||
final String APP_TOKEN = "fa3a21af-606b-4129-a22b-aedc2a52c7b6";
|
||||
|
||||
final Request request = chain.request();
|
||||
final HttpUrl url = request.url().newBuilder()
|
||||
@ -29,6 +30,7 @@ public class HttpInterceptor implements Interceptor {
|
||||
.addHeader("Authorization", "Bearer " + ACCESS_TOKEN)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "*/*")
|
||||
.addHeader("x-app-token", APP_TOKEN)
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
@ -20,29 +21,30 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
||||
* Created by GiuseppeS on 06/03/2018.
|
||||
*/
|
||||
|
||||
@Singleton
|
||||
public class RESTBuilder {
|
||||
|
||||
private static final boolean ADD_LOGGER_INTERCEPTOR = false;
|
||||
|
||||
public static <T> T getService(final Class<T> service) {
|
||||
public <T> T getService(final Class<T> service) {
|
||||
return getService(service, SettingsManager.i().getServer().getProtocol(), SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true);
|
||||
|
||||
}
|
||||
|
||||
public static <T> T getService(final Class<T> service, int timeout) {
|
||||
public <T> T getService(final Class<T> service, int timeout) {
|
||||
return getService(service, SettingsManager.i().getServer().getProtocol(), SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, true, timeout);
|
||||
|
||||
}
|
||||
|
||||
public static <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors) {
|
||||
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors) {
|
||||
return getService(service, protocol, host, port, addInterceptors, true, 60);
|
||||
}
|
||||
|
||||
public static <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi) {
|
||||
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi) {
|
||||
return getService(service, protocol, host, port, addInterceptors, addEmsApi, 60);
|
||||
}
|
||||
|
||||
public static <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi, int timeout) {
|
||||
public <T> T getService(final Class<T> service, String protocol, String host, int port, boolean addInterceptors, boolean addEmsApi, int timeout) {
|
||||
OkHttpClient.Builder clientBuilder = getDefaultHttpClient();
|
||||
|
||||
clientBuilder.connectTimeout(timeout, TimeUnit.SECONDS);
|
||||
@ -71,15 +73,6 @@ public class RESTBuilder {
|
||||
}
|
||||
|
||||
|
||||
public static String getDefaultHost() {
|
||||
return SettingsManager.i().getServer().getHost();
|
||||
}
|
||||
|
||||
public static int getDefaultPort() {
|
||||
return SettingsManager.i().getServer().getPort();
|
||||
}
|
||||
|
||||
|
||||
public static OkHttpClient.Builder getDefaultHttpClient() {
|
||||
TrustManager[] trustAllCerts = new TrustManager[]{
|
||||
new X509TrustManager() {
|
||||
|
||||
@ -30,14 +30,16 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final SystemRESTConsumer systemRESTConsumer;
|
||||
|
||||
public ArticoloRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
public ArticoloRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
public void searchByBarcode(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
|
||||
var request = new SearchArticoloByBarcodeRequestDTO()
|
||||
.setBarcode(barcodeProd)
|
||||
@ -62,17 +64,12 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void getByCodMarts(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
getByCodMartsStatic(codMartToFind, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void getByCodMartsStatic(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
var codMarts = Stream.of(codMartToFind)
|
||||
.withoutNulls()
|
||||
.distinct().toList();
|
||||
|
||||
|
||||
ArticoloRESTConsumerService articoloRESTConsumer = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
articoloRESTConsumer
|
||||
.getByCodMart(new RetrieveArticoloByCodMartRequestDTO()
|
||||
.setCodMarts(codMarts))
|
||||
@ -92,7 +89,7 @@ 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);
|
||||
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
articoloRESTConsumer.getStatoPartita(codMart, partitaMag).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<StatoArticoloDTO>>> call, Response<ServiceRESTResponse<List<StatoArticoloDTO>>> response) {
|
||||
@ -183,7 +180,7 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void updateBarcodeImballo(String codMart, String newBarcodeImballo, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
|
||||
var request = new UpdateBarcodeImballoRequestDTO()
|
||||
.setCodMart(codMart)
|
||||
|
||||
@ -13,8 +13,14 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class AziendaRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public AziendaRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void retrieveAzienda(RunnableArgs<Azienda> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
AziendaRESTConsumerService aziendaRESTConsumerService = RESTBuilder.getService(AziendaRESTConsumerService.class);
|
||||
AziendaRESTConsumerService aziendaRESTConsumerService = restBuilder.getService(AziendaRESTConsumerService.class);
|
||||
aziendaRESTConsumerService.retrieveDefaultAzienda().enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Azienda>> call, Response<ServiceRESTResponse<Azienda>> response) {
|
||||
|
||||
@ -24,8 +24,14 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements ColliCaricoRESTConsumerInterface {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public ColliAccettazioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -44,7 +50,7 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
|
||||
|
||||
@Override
|
||||
public void closeUDC(CloseUDCRequestDTO closeUDCRequestDTO, RunnableArgs<CloseUDCResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -62,7 +68,7 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
|
||||
|
||||
@Override
|
||||
public void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -80,7 +86,7 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
|
||||
|
||||
@Override
|
||||
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -98,7 +104,7 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
|
||||
|
||||
@Override
|
||||
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
|
||||
@ -41,15 +41,17 @@ import retrofit2.Response;
|
||||
public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements ColliCaricoRESTConsumerInterface, ColliScaricoRESTConsumerInterface {
|
||||
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final SettingsManager settingsManager;
|
||||
|
||||
public ColliLavorazioneRESTConsumer(SettingsManager settingsManager) {
|
||||
public ColliLavorazioneRESTConsumer(RESTBuilder restBuilder, SettingsManager settingsManager) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.settingsManager = settingsManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -67,7 +69,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
|
||||
@Override
|
||||
public void closeUDC(CloseUDCRequestDTO closeUDCRequestDTO, RunnableArgs<CloseUDCResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -85,7 +87,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
|
||||
@Override
|
||||
public void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -103,7 +105,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
|
||||
@Override
|
||||
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -120,7 +122,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
}
|
||||
|
||||
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -139,7 +141,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
|
||||
@Override
|
||||
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -157,7 +159,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
|
||||
@Override
|
||||
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -174,7 +176,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
}
|
||||
|
||||
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -192,7 +194,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
|
||||
@Override
|
||||
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -210,7 +212,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
|
||||
@Override
|
||||
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -249,7 +251,7 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
createUDSFromArtRequestDTO
|
||||
.setCodJfas(posizione.getPosizione());
|
||||
}
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.createUDSFromArt(createUDSFromArtRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
|
||||
@ -48,19 +48,21 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||
private final EntityRESTConsumer mEntityRESTConsumer;
|
||||
private final SettingsManager mSettingsManager;
|
||||
private final RESTBuilder restBuilder;
|
||||
private final SystemRESTConsumer systemRESTConsumer;
|
||||
private final ArticoloRESTConsumer articoloRESTConsumer;
|
||||
private final EntityRESTConsumer entityRESTConsumer;
|
||||
private final SettingsManager settingsManager;
|
||||
|
||||
public ColliMagazzinoRESTConsumer(SystemRESTConsumer systemRESTConsumer,
|
||||
public ColliMagazzinoRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer,
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
EntityRESTConsumer entityRESTConsumer,
|
||||
SettingsManager settingsManager) {
|
||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
this.mEntityRESTConsumer = entityRESTConsumer;
|
||||
this.mSettingsManager = settingsManager;
|
||||
this.restBuilder = restBuilder;
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
this.articoloRESTConsumer = articoloRESTConsumer;
|
||||
this.entityRESTConsumer = entityRESTConsumer;
|
||||
this.settingsManager = settingsManager;
|
||||
}
|
||||
|
||||
public void saveCollo(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@ -78,7 +80,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.setMtbPartitaMag(null));
|
||||
}
|
||||
|
||||
this.mEntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback<MtbColt>() {
|
||||
this.entityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback<MtbColt>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
@ -102,7 +104,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
}
|
||||
|
||||
this.mEntityRESTConsumer.processEntityList(mtbColtsToSave, true, MtbColt.class, onComplete, onFailed);
|
||||
this.entityRESTConsumer.processEntityList(mtbColtsToSave, true, MtbColt.class, onComplete, onFailed);
|
||||
|
||||
}
|
||||
|
||||
@ -280,7 +282,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 colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
|
||||
@ -305,10 +307,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
fillMtbAartsOfMtbColtsStatic(mtbColts, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void fillMtbAartsOfMtbColtsStatic(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
List<String> codMarts = new ArrayList<>();
|
||||
|
||||
for (MtbColt mtbColt : mtbColts) {
|
||||
@ -320,9 +318,9 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
ArticoloRESTConsumer.getByCodMartsStatic(codMarts, arts -> {
|
||||
articoloRESTConsumer.getByCodMarts(codMarts, arts -> {
|
||||
|
||||
if (arts != null && arts.size() > 0) {
|
||||
if (arts != null && !arts.isEmpty()) {
|
||||
for (MtbColt mtbColt : mtbColts) {
|
||||
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
|
||||
|
||||
@ -331,7 +329,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
List<MtbAart> mtbAartStream = Stream.of(arts)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart())).toList();
|
||||
|
||||
if (mtbAartStream != null && mtbAartStream.size() > 0) {
|
||||
if (!mtbAartStream.isEmpty()) {
|
||||
foundMtbAart = mtbAartStream.get(0);
|
||||
}
|
||||
|
||||
@ -380,7 +378,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
testata.setMtbColr(new ObservableArrayList<>());
|
||||
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
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) {
|
||||
@ -417,7 +415,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.setMtbPartitaMag(null);
|
||||
}
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService
|
||||
.spostaULInPosizione(codMdep,
|
||||
posizioneString,
|
||||
@ -453,13 +451,13 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public static void retrieveBasketColli(RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
public 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>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<MtbColt>>> call, Response<ServiceRESTResponse<List<MtbColt>>> response) {
|
||||
analyzeAnswer(response, "getColliInBasket", mtbColts -> {
|
||||
fillMtbAartsOfMtbColtsStatic(mtbColts, onComplete, onFailed);
|
||||
fillMtbAartsOfMtbColts(mtbColts, onComplete, onFailed);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@ -480,7 +478,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.setNewNumCnf(newNumCnf)
|
||||
.setNewQtaCol(newQtaTot);
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.creaRettificaCollo(
|
||||
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
|
||||
rettificaULDTO
|
||||
@ -514,7 +512,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.setSourceMtbColt(mtbColtToMoveClone)
|
||||
.setDestinationMtbColt(mtbColtDestClone);
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
@ -540,7 +538,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.setMtbPartitaMag(null);
|
||||
}
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
|
||||
@ -565,7 +563,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.setMtbPartitaMag(null);
|
||||
}
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.versamentoAutomaticoUL(sourceMtbColtClone).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> call, Response<ServiceRESTResponse<VersamentoAutomaticoULResponseDTO>> response) {
|
||||
@ -580,7 +578,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.map(x -> x.getCodMart().trim())
|
||||
.toList();
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||
articoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||
for (var mtbColr : allMtbColr) {
|
||||
|
||||
MtbAart foundMtbAart = null;
|
||||
@ -613,7 +611,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
MtbColt sourceMtbColtClone = (MtbColt) sourceMtbColt.clone();
|
||||
sourceMtbColtClone.setMtbColr(new ObservableArrayList<>());
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.confirmGiacenzaUL(sourceMtbColtClone).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
@ -651,7 +649,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {
|
||||
}.getType();
|
||||
this.mSystemRESTConsumer.<ArrayList<MtbColt>>processSql(query, typeOfObjectsList, data -> {
|
||||
this.systemRESTConsumer.<ArrayList<MtbColt>>processSql(query, typeOfObjectsList, data -> {
|
||||
onComplete.run(data.get(0));
|
||||
}, onFailed);
|
||||
}
|
||||
@ -661,7 +659,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
CanULBeDeletedRequestDTO canULBeDeletedRequestDTO = new CanULBeDeletedRequestDTO()
|
||||
.setMtbColt(mtbColt);
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
|
||||
colliMagazzinoRESTConsumerService.canULBeDeleted(canULBeDeletedRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -679,7 +677,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void deleteUL(DeleteULRequestDTO deleteULRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
|
||||
colliMagazzinoRESTConsumerService.deleteUL(deleteULRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -702,7 +700,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
return;
|
||||
}
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
|
||||
colliMagazzinoRESTConsumerService.printUL(printULRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
|
||||
@ -24,9 +24,14 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public ColliSpedizioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -44,7 +49,7 @@ public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements Co
|
||||
}
|
||||
|
||||
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -62,7 +67,7 @@ public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements Co
|
||||
}
|
||||
|
||||
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -79,7 +84,7 @@ public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements Co
|
||||
}
|
||||
|
||||
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -96,7 +101,7 @@ public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements Co
|
||||
}
|
||||
|
||||
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
|
||||
@ -20,8 +20,14 @@ import retrofit2.Response;
|
||||
public class DocumentRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public DocumentRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void createDocsFromColli(List<LoadColliDTO> listColli, RunnableArgs<List<DtbDoct>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
DocumentiRESTConsumerService documentiRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
|
||||
DocumentiRESTConsumerService documentiRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
|
||||
documentiRESTConsumerService.createDocsFromColli(listColli).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<DtbDoct>>> call, Response<ServiceRESTResponse<List<DtbDoct>>> response) {
|
||||
@ -36,7 +42,7 @@ public class DocumentRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void createDocFromColli(LoadColliDTO loadColliDTO, RunnableArgs<DtbDoct> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
DocumentiRESTConsumerService documentiRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
|
||||
DocumentiRESTConsumerService documentiRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
|
||||
documentiRESTConsumerService.createDocFromColli(loadColliDTO).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<DtbDoct>> call, Response<ServiceRESTResponse<DtbDoct>> response) {
|
||||
@ -54,7 +60,7 @@ 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);
|
||||
var inventarioRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
|
||||
inventarioRESTConsumerService.retrieveArts(codDtip, codMgrp, codAnagForn)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
|
||||
@ -23,6 +23,11 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class EntityRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public EntityRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) {
|
||||
|
||||
@ -30,7 +35,7 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
|
||||
if (callback != null) callback.onFailed(ex);
|
||||
};
|
||||
|
||||
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
||||
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
|
||||
service
|
||||
.processEntity(entityToSave)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -74,7 +79,7 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
};
|
||||
|
||||
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
||||
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
|
||||
Call<List<ServiceRESTResponse<JsonObject>>> request = service.processEntityList(singleTransaction, entitiesToSave);
|
||||
request.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -124,7 +129,7 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
|
||||
@Deprecated
|
||||
public <T extends EntityBase> void selectEntity(T entityToSave, final ISimpleOperationCallback<List<T>> callback, Class type) {
|
||||
|
||||
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
||||
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<JsonObject>> request = service.processEntity(entityToSave);
|
||||
request.enqueue(new Callback<>() {
|
||||
@Override
|
||||
|
||||
@ -20,9 +20,15 @@ import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public GestSetupRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
|
||||
public void getValue(String gestName, String sectionName, String keySection, RunnableArgs<GestSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
|
||||
GestSetupRESTConsumerService service = restBuilder.getService(GestSetupRESTConsumerService.class);
|
||||
|
||||
service.getGestSetupValue(gestName, sectionName, keySection)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -51,7 +57,7 @@ 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);
|
||||
GestSetupRESTConsumerService service = restBuilder.getService(GestSetupRESTConsumerService.class);
|
||||
service.getGestSetupValue(gestName, sectionName, keySection, codMdep).enqueue(new Callback<ServiceRESTResponse<GestSetupDTO>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<GestSetupDTO>> call, Response<ServiceRESTResponse<GestSetupDTO>> response) {
|
||||
@ -81,7 +87,7 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
||||
public void getValues(String codMdep, List<StbGestSetupReader> stbGestSetupList, RunnableArgs<List<StbGestSetupReader>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
var stbGestSetups = stbGestSetupList.stream().map(x -> (StbGestSetup) x).collect(Collectors.toList());
|
||||
|
||||
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
|
||||
GestSetupRESTConsumerService service = restBuilder.getService(GestSetupRESTConsumerService.class);
|
||||
service.getGestSetupValues(codMdep, stbGestSetups).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Response<ServiceRESTResponse<List<StbGestSetup>>> response) {
|
||||
|
||||
@ -25,15 +25,17 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||
private final RESTBuilder restBuilder;
|
||||
private final ArticoloRESTConsumer articoloRESTConsumer;
|
||||
|
||||
public GiacenzaRESTConsumer(ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
public GiacenzaRESTConsumer(RESTBuilder restBuilder, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.articoloRESTConsumer = articoloRESTConsumer;
|
||||
|
||||
}
|
||||
|
||||
public void getGiacenzeInPosizione(MtbDepoPosizione posizione, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||
giacenzaRESTConsumerService.retrieveAvailableItems(posizione.getPosizione()).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Response<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> response) {
|
||||
@ -44,7 +46,7 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||
.map(x -> x.getCodMart().trim())
|
||||
.toList();
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||
articoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||
for (var row : inventarioList) {
|
||||
|
||||
MtbAart foundMtbAart = null;
|
||||
@ -75,7 +77,7 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void getGiacenzeInPosizione(List<String> posizioni, boolean withTestataCollo, RunnableArgs<List<ArtsInGiacenzaDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||
giacenzaRESTConsumerService.retrieveAvailableItems(posizioni, withTestataCollo).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> call, Response<ServiceRESTResponse<List<ArtsInGiacenzaDTO>>> response) {
|
||||
@ -85,7 +87,7 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||
.map(x -> x.getCodMart().trim())
|
||||
.toList();
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||
articoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||
for (var articoli : inventarioList) {
|
||||
List<MvwSitArtUdcDetInventario> mvwSitArtUdcDetInventario = articoli.getMvwSitArtUdcDetInventarioDTO();
|
||||
if (mvwSitArtUdcDetInventario != null && !mvwSitArtUdcDetInventario.isEmpty()){
|
||||
@ -117,7 +119,7 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void getGiacenzeByArticolo(String codMart, String partitaMag, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||
var serviceRESTResponseCall =
|
||||
UtilityString.isNullOrEmpty(partitaMag) ?
|
||||
giacenzaRESTConsumerService.retrieveAvailableItemsByArt(codMart) :
|
||||
@ -132,7 +134,7 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||
articoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||
for (var row : inventarioList) {
|
||||
|
||||
MtbAart foundMtbAart = null;
|
||||
@ -161,7 +163,7 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void getInstantItemSituation(String codMdep, String codMart, String partitaMag, String codJcom, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = restBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||
|
||||
giacenzaRESTConsumerService.retrieveInstantItemSituation(codMdep, codMart, partitaMag, codJcom)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -200,9 +202,9 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||
return;
|
||||
}
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(inputCodMarts, mtbAarts -> {
|
||||
articoloRESTConsumer.getByCodMarts(inputCodMarts, mtbAarts -> {
|
||||
|
||||
mArticoloRESTConsumer.fillMtbAartsWithMtbUntMis(mtbAarts, newMtbAarts -> {
|
||||
articoloRESTConsumer.fillMtbAartsWithMtbUntMis(mtbAarts, newMtbAarts -> {
|
||||
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
||||
for (var item : data.getIncomingItems()) {
|
||||
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
||||
|
||||
@ -17,15 +17,17 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class ImballiRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
public ImballiRESTConsumer(ExecutorService executorService) {
|
||||
public ImballiRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
|
||||
public List<MtbTCol> retrieveTipiColloSyncronized(MtbTCol.FlagUiUlEnum tipoImballo) throws Exception {
|
||||
ImballiRESTConsumerService service = RESTBuilder.getService(ImballiRESTConsumerService.class);
|
||||
ImballiRESTConsumerService service = restBuilder.getService(ImballiRESTConsumerService.class);
|
||||
Response<ServiceRESTResponse<List<MtbTCol>>> response = service.retrieveTipiCollo(tipoImballo)
|
||||
.execute();
|
||||
|
||||
@ -45,7 +47,7 @@ public class ImballiRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void registraCaricoSyncronized(String codAnag, List<ImballoQuantityDTO> imballi) throws Exception {
|
||||
ImballiRESTConsumerService service = RESTBuilder.getService(ImballiRESTConsumerService.class);
|
||||
ImballiRESTConsumerService service = restBuilder.getService(ImballiRESTConsumerService.class);
|
||||
Response<ServiceRESTResponse<Void>> response = service.registraCarico(
|
||||
new RegistraCaricoImballiRequestDTO()
|
||||
.setCodAnag(codAnag)
|
||||
@ -68,7 +70,7 @@ public class ImballiRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void registraScaricoSyncronized(String codVettore, List<ImballoQuantityDTO> imballi) throws Exception {
|
||||
ImballiRESTConsumerService service = RESTBuilder.getService(ImballiRESTConsumerService.class);
|
||||
ImballiRESTConsumerService service = restBuilder.getService(ImballiRESTConsumerService.class);
|
||||
Response<ServiceRESTResponse<Void>> response = service.registraScarico(
|
||||
new RegistraScaricoImballiRequestDTO()
|
||||
.setCodVettore(codVettore)
|
||||
|
||||
@ -4,6 +4,7 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
@ -20,9 +21,15 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class InventarioRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
@Inject
|
||||
public InventarioRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void loadInventario(long inventoryId, RunnableArgs<RetrieveInventarioResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
var inventarioRESTConsumerService = RESTBuilder.getService(InventarioRESTConsumerService.class);
|
||||
var inventarioRESTConsumerService = restBuilder.getService(InventarioRESTConsumerService.class);
|
||||
inventarioRESTConsumerService.retrieve(inventoryId)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -39,7 +46,7 @@ public class InventarioRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void loadInventarioArts(long inventoryId, RunnableArgs<RetrieveInventarioArtsResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
var inventarioRESTConsumerService = RESTBuilder.getService(InventarioRESTConsumerService.class);
|
||||
var inventarioRESTConsumerService = restBuilder.getService(InventarioRESTConsumerService.class);
|
||||
inventarioRESTConsumerService.retrieveArts(inventoryId)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -55,7 +62,7 @@ public class InventarioRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public List<MtbInvent> makeSynchronousRetrieveRequest() throws Exception {
|
||||
var inventarioRESTConsumerService = RESTBuilder.getService(InventarioRESTConsumerService.class, 120);
|
||||
var inventarioRESTConsumerService = restBuilder.getService(InventarioRESTConsumerService.class, 120);
|
||||
|
||||
var response = inventarioRESTConsumerService.retrieve()
|
||||
.execute();
|
||||
@ -70,7 +77,7 @@ public class InventarioRESTConsumer extends _BaseRESTConsumer {
|
||||
var request = new InsertInventarioRequestDTO()
|
||||
.setMtbInvent(inventarioToInsert);
|
||||
|
||||
var inventarioRESTConsumerService = RESTBuilder.getService(InventarioRESTConsumerService.class, 300);
|
||||
var inventarioRESTConsumerService = restBuilder.getService(InventarioRESTConsumerService.class, 300);
|
||||
inventarioRESTConsumerService
|
||||
.insert(inventarioToInsert.getIdInventario(), request)
|
||||
.enqueue(new Callback<>() {
|
||||
|
||||
@ -15,8 +15,15 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public MagazzinoAutomaticoRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void pickItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = RESTBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
|
||||
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = restBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
|
||||
magazzinoAutomaticoRESTConsumerService.pickItems(posizione.getPosizione(), magazzinoAutomaticoPickItemsRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -34,7 +41,7 @@ public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void putItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPutItemsRequestDTO magazzinoAutomaticoPutItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = RESTBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
|
||||
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = restBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
|
||||
magazzinoAutomaticoRESTConsumerService.putItems(posizione.getPosizione(), magazzinoAutomaticoPutItemsRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
|
||||
@ -15,8 +15,14 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class MagazzinoBufferRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public MagazzinoBufferRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void isVersamentoStarted(MtbDepoPosizione posizione, MagazzinoBufferVersamentoMaterialeRequestDTO magazzinoBufferVersamentoMaterialeRequestDTO, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoBufferRESTConsumerService magazzinoBufferRESTConsumerService = RESTBuilder.getService(MagazzinoBufferRESTConsumerService.class);
|
||||
MagazzinoBufferRESTConsumerService magazzinoBufferRESTConsumerService = restBuilder.getService(MagazzinoBufferRESTConsumerService.class);
|
||||
magazzinoBufferRESTConsumerService.isVersamentoStarted(posizione.getPosizione(), magazzinoBufferVersamentoMaterialeRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -32,7 +38,7 @@ public class MagazzinoBufferRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void startVersamentoMateriale(MtbDepoPosizione posizione, MagazzinoBufferVersamentoMaterialeRequestDTO magazzinoBufferVersamentoMaterialeRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoBufferRESTConsumerService magazzinoBufferRESTConsumerService = RESTBuilder.getService(MagazzinoBufferRESTConsumerService.class);
|
||||
MagazzinoBufferRESTConsumerService magazzinoBufferRESTConsumerService = restBuilder.getService(MagazzinoBufferRESTConsumerService.class);
|
||||
magazzinoBufferRESTConsumerService.startVersamentoMateriale(posizione.getPosizione(), magazzinoBufferVersamentoMaterialeRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -48,7 +54,7 @@ public class MagazzinoBufferRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void endVersamentoMateriale(MtbDepoPosizione posizione, MagazzinoBufferVersamentoMaterialeCloseRequestDTO magazzinoBufferVersamentoMaterialeCloseRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoBufferRESTConsumerService magazzinoBufferRESTConsumerService = RESTBuilder.getService(MagazzinoBufferRESTConsumerService.class);
|
||||
MagazzinoBufferRESTConsumerService magazzinoBufferRESTConsumerService = restBuilder.getService(MagazzinoBufferRESTConsumerService.class);
|
||||
magazzinoBufferRESTConsumerService.endVersamentoMateriale(posizione.getPosizione(), magazzinoBufferVersamentoMaterialeCloseRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
|
||||
@ -16,16 +16,18 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class MagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final ExecutorService executorService;
|
||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||
private final SystemRESTConsumer systemRESTConsumer;
|
||||
|
||||
public MagazzinoRESTConsumer(ExecutorService executorService, SystemRESTConsumer mSystemRESTConsumer) {
|
||||
public MagazzinoRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.executorService = executorService;
|
||||
this.mSystemRESTConsumer = mSystemRESTConsumer;
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
public void saveTerminalinoWMS(SaveDTO saveDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoRESTConsumerService service = RESTBuilder.getService(MagazzinoRESTConsumerService.class);
|
||||
MagazzinoRESTConsumerService service = restBuilder.getService(MagazzinoRESTConsumerService.class);
|
||||
service.saveTerminalinoWMS(saveDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -42,7 +44,7 @@ public class MagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public MtbPartitaMag retrievePartitaMagSyncronized(String partitaMag, String codMart) throws Exception {
|
||||
MagazzinoRESTConsumerService service = RESTBuilder.getService(MagazzinoRESTConsumerService.class);
|
||||
MagazzinoRESTConsumerService service = restBuilder.getService(MagazzinoRESTConsumerService.class);
|
||||
Response<ServiceRESTResponse<MtbPartitaMag>> response = service.retrievePartitaMag(codMart, partitaMag)
|
||||
.execute();
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ 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;
|
||||
@ -14,7 +13,6 @@ import it.integry.integrywmsnative.core.model.JtbFasi;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
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;
|
||||
@ -23,14 +21,16 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class MesRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||
private final RESTBuilder restBuilder;
|
||||
private final SystemRESTConsumer systemRESTConsumer;
|
||||
|
||||
public MesRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||
public MesRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
public void getOrdiniLavorazioneMateriale(String codJfas, String idMateriale, RunnableArgs<List<OrdineLavorazioneDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MesRESTConsumerService mesRESTConsumerService = RESTBuilder.getService(MesRESTConsumerService.class);
|
||||
MesRESTConsumerService mesRESTConsumerService = restBuilder.getService(MesRESTConsumerService.class);
|
||||
|
||||
mesRESTConsumerService.getOrdiniLavorazioneMateriale(codJfas, idMateriale)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -47,7 +47,7 @@ public class MesRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void getOrdiniLavorazione(String flagEvaso, String codJfas, String codAnag, RunnableArgs<List<OrdineLavorazioneDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MesRESTConsumerService mesRESTConsumerService = RESTBuilder.getService(MesRESTConsumerService.class);
|
||||
MesRESTConsumerService mesRESTConsumerService = restBuilder.getService(MesRESTConsumerService.class);
|
||||
|
||||
mesRESTConsumerService.getOrdiniLavorazione(null, flagEvaso, codJfas, codAnag)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -65,7 +65,7 @@ public class MesRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void getOrdiniLavorazione(String flagEvaso, RunnableArgs<List<OrdineLavorazioneDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MesRESTConsumerService mesRESTConsumerService = RESTBuilder.getService(MesRESTConsumerService.class);
|
||||
MesRESTConsumerService mesRESTConsumerService = restBuilder.getService(MesRESTConsumerService.class);
|
||||
|
||||
mesRESTConsumerService.getOrdiniLavorazione(flagEvaso)
|
||||
.enqueue(new Callback<ServiceRESTResponse<List<OrdineLavorazioneDTO>>>() {
|
||||
@ -85,7 +85,7 @@ public class MesRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<JtbFasi>>() {
|
||||
}.getType();
|
||||
this.mSystemRESTConsumer.processSql(
|
||||
this.systemRESTConsumer.processSql(
|
||||
"SELECT * FROM jtb_fasi WHERE cod_jfas_parent = " + UtilityDB.valueToString(codJfasParent),
|
||||
typeOfObjectsList,
|
||||
onComplete,
|
||||
|
||||
@ -37,16 +37,19 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||
private final EntityRESTConsumer mEntityRESTConsumer;
|
||||
|
||||
public OrdiniRESTConsumer(SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||
public OrdiniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||
this.mEntityRESTConsumer = entityRESTConsumer;
|
||||
}
|
||||
|
||||
public void getSuggestedPickingList(String codMdep, List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<PickingObjectDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class, 90);
|
||||
OrdiniRESTConsumerService service = restBuilder.getService(OrdiniRESTConsumerService.class, 90);
|
||||
service
|
||||
.getSuggestedPickingList(codMdep, sitArtOrdList)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -123,7 +126,7 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void getOrdiniInevasi(String codMdep, GestioneEnum gestione, RunnableArgs<List<OrdineUscitaInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class);
|
||||
OrdiniRESTConsumerService service = restBuilder.getService(OrdiniRESTConsumerService.class);
|
||||
|
||||
service.getOrdiniInevasi(codMdep, gestione.getText())
|
||||
.enqueue(new Callback<>() {
|
||||
@ -156,7 +159,7 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
.setIdViaggio(x.getIdViaggio()))
|
||||
.toList();
|
||||
|
||||
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class, 90);
|
||||
OrdiniRESTConsumerService service = restBuilder.getService(OrdiniRESTConsumerService.class, 90);
|
||||
|
||||
service.getArticoliFromOrdini(codMdep, getPickingListDTOs).enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -180,7 +183,6 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void getBancaliGiaRegistrati(List<OrdineInevasoDTO> orders, GestioneEnum gestione, int segno, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
String whereCondGestione = "";
|
||||
|
||||
|
||||
@ -28,14 +28,16 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final MagazzinoRESTConsumer magazzinoRESTConsumer;
|
||||
|
||||
public PVOrdiniAcquistoRESTConsumer(MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||
public PVOrdiniAcquistoRESTConsumer(RESTBuilder restBuilder, MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.magazzinoRESTConsumer = magazzinoRESTConsumer;
|
||||
}
|
||||
|
||||
public void retrieveArticoli(String codAlis, String codMdep, RunnableArgs<OrdiniAcquistoGrigliaDTO> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||
PVOrdiniAcquistoRESTConsumerService ordiniARestService = RESTBuilder.getService(PVOrdiniAcquistoRESTConsumerService.class, 300);
|
||||
PVOrdiniAcquistoRESTConsumerService ordiniARestService = restBuilder.getService(PVOrdiniAcquistoRESTConsumerService.class, 300);
|
||||
ordiniARestService.retrieveArticoli(codAlis, codMdep, null)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -59,7 +61,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);
|
||||
PVOrdiniAcquistoRESTConsumerService ordiniARestService = restBuilder.getService(PVOrdiniAcquistoRESTConsumerService.class, 300);
|
||||
ordiniARestService.retrieveArticoli(codAlis, codMdep, barcode)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -98,7 +100,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
saveDTO.setGestione("O");
|
||||
saveDTO.setOrdineDTO(ordineDTO);
|
||||
|
||||
PVOrdiniAcquistoRESTConsumerService ordiniARestService = RESTBuilder.getService(PVOrdiniAcquistoRESTConsumerService.class, 300);
|
||||
PVOrdiniAcquistoRESTConsumerService ordiniARestService = restBuilder.getService(PVOrdiniAcquistoRESTConsumerService.class, 300);
|
||||
ordiniARestService.save(codMdep, saveDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
|
||||
@ -21,16 +21,18 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class PosizioniRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||
private final RESTBuilder restBuilder;
|
||||
private final SystemRESTConsumer systemRESTConsumer;
|
||||
|
||||
public PosizioniRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||
public PosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
public void getAvailablePosizioni(RunnableArgs<List<MtbDepoPosizione>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
String codMdep = null;
|
||||
|
||||
PosizioniRESTConsumerService posizioniRESTConsumerService = RESTBuilder.getService(PosizioniRESTConsumerService.class);
|
||||
PosizioniRESTConsumerService posizioniRESTConsumerService = restBuilder.getService(PosizioniRESTConsumerService.class);
|
||||
posizioniRESTConsumerService.getAvailablePosizioni(codMdep).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<MtbDepoPosizione>>> call, Response<ServiceRESTResponse<List<MtbDepoPosizione>>> response) {
|
||||
@ -57,7 +59,7 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer {
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {
|
||||
}.getType();
|
||||
|
||||
mSystemRESTConsumer.<ArrayList<MtbColt>>processSql(sql, typeOfObjectsList, value -> {
|
||||
systemRESTConsumer.<ArrayList<MtbColt>>processSql(sql, typeOfObjectsList, value -> {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
}, ex -> {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
|
||||
@ -29,6 +29,12 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public PrinterRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
PRIMARIA,
|
||||
SECONDARIA
|
||||
@ -39,7 +45,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
String printerTypeStr = printerType != null ? printerType.toString() : null;
|
||||
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||
PrinterRESTConsumerService printerService = restBuilder.getService(PrinterRESTConsumerService.class);
|
||||
printerService.getAvailablePrinters(codMdep, printerTypeStr).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<String>>> call, Response<ServiceRESTResponse<List<String>>> response) {
|
||||
@ -65,7 +71,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
return;
|
||||
}
|
||||
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||
PrinterRESTConsumerService printerService = restBuilder.getService(PrinterRESTConsumerService.class);
|
||||
printerService
|
||||
.printCollo(testataColloToPrint)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -98,7 +104,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
Stream.of(params)
|
||||
.forEach(x -> jasperDTO.getParams().add(new JasperPairDTO(x.getKey(), x.getValue())));
|
||||
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||
PrinterRESTConsumerService printerService = restBuilder.getService(PrinterRESTConsumerService.class);
|
||||
printerService
|
||||
.processPrintReport(printerName, quantity, jasperDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -128,7 +134,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
Stream.of(params)
|
||||
.forEach(x -> reportTypeDTO.getParams().add(new JasperPairDTO(x.getKey(), x.getValue())));
|
||||
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||
PrinterRESTConsumerService printerService = restBuilder.getService(PrinterRESTConsumerService.class);
|
||||
printerService
|
||||
.printReportType(reportTypeDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -162,7 +168,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
return;
|
||||
}
|
||||
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class, 240);
|
||||
PrinterRESTConsumerService printerService = restBuilder.getService(PrinterRESTConsumerService.class, 240);
|
||||
Call<ServiceRESTResponse<Object>> callable = printerService.printClosedOrders(codMdep, dto);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
|
||||
@ -18,8 +18,14 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public ProductionLinesRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void avviaLineaDiProduzione(String codJfas, Integer hrNum, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class);
|
||||
ProductionLinesRESTConsumerService restService = restBuilder.getService(ProductionLinesRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<JsonObject>> callable = restService.avviaLineaDiProduzione(codJfas, hrNum);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -37,7 +43,7 @@ public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void arrestaLineaDiProduzione(String codJfas, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class);
|
||||
ProductionLinesRESTConsumerService restService = restBuilder.getService(ProductionLinesRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<JsonObject>> callable = restService.arrestaLineaDiProduzione(codJfas);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -55,7 +61,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);
|
||||
ProductionLinesRESTConsumerService restService = restBuilder.getService(ProductionLinesRESTConsumerService.class, 300);
|
||||
Call<ServiceRESTResponse<JsonObject>> callable = restService.avviaProduzioneArticoloSuLinea(codJfas, codMart, partitaMag);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -73,7 +79,7 @@ public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void getStatoLinee(String codMdep, RunnableArgs<List<ProdLineStatusDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class);
|
||||
ProductionLinesRESTConsumerService restService = restBuilder.getService(ProductionLinesRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> callable = restService.getStatoLinee(codMdep);
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -90,7 +96,7 @@ public class ProductionLinesRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void getLineDetails(ProdLineStatusDTO lineaProd, RunnableArgs<ProdLineStatusDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ProductionLinesRESTConsumerService restService = RESTBuilder.getService(ProductionLinesRESTConsumerService.class);
|
||||
ProductionLinesRESTConsumerService restService = restBuilder.getService(ProductionLinesRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<List<ProdLineStatusDTO>>> callable = restService.getStatoLinee(lineaProd.getCodMdepLav());
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
|
||||
@ -36,66 +36,68 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public SystemRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void registerDevice(final Runnable onSuccess, final RunnableArgs<Exception> onFailed) {
|
||||
RegisterDeviceRequestDTO registerDeviceRequestDTO = new RegisterDeviceRequestDTO()
|
||||
.setApp("WMS");
|
||||
RegisterDeviceRequestDTO registerDeviceRequestDTO = new RegisterDeviceRequestDTO().setApp("WMS");
|
||||
|
||||
SystemRESTConsumerService systemRESTConsumerService = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||
systemRESTConsumerService.registerDevice(registerDeviceRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "device/register", Void -> onSuccess.run(), onFailed);
|
||||
}
|
||||
SystemRESTConsumerService systemRESTConsumerService = restBuilder.getService(SystemRESTConsumerService.class);
|
||||
systemRESTConsumerService.registerDevice(registerDeviceRequestDTO).enqueue(new Callback<>() {
|
||||
@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));
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public <T> void processSql(String nativeSql, final Type clazz, final RunnableArgs<T> onComplete, final RunnableArgs<Exception> onFailed) {
|
||||
NativeSqlRequestDTO nativeSqlDTO = new NativeSqlRequestDTO()
|
||||
.setNativeSql(nativeSql);
|
||||
NativeSqlRequestDTO nativeSqlDTO = new NativeSqlRequestDTO().setNativeSql(nativeSql);
|
||||
|
||||
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||
service
|
||||
.processSql(nativeSqlDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "ProcessSql", o -> {
|
||||
Gson gson = UtilityGson.createObject();
|
||||
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
||||
service.processSql(nativeSqlDTO).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "ProcessSql", o -> {
|
||||
Gson gson = UtilityGson.createObject();
|
||||
|
||||
|
||||
String json = gson.toJson(o);
|
||||
String json = gson.toJson(o);
|
||||
|
||||
InputStream ims = new ByteArrayInputStream(json.getBytes());
|
||||
Reader reader = new InputStreamReader(ims);
|
||||
T gsonObj = gson.fromJson(reader, clazz);
|
||||
InputStream ims = new ByteArrayInputStream(json.getBytes());
|
||||
Reader reader = new InputStreamReader(ims);
|
||||
T gsonObj = gson.fromJson(reader, clazz);
|
||||
|
||||
onComplete.run(gsonObj);
|
||||
}, onFailed);
|
||||
}
|
||||
onComplete.run(gsonObj);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
Logger.e(t, "ProcessSQL");
|
||||
@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));
|
||||
}
|
||||
});
|
||||
if (t instanceof ConnectException)
|
||||
onFailed.run(new InvalidConnectionException(
|
||||
SettingsManager.i().getServer().getHost(),
|
||||
SettingsManager.i().getServer().getPort(),
|
||||
t));
|
||||
else onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void getAvailableCodMdeps(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
||||
service.getAvailableCodMdeps().enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> call, Response<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> response) {
|
||||
@ -123,13 +125,7 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
MailRequestDTO mailDTO = new MailRequestDTO()
|
||||
.setFrom("sender@integry.it")
|
||||
.setFromName((BuildConfig.DEBUG ? "[DEBUG] " : "") + "WMS Android")
|
||||
.setTo(dest)
|
||||
.setSubject("Bug notification" + currentAzienda)
|
||||
.setMsgText(message)
|
||||
.setHtml(true);
|
||||
MailRequestDTO mailDTO = new MailRequestDTO().setFrom("sender@integry.it").setFromName((BuildConfig.DEBUG ? "[DEBUG] " : "") + "WMS Android").setTo(dest).setSubject("Bug notification" + currentAzienda).setMsgText(message).setHtml(true);
|
||||
|
||||
sendMail(mailDTO, () -> {
|
||||
if (onComplete != null) onComplete.run();
|
||||
@ -142,7 +138,7 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void sendMail(MailRequestDTO mailDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
||||
service.sendMail(mailDTO).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<String>> call, Response<ServiceRESTResponse<String>> response) {
|
||||
|
||||
@ -15,15 +15,17 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class VettoriRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
public VettoriRESTConsumer(ExecutorService executorService) {
|
||||
public VettoriRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
|
||||
public List<VtbVett> retrieveRecentlyUsedInOrdersSyncronized(GestioneEnum gestione) throws Exception {
|
||||
var service = RESTBuilder.getService(VettoriRESTConsumerService.class);
|
||||
var service = restBuilder.getService(VettoriRESTConsumerService.class);
|
||||
Response<ServiceRESTResponse<List<VtbVett>>> response = service.retrieveRecentlyUsedInOrders(gestione)
|
||||
.execute();
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLicenseException;
|
||||
import it.integry.integrywmsnative.core.exception.UnauthorizedAccessException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.rest.CommonRESTException;
|
||||
import it.integry.integrywmsnative.core.rest.model.EsitoType;
|
||||
@ -39,7 +40,10 @@ public abstract class _BaseRESTConsumer {
|
||||
throw new Exception(response.message());
|
||||
}
|
||||
} else {
|
||||
if (response.code() == 404) {
|
||||
if (response.code() == 401) {
|
||||
Log.e(logTitle, "Errore " + response.code() + ": Accesso non autorizzato. Si prega di controllare le credenziali e riprovare");
|
||||
throw new UnauthorizedAccessException();
|
||||
} else if (response.code() == 404) {
|
||||
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata (" + response.raw().request().url() + ")");
|
||||
throw new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")");
|
||||
} else if (response.code() == 550)
|
||||
|
||||
@ -2,6 +2,7 @@ package it.integry.integrywmsnative.gest.accettazione_bolla_elenco;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.BolleAccettazioneRESTConsumer;
|
||||
|
||||
@Module(subcomponents = {MainAccettazioneBollaElencoComponent.class})
|
||||
@ -9,8 +10,8 @@ public class MainAccettazioneBollaElencoModule {
|
||||
|
||||
|
||||
@Provides
|
||||
BolleAccettazioneRESTConsumer providesBolleAccettazioneRESTConsumer() {
|
||||
return new BolleAccettazioneRESTConsumer();
|
||||
BolleAccettazioneRESTConsumer providesBolleAccettazioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new BolleAccettazioneRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -20,9 +20,14 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class BolleAccettazioneRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public BolleAccettazioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void retrieveBolleDaAccettare(RunnableArgs<List<TestataBollaAccettazioneDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
BolleAccettazioneRESTConsumerService service = RESTBuilder.getService(BolleAccettazioneRESTConsumerService.class);
|
||||
BolleAccettazioneRESTConsumerService service = restBuilder.getService(BolleAccettazioneRESTConsumerService.class);
|
||||
service.retrieveElencoBolle()
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -38,7 +43,7 @@ public class BolleAccettazioneRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void retrievePickingListBolle(List<TestataBollaAccettazioneDTO> bolle, RunnableArgs<List<SitBollaAccettazioneDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
BolleAccettazioneRESTConsumerService service = RESTBuilder.getService(BolleAccettazioneRESTConsumerService.class);
|
||||
BolleAccettazioneRESTConsumerService service = restBuilder.getService(BolleAccettazioneRESTConsumerService.class);
|
||||
|
||||
var request = new RetrieveElencoArticoliAccettazioneBollaRequestDTO()
|
||||
.setBolle(bolle);
|
||||
|
||||
@ -21,13 +21,17 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class AccettazioneBollaPickingRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
@Inject
|
||||
public AccettazioneBollaPickingRESTConsumer() {
|
||||
public AccettazioneBollaPickingRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
|
||||
public void retrieveAlreadyRegisteredUDC(List<TestataBollaAccettazioneDTO> bolle, RunnableArgs<List<AlreadyRegisteredUDCDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
AccettazioneBollaPickingRESTConsumerService service = RESTBuilder.getService(AccettazioneBollaPickingRESTConsumerService.class);
|
||||
AccettazioneBollaPickingRESTConsumerService service = restBuilder.getService(AccettazioneBollaPickingRESTConsumerService.class);
|
||||
|
||||
var request = new RetrieveAlreadyRegisteredULAccettazioneBollaRequestDTO()
|
||||
.setBolle(bolle);
|
||||
|
||||
@ -2,14 +2,15 @@ package it.integry.integrywmsnative.gest.accettazione_ordini_elenco;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordini_elenco.rest.OrdiniAccettazioneRESTConsumer;
|
||||
|
||||
@Module(subcomponents = {MainAccettazioneOrdiniElencoComponent.class})
|
||||
public class MainAccettazioneOrdiniElencoModule {
|
||||
|
||||
@Provides
|
||||
OrdiniAccettazioneRESTConsumer providesOrdiniAccettazioneRESTConsumer() {
|
||||
return new OrdiniAccettazioneRESTConsumer();
|
||||
OrdiniAccettazioneRESTConsumer providesOrdiniAccettazioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new OrdiniAccettazioneRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@ -21,9 +21,14 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class OrdiniAccettazioneRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public OrdiniAccettazioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void getOrdiniInevasi(String codMdep, RunnableArgs<List<OrdineAccettazioneInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
OrdiniAccettazioneRESTConsumerService service = RESTBuilder.getService(OrdiniAccettazioneRESTConsumerService.class);
|
||||
OrdiniAccettazioneRESTConsumerService service = restBuilder.getService(OrdiniAccettazioneRESTConsumerService.class);
|
||||
service.listOrdiniInevasi(codMdep, "A").enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> call, Response<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> response) {
|
||||
@ -46,7 +51,7 @@ public class OrdiniAccettazioneRESTConsumer extends _BaseRESTConsumer {
|
||||
.setNumero(x.getNumero()))
|
||||
.toList();
|
||||
|
||||
OrdiniAccettazioneRESTConsumerService service = RESTBuilder.getService(OrdiniAccettazioneRESTConsumerService.class);
|
||||
OrdiniAccettazioneRESTConsumerService service = restBuilder.getService(OrdiniAccettazioneRESTConsumerService.class);
|
||||
service.getArticoliFromOrdiniAccettazione(getPickingListDTOs).enqueue(new Callback<ServiceRESTResponse<List<SitArtOrdDTO>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, Response<ServiceRESTResponse<List<SitArtOrdDTO>>> response) {
|
||||
|
||||
@ -3,6 +3,7 @@ package it.integry.integrywmsnative.gest.accettazione_ordini_picking;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.ean128.Ean128Service;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliAccettazioneRESTConsumer;
|
||||
@ -17,8 +18,8 @@ import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFrag
|
||||
public class AccettazioneOrdiniPickingModule {
|
||||
|
||||
@Provides
|
||||
AccettazioneOrdiniPickingRESTConsumer providesAccettazionePickingRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
return new AccettazioneOrdiniPickingRESTConsumer(systemRESTConsumer);
|
||||
AccettazioneOrdiniPickingRESTConsumer providesAccettazionePickingRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new AccettazioneOrdiniPickingRESTConsumer(restBuilder, systemRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@ -22,15 +22,17 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class AccettazioneOrdiniPickingRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final SystemRESTConsumer mSystemRestConsumer;
|
||||
private final RESTBuilder restBuilder;
|
||||
private final SystemRESTConsumer systemRestConsumer;
|
||||
|
||||
@Inject
|
||||
public AccettazioneOrdiniPickingRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
this.mSystemRestConsumer = systemRESTConsumer;
|
||||
public AccettazioneOrdiniPickingRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.systemRestConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
public void getBancaliGiaRegistrati(List<OrdineAccettazioneInevasoDTO> ordiniToShow, RunnableArgs<List<AlreadyRegisteredUDCDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
AccettazioneOrdiniPickingRESTConsumerService service = RESTBuilder.getService(AccettazioneOrdiniPickingRESTConsumerService.class);
|
||||
AccettazioneOrdiniPickingRESTConsumerService service = restBuilder.getService(AccettazioneOrdiniPickingRESTConsumerService.class);
|
||||
|
||||
var request = new RetrieveAlreadyRegisteredULAccettazioneOrdineRequestDTO()
|
||||
.setOrdini(ordiniToShow);
|
||||
|
||||
@ -17,14 +17,16 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class DocInterniRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final MagazzinoRESTConsumer magazzinoRESTConsumer;
|
||||
|
||||
public DocInterniRESTConsumer(MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||
public DocInterniRESTConsumer(RESTBuilder restBuilder, MagazzinoRESTConsumer magazzinoRESTConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.magazzinoRESTConsumer = magazzinoRESTConsumer;
|
||||
}
|
||||
|
||||
public void getDocInterniSetup(RunnableArgs<DocInterniSetupDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
DocInterniRESTConsumerService service = RESTBuilder.getService(DocInterniRESTConsumerService.class);
|
||||
DocInterniRESTConsumerService service = restBuilder.getService(DocInterniRESTConsumerService.class);
|
||||
service.getSetupDocInterni().enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<DocInterniSetupDTO>> call, Response<ServiceRESTResponse<DocInterniSetupDTO>> response) {
|
||||
|
||||
@ -5,6 +5,7 @@ import javax.inject.Singleton;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRepository;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.InventarioRESTConsumer;
|
||||
|
||||
@ -13,8 +14,8 @@ public class ElencoInventariModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
InventarioRESTConsumer providesInventarioRESTConsumer() {
|
||||
return new InventarioRESTConsumer();
|
||||
InventarioRESTConsumer providesInventarioRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new InventarioRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@ -4,8 +4,9 @@ import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.login.rest.LoginRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.login.rest.AuthRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.login.viewmodel.LoginViewModel;
|
||||
|
||||
@Module(subcomponents = LoginComponent.class)
|
||||
@ -13,13 +14,13 @@ public class LoginModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
LoginRESTConsumer provideLoginRESTConsumer() {
|
||||
return new LoginRESTConsumer();
|
||||
AuthRESTConsumer provideLoginRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new AuthRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
LoginViewModel providesSpedizioneViewModel(SystemRESTConsumer systemRESTConsumer, LoginRESTConsumer loginRESTConsumer) {
|
||||
return new LoginViewModel(systemRESTConsumer, loginRESTConsumer);
|
||||
LoginViewModel providesSpedizioneViewModel(SystemRESTConsumer systemRESTConsumer, AuthRESTConsumer authRESTConsumer) {
|
||||
return new LoginViewModel(systemRESTConsumer, authRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.gest.login.dto;
|
||||
|
||||
public class RefreshRequestDTO {
|
||||
private String refreshToken;
|
||||
|
||||
public String getRefreshToken() {
|
||||
return refreshToken;
|
||||
}
|
||||
|
||||
public RefreshRequestDTO setRefreshToken(String refreshToken) {
|
||||
this.refreshToken = refreshToken;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ import android.util.Log;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
@ -14,21 +15,29 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.gest.login.dto.LoginAziendaDTO;
|
||||
import it.integry.integrywmsnative.gest.login.dto.LoginJwtResponseDTO;
|
||||
import it.integry.integrywmsnative.gest.login.dto.LoginRequestDTO;
|
||||
import it.integry.integrywmsnative.gest.login.dto.RefreshRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class LoginRESTConsumer extends _BaseRESTConsumer {
|
||||
public class AuthRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
@Inject
|
||||
public AuthRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void retrieveServerData(String codAzienda, RunnableArgs<LoginAziendaDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
String protocol = CommonConst.Login.Azienda.protocol;
|
||||
String host = CommonConst.Login.Azienda.host;
|
||||
int port = CommonConst.Login.Azienda.port;
|
||||
|
||||
LoginRESTConsumerService service = RESTBuilder.getService(LoginRESTConsumerService.class, protocol, host, port, false, true);
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port, false, true);
|
||||
service.loginAzienda(codAzienda).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<LoginAziendaDTO>> call, Response<ServiceRESTResponse<LoginAziendaDTO>> response) {
|
||||
@ -43,9 +52,27 @@ public class LoginRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void me(RunnableArgs<Object> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class);
|
||||
|
||||
service.me()
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "me", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
Log.e("me", t.toString());
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void authenticate(String protocol, String host, int port, String username, String password, String profileDb, String deviceSalt, RunnableArgs<LoginJwtResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
LoginRESTConsumerService service = RESTBuilder.getService(LoginRESTConsumerService.class, protocol, host, port, false);
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port, false);
|
||||
|
||||
LoginRequestDTO loginRequestDTO = new LoginRequestDTO()
|
||||
.setUsername(username)
|
||||
@ -59,12 +86,36 @@ public class LoginRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<LoginJwtResponseDTO>> call, Response<ServiceRESTResponse<LoginJwtResponseDTO>> response) {
|
||||
analyzeAnswer(response, "Login", onComplete, onFailed);
|
||||
analyzeAnswer(response, "login", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<LoginJwtResponseDTO>> call, final Throwable t) {
|
||||
Log.e("Login", t.toString());
|
||||
Log.e("login", t.toString());
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void refreshToken(String protocol, String host, int port, String username, String password, String profileDb, String deviceSalt, RunnableArgs<LoginJwtResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class);
|
||||
|
||||
RefreshRequestDTO refreshRequest = new RefreshRequestDTO()
|
||||
.setRefreshToken(username);
|
||||
|
||||
service
|
||||
.refresh(refreshRequest)
|
||||
.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<LoginJwtResponseDTO>> call, Response<ServiceRESTResponse<LoginJwtResponseDTO>> response) {
|
||||
analyzeAnswer(response, "refresh", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<LoginJwtResponseDTO>> call, final Throwable t) {
|
||||
Log.e("refresh", t.toString());
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
@ -72,7 +123,7 @@ public class LoginRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void retrieveAvailableProfiles(String protocol, String host, int port, String username, RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
LoginRESTConsumerService service = RESTBuilder.getService(LoginRESTConsumerService.class, protocol, host, port, false);
|
||||
AuthenticationRESTConsumerService service = restBuilder.getService(AuthenticationRESTConsumerService.class, protocol, host, port, false);
|
||||
|
||||
service.retreiveAvailableProfiles(username)
|
||||
.enqueue(new Callback<>() {
|
||||
@ -8,13 +8,14 @@ import it.integry.integrywmsnative.gest.login.dto.LoginAziendaDTO;
|
||||
import it.integry.integrywmsnative.gest.login.dto.LoginJwtResponseDTO;
|
||||
import it.integry.integrywmsnative.gest.login.dto.LoginRequestDTO;
|
||||
import it.integry.integrywmsnative.gest.login.dto.LoginResponseDTO;
|
||||
import it.integry.integrywmsnative.gest.login.dto.RefreshRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface LoginRESTConsumerService {
|
||||
public interface AuthenticationRESTConsumerService {
|
||||
|
||||
|
||||
@GET("loginAziendaWms")
|
||||
@ -26,6 +27,12 @@ public interface LoginRESTConsumerService {
|
||||
@POST("auth/login")
|
||||
Call<ServiceRESTResponse<LoginJwtResponseDTO>> loginNew(@Body LoginRequestDTO loginRequestDTO);
|
||||
|
||||
@POST("auth/refresh")
|
||||
Call<ServiceRESTResponse<LoginJwtResponseDTO>> refresh(@Body RefreshRequestDTO refreshRequestDTO);
|
||||
|
||||
@GET("auth/me")
|
||||
Call<ServiceRESTResponse<Object>> me();
|
||||
|
||||
@GET("users/availableProfiles")
|
||||
Call<ServiceRESTResponse<List<String>>> retreiveAvailableProfiles(@Query("username") String username);
|
||||
|
||||
@ -20,20 +20,20 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.gest.login.dto.AuthTokenClaimsDTO;
|
||||
import it.integry.integrywmsnative.gest.login.exception.InvalidServerCodAziendaException;
|
||||
import it.integry.integrywmsnative.gest.login.exception.InvalidUserDepositException;
|
||||
import it.integry.integrywmsnative.gest.login.rest.LoginRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.login.rest.AuthRESTConsumer;
|
||||
|
||||
public class LoginViewModel {
|
||||
|
||||
|
||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||
private final LoginRESTConsumer mLoginRESTConsumer;
|
||||
private final AuthRESTConsumer mAuthRESTConsumer;
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
@Inject
|
||||
public LoginViewModel(SystemRESTConsumer systemRESTConsumer, LoginRESTConsumer loginRESTConsumer) {
|
||||
public LoginViewModel(SystemRESTConsumer systemRESTConsumer, AuthRESTConsumer authRESTConsumer) {
|
||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||
this.mLoginRESTConsumer = loginRESTConsumer;
|
||||
this.mAuthRESTConsumer = authRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ public class LoginViewModel {
|
||||
|
||||
|
||||
private void retrieveServerData(String codAzienda, RunnableArgsss<String, String, Integer> onComplete) {
|
||||
mLoginRESTConsumer.retrieveServerData(codAzienda, value -> {
|
||||
mAuthRESTConsumer.retrieveServerData(codAzienda, value -> {
|
||||
|
||||
final String serverEndpoint = value.getEndpointRestApi();
|
||||
|
||||
@ -102,7 +102,7 @@ public class LoginViewModel {
|
||||
}
|
||||
|
||||
private void retrieveAvailableProfiles(String protocol, String host, int port, String username, RunnableArgs<String> onComplete) {
|
||||
mLoginRESTConsumer.retrieveAvailableProfiles(protocol, host, port, username, availableProfiles -> {
|
||||
mAuthRESTConsumer.retrieveAvailableProfiles(protocol, host, port, username, availableProfiles -> {
|
||||
|
||||
if (availableProfiles == null || availableProfiles.isEmpty()) {
|
||||
this.sendError(new Exception("Non è stato trovato alcun profilo per l'utente: " + username));
|
||||
@ -123,7 +123,7 @@ public class LoginViewModel {
|
||||
}
|
||||
|
||||
private void authenticate(String protocol, String host, int port, String username, String password, String profileDb, String deviceSalt, RunnableArgs<String> onComplete) {
|
||||
mLoginRESTConsumer.authenticate(protocol, host, port, username, password, profileDb, deviceSalt, sessionData -> {
|
||||
mAuthRESTConsumer.authenticate(protocol, host, port, username, password, profileDb, deviceSalt, sessionData -> {
|
||||
|
||||
JWT jwt = new JWT(sessionData.getAccessToken());
|
||||
var claims = jwt.getClaims();
|
||||
|
||||
@ -4,6 +4,7 @@ import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
|
||||
@ -14,8 +15,8 @@ public class OrdiniUscitaElencoModule {
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
OrdiniUscitaElencoRESTConsumer providesOrdiniUscitaElencoRESTConsumer() {
|
||||
return new OrdiniUscitaElencoRESTConsumer();
|
||||
OrdiniUscitaElencoRESTConsumer providesOrdiniUscitaElencoRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new OrdiniUscitaElencoRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@ -18,8 +18,14 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class OrdiniUscitaElencoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private RESTBuilder restBuilder;
|
||||
|
||||
public OrdiniUscitaElencoRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void getOrdiniFromCommessaCollo(String codMdep, MtbColt testataCollo, RunnableArgs<List<DtbOrdt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
OrdiniUscitaElencoRESTConsumerService service = RESTBuilder.getService(OrdiniUscitaElencoRESTConsumerService.class);
|
||||
OrdiniUscitaElencoRESTConsumerService service = restBuilder.getService(OrdiniUscitaElencoRESTConsumerService.class);
|
||||
service.getOrdiniInCommessaCollo(
|
||||
testataCollo.getDataColloS(),
|
||||
testataCollo.getNumCollo(),
|
||||
|
||||
@ -2,14 +2,15 @@ package it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.rest.ProdOrdineProduzioneRESTConsumer;
|
||||
|
||||
@Module(subcomponents = ProdOrdineProduzioneElencoComponent.class)
|
||||
public class ProdOrdineProduzioneElencoModule {
|
||||
|
||||
@Provides
|
||||
ProdOrdineProduzioneRESTConsumer providesProdOrdineProduzioneRESTConsumer() {
|
||||
return new ProdOrdineProduzioneRESTConsumer();
|
||||
ProdOrdineProduzioneRESTConsumer providesProdOrdineProduzioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new ProdOrdineProduzioneRESTConsumer(restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@ -22,8 +22,14 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class ProdOrdineProduzioneRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public ProdOrdineProduzioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void getOrdiniInevasi(String codMdep, RunnableArgs<List<OrdineAccettazioneInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
OrdiniAccettazioneRESTConsumerService service = RESTBuilder.getService(OrdiniAccettazioneRESTConsumerService.class);
|
||||
OrdiniAccettazioneRESTConsumerService service = restBuilder.getService(OrdiniAccettazioneRESTConsumerService.class);
|
||||
service.listOrdiniInevasi(codMdep, "P").enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> call, Response<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> response) {
|
||||
@ -46,7 +52,7 @@ public class ProdOrdineProduzioneRESTConsumer extends _BaseRESTConsumer {
|
||||
.setNumero(x.getNumero()))
|
||||
.toList();
|
||||
|
||||
OrdiniAccettazioneRESTConsumerService service = RESTBuilder.getService(OrdiniAccettazioneRESTConsumerService.class);
|
||||
OrdiniAccettazioneRESTConsumerService service = restBuilder.getService(OrdiniAccettazioneRESTConsumerService.class);
|
||||
service.getArticoliFromOrdiniAccettazione(getPickingListDTOs).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, Response<ServiceRESTResponse<List<SitArtOrdDTO>>> response) {
|
||||
|
||||
@ -11,12 +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.consumers.MagazzinoBufferRESTConsumerService;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers._BaseRESTConsumer;
|
||||
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;
|
||||
@ -25,15 +23,17 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class ProdFabbisognoLineeProdRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final SystemRESTConsumer mSystemRESTConsumer;
|
||||
private final RESTBuilder restBuilder;
|
||||
private final SystemRESTConsumer systemRESTConsumer;
|
||||
|
||||
public ProdFabbisognoLineeProdRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||
public ProdFabbisognoLineeProdRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
public void loadFabbisogno(String numOrd, String codMdep, RunnableArgs<List<ProdFabbisognoLineeProdDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ProdFabbisognoLineeProdRESTConsumerService prodFabbisognoLineeProdRESTConsumerService = RESTBuilder.getService(ProdFabbisognoLineeProdRESTConsumerService.class);
|
||||
ProdFabbisognoLineeProdRESTConsumerService prodFabbisognoLineeProdRESTConsumerService = restBuilder.getService(ProdFabbisognoLineeProdRESTConsumerService.class);
|
||||
prodFabbisognoLineeProdRESTConsumerService.loadFabbisogno(numOrd, codMdep)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
@ -73,7 +73,7 @@ public class ProdFabbisognoLineeProdRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<ProdFabbisognoLineeProdDTO>>() {}.getType();
|
||||
this.mSystemRESTConsumer.processSql(sql, typeOfObjectsList, onComplete, onFailed);
|
||||
this.systemRESTConsumer.processSql(sql, typeOfObjectsList, onComplete, onFailed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package it.integry.integrywmsnative.gest.prod_rientro_merce.order_detail;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
@ -11,8 +12,8 @@ import it.integry.integrywmsnative.gest.prod_rientro_merce.order_detail.rest.Pro
|
||||
public class ProdRientroMerceOrderDetailModule {
|
||||
|
||||
@Provides
|
||||
ProdRientroMerceOrderDetailRESTConsumer provideProdRientroMerceOrderDetailRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
return new ProdRientroMerceOrderDetailRESTConsumer(systemRESTConsumer);
|
||||
ProdRientroMerceOrderDetailRESTConsumer provideProdRientroMerceOrderDetailRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new ProdRientroMerceOrderDetailRESTConsumer(restBuilder, systemRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@ -32,10 +32,12 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class ProdRientroMerceOrderDetailRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final SystemRESTConsumer systemRESTConsumer;
|
||||
|
||||
@Inject
|
||||
public ProdRientroMerceOrderDetailRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
public ProdRientroMerceOrderDetailRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
@ -110,7 +112,7 @@ public class ProdRientroMerceOrderDetailRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void importColloDaProduzione(ImportColliDaProduzioneRequestDTO importColliDaProduzioneRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
ProdRientroMerceOrderDetailRESTConsumerService service = RESTBuilder.getService(ProdRientroMerceOrderDetailRESTConsumerService.class);
|
||||
ProdRientroMerceOrderDetailRESTConsumerService service = restBuilder.getService(ProdRientroMerceOrderDetailRESTConsumerService.class);
|
||||
service.importColloDaProduzione(importColliDaProduzioneRequestDTO).enqueue(new Callback<ServiceRESTResponse<List<MtbColt>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<MtbColt>>> call, Response<ServiceRESTResponse<List<MtbColt>>> response) {
|
||||
@ -131,7 +133,7 @@ public class ProdRientroMerceOrderDetailRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void deleteColloDaProduzione(MtbColt mtbColtToDelete, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ProdRientroMerceOrderDetailRESTConsumerService service = RESTBuilder.getService(ProdRientroMerceOrderDetailRESTConsumerService.class);
|
||||
ProdRientroMerceOrderDetailRESTConsumerService service = restBuilder.getService(ProdRientroMerceOrderDetailRESTConsumerService.class);
|
||||
service.deleteColloDaProduzione(mtbColtToDelete).enqueue(new Callback<ServiceRESTResponse<Object>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
|
||||
@ -4,6 +4,7 @@ import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
@ -17,8 +18,8 @@ public class RettificaGiacenzeModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
RettificaGiacenzeRESTConsumer providesRettificaGiacenzeRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||
return new RettificaGiacenzeRESTConsumer(systemRESTConsumer);
|
||||
RettificaGiacenzeRESTConsumer providesRettificaGiacenzeRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) {
|
||||
return new RettificaGiacenzeRESTConsumer(restBuilder, systemRESTConsumer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -30,10 +30,12 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class RettificaGiacenzeRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final SystemRESTConsumer mSystemRestConsumer;
|
||||
private final RESTBuilder restBuilder;
|
||||
private final SystemRESTConsumer systemRestConsumer;
|
||||
|
||||
public RettificaGiacenzeRESTConsumer(SystemRESTConsumer systemRestConsumer) {
|
||||
mSystemRestConsumer = systemRestConsumer;
|
||||
public RettificaGiacenzeRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRestConsumer) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.systemRestConsumer = systemRestConsumer;
|
||||
}
|
||||
|
||||
public void loadListaFornitori(RunnableArgs<ArrayList<FornitoreDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@ -42,14 +44,14 @@ public class RettificaGiacenzeRESTConsumer extends _BaseRESTConsumer {
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<FornitoreDTO>>() {
|
||||
}.getType();
|
||||
|
||||
mSystemRestConsumer.<ArrayList<FornitoreDTO>>processSql(sql, typeOfObjectsList, value -> {
|
||||
systemRestConsumer.<ArrayList<FornitoreDTO>>processSql(sql, typeOfObjectsList, value -> {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
|
||||
public void searchArtForn(String codAlis, String codArtForOrDescr, RunnableArgs<List<SearchArticoloByCodArtFornOrDescrizioneResponseDTO>> onComplete, RunnableArgs<Exception> onError) {
|
||||
final RettificaGiacenzeRESTConsumerService service = RESTBuilder.getService(RettificaGiacenzeRESTConsumerService.class);
|
||||
final RettificaGiacenzeRESTConsumerService service = restBuilder.getService(RettificaGiacenzeRESTConsumerService.class);
|
||||
service.searchByCodArtFornOrDescrizione(new SearchArticoloByCodArtFornOrDescrizioneRequestDTO()
|
||||
.setCodAlis(codAlis)
|
||||
.setCodArtFornOrDescrizione(codArtForOrDescr))
|
||||
@ -72,7 +74,7 @@ public class RettificaGiacenzeRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void searchArtInt(String codMartOrBarcodeOrDescr, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onError) {
|
||||
final RettificaGiacenzeRESTConsumerService service = RESTBuilder.getService(RettificaGiacenzeRESTConsumerService.class);
|
||||
final RettificaGiacenzeRESTConsumerService service = restBuilder.getService(RettificaGiacenzeRESTConsumerService.class);
|
||||
service.searchByCodMartOrBarcode(new SearchArticoloByBarcodeOrCodMartRequestDTO()
|
||||
.setCodMartOrBarcode(codMartOrBarcodeOrDescr))
|
||||
.enqueue(new Callback<>() {
|
||||
@ -108,7 +110,7 @@ public class RettificaGiacenzeRESTConsumer extends _BaseRESTConsumer {
|
||||
var request = new SaveDocFromPickingRequestDTO()
|
||||
.setColliFromMtbColts(Collections.singletonList(mtbColt));
|
||||
|
||||
final RettificaGiacenzeRESTConsumerService service = RESTBuilder.getService(RettificaGiacenzeRESTConsumerService.class);
|
||||
final RettificaGiacenzeRESTConsumerService service = restBuilder.getService(RettificaGiacenzeRESTConsumerService.class);
|
||||
service.saveDocFromPickingPvm(request)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.basket_lu;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogBasketLUComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogBasketLUComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogBasketLUView dialogBasketLUView);
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.basket_lu;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.pages.page1.DialogBasketLU_Page1_ViewModel;
|
||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.pages.page2.DialogBasketLU_Page2_ViewModel;
|
||||
|
||||
@Module(subcomponents = DialogBasketLUComponent.class)
|
||||
public class DialogBasketLUModule {
|
||||
|
||||
@Provides
|
||||
DialogBasketLU_Page1_ViewModel providesDialogBasketLUPage1ViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer) {
|
||||
return new DialogBasketLU_Page1_ViewModel(colliMagazzinoRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
DialogBasketLU_Page2_ViewModel providesDialogBasketLUPage2ViewModel() {
|
||||
return new DialogBasketLU_Page2_ViewModel();
|
||||
}
|
||||
|
||||
}
|
||||
@ -14,16 +14,25 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.databinding.DialogBasketLuBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.interfaces.IDialogBasketLUViewModel;
|
||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.pages.page1.DialogBasketLU_Page1_ViewModel;
|
||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.pages.page2.DialogBasketLU_Page2_ViewModel;
|
||||
|
||||
public class DialogBasketLUView extends BaseDialogFragment {
|
||||
|
||||
@Inject
|
||||
DialogBasketLU_Page1_ViewModel dialogBasketLUPage1ViewModel;
|
||||
@Inject
|
||||
DialogBasketLU_Page2_ViewModel dialogBasketLUPage2ViewModel;
|
||||
|
||||
private final RunnableArgs<MtbColt> mOnComplete;
|
||||
private DialogBasketLuBinding mBindings;
|
||||
|
||||
@ -31,6 +40,11 @@ public class DialogBasketLUView extends BaseDialogFragment {
|
||||
|
||||
public DialogBasketLUView(RunnableArgs<MtbColt> onComplete) {
|
||||
mOnComplete = onComplete;
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogBasketLUComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@ -51,9 +65,9 @@ public class DialogBasketLUView extends BaseDialogFragment {
|
||||
}
|
||||
|
||||
private void initViewPager(Dialog dialog) {
|
||||
List<Map.Entry<Integer, Class<?>>> views = new ArrayList<>();
|
||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_basket_lu__page1, DialogBasketLU_Page1_ViewModel.class));
|
||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_basket_lu__page2, DialogBasketLU_Page2_ViewModel.class));
|
||||
List<Map.Entry<Integer, IDialogBasketLUViewModel>> views = new ArrayList<>();
|
||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_basket_lu__page1, dialogBasketLUPage1ViewModel));
|
||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_basket_lu__page2, dialogBasketLUPage2ViewModel));
|
||||
|
||||
DialogBasketLU_ViewPagerAdapter viewPagerAdapter = new DialogBasketLU_ViewPagerAdapter(requireContext(), views);
|
||||
mBindings.viewpager.setAdapter(viewPagerAdapter);
|
||||
|
||||
@ -24,12 +24,12 @@ public class DialogBasketLU_ViewPagerAdapter extends PagerAdapter implements Vie
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
private final List<Map.Entry<Integer, Class<?>>> mDatasetLayout;
|
||||
private final List<Map.Entry<Integer, IDialogBasketLUViewModel>> mDatasetLayout;
|
||||
private final List<Map.Entry<ViewDataBinding, IDialogBasketLUViewModel>> mDatasetViews;
|
||||
|
||||
private DeactivatableViewPager viewPager;
|
||||
|
||||
public DialogBasketLU_ViewPagerAdapter(Context context, List<Map.Entry<Integer, Class<?>>> datasetLayouts) {
|
||||
public DialogBasketLU_ViewPagerAdapter(Context context, List<Map.Entry<Integer, IDialogBasketLUViewModel>> datasetLayouts) {
|
||||
this.mContext = context;
|
||||
this.mDatasetLayout = datasetLayouts;
|
||||
this.mDatasetViews = new ArrayList<>();
|
||||
@ -45,32 +45,28 @@ public class DialogBasketLU_ViewPagerAdapter extends PagerAdapter implements Vie
|
||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||
ViewDataBinding mBinding = DataBindingUtil.inflate(inflater, viewId, null, false);
|
||||
|
||||
Class<?> viewModelClass = mDatasetLayout.get(position).getValue();
|
||||
IDialogBasketLUViewModel viewModel = null;
|
||||
// Class<?> viewModelClass = mDatasetLayout.get(position).getValue();
|
||||
IDialogBasketLUViewModel viewModel = mDatasetLayout.get(position).getValue();
|
||||
|
||||
try {
|
||||
viewModel = (IDialogBasketLUViewModel) viewModelClass.newInstance();
|
||||
viewModel.setBinding(mBinding);
|
||||
viewModel.setContext(mContext);
|
||||
viewModel.setOnDone(data -> {
|
||||
int newIndex = viewPager.getCurrentItem() + 1;
|
||||
// viewModel = (IDialogBasketLUViewModel) viewModelClass.newInstance();
|
||||
viewModel.setBinding(mBinding);
|
||||
viewModel.setContext(mContext);
|
||||
viewModel.setOnDone(data -> {
|
||||
int newIndex = viewPager.getCurrentItem() + 1;
|
||||
|
||||
if(newIndex <= getCount()) {
|
||||
this.mDatasetViews.get(newIndex).getValue().setInputData(data);
|
||||
this.mDatasetViews.get(newIndex).getValue().onPreShow();
|
||||
viewPager.setCurrentItem(newIndex, true);
|
||||
}
|
||||
});
|
||||
viewModel.setOnPrev(() -> {
|
||||
int newIndex = viewPager.getCurrentItem() - 1;
|
||||
if(newIndex <= getCount()) {
|
||||
this.mDatasetViews.get(newIndex).getValue().setInputData(data);
|
||||
this.mDatasetViews.get(newIndex).getValue().onPreShow();
|
||||
viewPager.setCurrentItem(newIndex, true);
|
||||
}
|
||||
});
|
||||
viewModel.setOnPrev(() -> {
|
||||
int newIndex = viewPager.getCurrentItem() - 1;
|
||||
|
||||
if(newIndex >= 0) {
|
||||
viewPager.setCurrentItem(newIndex, true);
|
||||
}
|
||||
});
|
||||
} catch (IllegalAccessException | InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(newIndex >= 0) {
|
||||
viewPager.setCurrentItem(newIndex, true);
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.setVariable(it.integry.integrywmsnative.BR.viewmodel, viewModel);
|
||||
|
||||
|
||||
@ -9,6 +9,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
@ -26,6 +28,13 @@ public class DialogBasketLU_Page1_ViewModel extends DialogBasketLU_BaseViewModel
|
||||
private List<MtbColt> availableMtbColts;
|
||||
private DialogBasketLU_Page1_ListAdapter mAdapter;
|
||||
|
||||
private final ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer;
|
||||
|
||||
@Inject
|
||||
public DialogBasketLU_Page1_ViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer) {
|
||||
this.colliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContext(Context context) {
|
||||
this.mContext = context;
|
||||
@ -47,11 +56,11 @@ public class DialogBasketLU_Page1_ViewModel extends DialogBasketLU_BaseViewModel
|
||||
|
||||
mBinding.constraintLayout.setMaxHeight((int) (mContext.getResources().getDisplayMetrics().heightPixels * 0.75));
|
||||
|
||||
ColliMagazzinoRESTConsumer.retrieveBasketColli(mtbColts -> {
|
||||
colliMagazzinoRESTConsumer.retrieveBasketColli(mtbColts -> {
|
||||
availableMtbColts = mtbColts;
|
||||
if(mtbColts != null && mtbColts.size() > 0) initRecyclerView(availableMtbColts);
|
||||
if(mtbColts != null && !mtbColts.isEmpty()) initRecyclerView(availableMtbColts);
|
||||
|
||||
mBinding.emptyView.setVisibility(mtbColts != null && mtbColts.size() > 0 ? View.GONE : View.VISIBLE);
|
||||
mBinding.emptyView.setVisibility(mtbColts != null && !mtbColts.isEmpty() ? View.GONE : View.VISIBLE);
|
||||
}, ex -> {
|
||||
mBinding.emptyView.setVisibility(View.VISIBLE);
|
||||
});
|
||||
|
||||
@ -2,6 +2,8 @@ package it.integry.integrywmsnative.view.dialogs.scan_or_create_lu;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.exception.AlreadyAttachedDocumentToLUException;
|
||||
@ -40,6 +42,7 @@ public class DialogScanOrCreateLUViewModel {
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
@Inject
|
||||
public DialogScanOrCreateLUViewModel(PosizioniRESTConsumer mPosizioniRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, ColliLavorazioneRESTConsumer mColliLavorazioneRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
this.mPosizioniRESTConsumer = mPosizioniRESTConsumer;
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user