Finish v1.46.16(504)
This commit is contained in:
commit
fe77f90a7a
@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 502
|
||||
def appVersionName = '1.46.14'
|
||||
def appVersionCode = 504
|
||||
def appVersionName = '1.46.16'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
|
||||
@ -313,8 +313,8 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
DocumentRESTConsumer provideDocumentiRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new DocumentRESTConsumer(restBuilder);
|
||||
DocumentRESTConsumer provideDocumentiRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
return new DocumentRESTConsumer(restBuilder, executorService);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@ -61,15 +61,16 @@ public class AuthInterceptor implements Interceptor {
|
||||
return chain.proceed(originalRequest);
|
||||
}
|
||||
|
||||
//Retrieve the new access token after refresh
|
||||
accessToken = SettingsManager.i().getUserSession().getAccessToken();
|
||||
}
|
||||
|
||||
// Add the access token to the request header
|
||||
var authorizedRequest = originalRequest.newBuilder()
|
||||
.header("Authorization", "Bearer " + SettingsManager.i().getUserSession().getAccessToken())
|
||||
.build();
|
||||
// Add the access token to the request header
|
||||
var authorizedRequest = originalRequest.newBuilder()
|
||||
.header("Authorization", "Bearer " + accessToken)
|
||||
.build();
|
||||
|
||||
return chain.proceed(authorizedRequest);
|
||||
} else
|
||||
return chain.proceed(originalRequest);
|
||||
return chain.proceed(authorizedRequest);
|
||||
} else
|
||||
return chain.proceed(originalRequest);
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ package it.integry.integrywmsnative.core.rest;
|
||||
import java.io.IOException;
|
||||
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Request;
|
||||
@ -31,18 +30,6 @@ public class HttpInterceptor implements Interceptor {
|
||||
.addHeader("Accept", "*/*")
|
||||
.addHeader("x-app-token", APP_TOKEN);
|
||||
|
||||
|
||||
String accessToken = null;
|
||||
|
||||
//Nel caso in cui il token è scaduto e devo richiamare la refresh non bisogna passare il vecchio token
|
||||
if(SettingsManager.i().getUserSession().getAccessTokenExpiryDate() != null &&
|
||||
UtilityDate.getNowTime().isBefore(SettingsManager.i().getUserSession().getAccessTokenExpiryDate().minusSeconds(20))) {
|
||||
accessToken = SettingsManager.i().getUserSession().getAccessToken();
|
||||
}
|
||||
|
||||
if(accessToken != null)
|
||||
builder.header("Authorization", "Bearer " + accessToken);
|
||||
|
||||
var newRequest = builder
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@ -20,9 +21,11 @@ import retrofit2.Response;
|
||||
public class DocumentRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final RESTBuilder restBuilder;
|
||||
private final ExecutorService executorService;
|
||||
|
||||
public DocumentRESTConsumer(RESTBuilder restBuilder) {
|
||||
public DocumentRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
|
||||
this.restBuilder = restBuilder;
|
||||
this.executorService = executorService;
|
||||
}
|
||||
|
||||
public void createDocsFromColli(List<LoadColliDTO> listColli, RunnableArgs<List<DtbDoct>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@ -40,19 +43,22 @@ public class DocumentRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void createDocFromColli(LoadColliDTO loadColliDTO, RunnableArgs<DtbDoct> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public DtbDoct makeSynchronousCreateDocFromColliRequest(LoadColliDTO loadColliDTO) throws Exception {
|
||||
DocumentiRESTConsumerService documentiRESTConsumerService = restBuilder.getService(DocumentiRESTConsumerService.class);
|
||||
documentiRESTConsumerService
|
||||
var response = documentiRESTConsumerService
|
||||
.createDocFromColli(loadColliDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<DtbDoct>> call, Response<ServiceRESTResponse<DtbDoct>> response) {
|
||||
analyzeAnswer(response, "createDocFromColli", onComplete, onFailed);
|
||||
}
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<DtbDoct>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
return analyzeAnswer(response, "createDocFromColli");
|
||||
}
|
||||
|
||||
public void makeCreateDocFromColliRequest(LoadColliDTO loadColliDTO, RunnableArgs<DtbDoct> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var result = makeSynchronousCreateDocFromColliRequest(loadColliDTO);
|
||||
if (onComplete != null) onComplete.run(result);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
var response = service.retrieveAlreadyRegisteredUDS(request)
|
||||
.execute();
|
||||
var data = analyzeAnswer(response, "getBancaliGiaRegistrati");
|
||||
return data == null ? new ArrayList<>() : data.getUdsList();
|
||||
return data == null || data.getUdsList() == null ? new ArrayList<>() : data.getUdsList();
|
||||
}
|
||||
|
||||
public void getBancaliGiaRegistrati(List<OrdineInevasoDTO> orders, int segno, RunnableArgs<List<AlreadyRegisteredUlDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
@ -125,13 +125,12 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void printClosedOrdersSynchronized(PrintOrderCloseDTO dto, String codMdep) throws Exception {
|
||||
if (BuildConfig.DEBUG) {
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
|
||||
PrinterRESTConsumerService printerService = restBuilder.getService(PrinterRESTConsumerService.class, 240);
|
||||
Call<ServiceRESTResponse<Object>> callable = printerService.printClosedOrders(codMdep, dto);
|
||||
|
||||
var response = callable.execute();
|
||||
var response = printerService.printClosedOrders(codMdep, dto).execute();
|
||||
analyzeAnswer(response, "printCollo");
|
||||
}
|
||||
|
||||
|
||||
@ -806,7 +806,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Stream.of(this.mOrdiniInevasiMutableData)
|
||||
this.mOrdiniInevasiMutableData.stream()
|
||||
.forEach(x -> x.getSelectedObservable().set(false));
|
||||
}
|
||||
|
||||
|
||||
@ -854,12 +854,10 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
|
||||
public void closeOrder() {
|
||||
this.fabPopupMenu.dismiss();
|
||||
this.onLoadingStarted();
|
||||
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewmodel.closeOrder();
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
onError(e);
|
||||
}
|
||||
|
||||
@ -341,14 +341,6 @@ public class SpedizioneViewModel {
|
||||
return mIsOrdTrasf;
|
||||
}
|
||||
|
||||
private void onOrderClosedPrintingDone() {
|
||||
if (this.mIsOrdTrasf && !UtilityString.isNullOrEmpty(SettingsManager.iDB().getCodDtipOrdTrasfV())) {
|
||||
this.sendCreateDocsRequest();
|
||||
} else {
|
||||
this.sendOnOrderClosed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.mListener != null) mListener.onLoadingStarted();
|
||||
@ -2123,15 +2115,21 @@ public class SpedizioneViewModel {
|
||||
}
|
||||
|
||||
public void closeOrder() {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
if (SettingsManager.iDB().isFlagPrintEtichetteOnOrderClose() || SettingsManager.iDB().isFlagPrintPackingListOnOrderClose()) {
|
||||
var printRequestResult = this.sendOnCloseOrderPrintRequest();
|
||||
this.onCloseOrderPrintRequest(printRequestResult);
|
||||
this.onCloseOrderPrintRequested(printRequestResult);
|
||||
}
|
||||
|
||||
this.onOrderClosedPrintingDone();
|
||||
if (this.mIsOrdTrasf && !UtilityString.isNullOrEmpty(SettingsManager.iDB().getCodDtipOrdTrasfV())) {
|
||||
this.sendCreateDocsRequest();
|
||||
}
|
||||
|
||||
this.sendOnOrderClosed();
|
||||
}
|
||||
|
||||
private void onCloseOrderPrintRequest(PrintOrderCloseDTO dto) {
|
||||
private void onCloseOrderPrintRequested(PrintOrderCloseDTO dto) {
|
||||
if (!dto.isFlagPrintPackingList() && !dto.isFlagPrintSSCC()) {
|
||||
return;
|
||||
}
|
||||
@ -2147,13 +2145,22 @@ public class SpedizioneViewModel {
|
||||
|
||||
dto.setPrintList(closedOrders);
|
||||
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
try {
|
||||
printClosedOrders(dto);
|
||||
latch.countDown();
|
||||
} catch (Exception e) {
|
||||
this.sendLUPrintError(e, () -> {
|
||||
latch.countDown();
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
latch.await();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void printClosedOrders(PrintOrderCloseDTO dto) throws Exception {
|
||||
@ -2196,6 +2203,7 @@ public class SpedizioneViewModel {
|
||||
|
||||
void createDocs() {
|
||||
executorService.execute(() -> {
|
||||
this.sendOnLoadingStarted();
|
||||
List<MtbColt> registeredUds = null;
|
||||
|
||||
try {
|
||||
@ -2232,7 +2240,12 @@ public class SpedizioneViewModel {
|
||||
loadCollidto.setSaveDoc(true);
|
||||
loadCollidto.setGestione("L");
|
||||
|
||||
this.mDocumentRESTConsumer.createDocFromColli(loadCollidto, doc -> this.sendOnOrderClosed(), this::sendError);
|
||||
try {
|
||||
this.mDocumentRESTConsumer.makeSynchronousCreateDocFromColliRequest(loadCollidto);
|
||||
} catch (Exception e) {
|
||||
sendError(e);
|
||||
}
|
||||
this.sendOnLoadingEnded();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user