From 1c9f4de437fdc7a0d8a024da217149283793eb74 Mon Sep 17 00:00:00 2001 From: MarcoE Date: Tue, 2 Jan 2024 16:26:02 +0100 Subject: [PATCH] Fix null point in approvvigionamento linee --- .../exception/NoOrdersScheduledException.java | 11 +++++++++++ .../ProdFabbisognoLineeProdViewModel.java | 17 +++++++++++------ app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 4 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 app/src/main/java/it/integry/integrywmsnative/core/exception/NoOrdersScheduledException.java diff --git a/app/src/main/java/it/integry/integrywmsnative/core/exception/NoOrdersScheduledException.java b/app/src/main/java/it/integry/integrywmsnative/core/exception/NoOrdersScheduledException.java new file mode 100644 index 00000000..8bbfabbb --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/core/exception/NoOrdersScheduledException.java @@ -0,0 +1,11 @@ +package it.integry.integrywmsnative.core.exception; + +import it.integry.integrywmsnative.R; +import it.integry.integrywmsnative.core.utility.UtilityResources; + +public class NoOrdersScheduledException extends Exception { + + public NoOrdersScheduledException() { + super(UtilityResources.getString(R.string.no_orders_scheduled)); + } +} diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/prod_fabbisogno_linee_prod/ProdFabbisognoLineeProdViewModel.java b/app/src/main/java/it/integry/integrywmsnative/gest/prod_fabbisogno_linee_prod/ProdFabbisognoLineeProdViewModel.java index 7bcfd3ec..19d76b92 100644 --- a/app/src/main/java/it/integry/integrywmsnative/gest/prod_fabbisogno_linee_prod/ProdFabbisognoLineeProdViewModel.java +++ b/app/src/main/java/it/integry/integrywmsnative/gest/prod_fabbisogno_linee_prod/ProdFabbisognoLineeProdViewModel.java @@ -5,6 +5,7 @@ import com.annimon.stream.Stream; import java.util.Date; import java.util.List; +import it.integry.integrywmsnative.core.exception.NoOrdersScheduledException; import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener; import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dto.ProdFabbisognoLineeProdDTO; @@ -29,13 +30,17 @@ public class ProdFabbisognoLineeProdViewModel { this.sendOnLoadingStarted(); this.mProdFabbisognoLineeProdRESTConsumer.loadFabbisogno(startDate, endDate, codMdep, jtbFasi -> { - if (jtbFasi != null) Stream.of(jtbFasi) - .forEach(x -> x - .setDataInizio(startDate) - .setDataFine(endDate)); + if (jtbFasi != null){ + Stream.of(jtbFasi) + .forEach(x -> x + .setDataInizio(startDate) + .setDataFine(endDate)); - this.sendOnLoadingEnded(); - onComplete.run(jtbFasi); + this.sendOnLoadingEnded(); + onComplete.run(jtbFasi); + }else{ + this.mListener.onError(new NoOrdersScheduledException()); + } }, this::sendError); } diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 78b4ac21..1dc4d0ef 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -215,6 +215,7 @@ Nessun articolo da prelevare Nessun documento da mostrare Nessun ordine da evadere + Nessun ordine programmato sulla linea per il periodo selezionato Nessun ordine compatibile Nessun articolo Nessuna UL versata in produzione diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5454bb93..cb147c39 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -219,6 +219,7 @@ No items to pick No documents to show No orders to dispatch + No orders scheduled on the line for the selected period: No inventory available no compatible orders found