Importate migliorie da branch RefactoringGestioneColli
This commit is contained in:
parent
ab230425c3
commit
efe84528da
@ -312,8 +312,8 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ColliAccettazioneRESTConsumer provideColliAccettazioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new ColliAccettazioneRESTConsumer(restBuilder);
|
||||
ColliAccettazioneRESTConsumer provideColliAccettazioneRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
|
||||
return new ColliAccettazioneRESTConsumer(executorService, restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@ -351,13 +351,10 @@ public class MtbColr extends EntityBase {
|
||||
}
|
||||
|
||||
|
||||
public String getDatetimeRowS() {
|
||||
public String getDatetimeRow() {
|
||||
return datetimeRow;
|
||||
}
|
||||
|
||||
public Date getDatetimeRowD() {
|
||||
return UtilityDate.recognizeDateWithExceptionHandler(getDatetimeRowS());
|
||||
}
|
||||
|
||||
public MtbColr setDatetimeRow(String datetimeRow) {
|
||||
this.datetimeRow = datetimeRow;
|
||||
|
||||
@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
@ -14,112 +16,133 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.DeleteUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements ColliCaricoRESTConsumerInterface {
|
||||
|
||||
private final ExecutorService executorService;
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public ColliAccettazioneRESTConsumer(RESTBuilder restBuilder) {
|
||||
public ColliAccettazioneRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
|
||||
this.executorService = executorService;
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@Override
|
||||
public MtbColt createUDCSynchronized(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Response<ServiceRESTResponse<CreateUDCResponseDTO>> response) {
|
||||
analyzeAnswer(response, "accettazione/createUDC", data -> onComplete.run(data.getMtbColt()), onFailed);
|
||||
}
|
||||
var response = colliAccettazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "accettazione/createUDC");
|
||||
return data.getMtbColt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
MtbColt result = createUDCSynchronized(createUDCRequestDTO);
|
||||
onComplete.run(result);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloseUDCResponseDTO synchronousCloseUDC(CloseUDCRequestDTO closeUDCRequestDTO) throws Exception {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
var response = colliAccettazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
|
||||
.execute();
|
||||
|
||||
return analyzeAnswer(response, "accettazione/closeUDC");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeUDC(CloseUDCRequestDTO closeUDCRequestDTO, RunnableArgs<CloseUDCResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
CloseUDCResponseDTO result = synchronousCloseUDC(closeUDCRequestDTO);
|
||||
onComplete.run(result);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public MtbColr synchronousInsertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO) throws Exception {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Response<ServiceRESTResponse<CloseUDCResponseDTO>> response) {
|
||||
analyzeAnswer(response, "accettazione/closeUDC", onComplete, onFailed);
|
||||
}
|
||||
var response = colliAccettazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "accettazione/insertUDCRow");
|
||||
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
onComplete.run(synchronousInsertUDCRow(insertUDCRowRequestDTO));
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public MtbColr synchronousEditUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO) throws Exception {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDCRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "accettazione/insertUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
var response = colliAccettazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "accettazione/editUDCRow");
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
onComplete.run(synchronousEditUDCRow(editUDCRowRequestDTO));
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronousDeleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO) throws Exception {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDCRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "accettazione/editUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
var response = colliAccettazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
analyzeAnswer(response, "accettazione/deleteUDCRow");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = restBuilder.getService(ColliAccettazioneRESTConsumerService.class);
|
||||
|
||||
colliAccettazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "accettazione/deleteUDCRow", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
synchronousDeleteUDCRow(deleteUDCRowRequestDTO);
|
||||
onComplete.run();
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void checkBarcodeUl(String barcodeUl, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed){
|
||||
|
||||
@ -20,10 +20,8 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CloseUDCResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.DeleteUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.EditUDCRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSFromArtRequestDTO;
|
||||
@ -31,7 +29,6 @@ import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
@ -53,75 +50,93 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public MtbColt createUDCSynchronized(CreateUDCRequestDTO createUDCRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, Response<ServiceRESTResponse<CreateUDCResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/createUDC", data -> onComplete.run(data.getMtbColt()), onFailed);
|
||||
}
|
||||
var response = colliLavorazioneRESTConsumerService.createUDC(createUDCRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "lavorazione/createUDC");
|
||||
return data.getMtbColt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
MtbColt result = createUDCSynchronized(createUDCRequestDTO);
|
||||
onComplete.run(result);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloseUDCResponseDTO synchronousCloseUDC(CloseUDCRequestDTO closeUDCRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
var response = colliLavorazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
|
||||
.execute();
|
||||
|
||||
return analyzeAnswer(response, "lavorazione/closeUDC");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeUDC(CloseUDCRequestDTO closeUDCRequestDTO, RunnableArgs<CloseUDCResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
CloseUDCResponseDTO result = synchronousCloseUDC(closeUDCRequestDTO);
|
||||
onComplete.run(result);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public MtbColr synchronousInsertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.closeUDC(closeUDCRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, Response<ServiceRESTResponse<CloseUDCResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/closeUDC", onComplete, onFailed);
|
||||
}
|
||||
var response = colliLavorazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "lavorazione/insertUDCRow");
|
||||
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
onComplete.run(synchronousInsertUDCRow(insertUDCRowRequestDTO));
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public MtbColr synchronousEditUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDCRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/insertUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
var response = colliLavorazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "lavorazione/editUDCRow");
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDCRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/editUDCRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
onComplete.run(synchronousEditUDCRow(editUDCRowRequestDTO));
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||
@ -231,22 +246,26 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void synchronousDeleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO) throws Exception {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "lavorazione/deleteUDCRow", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
var response = colliLavorazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
analyzeAnswer(response, "lavorazione/deleteUDCRow");
|
||||
}
|
||||
@Override
|
||||
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
synchronousDeleteUDCRow(deleteUDCRowRequestDTO);
|
||||
onComplete.run();
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -17,13 +17,13 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
@ -245,10 +245,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
saveCollo(newMtbColt, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void createColloFromEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
createColloFromEtichettaAnonima(barcodeScanDTO.getStringValue(), gestione, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void createColloFromEtichettaAnonima(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
MtbColt mtbColtToCreate = new MtbColt()
|
||||
@ -310,6 +306,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public List<MtbColr> fillMtbAartsOfMtbColrsSynchronized(List<MtbColr> mtbColrs) throws Exception {
|
||||
|
||||
List<String> codMarts = new ArrayList<>(mtbColrs.stream()
|
||||
@ -351,23 +348,18 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
List<MtbAart> mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||
List<MtbAart> artList = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||
if (artList == null)
|
||||
artList = new ArrayList<>();
|
||||
|
||||
Map<String, MtbAart> mtbAartsMap = artList.parallelStream()
|
||||
.collect(Collectors.toMap(mtbAart -> mtbAart.getCodMart().toUpperCase(), x -> x));
|
||||
|
||||
for (MtbColt mtbColt : mtbColts) {
|
||||
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
|
||||
|
||||
if (mtbAarts != null && !mtbAarts.isEmpty()) {
|
||||
MtbAart foundMtbAart = null;
|
||||
|
||||
List<MtbAart> mtbAartStream = mtbAarts.parallelStream()
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!mtbAartStream.isEmpty()) {
|
||||
foundMtbAart = mtbAartStream.get(0);
|
||||
}
|
||||
|
||||
mtbColr.setMtbAart(foundMtbAart);
|
||||
if (mtbAartsMap.containsKey(mtbColr.getCodMart().toUpperCase())) {
|
||||
mtbColr.setMtbAart(mtbAartsMap.get(mtbColr.getCodMart().toUpperCase()));
|
||||
}
|
||||
|
||||
mtbColr.setGestione(mtbColt.getGestione());
|
||||
@ -456,7 +448,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void spostaUlSynchronized(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically) throws Exception {
|
||||
public void spostaUlSynchronized(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, boolean enableDocumentDailyGrouping) throws Exception {
|
||||
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
|
||||
|
||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||
@ -479,11 +471,19 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
analyzeAnswer(response, "spostaUL");
|
||||
}
|
||||
|
||||
public void spostaUlSynchronized(MtbColt mtbColtToMove, MtbDepoPosizione posizione, boolean enableDocumentDailyGrouping) throws Exception {
|
||||
|
||||
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
String codMdep = posizione.getCodMdep();
|
||||
String posizioneString = posizione.getPosizione();
|
||||
|
||||
spostaUlSynchronized(mtbColtToMove, codMdep, posizioneString, true, enableDocumentDailyGrouping);
|
||||
}
|
||||
|
||||
|
||||
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, boolean enableDocumentDailyGrouping, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
spostaUlSynchronized(mtbColtToMove, codMdep, posizione, createDocAutomatically);
|
||||
spostaUlSynchronized(mtbColtToMove, codMdep, posizione, createDocAutomatically, enableDocumentDailyGrouping);
|
||||
if (onComplete != null) onComplete.run();
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
@ -491,14 +491,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void spostaUL(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
String codMdep = posizione.getCodMdep();
|
||||
String posizioneString = posizione.getPosizione();
|
||||
|
||||
spostaUL(mtbColtToMove, codMdep, posizioneString, true, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void updateTipoULSynchronized(MtbColt mtbColt, String codTcol) throws Exception {
|
||||
|
||||
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
@ -9,12 +7,8 @@ import javax.inject.Singleton;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPutItemsRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
|
||||
@ -49,20 +43,12 @@ public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public void putItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPutItemsRequestDTO magazzinoAutomaticoPutItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void makeSynchronousPutItemsRequest(MtbDepoPosizione posizione, MagazzinoAutomaticoPutItemsRequestDTO magazzinoAutomaticoPutItemsRequestDTO) throws Exception {
|
||||
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = restBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
|
||||
magazzinoAutomaticoRESTConsumerService.putItems(posizione.getPosizione(), magazzinoAutomaticoPutItemsRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "magazzino-automatico/putItems", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
var response = magazzinoAutomaticoRESTConsumerService.putItems(posizione.getPosizione(), magazzinoAutomaticoPutItemsRequestDTO)
|
||||
.execute();
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
var data = analyzeAnswer(response, "magazzino-automatico/putItems");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -15,9 +15,9 @@ import java.util.concurrent.ExecutorService;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
@ -82,22 +82,22 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public List<AvailableCodMdepsDTO> getAvailableCodMdepsSynchronized() throws Exception {
|
||||
public List<MtbDepo> getAvailableCodMdepsSynchronized() throws Exception {
|
||||
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
||||
var response = service.getAvailableCodMdeps().execute();
|
||||
return analyzeAnswer(response, "CodMdepsAvailable");
|
||||
}
|
||||
|
||||
public void getAvailableCodMdeps(final RunnableArgs<List<AvailableCodMdepsDTO>> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||
public void getAvailableCodMdeps(final RunnableArgs<List<MtbDepo>> onSuccess, RunnableArgs<Exception> onFailed) {
|
||||
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
|
||||
service.getAvailableCodMdeps().enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> call, Response<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> response) {
|
||||
public void onResponse(Call<ServiceRESTResponse<List<MtbDepo>>> call, Response<ServiceRESTResponse<List<MtbDepo>>> response) {
|
||||
analyzeAnswer(response, "CodMdepsAvailable", onSuccess, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> call, @NonNull final Exception e) {
|
||||
public void onFailure(Call<ServiceRESTResponse<List<MtbDepo>>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
|
||||
@ -2,7 +2,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
@ -25,7 +25,7 @@ public interface SystemRESTConsumerService {
|
||||
Call<ServiceRESTResponse<List<String>>> getAvailableProfiles(@Query("username") String username, @Query("password") String password);
|
||||
|
||||
@GET("getAvailableCodMdepsForUser")
|
||||
Call<ServiceRESTResponse<List<AvailableCodMdepsDTO>>> getAvailableCodMdeps();
|
||||
Call<ServiceRESTResponse<List<MtbDepo>>> getAvailableCodMdeps();
|
||||
|
||||
@POST("sendEmail")
|
||||
Call<ServiceRESTResponse<Void>> sendMail(@Body MailRequestDTO mailDto);
|
||||
|
||||
@ -91,34 +91,40 @@ public abstract class _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public static <T> void analyzeAnswerList(Response<ServiceRESTResponse<T>> response, String logTitle, RunnableArgs<List<T>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
try {
|
||||
var dataList = analyzeAnswerList(response, logTitle);
|
||||
onComplete.run(dataList);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> List<T> analyzeAnswerList(Response<ServiceRESTResponse<T>> response, String logTitle) throws Exception {
|
||||
if (response.isSuccessful()) {
|
||||
if (response.body() != null) {
|
||||
if (response.body().getEsito() == EsitoType.OK) {
|
||||
if (!UtilityString.isNullOrEmpty(response.body().getErrorMessage())) {
|
||||
onFailed.run(new Exception(response.body().getErrorMessage()));
|
||||
throw new Exception(response.body().getErrorMessage());
|
||||
} else {
|
||||
|
||||
List<T> dataObj = response.body().getEntityList();
|
||||
|
||||
onComplete.run(dataObj);
|
||||
return response.body().getEntityList();
|
||||
}
|
||||
} else {
|
||||
Log.e(logTitle, response.body().getErrorMessage());
|
||||
onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage()));
|
||||
throw CommonRESTException.tryRecognizeException(response.body().getErrorMessage());
|
||||
}
|
||||
} else {
|
||||
Log.e(logTitle, response.message());
|
||||
onFailed.run(new Exception(response.message()));
|
||||
throw new Exception(response.message());
|
||||
}
|
||||
} else {
|
||||
if (response.code() == 404) {
|
||||
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata");
|
||||
onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")"));
|
||||
throw new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")");
|
||||
} else if (response.code() == 550)
|
||||
onFailed.run(new InvalidLicenseException());
|
||||
throw new InvalidLicenseException();
|
||||
else {
|
||||
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
|
||||
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||
throw new Exception("Status " + response.code() + ": " + response.message());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,13 +12,18 @@ import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||
|
||||
public interface ColliCaricoRESTConsumerInterface {
|
||||
|
||||
MtbColt createUDCSynchronized(CreateUDCRequestDTO createUDCRequestDTO) throws Exception;
|
||||
void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
CloseUDCResponseDTO synchronousCloseUDC(CloseUDCRequestDTO closeUDCRequestDTO) throws Exception;
|
||||
void closeUDC(CloseUDCRequestDTO closeUDCRequestDTO, RunnableArgs<CloseUDCResponseDTO> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
MtbColr synchronousInsertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO) throws Exception;
|
||||
void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
MtbColr synchronousEditUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO) throws Exception;
|
||||
void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
void synchronousDeleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO) throws Exception;
|
||||
void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
|
||||
}
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class AvailableCodMdepsDTO {
|
||||
|
||||
@SerializedName("codMdep")
|
||||
private String codMdep;
|
||||
|
||||
@SerializedName("descrizione")
|
||||
private String descrizione;
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if((obj) != null) {
|
||||
return ((AvailableCodMdepsDTO) obj).codMdep.equalsIgnoreCase(codMdep);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -7,15 +7,15 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.Azienda;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
|
||||
public class DBSettingsModel {
|
||||
|
||||
private List<String> availableProfiles = null;
|
||||
private List<AvailableCodMdepsDTO> availableCodMdep = null;
|
||||
private List<MtbDepo> availableDepos = null;
|
||||
private List<MtbDepoPosizione> availablePosizioni = null;
|
||||
|
||||
private Azienda datiAzienda = null;
|
||||
@ -101,6 +101,7 @@ public class DBSettingsModel {
|
||||
private boolean flagViewSwitchDepoButton = true;
|
||||
private boolean flagProduzioneSkipAskVersamentoAutomatico;
|
||||
private boolean flagAccettazioneViewLotto = false;
|
||||
private boolean flagSpedizioneUnderflowQuantityWarning = false;
|
||||
private boolean flagAccettazioneBollaMarkReceived = false;
|
||||
|
||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||
@ -157,12 +158,12 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<AvailableCodMdepsDTO> getAvailableCodMdep() {
|
||||
return availableCodMdep;
|
||||
public List<MtbDepo> getAvailableDepos() {
|
||||
return availableDepos;
|
||||
}
|
||||
|
||||
public void setAvailableCodMdep(List<AvailableCodMdepsDTO> availableCodMdep) {
|
||||
this.availableCodMdep = availableCodMdep;
|
||||
public void setAvailableDepos(List<MtbDepo> availableDepos) {
|
||||
this.availableDepos = availableDepos;
|
||||
}
|
||||
|
||||
public boolean isEnableCheckPartitaMagCheckPickingV() {
|
||||
@ -855,6 +856,15 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagSpedizioneUnderflowQuantityWarning() {
|
||||
return flagSpedizioneUnderflowQuantityWarning;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagSpedizioneUnderflowQuantityWarning(boolean flagSpedizioneUnderflowQuantityWarning) {
|
||||
this.flagSpedizioneUnderflowQuantityWarning = flagSpedizioneUnderflowQuantityWarning;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagAccettazioneBollaMarkReceived() {
|
||||
return flagAccettazioneBollaMarkReceived;
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ import javax.inject.Singleton;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
@ -26,7 +27,6 @@ import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityFirebase;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
@ -170,7 +170,7 @@ public class SettingsManager {
|
||||
private static void loadAvailableCodMdeps() throws Exception {
|
||||
var availableCodMdeps = mSystemRESTConsumer.getAvailableCodMdepsSynchronized();
|
||||
|
||||
dbSettingsModelIstance.setAvailableCodMdep(availableCodMdeps);
|
||||
dbSettingsModelIstance.setAvailableDepos(availableCodMdeps);
|
||||
|
||||
if (availableCodMdeps == null || availableCodMdeps.isEmpty()) {
|
||||
throw new Exception(mContext.getText(R.string.no_codmdep_available).toString());
|
||||
@ -179,7 +179,7 @@ public class SettingsManager {
|
||||
boolean codMdepExistsAnymore = false;
|
||||
|
||||
if (settingsModelIstance.getUserSession().getDepo() != null) {
|
||||
for (AvailableCodMdepsDTO availableCodMdepDTO : availableCodMdeps) {
|
||||
for (MtbDepo availableCodMdepDTO : availableCodMdeps) {
|
||||
//Controllo se il codMdep salvato esiste ancora
|
||||
if (availableCodMdepDTO.getCodMdep().equalsIgnoreCase(settingsModelIstance.getUserSession().getDepo().getCodMdep())) {
|
||||
codMdepExistsAnymore = true;
|
||||
@ -264,6 +264,11 @@ public class SettingsManager {
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_CAN_ADD_EXTRA_QUANTITY")
|
||||
.setSetter(dbSettingsModelIstance::setFlagCanAddExtraQuantitySpedizione));
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("FLAG_UNDERFLOW_QUANTITY_WARNING")
|
||||
.setSetter(dbSettingsModelIstance::setFlagSpedizioneUnderflowQuantityWarning));
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
|
||||
@ -2,7 +2,7 @@ package it.integry.integrywmsnative.core.settings;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
|
||||
public class SettingsModel {
|
||||
|
||||
@ -85,7 +85,7 @@ public class SettingsModel {
|
||||
private LocalDateTime refreshTokenExpiryDate;
|
||||
private String deviceId;
|
||||
private String profileDB;
|
||||
private AvailableCodMdepsDTO depo;
|
||||
private MtbDepo depo;
|
||||
private Integer defaultOrdinamentoPickingAccettazione = 0;
|
||||
private Integer defaultOrdinamentoPickingAccettazioneBolle = 0;
|
||||
|
||||
@ -134,11 +134,11 @@ public class SettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AvailableCodMdepsDTO getDepo() {
|
||||
public MtbDepo getDepo() {
|
||||
return depo;
|
||||
}
|
||||
|
||||
public UserSession setDepo(AvailableCodMdepsDTO depo) {
|
||||
public UserSession setDepo(MtbDepo depo) {
|
||||
this.depo = depo;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ public class ContenutoBancaleActivity extends BaseActivity implements ContenutoB
|
||||
}
|
||||
|
||||
private void initColloInfo() {
|
||||
SettingsManager.iDB().getAvailableCodMdep().stream()
|
||||
SettingsManager.iDB().getAvailableDepos().stream()
|
||||
.filter(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.get().getCodMdep()))
|
||||
.findFirst()
|
||||
.ifPresent(x -> descrizioneDepo.set("(" + x.getDescrizione() + ")"));
|
||||
|
||||
@ -158,7 +158,7 @@ public class LoginViewModel {
|
||||
public void loadDepo(Runnable onComplete) {
|
||||
|
||||
this.mSystemRESTConsumer.getAvailableCodMdeps(availableCodMdeps -> {
|
||||
SettingsManager.iDB().setAvailableCodMdep(availableCodMdeps);
|
||||
SettingsManager.iDB().setAvailableDepos(availableCodMdeps);
|
||||
|
||||
if (availableCodMdeps == null || availableCodMdeps.isEmpty()) {
|
||||
this.sendError(new InvalidUserDepositException());
|
||||
|
||||
@ -33,11 +33,11 @@ import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
@ -158,7 +158,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
|
||||
initRecuperoCollo();
|
||||
|
||||
mBindings.switchDepoButton.setVisibility(SettingsManager.iDB().getAvailableCodMdep().size() > 1 ? View.VISIBLE : View.GONE);
|
||||
mBindings.switchDepoButton.setVisibility(SettingsManager.iDB().getAvailableDepos().size() > 1 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void initSessionData() {
|
||||
@ -339,11 +339,11 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
}
|
||||
|
||||
public void changeUserDepo() {
|
||||
DialogSwitchUserDepoView.newInstance(SettingsManager.iDB().getAvailableCodMdep(), this::onUserDepoChanged)
|
||||
DialogSwitchUserDepoView.newInstance(SettingsManager.iDB().getAvailableDepos(), this::onUserDepoChanged)
|
||||
.show(getParentFragmentManager(), "switch-user-depo");
|
||||
}
|
||||
|
||||
private void onUserDepoChanged(AvailableCodMdepsDTO newDepo) {
|
||||
private void onUserDepoChanged(MtbDepo newDepo) {
|
||||
SettingsManager.i().getUserSession().setDepo(newDepo);
|
||||
initSessionData();
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ public class PickingLiberoViewModel {
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getByTestataSynchronized(mtbColtList.get(0), true, false);
|
||||
|
||||
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
|
||||
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableDepos())
|
||||
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
|
||||
|
||||
if (codMdepIsValid) {
|
||||
@ -269,7 +269,7 @@ public class PickingLiberoViewModel {
|
||||
|
||||
} else if ((mtbColtScanned.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColtScanned.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && mtbColtScanned.getSegno() > 0) {
|
||||
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableCodMdep().stream()
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableDepos().stream()
|
||||
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColtScanned.getCodMdep()));
|
||||
|
||||
if (codMdepIsValid) {
|
||||
@ -657,7 +657,7 @@ public class PickingLiberoViewModel {
|
||||
String newCodMdep = shouldChangeCodMdep ? refMtbColt.getCodMdep() : null;
|
||||
|
||||
if (shouldChangeCodMdep) {
|
||||
mColliMagazzinoRESTConsumer.spostaUlSynchronized(mCurrentMtbColt, newCodMdep, null, false);
|
||||
mColliMagazzinoRESTConsumer.spostaUlSynchronized(mCurrentMtbColt, newCodMdep, null, false, false);
|
||||
mCurrentMtbColt.setCodMdep(newCodMdep);
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ public class ProdRiposizionamentoDaProdViewModel {
|
||||
this.sendError(new ScannedPositionNotExistException());
|
||||
} else {
|
||||
if (mtbColt != null) {
|
||||
mColliMagazzinoRESTConsumer.spostaUL(mtbColt, mtbDepoPosizione, () -> {
|
||||
mColliMagazzinoRESTConsumer.spostaUL(mtbColt, mtbDepoPosizione.getCodMdep(), mtbDepoPosizione.getPosizione(), true, false, () -> {
|
||||
List<MvwSitArtUdcDetInventario> mvwSitArtUdcDetInventarioList = mMvwSitArtUdcDetInventarioLiveData.getValue();
|
||||
|
||||
if (mvwSitArtUdcDetInventarioList != null) {
|
||||
|
||||
@ -117,7 +117,7 @@ public class ProdVersamentoMaterialeViewModel {
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getByTestataSynchronized(mtbColtList.get(0), true, false);
|
||||
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableCodMdep().stream()
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableDepos().stream()
|
||||
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
|
||||
|
||||
if (codMdepIsValid) {
|
||||
@ -133,7 +133,7 @@ public class ProdVersamentoMaterialeViewModel {
|
||||
private void executeEtichettaLU(String sscc) throws Exception {
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(sscc, true, false);
|
||||
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableCodMdep().stream()
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableDepos().stream()
|
||||
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
|
||||
|
||||
if (codMdepIsValid) {
|
||||
|
||||
@ -667,7 +667,7 @@ public class SpedizioneViewModel {
|
||||
}
|
||||
} else {
|
||||
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableCodMdep()
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableDepos()
|
||||
.stream()
|
||||
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
|
||||
|
||||
@ -710,7 +710,7 @@ public class SpedizioneViewModel {
|
||||
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableCodMdep().stream()
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableDepos().stream()
|
||||
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
|
||||
|
||||
if (codMdepIsValid) {
|
||||
@ -729,7 +729,7 @@ public class SpedizioneViewModel {
|
||||
if (mtbColt.getSegno() != -1) {
|
||||
|
||||
boolean codMdepMatchPreviousPick = mCurrentMtbColt == null || mCurrentMtbColt.getMtbColr().isEmpty() || mCurrentMtbColt.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep());
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableCodMdep().stream()
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableDepos().stream()
|
||||
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
|
||||
|
||||
if (codMdepIsValid && codMdepMatchPreviousPick) {
|
||||
@ -1632,7 +1632,7 @@ public class SpedizioneViewModel {
|
||||
String newCodMdep = shouldChangeCodMdep ? refMtbColt.getCodMdep() : null;
|
||||
|
||||
if (shouldChangeCodMdep) {
|
||||
mColliMagazzinoRESTConsumer.spostaUlSynchronized(mCurrentMtbColt, newCodMdep, null, false);
|
||||
mColliMagazzinoRESTConsumer.spostaUlSynchronized(mCurrentMtbColt, newCodMdep, null, false, false);
|
||||
mCurrentMtbColt.setCodMdep(newCodMdep);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,12 +10,12 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@ -76,7 +76,7 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_main_versamento_merce, container, false);
|
||||
mBindings = FragmentMainVersamentoMerceBinding.inflate(inflater, container, false);
|
||||
|
||||
MainApplication.appComponent
|
||||
.versamentoMerceComponent()
|
||||
@ -112,9 +112,9 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
if (mtbColt == null) {
|
||||
((IPoppableActivity) getActivity()).pop();
|
||||
} else if ((mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && mtbColt.getSegno().equals(+1)) {
|
||||
this.mViewModel.getCurrentMtbColt().postValue(mtbColt);
|
||||
this.mViewModel.initUL(mtbColt);
|
||||
} else if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA) {
|
||||
this.mViewModel.getCurrentMtbColt().postValue(mtbColt);
|
||||
this.mViewModel.initUL(mtbColt);
|
||||
} else {
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString(Html.fromHtml("Sono accettate solamente UL di <b>Acquisto</b> o <b>Lavorazione</b> di <b>CARICO</b>")),
|
||||
@ -136,8 +136,13 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||
this.onLoadingEnded();
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewModel.processBarcodeDTO(data);
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@ -213,12 +218,12 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
.setCanLUBeClosed(false);
|
||||
|
||||
if (!mDialogInputQuantityV2View.isVisible())
|
||||
this.requireActivity().runOnUiThread(() -> {
|
||||
handler.post(() -> {
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete(resultDTO -> {
|
||||
|
||||
if(resultDTO == null || resultDTO.isAborted()) {
|
||||
if (resultDTO == null || resultDTO.isAborted()) {
|
||||
this.onLoadingEnded();
|
||||
return;
|
||||
}
|
||||
@ -233,7 +238,6 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
onComplete.run(pickedQuantityDTO);
|
||||
|
||||
})
|
||||
.setOnAbort(this::onLoadingEnded)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
});
|
||||
else this.onLoadingEnded();
|
||||
@ -241,8 +245,22 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
|
||||
@Override
|
||||
public void onDataSaved() {
|
||||
this.requireActivity().runOnUiThread(() -> {
|
||||
DialogCommon.showDataSaved(requireActivity(), this::popMe);
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
|
||||
handler.post(() -> {
|
||||
DialogCommon.showDataSaved(requireActivity(), () -> {
|
||||
countDownLatch.countDown();
|
||||
});
|
||||
});
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
mViewModel.resetAll();
|
||||
this.openLU();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package it.integry.integrywmsnative.gest.versamento_merce;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
@ -11,11 +12,12 @@ import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
public class VersamentoMerceModule {
|
||||
|
||||
@Provides
|
||||
VersamentoMerceViewModel providesVersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
VersamentoMerceViewModel providesVersamentoMerceViewModel(ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
PosizioniRESTConsumer posizioniRESTConsumer,
|
||||
MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer) {
|
||||
return new VersamentoMerceViewModel(colliMagazzinoRESTConsumer, barcodeRESTConsumer, posizioniRESTConsumer, magazzinoAutomaticoRESTConsumer);
|
||||
return new VersamentoMerceViewModel(colliLavorazioneRESTConsumer, colliMagazzinoRESTConsumer, barcodeRESTConsumer, posizioniRESTConsumer, magazzinoAutomaticoRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -8,12 +8,15 @@ import com.annimon.stream.Stream;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
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.InvalidCodMdepException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
|
||||
import it.integry.integrywmsnative.core.exception.NoArtsInLUException;
|
||||
@ -28,12 +31,15 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPutItemsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
@ -45,228 +51,224 @@ public class VersamentoMerceViewModel {
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
private final ColliLavorazioneRESTConsumer mColliLavorazioneRESTConsumer;
|
||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
||||
private final MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer;
|
||||
|
||||
@Inject
|
||||
public VersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer, MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer) {
|
||||
public VersamentoMerceViewModel(ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer, MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer) {
|
||||
this.mColliLavorazioneRESTConsumer = colliLavorazioneRESTConsumer;
|
||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
this.mPosizioniRESTConsumer = posizioniRESTConsumer;
|
||||
this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer;
|
||||
}
|
||||
|
||||
public void initUL(MtbColt response) {
|
||||
this.mCurrentMtbColt.postValue(response);
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO, false)) {
|
||||
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
||||
this.executeEtichettaPosizione(barcodeScanDTO);
|
||||
|
||||
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), true, onComplete);
|
||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), true);
|
||||
|
||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||
} else {
|
||||
onComplete.run();
|
||||
this.executeEtichettaEan128(barcodeScanDTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
MtbDepoPosizione foundPosizione = SettingsManager.iDB().getAvailablePosizioni().stream()
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||
.single();
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
|
||||
if (foundPosizione == null) {
|
||||
//Nessuna posizione trovata con questo barcode
|
||||
this.sendError(new ScannedPositionNotExistException());
|
||||
return;
|
||||
throw new ScannedPositionNotExistException();
|
||||
}
|
||||
|
||||
if (foundPosizione.isMagazzinoAutomatico()) {
|
||||
//La posizione è di un magazzino automatico
|
||||
this.executePosizioneMagazzinoAutomatico(foundPosizione, onComplete);
|
||||
this.executePosizione(foundPosizione);
|
||||
}
|
||||
|
||||
} else if (foundPosizione.isFlagMonoCollo()) {
|
||||
this.executePosizioneMonocollo(onComplete, foundPosizione);
|
||||
|
||||
public void executePosizione(MtbDepoPosizione mtbDepoPosizione) throws Exception {
|
||||
if (mtbDepoPosizione.isMagazzinoAutomatico()) {
|
||||
//La posizione è di un magazzino automatico
|
||||
this.executePosizioneMagazzinoAutomatico(mtbDepoPosizione);
|
||||
|
||||
} else if (mtbDepoPosizione.isFlagMonoCollo()) {
|
||||
this.executePosizioneMonocollo(mtbDepoPosizione);
|
||||
} else {
|
||||
|
||||
if (!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) {
|
||||
this.sendOnSpostamentoTraDepConfirmRequired(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep(), canContinue -> {
|
||||
onComplete.run();
|
||||
if (canContinue) {
|
||||
if (UtilityPosizione.isPosizioneWithLivello(foundPosizione)) {
|
||||
askLivelloPosizione(foundPosizione);
|
||||
} else {
|
||||
updatePosizione(foundPosizione);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
onComplete.run();
|
||||
if (UtilityPosizione.isPosizioneWithLivello(foundPosizione)) {
|
||||
askLivelloPosizione(foundPosizione);
|
||||
boolean canContinue = true;
|
||||
|
||||
if (!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), mtbDepoPosizione.getCodMdep())) {
|
||||
canContinue = this.sendOnSpostamentoTraDepConfirmRequired(mCurrentMtbColt.getValue().getCodMdep(), mtbDepoPosizione.getCodMdep());
|
||||
|
||||
}
|
||||
|
||||
if (canContinue) {
|
||||
if (UtilityPosizione.isPosizioneWithLivello(mtbDepoPosizione)) {
|
||||
askLivelloPosizione(mtbDepoPosizione);
|
||||
} else {
|
||||
updatePosizione(foundPosizione);
|
||||
updatePosizione(mtbDepoPosizione);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void executePosizioneMagazzinoAutomatico(MtbDepoPosizione mtbDepoPosizione, Runnable onComplete) {
|
||||
private void executePosizioneMagazzinoAutomatico(MtbDepoPosizione mtbDepoPosizione) throws Exception {
|
||||
var magazzinoAutomaticoPickRequest = new MagazzinoAutomaticoPutItemsRequestDTO()
|
||||
.setInputMtbColt(this.mCurrentMtbColt.getValue());
|
||||
|
||||
mMagazzinoAutomaticoRESTConsumer.putItems(mtbDepoPosizione,
|
||||
magazzinoAutomaticoPickRequest, () -> {
|
||||
onComplete.run();
|
||||
this.sendOnDataSaved();
|
||||
}, this::sendError);
|
||||
mMagazzinoAutomaticoRESTConsumer.makeSynchronousPutItemsRequest(mtbDepoPosizione, magazzinoAutomaticoPickRequest);
|
||||
|
||||
this.sendOnDataSaved();
|
||||
}
|
||||
|
||||
private void executePosizioneMonocollo(Runnable onComplete, MtbDepoPosizione foundPosizione) {
|
||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> {
|
||||
private void executePosizioneMonocollo(MtbDepoPosizione foundPosizione) throws Exception {
|
||||
var barcodeUlInPosizioneList = this.mPosizioniRESTConsumer.getBancaliInPosizioneSynchronized(foundPosizione);
|
||||
|
||||
if (mtbColtList == null || mtbColtList.isEmpty()) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
||||
if (barcodeUlInPosizioneList == null || barcodeUlInPosizioneList.isEmpty()) {
|
||||
throw new NoLUFoundException();
|
||||
} else if (barcodeUlInPosizioneList.size() == 1) {
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getByTestataSynchronized(
|
||||
barcodeUlInPosizioneList.get(0), true, false
|
||||
);
|
||||
|
||||
//TAKE HERE
|
||||
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
|
||||
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
|
||||
//TAKE HERE
|
||||
boolean codMdepIsValid = SettingsManager.iDB().getAvailableDepos().stream()
|
||||
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
|
||||
|
||||
if (codMdepIsValid) {
|
||||
pickMerceULtoUL(mtbColt, onComplete);
|
||||
} else this.sendError(new InvalidCodMdepException());
|
||||
if (codMdepIsValid) {
|
||||
pickMerceULtoUL(mtbColt);
|
||||
} else throw new InvalidCodMdepException();
|
||||
|
||||
} else {
|
||||
throw new TooManyLUFoundInMonoLUPositionException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
var ean128Model = this.mBarcodeRESTConsumer.decodeEan128Synchronized(barcodeScanDTO);
|
||||
|
||||
|
||||
String barcodeProd = null;
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||
barcodeProd = ean128Model.Content;
|
||||
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
this.executeEtichettaLU(ean128Model.Sscc, false);
|
||||
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||
throw new NoLUFoundException();
|
||||
}
|
||||
}, this::sendError);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Runnable onBarcodeScanComplete) {
|
||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
private void executeEtichettaLU(String sscc, boolean isAnonima) throws Exception {
|
||||
var mtbColt = this.mColliMagazzinoRESTConsumer.getBySsccSynchronized(
|
||||
sscc, true, false
|
||||
);
|
||||
|
||||
String barcodeProd = null;
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||
barcodeProd = ean128Model.Content;
|
||||
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
this.executeEtichettaLU(ean128Model.Sscc, false, onBarcodeScanComplete);
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
if (mtbColt == null && !isAnonima) {
|
||||
throw new NoLUFoundException();
|
||||
} else if (mtbColt != null && (/*mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO ||*/ mtbColt.getGestioneEnum() == GestioneEnum.VENDITA)) {
|
||||
throw new InvalidLUGestioneException(GestioneEnum.VENDITA);
|
||||
} else {
|
||||
if (mtbColt == null) {
|
||||
int numCollo = -1;
|
||||
try {
|
||||
numCollo = UtilityBarcode.getNumColloFromULAnonima(sscc);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
var createUDCRequestDTO = new CreateUDCRequestDTO()
|
||||
.setNumCollo(numCollo)
|
||||
.setSerCollo(CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE)
|
||||
.setBarcodeUl(sscc);
|
||||
|
||||
var mtbColtAnonimo = this.mColliLavorazioneRESTConsumer.createUDCSynchronized(createUDCRequestDTO);
|
||||
pickMerceULtoUL(mtbColtAnonimo);
|
||||
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
onBarcodeScanComplete.run();
|
||||
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableDepos())
|
||||
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
|
||||
|
||||
if (codMdepIsValid) {
|
||||
pickMerceULtoUL(mtbColt);
|
||||
} else throw new InvalidCodMdepException();
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaLU(String sscc, boolean isAnonima, Runnable onComplete) {
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, mtbColt -> {
|
||||
|
||||
if (mtbColt == null && !isAnonima) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (mtbColt != null && (/*mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO ||*/ mtbColt.getGestioneEnum() == GestioneEnum.VENDITA)) {
|
||||
this.sendError(new InvalidLUGestioneException(GestioneEnum.VENDITA));
|
||||
} else {
|
||||
if (mtbColt == null) {
|
||||
this.mColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(sscc, GestioneEnum.LAVORAZIONE, mtbColtAnonimo -> {
|
||||
pickMerceULtoUL(mtbColtAnonimo, onComplete);
|
||||
}, this::sendError);
|
||||
|
||||
} else {
|
||||
boolean codMdepIsValid = Stream.of(SettingsManager.iDB().getAvailableCodMdep())
|
||||
.anyMatch(x -> x.getCodMdep().equalsIgnoreCase(mtbColt.getCodMdep()));
|
||||
|
||||
if (codMdepIsValid) {
|
||||
pickMerceULtoUL(mtbColt, onComplete);
|
||||
} else this.sendError(new InvalidCodMdepException());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
private void pickMerceULtoUL(MtbColt destMtbColt, Runnable onComplete) {
|
||||
private void pickMerceULtoUL(MtbColt destMtbColt) throws Exception {
|
||||
this.sendOnLoadingStarted();
|
||||
MtbColt sourceMtbColt = mCurrentMtbColt.getValue();
|
||||
|
||||
if (!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep())) {
|
||||
this.sendError(new Exception("Impossibile spostare la merce tra UL di due depositi differenti"));
|
||||
return;
|
||||
}
|
||||
if (!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep()))
|
||||
throw new Exception("Impossibile spostare la merce tra UL di due depositi differenti");
|
||||
|
||||
List<MtbColr> mtbColrsToPick = Stream.of(sourceMtbColt.getMtbColr())
|
||||
.filter(x -> x.getQtaCol().floatValue() > 0)
|
||||
.toList();
|
||||
List<MtbColr> mtbColrsToPick = sourceMtbColt.getMtbColr().stream()
|
||||
.filter(x -> UtilityBigDecimal.greaterThan(x.getQtaCol(), BigDecimal.ZERO))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (mtbColrsToPick.isEmpty()) {
|
||||
this.sendError(new NoArtsInLUException());
|
||||
return;
|
||||
throw new NoArtsInLUException();
|
||||
}
|
||||
|
||||
this.sendOnLoadingEnded();
|
||||
this.sendOnArtsChooseRequired(mtbColrsToPick, pickedAarts -> {
|
||||
List<MtbColr> destNewMtbColr = new ArrayList<>();
|
||||
var pickedAarts = this.sendOnArtsChooseRequired(mtbColrsToPick);
|
||||
|
||||
askQuantities(pickedAarts.iterator(), destNewMtbColr, () -> {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
MtbColt clonedSourceTestata = (MtbColt) sourceMtbColt.clone();
|
||||
clonedSourceTestata.setMtbColr(new ObservableArrayList<>());
|
||||
clonedSourceTestata.getMtbColr().addAll(destNewMtbColr);
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.spostaArtsTraUL(
|
||||
clonedSourceTestata,
|
||||
destMtbColt,
|
||||
false,
|
||||
(generatedMtbColrs) -> {
|
||||
this.sendOnDataSaved();
|
||||
onComplete.run();
|
||||
},
|
||||
this::sendError
|
||||
);
|
||||
|
||||
}, this::sendOnLoadingEnded);
|
||||
|
||||
}, this::sendOnLoadingEnded);
|
||||
}
|
||||
|
||||
|
||||
private void askQuantities(Iterator<MtbColr> sourceMtbColrs, List<MtbColr> destMtbColr, Runnable onComplete, Runnable onAbort) {
|
||||
|
||||
if (sourceMtbColrs.hasNext()) {
|
||||
askSingleQuantity(sourceMtbColrs.next(), mtbColr -> {
|
||||
destMtbColr.add(mtbColr);
|
||||
askQuantities(sourceMtbColrs, destMtbColr, onComplete, onAbort);
|
||||
}, onAbort);
|
||||
} else {
|
||||
onComplete.run();
|
||||
if (pickedAarts == null || pickedAarts.isEmpty()) {
|
||||
// User aborted the picking
|
||||
return;
|
||||
}
|
||||
|
||||
List<MtbColr> destNewMtbColr = new ArrayList<>();
|
||||
|
||||
for (MtbColr pickedMtbColr : pickedAarts) {
|
||||
var mtbColr = askSingleQuantity(pickedMtbColr);
|
||||
destNewMtbColr.add(mtbColr);
|
||||
}
|
||||
|
||||
|
||||
MtbColt clonedSourceTestata = (MtbColt) sourceMtbColt.clone();
|
||||
clonedSourceTestata.setMtbColr(new ObservableArrayList<>());
|
||||
clonedSourceTestata.getMtbColr().addAll(destNewMtbColr);
|
||||
|
||||
var generatedMtbColrs = this.mColliMagazzinoRESTConsumer.spostaArtsTraULSynchronized(
|
||||
clonedSourceTestata,
|
||||
destMtbColt,
|
||||
false);
|
||||
|
||||
this.sendOnDataSaved();
|
||||
}
|
||||
|
||||
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete, Runnable onAbort) {
|
||||
this.sendOnItemDispatched(mtbColr.getMtbAart(),
|
||||
private MtbColr askSingleQuantity(MtbColr mtbColr) {
|
||||
var pickedQuantity = this.sendOnItemDispatched(mtbColr.getMtbAart(),
|
||||
mtbColr.getNumCnf(),
|
||||
mtbColr.getQtaCnf(),
|
||||
mtbColr.getQtaCol(),
|
||||
@ -276,40 +278,42 @@ public class VersamentoMerceViewModel {
|
||||
mtbColr.getPartitaMag(),
|
||||
mtbColr.getDataScadPartita(),
|
||||
false,
|
||||
false,
|
||||
pickedQuantity -> {
|
||||
mtbColr
|
||||
.setQtaCol(pickedQuantity.getQtaTot())
|
||||
.setQtaCnf(pickedQuantity.getQtaCnf())
|
||||
.setNumCnf(pickedQuantity.getNumCnf())
|
||||
.setDatetimeRow(UtilityDate.getDateInstance());
|
||||
false);
|
||||
|
||||
onComplete.run(mtbColr);
|
||||
mtbColr
|
||||
.setQtaCol(pickedQuantity.getQtaTot())
|
||||
.setQtaCnf(pickedQuantity.getQtaCnf())
|
||||
.setNumCnf(pickedQuantity.getNumCnf())
|
||||
.setDatetimeRow(UtilityDate.toDateTime(UtilityDate.getNowTime()));
|
||||
|
||||
});
|
||||
return mtbColr;
|
||||
}
|
||||
|
||||
|
||||
public void askLivelloPosizione(MtbDepoPosizione mtbDepoPosizione) {
|
||||
this.sendOnLivelloPosizioneRequired(mtbDepoPosizione, newPosizione -> {
|
||||
if (newPosizione == null) {
|
||||
askLivelloPosizione(mtbDepoPosizione);
|
||||
} else {
|
||||
updatePosizione(newPosizione);
|
||||
}
|
||||
public void askLivelloPosizione(MtbDepoPosizione mtbDepoPosizione) throws Exception {
|
||||
var newPosizione = this.sendOnLivelloPosizioneRequired(mtbDepoPosizione);
|
||||
|
||||
if (newPosizione == null) {
|
||||
askLivelloPosizione(mtbDepoPosizione);
|
||||
} else {
|
||||
updatePosizione(newPosizione);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void updatePosizione(MtbDepoPosizione mtbDepoPosizione) {
|
||||
public void updatePosizione(MtbDepoPosizione mtbDepoPosizione) throws Exception {
|
||||
this.sendOnLoadingStarted();
|
||||
mColliMagazzinoRESTConsumer.spostaUL(mCurrentMtbColt.getValue(), mtbDepoPosizione, () -> {
|
||||
this.sendOnLoadingEnded();
|
||||
this.sendOnDataSaved();
|
||||
}, this::sendError);
|
||||
mColliMagazzinoRESTConsumer.spostaUlSynchronized(mCurrentMtbColt.getValue(), mtbDepoPosizione, true);
|
||||
|
||||
this.sendOnLoadingEnded();
|
||||
this.sendOnDataSaved();
|
||||
}
|
||||
|
||||
|
||||
public void resetAll() {
|
||||
this.mCurrentMtbColt.postValue(null);
|
||||
}
|
||||
|
||||
public MutableLiveData<MtbColt> getCurrentMtbColt() {
|
||||
return mCurrentMtbColt;
|
||||
}
|
||||
@ -323,33 +327,97 @@ public class VersamentoMerceViewModel {
|
||||
if (this.mListener != null) mListener.onDataSaved();
|
||||
}
|
||||
|
||||
private void sendOnLivelloPosizioneRequired(MtbDepoPosizione posizione, RunnableArgs<MtbDepoPosizione> onComplete) {
|
||||
private MtbDepoPosizione sendOnLivelloPosizioneRequired(MtbDepoPosizione posizione) {
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
AtomicReference<MtbDepoPosizione> result = new AtomicReference<>();
|
||||
|
||||
if (this.mListener != null)
|
||||
mListener.onLivelloPosizioneRequired(posizione, onComplete);
|
||||
mListener.onLivelloPosizioneRequired(posizione, data -> {
|
||||
if (data != null) {
|
||||
result.set(data);
|
||||
}
|
||||
countDownLatch.countDown();
|
||||
});
|
||||
|
||||
else {
|
||||
// If no listener is set, we complete immediately with an empty list
|
||||
result.set(null);
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return result.get();
|
||||
}
|
||||
|
||||
private void sendOnArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||
private List<MtbColr> sendOnArtsChooseRequired(List<MtbColr> mtbColrList) {
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
AtomicReference<List<MtbColr>> result = new AtomicReference<>();
|
||||
|
||||
if (this.mListener != null)
|
||||
mListener.onArtsChooseRequired(mtbColrList, onComplete, onAbort);
|
||||
mListener.onArtsChooseRequired(mtbColrList, data -> {
|
||||
if (data != null) {
|
||||
result.set(data);
|
||||
}
|
||||
countDownLatch.countDown();
|
||||
|
||||
}, countDownLatch::countDown);
|
||||
|
||||
else {
|
||||
// If no listener is set, we complete immediately with an empty list
|
||||
result.set(null);
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return result.get();
|
||||
}
|
||||
|
||||
private void sendOnSpostamentoTraDepConfirmRequired(String sourceCodMdep, String destinationCodMdep, RunnableArgs<Boolean> onComplete) {
|
||||
private Boolean sendOnSpostamentoTraDepConfirmRequired(String sourceCodMdep, String destinationCodMdep) {
|
||||
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
AtomicReference<Boolean> result = new AtomicReference<>();
|
||||
|
||||
if (this.mListener != null)
|
||||
mListener.onSpostamentoTraDepConfirmRequired(sourceCodMdep, destinationCodMdep, onComplete);
|
||||
mListener.onSpostamentoTraDepConfirmRequired(sourceCodMdep, destinationCodMdep, data -> {
|
||||
result.set(data);
|
||||
countDownLatch.countDown();
|
||||
});
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return result.get();
|
||||
}
|
||||
|
||||
private void sendOnItemDispatched(MtbAart mtbAart,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
BigDecimal initialQtaTot,
|
||||
BigDecimal totalQtaAvailable,
|
||||
BigDecimal totalNumCnfAvailable,
|
||||
BigDecimal qtaCnfAvailable,
|
||||
String partitaMag,
|
||||
LocalDate dataScad,
|
||||
boolean canOverflowOrderQuantity,
|
||||
boolean canBatchLotBeChanged,
|
||||
RunnableArgs<PickedQuantityDTO> onComplete) {
|
||||
private PickedQuantityDTO sendOnItemDispatched(MtbAart mtbAart,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
BigDecimal initialQtaTot,
|
||||
BigDecimal totalQtaAvailable,
|
||||
BigDecimal totalNumCnfAvailable,
|
||||
BigDecimal qtaCnfAvailable,
|
||||
String partitaMag,
|
||||
LocalDate dataScad,
|
||||
boolean canOverflowOrderQuantity,
|
||||
boolean canBatchLotBeChanged) {
|
||||
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
AtomicReference<PickedQuantityDTO> result = new AtomicReference<>();
|
||||
|
||||
|
||||
if (this.mListener != null) mListener.onItemDispatched(
|
||||
mtbAart,
|
||||
initialNumCnf,
|
||||
@ -362,7 +430,20 @@ public class VersamentoMerceViewModel {
|
||||
dataScad,
|
||||
canOverflowOrderQuantity,
|
||||
canBatchLotBeChanged,
|
||||
onComplete);
|
||||
pickedQuantityDTO -> {
|
||||
if (pickedQuantityDTO != null) {
|
||||
result.set(pickedQuantityDTO);
|
||||
}
|
||||
|
||||
countDownLatch.countDown();
|
||||
});
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return result.get();
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
|
||||
@ -8,8 +8,8 @@ import androidx.lifecycle.MutableLiveData;
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidCodMdepBarcodeException;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
@ -47,12 +47,12 @@ public class DialogAskDepositoViewModel {
|
||||
throw new InvalidCodMdepBarcodeException(barcodeScanDTO.getStringValue());
|
||||
}
|
||||
|
||||
AvailableCodMdepsDTO availableCodMdepsDTO = SettingsManager.iDB().getAvailableCodMdep().stream()
|
||||
MtbDepo availableDepo = SettingsManager.iDB().getAvailableDepos().stream()
|
||||
.filter(x -> x.getCodMdep().equalsIgnoreCase(ean128Model.Internal4))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (availableCodMdepsDTO == null) {
|
||||
if (availableDepo == null) {
|
||||
throw new InvalidCodMdepBarcodeException(ean128Model.Internal4);
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ import it.integry.integrywmsnative.core.di.binders.recyclerview.ItemBinder;
|
||||
import it.integry.integrywmsnative.core.di.binders.recyclerview.ItemBinderBase;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.databinding.DialogSwitchUserDepoBinding;
|
||||
|
||||
public class DialogSwitchUserDepoView extends BaseDialogFragment {
|
||||
@ -34,15 +34,15 @@ public class DialogSwitchUserDepoView extends BaseDialogFragment {
|
||||
private DialogSwitchUserDepoBinding mBindings;
|
||||
private Context mContext;
|
||||
|
||||
private final List<AvailableCodMdepsDTO> availableCodMdeps;
|
||||
private final RunnableArgs<AvailableCodMdepsDTO> onComplete;
|
||||
private final List<MtbDepo> availableCodMdeps;
|
||||
private final RunnableArgs<MtbDepo> onComplete;
|
||||
|
||||
//Pass here all external parameters
|
||||
public static DialogSwitchUserDepoView newInstance(List<AvailableCodMdepsDTO> availableCodMdeps, RunnableArgs<AvailableCodMdepsDTO> onComplete) {
|
||||
public static DialogSwitchUserDepoView newInstance(List<MtbDepo> availableCodMdeps, RunnableArgs<MtbDepo> onComplete) {
|
||||
return new DialogSwitchUserDepoView(availableCodMdeps, onComplete);
|
||||
}
|
||||
|
||||
private DialogSwitchUserDepoView(List<AvailableCodMdepsDTO> availableCodMdeps, RunnableArgs<AvailableCodMdepsDTO> onComplete) {
|
||||
private DialogSwitchUserDepoView(List<MtbDepo> availableCodMdeps, RunnableArgs<MtbDepo> onComplete) {
|
||||
super();
|
||||
|
||||
this.availableCodMdeps = availableCodMdeps;
|
||||
@ -80,9 +80,9 @@ public class DialogSwitchUserDepoView extends BaseDialogFragment {
|
||||
public void onInit(DialogInterface dialogInterface) {
|
||||
super.onInit(dialogInterface);
|
||||
|
||||
ItemBinder<AvailableCodMdepsDTO> itemBinder = new ItemBinderBase<>(BR.item, R.layout.dialog_switch_user_depo__list_item);
|
||||
ItemBinder<MtbDepo> itemBinder = new ItemBinderBase<>(BR.item, R.layout.dialog_switch_user_depo__list_item);
|
||||
|
||||
BindingRecyclerViewAdapter<AvailableCodMdepsDTO> adapter = new BindingRecyclerViewAdapter<>(itemBinder, availableCodMdeps);
|
||||
BindingRecyclerViewAdapter<MtbDepo> adapter = new BindingRecyclerViewAdapter<>(itemBinder, availableCodMdeps);
|
||||
adapter.setClickHandler(data -> {
|
||||
onComplete.run(data);
|
||||
dismiss();
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<data>
|
||||
<variable
|
||||
name="item"
|
||||
type="it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO" />
|
||||
type="it.integry.integrywmsnative.core.model.MtbDepo" />
|
||||
</data>
|
||||
|
||||
<RelativeLayout
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user