Aggiunto blocco durante la lettura dell'SSCC fornitore nell'accettazione se il barcode ul è già presente in un collo

This commit is contained in:
Marco Elefante 2024-06-18 16:06:02 +02:00
parent cef74ab71f
commit a5a9cb1c50
6 changed files with 68 additions and 2 deletions

View File

@ -114,4 +114,22 @@ public class ColliAccettazioneRESTConsumer extends _BaseRESTConsumer implements
}); });
} }
@Override
public void checkBarcodeUl(String barcodeUl, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed){
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
colliAccettazioneRESTConsumerService.checkIfBarcodeUlAlreadyRegistered(barcodeUl)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
analyzeAnswer(response, "accettazione/checkIfBarcodeUlAlreadyRegistered", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
} }

View File

@ -12,7 +12,9 @@ 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.InsertUDCRowResponseDTO;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST; import retrofit2.http.POST;
import retrofit2.http.Query;
public interface ColliAccettazioneRESTConsumerService { public interface ColliAccettazioneRESTConsumerService {
@ -31,4 +33,7 @@ public interface ColliAccettazioneRESTConsumerService {
@POST("wms/accettazione/deleteUDCRow") @POST("wms/accettazione/deleteUDCRow")
Call<ServiceRESTResponse<Void>> deleteUDCRow(@Body DeleteUDCRowRequestDTO deleteUDCRowRequestDTO); Call<ServiceRESTResponse<Void>> deleteUDCRow(@Body DeleteUDCRowRequestDTO deleteUDCRowRequestDTO);
@GET("wms/accettazione/checkIfBarcodeUlAlreadyRegistered")
Call<ServiceRESTResponse<Boolean>> checkIfBarcodeUlAlreadyRegistered(@Query("barcodeUl") String barcodeUl);
} }

View File

@ -264,4 +264,22 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
} }
}); });
} }
@Override
public void checkBarcodeUl(String barcodeUl, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed){
ColliAccettazioneRESTConsumerService colliAccettazioneRESTConsumerService = RESTBuilder.getService(ColliAccettazioneRESTConsumerService.class);
colliAccettazioneRESTConsumerService.checkIfBarcodeUlAlreadyRegistered(barcodeUl)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
analyzeAnswer(response, "accettazione/checkIfBarcodeUlAlreadyRegistered", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
onFailed.run(new Exception(t));
}
});
}
} }

View File

@ -21,4 +21,6 @@ public interface ColliCaricoRESTConsumerInterface {
void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed); void editUDCRow(EditUDCRowRequestDTO editUDCRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed); void deleteUDCRow(DeleteUDCRowRequestDTO deleteUDCRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
void checkBarcodeUl(String barcodeUl, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed);
} }

View File

