Refactoring picking resi cliente. Da completare con picking resi fornitore.
This commit is contained in:
@@ -241,8 +241,8 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PrinterRESTConsumer providePrinterRESTConsumer(RESTBuilder restBuilder) {
|
||||
return new PrinterRESTConsumer(restBuilder);
|
||||
PrinterRESTConsumer providePrinterRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
|
||||
return new PrinterRESTConsumer(executorService, restBuilder);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -319,8 +319,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
|
||||
|
||||
@@ -6,7 +6,7 @@ public interface ILUPrintListener {
|
||||
|
||||
void onLUSuccessullyPrinted();
|
||||
|
||||
void onLUPrintRequest(RunnableArgs<Boolean> onComplete);
|
||||
boolean onLUPrintRequest();
|
||||
|
||||
void onLUPrintError(Exception ex, Runnable onComplete);
|
||||
|
||||
|
||||
@@ -4,9 +4,8 @@ import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.model.key.DtbDocrKey;
|
||||
|
||||
public class DtbDocr extends EntityBase {
|
||||
|
||||
@@ -17,7 +16,7 @@ public class DtbDocr extends EntityBase {
|
||||
private String codDtip;
|
||||
|
||||
@SerializedName("dataDoc")
|
||||
private String dataDoc;
|
||||
private LocalDate dataDoc;
|
||||
|
||||
@SerializedName("idRiga")
|
||||
private Integer idRiga;
|
||||
@@ -216,6 +215,10 @@ public class DtbDocr extends EntityBase {
|
||||
type = "dtb_docr";
|
||||
}
|
||||
|
||||
public DtbDocrKey getKey() {
|
||||
return new DtbDocrKey(codAnag, codDtip, dataDoc, numDoc, serDoc, idRiga);
|
||||
}
|
||||
|
||||
public String getCodAnag() {
|
||||
return codAnag;
|
||||
}
|
||||
@@ -234,17 +237,12 @@ public class DtbDocr extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataDocS() {
|
||||
public LocalDate getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public Date getDataDocD() {
|
||||
return UtilityDate.recognizeDateWithExceptionHandler(getDataDocS());
|
||||
}
|
||||
|
||||
public DtbDocr setDataDoc(String dataDoc) {
|
||||
public void setDataDoc(LocalDate dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getIdRiga() {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package it.integry.integrywmsnative.core.model.key;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DtbDocrKey extends DtbDoctKey {
|
||||
|
||||
@SerializedName("idRiga")
|
||||
private final int idRiga;
|
||||
|
||||
public DtbDocrKey(String codAnag, String codDtip, LocalDate dataDoc, Integer numDoc, String serDoc, int idRiga) {
|
||||
super(codAnag, codDtip, dataDoc, numDoc, serDoc);
|
||||
this.idRiga = idRiga;
|
||||
}
|
||||
|
||||
public int getIdRiga() {
|
||||
return idRiga;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
DtbDocrKey that = (DtbDocrKey) o;
|
||||
return getIdRiga() == that.getIdRiga();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), getIdRiga());
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -17,106 +19,128 @@ 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 CreateUDCResponseDTO synchronousCreateUDC(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();
|
||||
|
||||
var data = analyzeAnswer(response, "accettazione/createUDC");
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
MtbColt result = synchronousCreateUDC(createUDCRequestDTO).getMtbColt();
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||
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);
|
||||
|
||||
var response = colliAccettazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
var data = analyzeAnswer(response, "accettazione/insertUDCRow");
|
||||
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
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);
|
||||
|
||||
var response = colliAccettazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
var data = analyzeAnswer(response, "accettazione/editUDCRow");
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
onComplete.run(synchronousEditUDCRow(editUDCRowRequestDTO));
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void synchronousDeleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO) throws Exception {
|
||||
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);
|
||||
var response = colliAccettazioneRESTConsumerService.deleteUDCRow(deleteUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
analyzeAnswer(response, "accettazione/deleteUDCRow");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
synchronousDeleteUDCRow(deleteUDCRowRequestDTO);
|
||||
onComplete.run();
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,7 +23,6 @@ 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 +30,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,72 +51,90 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public CreateUDCResponseDTO synchronousCreateUDC(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();
|
||||
|
||||
var data = analyzeAnswer(response, "lavorazione/createUDC");
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CreateUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||
public void createUDC(CreateUDCRequestDTO createUDCRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
MtbColt result = synchronousCreateUDC(createUDCRequestDTO).getMtbColt();
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CloseUDCResponseDTO>> call, @NonNull final Exception e) {
|
||||
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);
|
||||
|
||||
var response = colliLavorazioneRESTConsumerService.insertUDCRow(insertUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
var data = analyzeAnswer(response, "lavorazione/insertUDCRow");
|
||||
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<InsertUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
onComplete.run(synchronousInsertUDCRow(insertUDCRowRequestDTO));
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public MtbColr synchronousEditUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO) throws Exception {
|
||||
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);
|
||||
var response = colliLavorazioneRESTConsumerService.editUDCRow(editUDCRowRequestDTO)
|
||||
.execute();
|
||||
|
||||
var data = analyzeAnswer(response, "lavorazione/editUDCRow");
|
||||
return data.getSavedMtbColr();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<EditUDCRowResponseDTO>> call, @NonNull final Exception e) {
|
||||
public void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
onComplete.run(synchronousEditUDCRow(editUDCRowRequestDTO));
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
@@ -231,19 +247,23 @@ 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();
|
||||
|
||||
analyzeAnswer(response, "lavorazione/deleteUDCRow");
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
public void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
synchronousDeleteUDCRow(deleteUDCRowRequestDTO);
|
||||
onComplete.run();
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -485,19 +485,25 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
analyzeAnswer(response, "updateDepositoUL");
|
||||
}
|
||||
|
||||
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void synchronousUpdateDataFine(MtbColt mtbColt) throws Exception {
|
||||
|
||||
MtbColt cloneMtbColt = (MtbColt) mtbColt.clone();
|
||||
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.UPDATE);
|
||||
cloneMtbColt.setOraFinePrep(UtilityDate.getDateInstance());
|
||||
cloneMtbColt.setMtbColr(new ObservableArrayList<>());
|
||||
|
||||
saveCollo(cloneMtbColt, value -> {
|
||||
onComplete.run();
|
||||
}, ex -> {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
});
|
||||
var value = saveColloSynchronized(cloneMtbColt);
|
||||
}
|
||||
|
||||
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
synchronousUpdateDataFine(mtbColt);
|
||||
if (onComplete != null) onComplete.run();
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -743,24 +749,26 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
}
|
||||
|
||||
public void printUL(PrintULRequestDTO printULRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void printULSynchronized(PrintULRequestDTO printULRequestDTO) throws Exception {
|
||||
if (BuildConfig.DEBUG) {
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
|
||||
colliMagazzinoRESTConsumerService.printUL(printULRequestDTO)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "generic/printUL", Void -> onComplete.run(), onFailed);
|
||||
var response = colliMagazzinoRESTConsumerService.printUL(printULRequestDTO)
|
||||
.execute();
|
||||
|
||||
analyzeAnswer(response, "generic/printUL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
|
||||
onFailed.run(e);
|
||||
public void printUL(PrintULRequestDTO printULRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
printULSynchronized(printULRequestDTO);
|
||||
if (onComplete != null) onComplete.run();
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import androidx.annotation.NonNull;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@@ -25,32 +26,34 @@ import retrofit2.Response;
|
||||
@Singleton
|
||||
public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private final ExecutorService executorService;
|
||||
private final RESTBuilder restBuilder;
|
||||
|
||||
public PrinterRESTConsumer(RESTBuilder restBuilder) {
|
||||
public PrinterRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
|
||||
this.executorService = executorService;
|
||||
this.restBuilder = restBuilder;
|
||||
}
|
||||
|
||||
public void printCollo(MtbColt testataColloToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
public void synchronousPrintCollo(MtbColt testataColloToPrint) throws Exception {
|
||||
if (BuildConfig.DEBUG) {
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
|
||||
PrinterRESTConsumerService printerService = restBuilder.getService(PrinterRESTConsumerService.class);
|
||||
printerService
|
||||
var response = printerService
|
||||
.printCollo(testataColloToPrint)
|
||||
.enqueue(new ManagedErrorCallback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "printCollo", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
.execute();
|
||||
|
||||
analyzeAnswer(response, "printCollo");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
|
||||
public void printCollo(MtbColt testataColloToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
synchronousPrintCollo(testataColloToPrint);
|
||||
onComplete.run();
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,19 +6,25 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
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.uds.InsertUDCRowRequestDTO;
|
||||
|
||||
public interface ColliCaricoRESTConsumerInterface {
|
||||
|
||||
CreateUDCResponseDTO synchronousCreateUDC(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);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ public class CreateUDCRequestDTO {
|
||||
@SerializedName("annotazioni")
|
||||
private String annotazioni;
|
||||
|
||||
@SerializedName("reso")
|
||||
private boolean reso;
|
||||
|
||||
|
||||
@SerializedName("orders")
|
||||
private List<CreateUDCRequestOrderDTO> orders;
|
||||
@@ -94,6 +97,15 @@ public class CreateUDCRequestDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isReso() {
|
||||
return reso;
|
||||
}
|
||||
|
||||
public CreateUDCRequestDTO setReso(boolean reso) {
|
||||
this.reso = reso;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<CreateUDCRequestOrderDTO> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.key.DtbDocrKey;
|
||||
|
||||
public class InsertUDCRowRequestDTO {
|
||||
@SerializedName("targetMtbColt")
|
||||
@@ -48,6 +49,14 @@ public class InsertUDCRowRequestDTO {
|
||||
@SerializedName("codDtip")
|
||||
private String codDtip;
|
||||
|
||||
@SerializedName("pesoNettoKg")
|
||||
private BigDecimal pesoNettoKg;
|
||||
@SerializedName("pesoLordoKg")
|
||||
private BigDecimal pesoLordoKg;
|
||||
|
||||
@SerializedName("documentReso")
|
||||
private DtbDocrKey documentReso;
|
||||
|
||||
|
||||
public MtbColt getTargetMtbColt() {
|
||||
return targetMtbColt;
|
||||
@@ -210,4 +219,29 @@ public class InsertUDCRowRequestDTO {
|
||||
this.codDtip = codDtip;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getPesoNettoKg() {
|
||||
return pesoNettoKg;
|
||||
}
|
||||
|
||||
public void setPesoNettoKg(BigDecimal pesoNettoKg) {
|
||||
this.pesoNettoKg = pesoNettoKg;
|
||||
}
|
||||
|
||||
public BigDecimal getPesoLordoKg() {
|
||||
return pesoLordoKg;
|
||||
}
|
||||
|
||||
public void setPesoLordoKg(BigDecimal pesoLordoKg) {
|
||||
this.pesoLordoKg = pesoLordoKg;
|
||||
}
|
||||
|
||||
public DtbDocrKey getDocumentReso() {
|
||||
return documentReso;
|
||||
}
|
||||
|
||||
public InsertUDCRowRequestDTO setDocumentReso(DtbDocrKey documentReso) {
|
||||
this.documentReso = documentReso;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,8 +530,9 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUPrintRequest(RunnableArgs<Boolean> onComplete) {
|
||||
public boolean onLUPrintRequest() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -723,7 +723,8 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUPrintRequest(RunnableArgs<Boolean> onComplete) {
|
||||
public boolean onLUPrintRequest() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.SpannableString;
|
||||
import android.util.Pair;
|
||||
import android.view.Gravity;
|
||||
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
@@ -20,6 +21,8 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -32,7 +35,6 @@ import it.integry.integrywmsnative.core.data_cache.DataCache;
|
||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
@@ -144,7 +146,17 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
|
||||
executorService.execute(() -> {
|
||||
|
||||
this.onLoadingStarted();
|
||||
try {
|
||||
this.mViewmodel.init(mDocumentiResiList, defaultSegnoLU, codMdep);
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception ex) {
|
||||
this.onError(ex);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -161,7 +173,14 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
} else if (!noLUPresent.get()) {
|
||||
this.mShouldCloseActivity = true;
|
||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewmodel.closeLU(true);
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
|
||||
super.onBackPressed();
|
||||
@@ -198,7 +217,13 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
pickingResiListAdapter.setOnItemClicked((clickedItem, refMtbColt) -> {
|
||||
if (!noLUPresent.get()) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewmodel.dispatchOrdineRow(clickedItem, refMtbColt);
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -212,12 +237,12 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
.toList();
|
||||
|
||||
Stream.of(tmpList)
|
||||
.sortBy(x -> x.getNumDoc() + " " + x.getDataDocS() + " " + x.getCodDtip() + " " + x.getSerDoc() + " " + x.getCodAnag() + " " + x.getIdRiga())
|
||||
.sortBy(x -> x.getNumDoc() + " " + x.getDataDoc() + " " + x.getCodDtip() + " " + x.getSerDoc() + " " + x.getCodAnag() + " " + x.getIdRiga())
|
||||
.forEach(x -> {
|
||||
|
||||
PickingResiListModel pickingResiListModel = new PickingResiListModel();
|
||||
|
||||
pickingResiListModel.setGroupTitle(x.getCodDtip() + " - N° " + x.getNumDoc() + " del " + UtilityDate.formatDate(x.getDataDocD(), UtilityDate.COMMONS_DATE_FORMATS.DM_HUMAN));
|
||||
pickingResiListModel.setGroupTitle(x.getCodDtip() + " - N° " + x.getNumDoc() + " del " + UtilityDate.formatDate(x.getDataDoc(), UtilityDate.COMMONS_DATE_FORMATS.DM_HUMAN));
|
||||
pickingResiListModel.setBadge1(x.getCodMart());
|
||||
pickingResiListModel.setDescrizione(UtilityString.isNull(x.getDescrizioneEstesa(), x.getDescrizione()));
|
||||
pickingResiListModel.setActive(true);
|
||||
@@ -254,9 +279,15 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
this.onLoadingStarted();
|
||||
|
||||
this.mViewmodel.processBarcodeDTO(data, () -> {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewmodel.processBarcodeDTO(data);
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
private void initFab() {
|
||||
@@ -287,7 +318,15 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
public void createNewLU() {
|
||||
this.fabPopupMenu.dismiss();
|
||||
this.onLoadingStarted();
|
||||
this.mViewmodel.createNewLU(null, null, this::onLoadingEnded);
|
||||
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewmodel.createNewLU(null, null);
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void removeListFilter() {
|
||||
@@ -296,12 +335,28 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
@Override
|
||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||
this.onLoadingStarted();
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewmodel.dispatchRowEdit(mtbColr);
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMtbColrDelete(MtbColr mtbColr) {
|
||||
this.onLoadingStarted();
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewmodel.deleteRow(mtbColr);
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -316,13 +371,38 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
@Override
|
||||
public void onBottomSheetLUClose() {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
this.mViewmodel.closeLU(true);
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInfoAggiuntiveRequired(RunnableArgss<String, ObservableMtbTcol> onComplete) {
|
||||
DialogInfoAggiuntiveLUView.newInstance(onComplete, this::onLoadingEnded)
|
||||
public Pair<String, ObservableMtbTcol> onInfoAggiuntiveRequired() {
|
||||
AtomicReference<Pair<String, ObservableMtbTcol>> result = new AtomicReference<>();
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
|
||||
DialogInfoAggiuntiveLUView.newInstance((noteAggiuntive, mtbTcol) -> {
|
||||
result.set(new Pair<>(noteAggiuntive, mtbTcol));
|
||||
countDownLatch.countDown();
|
||||
|
||||
}, () -> {
|
||||
result.set(null);
|
||||
countDownLatch.countDown();
|
||||
})
|
||||
.show(getSupportFragmentManager(), DialogInfoAggiuntiveLUView.class.getName());
|
||||
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
this.onError(e);
|
||||
}
|
||||
|
||||
return result.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -348,7 +428,11 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
BigDecimal qtaCnfAvailable,
|
||||
String partitaMag,
|
||||
LocalDate dataScad,
|
||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
||||
RunnableArgs<PickedQuantityDTO> onComplete) {
|
||||
|
||||
|
||||
handler.post(() -> {
|
||||
|
||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||
.setMtbAart(mtbAart)
|
||||
.setInitialNumCnf(initialNumCnf)
|
||||
@@ -366,23 +450,24 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
if (!mDialogInputQuantityV2View.isVisible())
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete(resultDTO -> {
|
||||
if (resultDTO == null || resultDTO.isAborted()) {
|
||||
this.mViewmodel.resetMatchedRows();
|
||||
.setOnComplete(pickingResult -> {
|
||||
if (pickingResult == null || pickingResult.isAborted()) {
|
||||
onComplete.run(null);
|
||||
return;
|
||||
}
|
||||
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
.setQtaTot(resultDTO.getQtaTot())
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
.setNumCnf(pickingResult.getNumCnf())
|
||||
.setQtaCnf(pickingResult.getQtaCnf())
|
||||
.setQtaTot(pickingResult.getQtaTot())
|
||||
.setPartitaMag(pickingResult.getPartitaMag())
|
||||
.setDataScad(pickingResult.getDataScad())
|
||||
.setShouldCloseLu(pickingResult.isShouldCloseLu());
|
||||
|
||||
this.onLoadingStarted();
|
||||
onComplete.run(pickedQuantityDTO, resultDTO.isShouldCloseLu());
|
||||
onComplete.run(pickedQuantityDTO);
|
||||
})
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -406,12 +491,14 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
@Override
|
||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||
handler.post(() -> {
|
||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false)
|
||||
).show(getSupportFragmentManager(), "tag");
|
||||
).show(getSupportFragmentManager(), "delete-row-dialog");
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -439,21 +526,36 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
@Override
|
||||
public void onLUSuccessullyPrinted() {
|
||||
handler.post(() -> {
|
||||
Resources res = getResources();
|
||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||
DialogSimpleMessageView
|
||||
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
.show(getSupportFragmentManager(), "dialog-print-completed");
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUPrintRequest(RunnableArgs<Boolean> onComplete) {
|
||||
public boolean onLUPrintRequest() {
|
||||
AtomicReference<Boolean> resultPrintPackingList = new AtomicReference<>();
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
|
||||
DialogYesNoView.newInstance(getString(R.string.action_print),
|
||||
String.format(getString(R.string.message_print_packing_list), "Packing List"),
|
||||
result -> {
|
||||
onComplete.run(result == DialogConsts.Results.YES);
|
||||
resultPrintPackingList.set(result == DialogConsts.Results.YES);
|
||||
countDownLatch.countDown();
|
||||
})
|
||||
.show(getSupportFragmentManager(), "dialog-print");
|
||||
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
this.onError(e);
|
||||
}
|
||||
|
||||
return resultPrintPackingList.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -463,7 +565,8 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
onComplete)
|
||||
onComplete != null ? onComplete : () -> {
|
||||
})
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package it.integry.integrywmsnative.gest.picking_resi;
|
||||
|
||||
import android.os.Handler;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliAccettazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
@@ -26,8 +30,26 @@ public class PickingResiModule {
|
||||
}
|
||||
|
||||
@Provides
|
||||
PickingResiViewModel providesPickingResiViewModel(ArticoloRESTConsumer articoloRESTConsumer, ColliDataRecoverService colliDataRecoverService, OrdiniRESTConsumer ordiniRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, PrinterRESTConsumer printerRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PickingResiRESTConsumer pickingResiRESTConsumer) {
|
||||
return new PickingResiViewModel(articoloRESTConsumer, barcodeRESTConsumer, colliDataRecoverService, ordiniRESTConsumer, colliMagazzinoRESTConsumer, printerRESTConsumer, pickingResiRESTConsumer);
|
||||
PickingResiViewModel providesPickingResiViewModel(Handler handler,
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
ColliDataRecoverService colliDataRecoverService,
|
||||
OrdiniRESTConsumer ordiniRESTConsumer,
|
||||
ColliAccettazioneRESTConsumer colliAccettazioneRESTConsumer,
|
||||
ColliSpedizioneRESTConsumer colliSpedizioneRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
PrinterRESTConsumer printerRESTConsumer,
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
PickingResiRESTConsumer pickingResiRESTConsumer) {
|
||||
return new PickingResiViewModel(handler,
|
||||
articoloRESTConsumer,
|
||||
barcodeRESTConsumer,
|
||||
colliDataRecoverService,
|
||||
ordiniRESTConsumer,
|
||||
colliAccettazioneRESTConsumer,
|
||||
colliSpedizioneRESTConsumer,
|
||||
colliMagazzinoRESTConsumer,
|
||||
printerRESTConsumer,
|
||||
pickingResiRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
package it.integry.integrywmsnative.gest.picking_resi;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.util.Pair;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -20,27 +25,29 @@ import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILUBaseOperationsListener;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILUPrintListener;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliAccettazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.udc.CreateUDCRequestDTO;
|
||||
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.uds.DeleteULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
|
||||
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.UtilityString;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.exceptions.DocumentsLoadException;
|
||||
import it.integry.integrywmsnative.gest.picking_resi.rest.PickingResiRESTConsumer;
|
||||
@@ -63,47 +70,58 @@ public class PickingResiViewModel {
|
||||
private int mDefaultSegnoOfLU;
|
||||
private String mDefaultCodMdepOfLU;
|
||||
|
||||
private final Handler mHandler;
|
||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||
private final ColliDataRecoverService mColliDataRecoverService;
|
||||
private final OrdiniRESTConsumer mOrdiniRestConsumerService;
|
||||
private final ColliAccettazioneRESTConsumer mColliAccettazioneRESTConsumer;
|
||||
private final ColliSpedizioneRESTConsumer mColliSpedizioneRESTConsumer;
|
||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||
private final PrinterRESTConsumer mPrinterRESTConsumer;
|
||||
private final PickingResiRESTConsumer mPickingResiRESTConsumer;
|
||||
|
||||
|
||||
@Inject
|
||||
public PickingResiViewModel(ArticoloRESTConsumer articoloRESTConsumer,
|
||||
public PickingResiViewModel(Handler handler,
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
ColliDataRecoverService colliDataRecoverService,
|
||||
OrdiniRESTConsumer ordiniRESTConsumer,
|
||||
ColliAccettazioneRESTConsumer colliAccettazioneRESTConsumer,
|
||||
ColliSpedizioneRESTConsumer colliSpedizioneRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
PrinterRESTConsumer printerRESTConsumer,
|
||||
PickingResiRESTConsumer mPickingResiRESTConsumer) {
|
||||
this.mHandler = handler;
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
this.mColliDataRecoverService = colliDataRecoverService;
|
||||
this.mOrdiniRestConsumerService = ordiniRESTConsumer;
|
||||
this.mColliAccettazioneRESTConsumer = colliAccettazioneRESTConsumer;
|
||||
this.mColliSpedizioneRESTConsumer = colliSpedizioneRESTConsumer;
|
||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
this.mPrinterRESTConsumer = printerRESTConsumer;
|
||||
this.mPickingResiRESTConsumer = mPickingResiRESTConsumer;
|
||||
}
|
||||
|
||||
public void init(List<DocumentoResoDTO> documentList, int defaultSegnoLU, String codMdep) {
|
||||
public void init(List<DocumentoResoDTO> documentList, int defaultSegnoLU, String codMdep) throws Exception {
|
||||
this.mDefaultSegnoOfLU = defaultSegnoLU;
|
||||
this.mDefaultCodMdepOfLU = codMdep;
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
this.initDatiPicking(documentList);
|
||||
|
||||
this.mPickingResiRESTConsumer.loadDocRows(documentList, withdrawableDtbDocr -> {
|
||||
try {
|
||||
var withdrawableDtbDocr = this.mPickingResiRESTConsumer.makeSynchronousRetrieveDocRowsRequest(documentList);
|
||||
|
||||
this.mPickingList.postValue(withdrawableDtbDocr);
|
||||
this.sendOnLoadingEnded();
|
||||
}, ex -> this.sendError(new DocumentsLoadException(ex)));
|
||||
} catch (Exception ex) {
|
||||
throw new DocumentsLoadException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void initDatiPicking(List<DocumentoResoDTO> documentList) {
|
||||
private void initDatiPicking(List<DocumentoResoDTO> documentList) throws Exception {
|
||||
List<String> foundGestioni = Stream.of(documentList)
|
||||
.map(DocumentoResoDTO::getGestione)
|
||||
.distinct()
|
||||
@@ -111,8 +129,10 @@ public class PickingResiViewModel {
|
||||
.toList();
|
||||
|
||||
if (foundGestioni.size() > 1) {
|
||||
this.sendError(new Exception("Sono stati caricati documenti con diverse gestioni"));
|
||||
} else mDefaultGestioneOfLU = foundGestioni.get(0);
|
||||
throw new Exception("Sono stati caricati documenti con diverse gestioni");
|
||||
}
|
||||
|
||||
mDefaultGestioneOfLU = foundGestioni.get(0);
|
||||
|
||||
|
||||
List<String> foundCodAnags = Stream.of(documentList)
|
||||
@@ -121,113 +141,93 @@ public class PickingResiViewModel {
|
||||
.toList();
|
||||
|
||||
if (foundCodAnags.size() > 1) {
|
||||
this.sendError(new Exception("Sono stati caricati documenti con diversi codici anagrafici"));
|
||||
} else mDefaultCodAnagOfLU = foundCodAnags.get(0);
|
||||
throw new Exception("Sono stati caricati documenti con diversi codici anagrafici");
|
||||
}
|
||||
|
||||
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
mtbColt.initDefaultFields(GestioneEnum.fromString(mDefaultGestioneOfLU))
|
||||
.setSegno(mDefaultSegnoOfLU)
|
||||
mDefaultCodAnagOfLU = foundCodAnags.get(0);
|
||||
}
|
||||
|
||||
public void createNewLU(Integer customNumCollo, String customSerCollo) throws Exception {
|
||||
// mColliAccettazioneRESTConsumer.createUDC(new Cre);
|
||||
|
||||
var createUdcResponse = mColliAccettazioneRESTConsumer.synchronousCreateUDC(new CreateUDCRequestDTO()
|
||||
.setCodAnag(mDefaultCodAnagOfLU)
|
||||
.setCodMdep(mDefaultCodMdepOfLU)
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
.setNumCollo(customNumCollo)
|
||||
.setSerCollo(customSerCollo)
|
||||
.setReso(true));
|
||||
|
||||
if (customNumCollo != null) mtbColt.setNumCollo(customNumCollo);
|
||||
if (!UtilityString.isNullOrEmpty(customSerCollo)) mtbColt.setSerCollo(customSerCollo);
|
||||
|
||||
mColliMagazzinoRESTConsumer.saveCollo(mtbColt, value -> {
|
||||
mtbColt
|
||||
.setNumCollo(value.getNumCollo())
|
||||
.setDataCollo(value.getDataColloS())
|
||||
.setMtbColr(new ObservableArrayList<>());
|
||||
|
||||
this.mCurrentMtbColt = mtbColt;
|
||||
|
||||
if (onComplete != null) onComplete.run();
|
||||
this.sendLUOpened(mtbColt);
|
||||
}, this::sendError);
|
||||
this.mCurrentMtbColt = createUdcResponse.getMtbColt();
|
||||
this.sendLUOpened(createUdcResponse.getMtbColt());
|
||||
}
|
||||
|
||||
|
||||
public void closeLU(boolean shouldPrint) {
|
||||
public void closeLU(boolean shouldPrint) throws Exception {
|
||||
if (mCurrentMtbColt == null) return;
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
mColliMagazzinoRESTConsumer.canULBeDeleted(mCurrentMtbColt, canBeDeleted -> {
|
||||
var canBeDeleted = mColliMagazzinoRESTConsumer.canULBeDeletedSynchronized(mCurrentMtbColt);
|
||||
|
||||
if (canBeDeleted) {
|
||||
deleteLU(() -> {
|
||||
deleteLU();
|
||||
this.sendLUClosed();
|
||||
this.sendOnLoadingEnded();
|
||||
});
|
||||
|
||||
} else {
|
||||
this.sendOnInfoAggiuntiveRequired((noteAggiuntive, tCol) -> {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(noteAggiuntive)) {
|
||||
this.mCurrentMtbColt.setAnnotazioni(noteAggiuntive);
|
||||
}
|
||||
if (tCol != null) {
|
||||
this.mCurrentMtbColt.setCodTcol(tCol.getCodTcol());
|
||||
this.mCurrentMtbColt.setMtbTCol(tCol);
|
||||
var noteAggiuntiveResponse = this.sendOnInfoAggiuntiveRequired();
|
||||
|
||||
if (noteAggiuntiveResponse != null) {
|
||||
if (!UtilityString.isNullOrEmpty(noteAggiuntiveResponse.first)) {
|
||||
this.mCurrentMtbColt.setAnnotazioni(noteAggiuntiveResponse.first);
|
||||
}
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.updateDataFine(mCurrentMtbColt, () -> {
|
||||
if (noteAggiuntiveResponse.second != null) {
|
||||
this.mCurrentMtbColt.setCodTcol(noteAggiuntiveResponse.second.getCodTcol());
|
||||
this.mCurrentMtbColt.setMtbTCol(noteAggiuntiveResponse.second);
|
||||
}
|
||||
}
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.synchronousUpdateDataFine(mCurrentMtbColt);
|
||||
|
||||
|
||||
if (shouldPrint) {
|
||||
printCollo(mCurrentMtbColt, () -> {
|
||||
postCloseOperations(mCurrentMtbColt, () -> {
|
||||
printCollo(mCurrentMtbColt);
|
||||
}
|
||||
|
||||
postCloseOperations(mCurrentMtbColt);
|
||||
|
||||
this.sendLUClosed();
|
||||
this.sendOnLoadingEnded();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
postCloseOperations(mCurrentMtbColt, () -> {
|
||||
this.sendLUClosed();
|
||||
this.sendOnLoadingEnded();
|
||||
});
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
|
||||
});
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void deleteLU(Runnable onComplete) {
|
||||
private void deleteLU() throws Exception {
|
||||
DeleteULRequestDTO deleteULRequestDTO = new DeleteULRequestDTO()
|
||||
.setMtbColt(mCurrentMtbColt);
|
||||
|
||||
mColliMagazzinoRESTConsumer.deleteUL(deleteULRequestDTO, () -> {
|
||||
mColliMagazzinoRESTConsumer.deleteULSynchronized(deleteULRequestDTO);
|
||||
|
||||
this.mCurrentMtbColt = null;
|
||||
if (onComplete != null) onComplete.run();
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void printCollo(MtbColt mtbColtToPrint, Runnable onComplete) {
|
||||
this.sendLUPrintRequest(shouldPrint -> {
|
||||
private void printCollo(MtbColt mtbColtToPrint) {
|
||||
var shouldPrint = this.sendLUPrintRequest();
|
||||
|
||||
if (!shouldPrint) {
|
||||
onComplete.run();
|
||||
} else {
|
||||
singlePrint(mtbColtToPrint, onComplete, ex -> this.sendLUPrintError(ex, onComplete));
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
private void singlePrint(MtbColt mtbColtToPrint, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
try {
|
||||
this.mPrinterRESTConsumer.synchronousPrintCollo(mtbColtToPrint);
|
||||
} catch (Exception e) {
|
||||
this.sendLUPrintError(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void singlePrint(MtbColt mtbColtToPrint) {
|
||||
|
||||
this.mPrinterRESTConsumer.printCollo(
|
||||
mtbColtToPrint,
|
||||
onComplete, onFailed);
|
||||
|
||||
}
|
||||
|
||||
private void postCloseOperations(MtbColt mtbColt, Runnable onComplete) {
|
||||
private void postCloseOperations(MtbColt mtbColt) {
|
||||
this.mColliRegistrati.add(mtbColt);
|
||||
|
||||
List<WithdrawableDtbDocr> tmpList = getPickingList().getValue();
|
||||
@@ -250,10 +250,9 @@ public class PickingResiViewModel {
|
||||
}
|
||||
|
||||
this.mPickingList.postValue(tmpList);
|
||||
onComplete.run();
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
|
||||
//Se non c'è una UL aperta
|
||||
if (mCurrentMtbColt == null) {
|
||||
@@ -263,89 +262,79 @@ public class PickingResiViewModel {
|
||||
//Se il collo non esiste allora lo creo associandolo a questa etichetta anonima
|
||||
//invece se esiste apro un collo nuovo e cerco gli articoli presenti nell'ul
|
||||
//dell'etichetta anonima
|
||||
this.executeEtichettaAnonimaNotOpenedLU(barcodeScanDTO, onComplete);
|
||||
this.executeEtichettaAnonimaNotOpenedLU(barcodeScanDTO);
|
||||
} else {
|
||||
this.processBarcodeNotOpenedLU(barcodeScanDTO, onComplete);
|
||||
this.processBarcodeNotOpenedLU(barcodeScanDTO);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
|
||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onComplete);
|
||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue());
|
||||
|
||||
} else {
|
||||
this.processBarcodeAlreadyOpenedLU(barcodeScanDTO, onComplete);
|
||||
this.processBarcodeAlreadyOpenedLU(barcodeScanDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processBarcodeNotOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
private void processBarcodeNotOpenedLU(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
this.createNewLU(
|
||||
null,
|
||||
null,
|
||||
() -> processBarcodeAlreadyOpenedLU(barcodeScanDTO, onComplete));
|
||||
null);
|
||||
processBarcodeAlreadyOpenedLU(barcodeScanDTO);
|
||||
}
|
||||
|
||||
|
||||
private void processBarcodeAlreadyOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
|
||||
private void processBarcodeAlreadyOpenedLU(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
//Cerco tramite etichetta ean 128 (che può indicarmi un articolo o una UL)
|
||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||
|
||||
|
||||
} else onComplete.run();
|
||||
this.executeEtichettaEan128(barcodeScanDTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaAnonimaNotOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), true, false, mtbColt -> {
|
||||
private void executeEtichettaAnonimaNotOpenedLU(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(barcodeScanDTO.getStringValue(), true, false);
|
||||
|
||||
if (mtbColt == null) {
|
||||
|
||||
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
||||
this.sendError(new NotCurrentYearLUException());
|
||||
throw new NotCurrentYearLUException();
|
||||
} else {
|
||||
int numCollo = -1;
|
||||
|
||||
try {
|
||||
numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
|
||||
this.createNewLU(
|
||||
numCollo,
|
||||
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, onComplete);
|
||||
} catch (Exception ex) {
|
||||
this.sendError(ex);
|
||||
}
|
||||
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
this.createNewLU(
|
||||
null,
|
||||
null,
|
||||
() -> searchArtFromUL(mtbColt, onComplete)
|
||||
);
|
||||
null);
|
||||
searchArtFromUL(mtbColt);
|
||||
}
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void executeEtichettaLU(String SSCC, Runnable onComplete) {
|
||||
mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
|
||||
private void executeEtichettaLU(String SSCC) throws Exception {
|
||||
var mtbColt = mColliMagazzinoRESTConsumer.getBySsccSynchronized(SSCC, true, false);
|
||||
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
if (mtbColt.getSegno() != -1) {
|
||||
searchArtFromUL(mtbColt, onComplete);
|
||||
} else this.sendError(new InvalidLUException());
|
||||
searchArtFromUL(mtbColt);
|
||||
} else
|
||||
throw new InvalidLUException();
|
||||
} else {
|
||||
this.sendError(new NoResultFromBarcodeException(SSCC));
|
||||
throw new NoResultFromBarcodeException(SSCC);
|
||||
}
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) throws Exception {
|
||||
var ean128Model = mBarcodeRESTConsumer.decodeEan128Synchronized(barcodeScanDTO);
|
||||
|
||||
|
||||
String barcodeProd = null;
|
||||
|
||||
@@ -358,25 +347,22 @@ public class PickingResiViewModel {
|
||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
this.executeEtichettaLU(ean128Model.Sscc, onComplete);
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
}
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
onComplete.run();
|
||||
}
|
||||
}, this::sendError);
|
||||
this.executeEtichettaLU(ean128Model.Sscc);
|
||||
} else
|
||||
throw new NoLUFoundException();
|
||||
|
||||
}
|
||||
|
||||
private void searchArtFromUL(MtbColt scannedUL, Runnable onComplete) {
|
||||
}
|
||||
|
||||
private void searchArtFromUL(MtbColt scannedUL) throws Exception {
|
||||
|
||||
final List<WithdrawableDtbDocr> pickingList = mPickingList.getValue();
|
||||
final List<WithdrawableDtbDocr> matchPickingObject = new ArrayList<>();
|
||||
|
||||
|
||||
//Controllo se nel collo ho degli articoli che corrispondono per codice / taglia / colore / lotto
|
||||
Stream.of(scannedUL.getMtbColr())
|
||||
scannedUL.getMtbColr().stream()
|
||||
.filter(x -> !UtilityString.isNullOrEmpty(x.getCodMart()))
|
||||
.forEach(x -> {
|
||||
|
||||
@@ -399,7 +385,7 @@ public class PickingResiViewModel {
|
||||
ObservableArrayList<MtbColr> cloneMtbColrs = (ObservableArrayList<MtbColr>) cloneMtbColt.getMtbColr().clone();
|
||||
|
||||
|
||||
Stream.of(cloneMtbColt.getMtbColr())
|
||||
cloneMtbColt.getMtbColr().stream()
|
||||
.filter(x -> !(UtilityString.equalsIgnoreCase(x.getCodMart(), matchedObject.getCodMart()) &&
|
||||
UtilityString.equalsIgnoreCase(x.getCodTagl(), matchedObject.getCodTagl()) &&
|
||||
UtilityString.equalsIgnoreCase(x.getCodCol(), matchedObject.getCodCol())))
|
||||
@@ -415,11 +401,10 @@ public class PickingResiViewModel {
|
||||
|
||||
|
||||
this.loadMatchedRows(matchPickingObject);
|
||||
onComplete.run();
|
||||
}
|
||||
|
||||
|
||||
private void loadMatchedRows(List<WithdrawableDtbDocr> matchedRows) {
|
||||
private void loadMatchedRows(List<WithdrawableDtbDocr> matchedRows) throws Exception {
|
||||
if (matchedRows == null || matchedRows.isEmpty()) {
|
||||
this.sendError(new NoResultFromBarcodeException());
|
||||
} else if (matchedRows.size() == 1) {
|
||||
@@ -455,7 +440,7 @@ public class PickingResiViewModel {
|
||||
}
|
||||
|
||||
|
||||
public void dispatchOrdineRow(final WithdrawableDtbDocr withdrawableDtbDocr, final MtbColt refMtbColt) {
|
||||
public void dispatchOrdineRow(final WithdrawableDtbDocr withdrawableDtbDocr, final MtbColt refMtbColt) throws Exception {
|
||||
BigDecimal totalQtaDoc = withdrawableDtbDocr.getQtaDoc();
|
||||
BigDecimal totalNumCnfDoc = withdrawableDtbDocr.getNumCnf();
|
||||
BigDecimal qtaCnfDoc = withdrawableDtbDocr.getQtaCnf();
|
||||
@@ -481,7 +466,7 @@ public class PickingResiViewModel {
|
||||
totalAvailableNumCnf = totalNumCnfDoc;
|
||||
}
|
||||
|
||||
this.sendOnItemDispatched(
|
||||
var pickedQuantityDTO = this.sendOnItemDispatched(
|
||||
withdrawableDtbDocr.getMtbAart(),
|
||||
totalAvailableNumCnf,
|
||||
totalAvailableQtaCnf,
|
||||
@@ -490,8 +475,12 @@ public class PickingResiViewModel {
|
||||
totalAvailableNumCnf,
|
||||
totalAvailableQtaCnf,
|
||||
withdrawableDtbDocr.getPartitaMag(),
|
||||
withdrawableDtbDocr.getDataScadPartitaMag(),
|
||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
||||
withdrawableDtbDocr.getDataScadPartitaMag());
|
||||
|
||||
if (pickedQuantityDTO == null) {
|
||||
resetMatchedRows();
|
||||
return;
|
||||
}
|
||||
|
||||
this.saveNewRow(withdrawableDtbDocr,
|
||||
refMtbColt,
|
||||
@@ -500,13 +489,12 @@ public class PickingResiViewModel {
|
||||
pickedQuantityDTO.getQtaTot(),
|
||||
pickedQuantityDTO.getPartitaMag(),
|
||||
pickedQuantityDTO.getDataScad(),
|
||||
shouldCloseLU);
|
||||
});
|
||||
pickedQuantityDTO.isShouldCloseLu());
|
||||
}
|
||||
|
||||
public void dispatchRowEdit(final MtbColr mtbColrToEdit) {
|
||||
public void dispatchRowEdit(final MtbColr mtbColrToEdit) throws Exception {
|
||||
|
||||
this.sendOnItemDispatched(
|
||||
var pickedQuantityDTO = this.sendOnItemDispatched(
|
||||
mtbColrToEdit.getMtbAart(),
|
||||
mtbColrToEdit.getNumCnf(),
|
||||
mtbColrToEdit.getQtaCnf(),
|
||||
@@ -515,8 +503,13 @@ public class PickingResiViewModel {
|
||||
null,
|
||||
null,
|
||||
mtbColrToEdit.getPartitaMag(),
|
||||
mtbColrToEdit.getDataScadPartita(),
|
||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
||||
mtbColrToEdit.getDataScadPartita());
|
||||
|
||||
if (pickedQuantityDTO == null) {
|
||||
resetMatchedRows();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.saveEditedRow(mtbColrToEdit,
|
||||
pickedQuantityDTO.getNumCnf(),
|
||||
@@ -524,30 +517,25 @@ public class PickingResiViewModel {
|
||||
pickedQuantityDTO.getQtaTot(),
|
||||
pickedQuantityDTO.getPartitaMag(),
|
||||
pickedQuantityDTO.getDataScad(),
|
||||
shouldCloseLU);
|
||||
});
|
||||
pickedQuantityDTO.isShouldCloseLu());
|
||||
}
|
||||
|
||||
|
||||
public void saveNewRow(WithdrawableDtbDocr withdrawableDtbDocr, MtbColt refMtbColt, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) {
|
||||
public void saveNewRow(WithdrawableDtbDocr withdrawableDtbDocr, MtbColt refMtbColt, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) throws Exception {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
final MtbColr mtbColr = new MtbColr()
|
||||
InsertUDCRowRequestDTO insertUDCRowRequestDTO = new InsertUDCRowRequestDTO()
|
||||
.setTargetMtbColt(mCurrentMtbColt)
|
||||
.setCodMart(withdrawableDtbDocr.getMtbAart().getCodMart())
|
||||
.setPartitaMag(partitaMag)
|
||||
.setDataScadPartita(dataScad)
|
||||
.setQtaCol(qtaTot)
|
||||
.setDataScad(dataScad)
|
||||
.setQtaTot(qtaTot)
|
||||
.setQtaCnf(qtaCnf)
|
||||
.setNumCnf(numCnf)
|
||||
.setDescrizione(withdrawableDtbDocr.getMtbAart().getDescrizioneEstesa())
|
||||
.setDatetimeRow(UtilityDate.getNowTime())
|
||||
|
||||
.setCodAnagDoc(withdrawableDtbDocr.getCodAnag())
|
||||
.setCodDtipDoc(withdrawableDtbDocr.getCodDtip())
|
||||
.setSerDoc(withdrawableDtbDocr.getSerDoc())
|
||||
.setNumDoc(withdrawableDtbDocr.getNumDoc())
|
||||
.setDataDoc(withdrawableDtbDocr.getDataDocS())
|
||||
.setIdRigaDoc(withdrawableDtbDocr.getIdRiga());
|
||||
.setDocumentReso(withdrawableDtbDocr.getKey());
|
||||
|
||||
|
||||
//TODO: Al posto di prelevare la prima riga bisognerebbe controllare se c'è ne una che corrisponde con la partita richiesta
|
||||
MtbColr mtbColrToDispatch = withdrawableDtbDocr.getTempPickData() != null &&
|
||||
@@ -557,39 +545,35 @@ public class PickingResiViewModel {
|
||||
withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr().get(0) : null;
|
||||
|
||||
if (mtbColrToDispatch != null) {
|
||||
if (UtilityString.isNullOrEmpty(mCurrentMtbColt.getCodTcol()))
|
||||
mCurrentMtbColt.setCodTcol(UtilityString.empty2null(withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getCodTcol()));
|
||||
String newCodTcol = UtilityString.empty2null(withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getCodTcol());
|
||||
|
||||
mtbColr
|
||||
.setCodJcom(UtilityString.empty2null(mtbColrToDispatch.getCodJcom()))
|
||||
.setSerColloRif(UtilityString.empty2null(mtbColrToDispatch.getSerCollo()))
|
||||
.setNumColloRif(mtbColrToDispatch.getNumCollo())
|
||||
.setGestioneRif(UtilityString.empty2null(mtbColrToDispatch.getGestione()))
|
||||
.setDataColloRif(UtilityString.empty2null(mtbColrToDispatch.getDataColloS()));
|
||||
if (UtilityString.isNullOrEmpty(mCurrentMtbColt.getCodTcol()) && !UtilityString.isNullOrEmpty(newCodTcol)) {
|
||||
mColliMagazzinoRESTConsumer.updateTipoULSynchronized(mCurrentMtbColt, newCodTcol);
|
||||
mCurrentMtbColt.setCodTcol(newCodTcol);
|
||||
}
|
||||
|
||||
// insertUDCRowRequestDTO
|
||||
// .setCodJcom(UtilityString.empty2null(mtbColrToDispatch.getCodJcom()))
|
||||
// .setSerColloRif(UtilityString.empty2null(mtbColrToDispatch.getSerCollo()))
|
||||
// .setNumColloRif(mtbColrToDispatch.getNumCollo())
|
||||
// .setGestioneRif(UtilityString.empty2null(mtbColrToDispatch.getGestione()))
|
||||
// .setDataColloRif(UtilityString.empty2null(mtbColrToDispatch.getDataColloS()));
|
||||
|
||||
|
||||
if (mtbColrToDispatch.getPesoNettoKg() != null) {
|
||||
//Proporzione
|
||||
BigDecimal pesoNettoKg = UtilityBigDecimal.divide(UtilityBigDecimal.multiply(qtaTot, mtbColrToDispatch.getPesoNettoKg()), mtbColrToDispatch.getQtaCol());
|
||||
mtbColr.setPesoNettoKg(pesoNettoKg);
|
||||
insertUDCRowRequestDTO.setPesoNettoKg(pesoNettoKg);
|
||||
}
|
||||
|
||||
if (mtbColrToDispatch.getPesoLordoKg() != null) {
|
||||
//Proporzione
|
||||
BigDecimal pesoLordoKg = UtilityBigDecimal.divide(UtilityBigDecimal.multiply(qtaTot, mtbColrToDispatch.getPesoLordoKg()), mtbColrToDispatch.getQtaCol());
|
||||
mtbColr.setPesoLordoKg(pesoLordoKg);
|
||||
insertUDCRowRequestDTO.setPesoLordoKg(pesoLordoKg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
|
||||
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
|
||||
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.UPDATE);
|
||||
|
||||
cloneMtbColt.setMtbColr(new ObservableArrayList<>());
|
||||
cloneMtbColt.getMtbColr().add((MtbColr) mtbColr.clone());
|
||||
|
||||
boolean shouldPrint = true;
|
||||
|
||||
//Se è l'unico articolo del collo (controllo se è uguale a 0 perché ancora non è stato aggiunto nella lista delle righe)
|
||||
@@ -605,19 +589,16 @@ public class PickingResiViewModel {
|
||||
}
|
||||
|
||||
boolean finalShouldPrint = shouldPrint;
|
||||
this.mColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, value -> {
|
||||
MtbColr insertedULRow = this.mColliAccettazioneRESTConsumer.synchronousInsertUDCRow(insertUDCRowRequestDTO);
|
||||
|
||||
mtbColr
|
||||
.setDataCollo(value.getDataColloS())
|
||||
.setNumCollo(value.getNumCollo())
|
||||
.setGestione(value.getGestione())
|
||||
.setSerCollo(value.getSerCollo())
|
||||
.setRiga(value.getMtbColr().get(value.getMtbColr().size() - 1).getRiga())
|
||||
insertedULRow
|
||||
.setUntMis(withdrawableDtbDocr.getMtbAart().getUntMis())
|
||||
.setMtbAart(withdrawableDtbDocr.getMtbAart());
|
||||
|
||||
withdrawableDtbDocr.getWithdrawRows().add(mtbColr);
|
||||
mCurrentMtbColt.getMtbColr().add(mtbColr);
|
||||
mHandler.post(() -> {
|
||||
withdrawableDtbDocr.getWithdrawRows().add(insertedULRow);
|
||||
mCurrentMtbColt.getMtbColr().add(insertedULRow);
|
||||
});
|
||||
|
||||
this.mPickingList.postValue(this.mPickingList.getValue());
|
||||
|
||||
@@ -625,95 +606,70 @@ public class PickingResiViewModel {
|
||||
this.sendOnLoadingEnded();
|
||||
|
||||
if (shouldCloseLU) closeLU(finalShouldPrint);
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void saveEditedRow(MtbColr mtbColrToUpdate, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) {
|
||||
private void saveEditedRow(MtbColr mtbColrToUpdate, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) throws Exception {
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
EditUDCRowRequestDTO editUDCRowRequest = new EditUDCRowRequestDTO()
|
||||
.setSourceMtbColr(mtbColrToUpdate)
|
||||
.setNewNumCnf(numCnf)
|
||||
.setNewQtaCnf(qtaCnf)
|
||||
.setNewQtaTot(qtaTot)
|
||||
.setNewPartitaMag(partitaMag)
|
||||
.setNewDataScad(dataScad);
|
||||
|
||||
MtbColt mtbColt = new MtbColt()
|
||||
.setNumCollo(mtbColrToUpdate.getNumCollo())
|
||||
.setDataCollo(mtbColrToUpdate.getDataColloS())
|
||||
.setSerCollo(mtbColrToUpdate.getSerCollo())
|
||||
.setGestione(mtbColrToUpdate.getGestione())
|
||||
.setMtbColr(new ObservableArrayList<>());
|
||||
mtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
|
||||
MtbColr updatedMtbColr = this.mColliAccettazioneRESTConsumer.synchronousEditUDCRow(editUDCRowRequest);
|
||||
|
||||
final MtbColr mtbColr = (MtbColr) mtbColrToUpdate.clone();
|
||||
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||
mtbColr.setRiga(null)
|
||||
.setNumCnf(numCnf.subtract(mtbColrToUpdate.getNumCnf()))
|
||||
.setQtaCnf(qtaCnf)
|
||||
.setQtaCol(qtaTot.subtract(mtbColrToUpdate.getQtaCol()))
|
||||
.setPartitaMag(partitaMag)
|
||||
.setDataScadPartita(dataScad);
|
||||
updatedMtbColr
|
||||
.setUntMis(mtbColrToUpdate.getUntMis())
|
||||
.setMtbAart(mtbColrToUpdate.getMtbAart());
|
||||
|
||||
mtbColt.getMtbColr().add(mtbColr);
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.saveCollo(mtbColt, (value) -> {
|
||||
|
||||
mtbColr.setNumCnf(numCnf)
|
||||
.setQtaCnf(qtaCnf)
|
||||
.setQtaCol(qtaTot);
|
||||
|
||||
Optional<WithdrawableDtbDocr> pickingObjectDTO = Stream.of(this.mPickingList.getValue())
|
||||
.filter(x -> Stream.of(x.getWithdrawRows()).anyMatch(y -> y == mtbColrToUpdate))
|
||||
.findSingle();
|
||||
java.util.Optional<WithdrawableDtbDocr> pickingObjectDTO = this.mPickingList.getValue().stream()
|
||||
.filter(x -> x.getWithdrawRows().stream().anyMatch(y -> y == mtbColrToUpdate))
|
||||
.findFirst();
|
||||
|
||||
mHandler.post(() -> {
|
||||
if (pickingObjectDTO.isPresent()) {
|
||||
pickingObjectDTO.get().getWithdrawRows().remove(mtbColrToUpdate);
|
||||
pickingObjectDTO.get().getWithdrawRows().add(mtbColr);
|
||||
pickingObjectDTO.get().getWithdrawRows().add(updatedMtbColr);
|
||||
|
||||
this.mPickingList.postValue(this.mPickingList.getValue());
|
||||
}
|
||||
|
||||
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToUpdate);
|
||||
this.mCurrentMtbColt.getMtbColr().add(mtbColr);
|
||||
this.mCurrentMtbColt.getMtbColr().add(updatedMtbColr);
|
||||
});
|
||||
|
||||
this.sendOnRowSaved();
|
||||
this.sendOnLoadingEnded();
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
public void deleteRow(MtbColr mtbColrToDelete) {
|
||||
this.sendMtbColrDeleteRequest(canDelete -> {
|
||||
public void deleteRow(MtbColr mtbColrToDelete) throws Exception {
|
||||
var canDelete = this.sendMtbColrDeleteRequest();
|
||||
|
||||
if (canDelete) {
|
||||
this.sendOnLoadingStarted();
|
||||
DeleteUDCRowRequestDTO deleteUDCRowRequest = new DeleteUDCRowRequestDTO()
|
||||
.setMtbColrToDelete(mtbColrToDelete);
|
||||
|
||||
MtbColt mtbColt = new MtbColt()
|
||||
.setNumCollo(mtbColrToDelete.getNumCollo())
|
||||
.setDataCollo(mtbColrToDelete.getDataColloS())
|
||||
.setSerCollo(mtbColrToDelete.getSerCollo())
|
||||
.setGestione(mtbColrToDelete.getGestione())
|
||||
.setMtbColr(new ObservableArrayList<>());
|
||||
mtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
|
||||
this.mColliAccettazioneRESTConsumer.synchronousDeleteUDCRow(deleteUDCRowRequest);
|
||||
|
||||
MtbColr mtbColr = (MtbColr) mtbColrToDelete.clone();
|
||||
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||
mtbColr.setQtaCol(mtbColr.getQtaCol().multiply(new BigDecimal(-1)))
|
||||
.setNumCnf(mtbColr.getNumCnf().multiply(new BigDecimal(-1)))
|
||||
.setRiga(null);
|
||||
|
||||
mtbColt.getMtbColr().add(mtbColr);
|
||||
Optional<WithdrawableDtbDocr> pickingObjectDTO = this.mPickingList.getValue().stream()
|
||||
.filter(x -> x.getWithdrawRows().stream().anyMatch(y -> y == mtbColrToDelete))
|
||||
.findFirst();
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.saveCollo(mtbColt, (value) -> {
|
||||
|
||||
Optional<WithdrawableDtbDocr> pickingObjectDTO = Stream.of(this.mPickingList.getValue())
|
||||
.filter(x -> Stream.of(x.getWithdrawRows()).anyMatch(y -> y == mtbColrToDelete))
|
||||
.findSingle();
|
||||
mHandler.post(() -> {
|
||||
|
||||
if (pickingObjectDTO.isPresent()) {
|
||||
pickingObjectDTO.get().getWithdrawRows().remove(mtbColrToDelete);
|
||||
|
||||
this.mPickingList.postValue(this.mPickingList.getValue());
|
||||
}
|
||||
|
||||
this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
|
||||
});
|
||||
|
||||
this.sendOnRowSaved();
|
||||
this.sendOnLoadingEnded();
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateTipoUl(ObservableMtbTcol newTipoUL, Runnable onComplete) {
|
||||
@@ -739,8 +695,10 @@ public class PickingResiViewModel {
|
||||
return mPickingList;
|
||||
}
|
||||
|
||||
private void sendOnInfoAggiuntiveRequired(RunnableArgss<String, ObservableMtbTcol> onComplete) {
|
||||
if (this.mListener != null) this.mListener.onInfoAggiuntiveRequired(onComplete);
|
||||
private Pair<String, ObservableMtbTcol> sendOnInfoAggiuntiveRequired() {
|
||||
if (this.mListener != null) return this.mListener.onInfoAggiuntiveRequired();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
@@ -763,19 +721,42 @@ public class PickingResiViewModel {
|
||||
if (this.mListener != null) mListener.onLUClosed();
|
||||
}
|
||||
|
||||
private void sendLUPrintRequest(RunnableArgs<Boolean> onComplete) {
|
||||
if (this.mListener != null) mListener.onLUPrintRequest(onComplete);
|
||||
private boolean sendLUPrintRequest() {
|
||||
if (this.mListener != null) return mListener.onLUPrintRequest();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void sendLUPrintError(Exception ex, Runnable onComplete) {
|
||||
if (this.mListener != null) mListener.onLUPrintError(ex, onComplete);
|
||||
private void sendLUPrintError(Exception ex) {
|
||||
if (this.mListener != null) mListener.onLUPrintError(ex, null);
|
||||
}
|
||||
|
||||
private void sendMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||
if (this.mListener != null) mListener.onMtbColrDeleteRequest(onComplete);
|
||||
private boolean sendMtbColrDeleteRequest() {
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
AtomicReference<Boolean> result = new AtomicReference<>();
|
||||
|
||||
if (this.mListener != null)
|
||||
mListener.onMtbColrDeleteRequest(data -> {
|
||||
result.set(data);
|
||||
countDownLatch.countDown();
|
||||
});
|
||||
|
||||
else {
|
||||
result.set(false);
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
|
||||
private void sendOnItemDispatched(MtbAart mtbAart,
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
this.sendError(e);
|
||||
}
|
||||
|
||||
return result.get();
|
||||
}
|
||||
|
||||
private PickedQuantityDTO sendOnItemDispatched(MtbAart mtbAart,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
BigDecimal initialQtaTot,
|
||||
@@ -783,8 +764,12 @@ public class PickingResiViewModel {
|
||||
BigDecimal totalNumCnfAvailable,
|
||||
BigDecimal qtaCnfAvailable,
|
||||
String partitaMag,
|
||||
LocalDate dataScad,
|
||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
||||
LocalDate dataScad) {
|
||||
|
||||
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
AtomicReference<PickedQuantityDTO> result = new AtomicReference<>();
|
||||
|
||||
if (this.mListener != null) mListener.onItemDispatched(mtbAart,
|
||||
initialNumCnf,
|
||||
initialQtaCnf,
|
||||
@@ -794,7 +779,24 @@ public class PickingResiViewModel {
|
||||
qtaCnfAvailable,
|
||||
partitaMag,
|
||||
dataScad,
|
||||
onComplete);
|
||||
pickedQuantity -> {
|
||||
result.set(pickedQuantity);
|
||||
countDownLatch.countDown();
|
||||
});
|
||||
|
||||
else {
|
||||
result.set(null);
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
this.sendError(e);
|
||||
}
|
||||
|
||||
return result.get();
|
||||
}
|
||||
|
||||
private void sendOnRowSaved() {
|
||||
@@ -818,7 +820,7 @@ public class PickingResiViewModel {
|
||||
|
||||
public interface Listener extends ILUPrintListener, ILoadingListener, ILUBaseOperationsListener {
|
||||
|
||||
void onInfoAggiuntiveRequired(RunnableArgss<String, ObservableMtbTcol> onComplete);
|
||||
Pair<String, ObservableMtbTcol> onInfoAggiuntiveRequired();
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
@@ -831,7 +833,7 @@ public class PickingResiViewModel {
|
||||
BigDecimal qtaCnfAvailable,
|
||||
String partitaMag,
|
||||
LocalDate dataScad,
|
||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
|
||||
RunnableArgs<PickedQuantityDTO> onComplete);
|
||||
|
||||
void onFilterApplied(String newValue);
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package it.integry.integrywmsnative.gest.picking_resi.rest;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.DtbDocr;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
@@ -32,20 +31,19 @@ public class PickingResiRESTConsumer {
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
}
|
||||
|
||||
public void loadDocRows(List<DocumentoResoDTO> documents, RunnableArgs<ArrayList<WithdrawableDtbDocr>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public ArrayList<WithdrawableDtbDocr> makeSynchronousRetrieveDocRowsRequest(List<DocumentoResoDTO> documents) throws Exception {
|
||||
List<HashMap<String, Object>> filterCond = new ArrayList<>();
|
||||
|
||||
for(int i = 0; i < documents.size(); i++) {
|
||||
HashMap<String, Object> filter = new HashMap<>();
|
||||
|
||||
filter.put("data_doc", documents.get(i).getDataDoc());
|
||||
filter.put("num_doc", documents.get(i).getNumDoc());
|
||||
filter.put("ser_doc", documents.get(i).getSerDoc());
|
||||
filter.put("cod_anag", documents.get(i).getCodAnag());
|
||||
filter.put("cod_dtip", documents.get(i).getCodDtip());
|
||||
|
||||
filterCond.add(filter);
|
||||
documents.forEach(x ->
|
||||
filterCond.add(new HashMap<>() {
|
||||
{
|
||||
put("data_doc", x.getDataDoc());
|
||||
put("num_doc", x.getNumDoc());
|
||||
put("ser_doc", x.getSerDoc());
|
||||
put("cod_anag", x.getCodAnag());
|
||||
put("cod_dtip", x.getCodDtip());
|
||||
}
|
||||
}));
|
||||
|
||||
String sql = "SELECT * FROM dvw_situazione_qta_docs " +
|
||||
"WHERE " +
|
||||
@@ -53,43 +51,46 @@ public class PickingResiRESTConsumer {
|
||||
"ORDER BY cod_mart";
|
||||
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<WithdrawableDtbDocr>>() {}.getType();
|
||||
this.mSystemRestConsumer.<ArrayList<WithdrawableDtbDocr>>processSql(sql, typeOfObjectsList, values -> {
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<WithdrawableDtbDocr>>() {
|
||||
}.getType();
|
||||
|
||||
var values = this.mSystemRestConsumer.<ArrayList<WithdrawableDtbDocr>>processSqlSynchronized(sql, typeOfObjectsList);
|
||||
|
||||
|
||||
if (values != null && !values.isEmpty()) {
|
||||
List<String> codMarts = Stream.of(values)
|
||||
List<String> codMarts = values.stream()
|
||||
.map(DtbDocr::getCodMart)
|
||||
.withoutNulls()
|
||||
.filter(x -> x != null && !x.isEmpty())
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> {
|
||||
var arts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
|
||||
|
||||
|
||||
if (arts != null && !arts.isEmpty()) {
|
||||
for (DtbDocr value : values) {
|
||||
|
||||
MtbAart foundMtbAart = null;
|
||||
|
||||
List<MtbAart> mtbAartStream = Stream.of(arts)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(value.getCodMart())).toList();
|
||||
Optional<MtbAart> foundArt = arts.stream()
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(value.getCodMart()))
|
||||
.findFirst();
|
||||
|
||||
if(mtbAartStream != null && !mtbAartStream.isEmpty()){
|
||||
foundMtbAart = mtbAartStream.get(0);
|
||||
if (!foundArt.isEmpty()) {
|
||||
foundMtbAart = foundArt.get();
|
||||
}
|
||||
|
||||
value.setMtbAart(foundMtbAart);
|
||||
}
|
||||
|
||||
return values;
|
||||
|
||||
if(onComplete != null) onComplete.run(values);
|
||||
} else onComplete.run(new ArrayList<>());
|
||||
|
||||
}, onFailed);
|
||||
|
||||
} else {
|
||||
if(onComplete != null) onComplete.run(values);
|
||||
} else
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}, onFailed);
|
||||
|
||||
return values;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import com.google.android.material.textfield.TextInputLayout;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -518,14 +520,33 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUPrintRequest(RunnableArgs<Boolean> onComplete) {
|
||||
public boolean onLUPrintRequest() {
|
||||
AtomicReference<Boolean> resultPrintPackingList = new AtomicReference<>();
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
|
||||
DialogSimpleMessageView.makeInfoDialog(
|
||||
getActivity().getResources().getString(R.string.action_print_ul),
|
||||
new SpannableString(getActivity().getResources().getString(R.string.ask_print_message)),
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false))
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
() -> {
|
||||
resultPrintPackingList.set(true);
|
||||
countDownLatch.countDown();
|
||||
},
|
||||
() -> {
|
||||
resultPrintPackingList.set(false);
|
||||
countDownLatch.countDown();
|
||||
})
|
||||
.show(getActivity().getSupportFragmentManager(), "dialog-print");
|
||||
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (
|
||||
InterruptedException e) {
|
||||
this.onError(e);
|
||||
}
|
||||
|
||||
return resultPrintPackingList.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -509,7 +509,7 @@ public class RettificaGiacenzeViewModel {
|
||||
}
|
||||
|
||||
private void printLU(Runnable onComplete) {
|
||||
this.sendLUPrintRequest(shouldPrint -> {
|
||||
var shouldPrint = this.sendLUPrintRequest();
|
||||
if (!shouldPrint) {
|
||||
onComplete.run();
|
||||
} else {
|
||||
@@ -519,7 +519,6 @@ public class RettificaGiacenzeViewModel {
|
||||
onComplete.run();
|
||||
}, ex -> this.sendLUPrintError(ex, onComplete));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void dispatchRowEdit(MtbColr mtbColrToUpdate) {
|
||||
@@ -695,8 +694,9 @@ public class RettificaGiacenzeViewModel {
|
||||
if (this.mListener != null) mListener.onLUSuccessullyPrinted();
|
||||
}
|
||||
|
||||
private void sendLUPrintRequest(RunnableArgs<Boolean> onComplete) {
|
||||
if (this.mListener != null) mListener.onLUPrintRequest(onComplete);
|
||||
private boolean sendLUPrintRequest() {
|
||||
if (this.mListener != null) return mListener.onLUPrintRequest();
|
||||
return false;
|
||||
}
|
||||
|
||||
private void sendLUPrintError(Exception ex, Runnable onComplete) {
|
||||
|
||||
@@ -918,15 +918,28 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUPrintRequest(RunnableArgs<Boolean> onComplete) {
|
||||
public boolean onLUPrintRequest() {
|
||||
AtomicReference<Boolean> resultPrintPackingList = new AtomicReference<>();
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
|
||||
handler.post(() -> {
|
||||
DialogYesNoView.newInstance(getString(R.string.action_print),
|
||||
String.format(getString(R.string.message_print_packing_list), "Packing List"),
|
||||
result -> {
|
||||
onComplete.run(result == DialogConsts.Results.YES);
|
||||
resultPrintPackingList.set(result == DialogConsts.Results.YES);
|
||||
countDownLatch.countDown();
|
||||
})
|
||||
.show(getSupportFragmentManager(), "dialog-print");
|
||||
});
|
||||
|
||||
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
this.onError(e);
|
||||
}
|
||||
|
||||
return resultPrintPackingList.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -422,8 +422,9 @@ public class SpedizioneViewModel {
|
||||
mListener.onLUPesoRequired(codTcol, netWeightKG, grossWeightKG, onComplete);
|
||||
}
|
||||
|
||||
private void sendLUPrintRequest(RunnableArgs<Boolean> onComplete) {
|
||||
if (this.mListener != null) mListener.onLUPrintRequest(onComplete);
|
||||
private boolean sendLUPrintRequest() {
|
||||
if (this.mListener != null) return mListener.onLUPrintRequest();
|
||||
return false;
|
||||
}
|
||||
|
||||
private void sendLUPrintError(Exception ex, Runnable onComplete) {
|
||||
@@ -2003,32 +2004,21 @@ public class SpedizioneViewModel {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
this.sendLUPrintRequest(shouldPrint -> {
|
||||
var shouldPrint = this.sendLUPrintRequest();
|
||||
if (!shouldPrint) {
|
||||
latch.countDown();
|
||||
return;
|
||||
}
|
||||
|
||||
var printUDSRequestDto = new PrintULRequestDTO()
|
||||
.setMtbColts(mtbColtsToPrint);
|
||||
|
||||
this.mColliMagazzinoRESTConsumer
|
||||
.printUL(printUDSRequestDto,
|
||||
latch::countDown,
|
||||
ex -> this.sendLUPrintError(ex, latch::countDown));
|
||||
|
||||
});
|
||||
|
||||
try {
|
||||
latch.await(); // Attende che il dialog venga chiuso
|
||||
} catch (InterruptedException e) {
|
||||
this.sendError(e);
|
||||
this.mColliMagazzinoRESTConsumer
|
||||
.printULSynchronized(printUDSRequestDto);
|
||||
} catch (Exception e) {
|
||||
this.sendLUPrintError(e, () -> {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -77,6 +78,7 @@ public class DialogUltimeConsegneFiltroAvanzatoView extends BaseDialogFragment {
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||
alertDialog.setOnShowListener(this); // Rimosso se non specificamente necessario per altro
|
||||
alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
|
||||
this.initDropDowns();
|
||||
|
||||
|
||||
@@ -94,7 +94,17 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
||||
this.mViewModel.init(mShouldCheckResiduo, mShouldCheckIfExistDoc, mEnableCreation, mWarnOnOpeningVendita);
|
||||
|
||||
mBindings.createNewLuButton.setOnClickListener(v -> {
|
||||
executorService.execute(() -> {
|
||||
this.onLoadingStarted();
|
||||
|
||||
try {
|
||||
this.mViewModel.createNewLU();
|
||||
this.onLoadingEnded();
|
||||
} catch (Exception e) {
|
||||
this.onError(e);
|
||||
}
|
||||
});
|
||||
|
||||
// dismiss();
|
||||
});
|
||||
|
||||
@@ -131,8 +141,6 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void initBarcode() {
|
||||
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(onScanSuccessfull)
|
||||
|
||||
@@ -59,16 +59,13 @@ public class DialogScanOrCreateLUViewModel {
|
||||
this.mWarnOnOpeningVendita = warnOnOpeningVendita;
|
||||
}
|
||||
|
||||
public void createNewLU() {
|
||||
this.sendOnLoadingStarted();
|
||||
public void createNewLU() throws Exception {
|
||||
|
||||
var createUdcRequest = new CreateUDCRequestDTO()
|
||||
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||
|
||||
this.mColliLavorazioneRESTConsumer.createUDC(createUdcRequest, createdMtbColt -> {
|
||||
this.sendOnLoadingEnded();
|
||||
this.sendOnLUOpened(createdMtbColt, true);
|
||||
}, this::sendError);
|
||||
var createResponse = this.mColliLavorazioneRESTConsumer.synchronousCreateUDC(createUdcRequest);
|
||||
this.sendOnLUOpened(createResponse.getMtbColt(), true);
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
|
||||
Reference in New Issue
Block a user