@ -4,6 +4,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.text.Html;
import android.text.SpannableString; import android.text.SpannableString;
import android.view.Gravity; import android.view.Gravity;
import android.view.Menu; import android.view.Menu;
@ -741,6 +742,16 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
BarcodeManager.enable(); BarcodeManager.enable();
} }
@Override
public void onWarning(String warningText, Runnable action) {
this.runOnUiThread(() -> {
this.onLoadingEnded();
DialogSimpleMessageView
.makeWarningDialog(new SpannableString(Html.fromHtml(warningText)), null, action)
.show(getSupportFragmentManager(), "tag");
});
}
@Override @Override
public void onItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaOrd, BigDecimal totalNumCnfOrd, BigDecimal qtaCnfOrd, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String partitaMag, LocalDate dataScad, boolean canPartitaMagBeChanged, boolean canOverflowQuantity, String customArtDescription, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) { public void onItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaOrd, BigDecimal totalNumCnfOrd, BigDecimal qtaCnfOrd, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String partitaMag, LocalDate dataScad, boolean canPartitaMagBeChanged, boolean canOverflowQuantity, String customArtDescription, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO().setMtbAart(mtbAart).setInitialNumCnf(initialNumCnf).setInitialQtaCnf(initialQtaCnf).setInitialQtaTot(initialQtaTot).setTotalQtaOrd(totalQtaOrd).setTotalNumCnfOrd(totalNumCnfOrd).setQtaCnfOrd(qtaCnfOrd).setTotalQtaToBeTaken(totalQtaToBeTaken).setTotalNumCnfToBeTaken(totalNumCnfToBeTaken).setQtaCnfToBeTaken(qtaCnfToBeTaken).setTotalQtaAvailable(totalQtaAvailable).setTotalNumCnfAvailable(totalNumCnfAvailable).setQtaCnfAvailable(qtaCnfAvailable).setPartitaMag(partitaMag).setDataScad(dataScad).setCanPartitaMagBeChanged(canPartitaMagBeChanged).setCanLUBeClosed(true).setCanOverflowOrderQuantity(canOverflowQuantity).setCustomArtDescription(customArtDescription); DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO().setMtbAart(mtbAart).setInitialNumCnf(initialNumCnf).setInitialQtaCnf(initialQtaCnf).setInitialQtaTot(initialQtaTot).setTotalQtaOrd(totalQtaOrd).setTotalNumCnfOrd(totalNumCnfOrd).setQtaCnfOrd(qtaCnfOrd).setTotalQtaToBeTaken(totalQtaToBeTaken).setTotalNumCnfToBeTaken(totalNumCnfToBeTaken).setQtaCnfToBeTaken(qtaCnfToBeTaken).setTotalQtaAvailable(totalQtaAvailable).setTotalNumCnfAvailable(totalNumCnfAvailable).setQtaCnfAvailable(qtaCnfAvailable).setPartitaMag(partitaMag).setDataScad(dataScad).setCanPartitaMagBeChanged(canPartitaMagBeChanged).setCanLUBeClosed(true).setCanOverflowOrderQuantity(canOverflowQuantity).setCustomArtDescription(customArtDescription);

View File

@ -247,8 +247,14 @@ public class AccettazioneOrdiniPickingViewModel {
try { try {
Ean128Model ean128Model = mEan128Service.decode(barcodeScanDTO); Ean128Model ean128Model = mEan128Service.decode(barcodeScanDTO);
mColliAccettazioneRESTConsumer.checkBarcodeUl(ean128Model.Sscc, result -> {
if (result){
this.sendWarning("Barcode ul già registrato!", onComplete);
} else {
//Nel caso trovo un SSCC lo aggiungo //Nel caso trovo un SSCC lo aggiungo
this.processBarcodeNotOpenedLU(barcodeScanDTO, ean128Model.Sscc, onComplete); this.processBarcodeNotOpenedLU(barcodeScanDTO, ean128Model.Sscc, onComplete);
}
}, this::sendError);
} catch (Exception e) { } catch (Exception e) {
this.sendError(e); this.sendError(e);
@ -933,6 +939,10 @@ public class AccettazioneOrdiniPickingViewModel {
if (this.mListener != null) mListener.onError(ex); if (this.mListener != null) mListener.onError(ex);
} }
private void sendWarning(String warningText, Runnable action) {
if (this.mListener != null) mListener.onWarning(warningText, action);
}
private void sendLUOpened(MtbColt mtbColt) { private void sendLUOpened(MtbColt mtbColt) {
if (this.mListener != null) mListener.onLUOpened(mtbColt); if (this.mListener != null) mListener.onLUOpened(mtbColt);
} }
@ -1050,6 +1060,8 @@ public class AccettazioneOrdiniPickingViewModel {
void onFilterPosizioneApplied(String posizioneToFilter); void onFilterPosizioneApplied(String posizioneToFilter);
void onWarning(String warningText, Runnable action);
void onULVersata(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete); void onULVersata(VersamentoAutomaticoULResponseDTO versamentoAutomaticoULResponseDTO, Runnable onComplete);
} }