Bugfix vari

This commit is contained in:
Giuseppe Scorrano 2022-04-13 17:24:20 +02:00
parent 83d9e0c5f7
commit 4407f37f8c
25 changed files with 280 additions and 210 deletions

View File

@ -0,0 +1,12 @@
package it.integry.integrywmsnative.core.exception;
import java.util.Locale;
public class InvalidConnectionException extends Exception {
public InvalidConnectionException(String host, int port, Throwable cause) {
super(String.format(Locale.ITALY, "Impossibile stabilire la connessione con il server (%s:%d)", host, port), cause);
}
}

View File

@ -4,6 +4,11 @@ import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.utility.UtilityResources; import it.integry.integrywmsnative.core.utility.UtilityResources;
public final class NoResultFromBarcodeException extends Exception { public final class NoResultFromBarcodeException extends Exception {
public NoResultFromBarcodeException() {
super(UtilityResources.getString(R.string.no_result_from_barcode));
}
public NoResultFromBarcodeException(String barcode) { public NoResultFromBarcodeException(String barcode) {
super(UtilityResources.getString(R.string.no_result_from_barcode) + " (" + barcode + ")"); super(UtilityResources.getString(R.string.no_result_from_barcode) + " (" + barcode + ")");
} }

View File

@ -1,7 +1,6 @@
package it.integry.integrywmsnative.core.expansion; package it.integry.integrywmsnative.core.expansion;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -55,37 +54,31 @@ public abstract class BaseFragment extends Fragment {
} }
public void onLoadingStarted() { public void onLoadingStarted() {
BarcodeManager.disable();
this.openProgress(); this.openProgress();
} }
public void onLoadingEnded() { public void onLoadingEnded() {
this.closeProgress(); this.closeProgress();
BarcodeManager.enable();
} }
private void openProgress() { private void openProgress() {
Log.d("PROGRESS DIALOG", "OPENED"); BarcodeManager.disable();
new Thread(() -> {
if (!progressOpened && !this.mCurrentProgress.isAdded()) { if (!progressOpened && !this.mCurrentProgress.isAdded()) {
this.progressOpened = true; this.progressOpened = true;
requireActivity().runOnUiThread(() -> { requireActivity().runOnUiThread(() -> {
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag"); this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
}); });
} }
}).start();
} }
private void closeProgress() { private void closeProgress() {
Log.d("PROGRESS DIALOG", "CLOSED"); BarcodeManager.enable();
new Thread(() -> {
if (progressOpened) { if (progressOpened) {
this.progressOpened = false; this.progressOpened = false;
requireActivity().runOnUiThread(() -> { requireActivity().runOnUiThread(() -> {
mCurrentProgress.dismiss(); mCurrentProgress.dismiss();
}); });
} }
}).start();
} }
public void onError(Exception ex) { public void onError(Exception ex) {

View File

@ -2,7 +2,7 @@ package it.integry.integrywmsnative.core.expansion;
import androidx.databinding.Observable; import androidx.databinding.Observable;
public abstract class OnGeneralChangedCallback extends Observable.OnPropertyChangedCallback implements Runnable{ public abstract class OnGeneralChangedCallback extends Observable.OnPropertyChangedCallback implements Runnable {
@Override @Override
public void onPropertyChanged(Observable sender, int propertyId) { public void onPropertyChanged(Observable sender, int propertyId) {

View File

@ -5,6 +5,7 @@ import java.net.SocketTimeoutException;
import java.util.HashMap; import java.util.HashMap;
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException; import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
/** /**
* Created by GiuseppeS on 22/03/2018. * Created by GiuseppeS on 22/03/2018.
@ -15,12 +16,17 @@ public class CommonRESTException {
private static String MESSAGE_KEY = "message"; private static String MESSAGE_KEY = "message";
private static String EXCEPTION_KEY = "exception"; private static String EXCEPTION_KEY = "exception";
private static HashMap<String, HashMap<String, Object>> bindingExceptions = new HashMap() {{ private static final HashMap<String, HashMap<String, Object>> bindingExceptions = new HashMap<>() {{
put("Printer not found", new HashMap<String, Object>(){{ put("Printer not found", new HashMap<>() {{
put(MESSAGE_KEY, "Stampante non trovata"); put(MESSAGE_KEY, "Stampante non trovata");
put(EXCEPTION_KEY, NoPrintersFoundException.class); put(EXCEPTION_KEY, NoPrintersFoundException.class);
}}); }});
put("barcode non letto correttamente", new HashMap<>() {{
put(MESSAGE_KEY, "Barcode non letto correttamente");
put(EXCEPTION_KEY, NoResultFromBarcodeException.class);
}});
}}; }};
@ -42,13 +48,11 @@ public class CommonRESTException {
for(String key : bindingExceptions.keySet()) { for(String key : bindingExceptions.keySet()) {
if(message.contains(key)) { if(message.contains(key)) {
Class classType = (Class) bindingExceptions.get(key).get(EXCEPTION_KEY); Class<?> classType = (Class<?>) bindingExceptions.get(key).get(EXCEPTION_KEY);
try { try {
return (Exception) classType.newInstance(); return (Exception) classType.newInstance();
} catch (IllegalAccessException e) { } catch (IllegalAccessException | InstantiationException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@ -21,6 +21,7 @@ public class RESTBuilder {
return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true); return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true);
} }
public static <T> T getService(final Class<T> service, int timeout) { public static <T> T getService(final Class<T> service, int timeout) {
return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, true, timeout); return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true, true, timeout);
@ -34,7 +35,7 @@ public class RESTBuilder {
return getService(service, host, port, addInterceptors, addEmsApi, 30); return getService(service, host, port, addInterceptors, addEmsApi, 30);
} }
public static <T> T getService(final Class<T> service, String host, int port, boolean addInterceptors, boolean addEmsApi, int timeout){ public static <T> T getService(final Class<T> service, String host, int port, boolean addInterceptors, boolean addEmsApi, int timeout) {
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder(); OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
clientBuilder.connectTimeout(timeout, TimeUnit.SECONDS); clientBuilder.connectTimeout(timeout, TimeUnit.SECONDS);
@ -43,7 +44,7 @@ public class RESTBuilder {
clientBuilder.retryOnConnectionFailure(true); clientBuilder.retryOnConnectionFailure(true);
if(addInterceptors) clientBuilder.addInterceptor(new HttpInterceptor()); if (addInterceptors) clientBuilder.addInterceptor(new HttpInterceptor());
OkHttpClient client = clientBuilder.build(); OkHttpClient client = clientBuilder.build();
@ -62,4 +63,13 @@ public class RESTBuilder {
return retrofit.create(service); return retrofit.create(service);
} }
public static String getDefaultHost() {
return SettingsManager.i().getServer().getHost();
}
public static int getDefaultPort() {
return SettingsManager.i().getServer().getPort();
}
} }

View File

@ -245,7 +245,14 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
MtbColt mtbColtToCreate = new MtbColt() MtbColt mtbColtToCreate = new MtbColt()
.initDefaultFields(gestione); .initDefaultFields(gestione);
Integer customNumCollo = UtilityBarcode.getNumColloFromULAnonima(barcode); Integer customNumCollo = null;
try {
customNumCollo = UtilityBarcode.getNumColloFromULAnonima(barcode);
} catch (Exception ex) {
onFailed.run(ex);
}
String customSerCollo = CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE; String customSerCollo = CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE;
if (customNumCollo != null) { if (customNumCollo != null) {

View File

@ -15,6 +15,7 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.Reader; import java.io.Reader;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.net.ConnectException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -23,6 +24,7 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.BuildConfig; import it.integry.integrywmsnative.BuildConfig;
import it.integry.integrywmsnative.core.CommonConst; import it.integry.integrywmsnative.core.CommonConst;
import it.integry.integrywmsnative.core.exception.InvalidConnectionException;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.Azienda; import it.integry.integrywmsnative.core.model.Azienda;
import it.integry.integrywmsnative.core.rest.RESTBuilder; import it.integry.integrywmsnative.core.rest.RESTBuilder;
@ -47,12 +49,14 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
nativeSqlDTO.nativeSql = nativeSql; nativeSqlDTO.nativeSql = nativeSql;
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class); SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
service.processSql(nativeSqlDTO).enqueue(new Callback<>() { service
.processSql(nativeSqlDTO)
.enqueue(new Callback<>() {
@Override @Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) { public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "ProcessSql", o -> { analyzeAnswer(response, "ProcessSql", o -> {
Gson gson = new GsonBuilder() Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, (JsonDeserializer) (json, typeOfT, context) -> { .registerTypeAdapter(Date.class, (JsonDeserializer<?>) (json, typeOfT, context) -> {
try { try {
return UtilityDate.recognizeDate(json.getAsString()); return UtilityDate.recognizeDate(json.getAsString());
} catch (Exception e) { } catch (Exception e) {
@ -75,6 +79,10 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
@Override @Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) { public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
Logger.e(t, "ProcessSQL"); Logger.e(t, "ProcessSQL");
if (t instanceof ConnectException)
onFailed.run(new InvalidConnectionException(RESTBuilder.getDefaultHost(), RESTBuilder.getDefaultPort(), t));
else
onFailed.run(new Exception(t)); onFailed.run(new Exception(t));
} }
}); });

View File

@ -31,7 +31,6 @@ public class _BaseRESTConsumer {
} }
} else { } else {
Log.e(logTitle, response.body().getErrorMessage()); Log.e(logTitle, response.body().getErrorMessage());
// callback.onFailed(new Exception(response.body().getErrorMessage()));
onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage())); onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage()));
} }
} else { } else {

View File

@ -16,7 +16,7 @@ public class UtilityBarcode {
return (isEan13(barcodeScanDTO) || isEtichetta128(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("3"); return (isEan13(barcodeScanDTO) || isEtichetta128(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("3");
} }
public static boolean isEtichettaAnonima(BarcodeScanDTO barcodeScanDTO){ public static boolean isEtichettaAnonima(BarcodeScanDTO barcodeScanDTO) {
return barcodeScanDTO != null && barcodeScanDTO.getType() == BarcodeType.CODE128 && barcodeScanDTO.getStringValue().startsWith("U"); return barcodeScanDTO != null && barcodeScanDTO.getType() == BarcodeType.CODE128 && barcodeScanDTO.getStringValue().startsWith("U");
} }
@ -28,7 +28,7 @@ public class UtilityBarcode {
return fullYear.equalsIgnoreCase("" + currentYear); return fullYear.equalsIgnoreCase("" + currentYear);
} }
public static boolean isEtichetta128(BarcodeScanDTO barcodeScanDTO){ public static boolean isEtichetta128(BarcodeScanDTO barcodeScanDTO) {
return barcodeScanDTO != null && (barcodeScanDTO.getType() == BarcodeType.CODE128 || barcodeScanDTO.getType() == BarcodeType.EAN128); return barcodeScanDTO != null && (barcodeScanDTO.getType() == BarcodeType.CODE128 || barcodeScanDTO.getType() == BarcodeType.EAN128);
} }
@ -42,11 +42,11 @@ public class UtilityBarcode {
String barcode = barcodeScanDTO.getStringValue(); String barcode = barcodeScanDTO.getStringValue();
boolean isPosizione = false; boolean isPosizione = false;
if(SettingsManager.iDB().getAvailablePosizioni() != null) { if (SettingsManager.iDB().getAvailablePosizioni() != null) {
Stream<MtbDepoPosizione> tmpStream = Stream.of(SettingsManager.iDB().getAvailablePosizioni()) Stream<MtbDepoPosizione> tmpStream = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
.filter(x -> x.getPosizione().equalsIgnoreCase(barcode) && (!enableCheckCodMdep || currentCodMdep.equalsIgnoreCase(x.getCodMdep()))); .filter(x -> x.getPosizione().equalsIgnoreCase(barcode) && (!enableCheckCodMdep || currentCodMdep.equalsIgnoreCase(x.getCodMdep())));
if(tmpStream.count() > 0){ if (tmpStream.count() > 0) {
isPosizione = true; isPosizione = true;
} }
} }
@ -59,7 +59,6 @@ public class UtilityBarcode {
} }
public static boolean isEanPeso(BarcodeScanDTO barcodeScanDTO) { public static boolean isEanPeso(BarcodeScanDTO barcodeScanDTO) {
return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("2"); return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("2");
} }
@ -81,31 +80,31 @@ public class UtilityBarcode {
} }
public static Integer getNumColloFromULAnonima(String barcode) throws Exception {
public static Integer getNumColloFromULAnonima(String barcode) { if (!UtilityString.isNullOrEmpty(barcode)) {
if(!UtilityString.isNullOrEmpty(barcode)) {
barcode = barcode.trim(); barcode = barcode.trim();
try {
return Integer.parseInt(barcode.substring(3)); return Integer.parseInt(barcode.substring(3));
} catch (NumberFormatException nfex) {
throw new Exception("Impossibile leggere il numero collo dal barcode: " + barcode);
}
} else } else
return null; return null;
} }
public static Integer getAnnoColloFromULAnonima(String barcode) { public static Integer getAnnoColloFromULAnonima(String barcode) {
if(barcode != null){ if (barcode != null) {
return Integer.parseInt(barcode.substring(1, 3)); return Integer.parseInt(barcode.substring(1, 3));
} else } else
return null; return null;
} }
public static String convertITF14toEAN13(String barcodeITF14) { public static String convertITF14toEAN13(String barcodeITF14) {
String barcodeEAN13 = null; String barcodeEAN13 = null;
if(barcodeITF14.length() == 14) { if (barcodeITF14.length() == 14) {
barcodeEAN13 = barcodeITF14.substring(1, barcodeITF14.length() - 1).trim(); barcodeEAN13 = barcodeITF14.substring(1, barcodeITF14.length() - 1).trim();
barcodeEAN13 += getEAN13CheckDigit(barcodeEAN13); barcodeEAN13 += getEAN13CheckDigit(barcodeEAN13);
} }
@ -116,7 +115,7 @@ public class UtilityBarcode {
public static String convertITF14toNeutral(String barcodeITF14) { public static String convertITF14toNeutral(String barcodeITF14) {
String barcodeNeutral = null; String barcodeNeutral = null;
if(barcodeITF14.length() == 14) { if (barcodeITF14.length() == 14) {
barcodeNeutral = barcodeITF14.substring(1, barcodeITF14.length() - 1); barcodeNeutral = barcodeITF14.substring(1, barcodeITF14.length() - 1);
} }
@ -127,7 +126,7 @@ public class UtilityBarcode {
private static String getEAN13CheckDigit(String ean) { private static String getEAN13CheckDigit(String ean) {
if (ean.length() != 12) { if (ean.length() != 12) {
UtilityLogger.errorMe(new Exception("Please provide an input string of 12 chars. Current lenght: "+ean.length())); UtilityLogger.errorMe(new Exception("Please provide an input string of 12 chars. Current lenght: " + ean.length()));
return null; return null;
} }
long tot = 0; long tot = 0;
@ -135,7 +134,7 @@ public class UtilityBarcode {
for (int i = 0; i < 12; i++) { for (int i = 0; i < 12; i++) {
tot = tot + (Long.parseLong(String.valueOf(ean.charAt(i))) * (i % 2 == 0 ? 1 : 3)); tot = tot + (Long.parseLong(String.valueOf(ean.charAt(i))) * (i % 2 == 0 ? 1 : 3));
} }
return tot % 10 == 0 ? "0" : "" + ( 10 - ( tot % 10)); return tot % 10 == 0 ? "0" : "" + (10 - (tot % 10));
} }
} }

View File

@ -11,14 +11,19 @@ import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.orhanobut.logger.Logger; import com.orhanobut.logger.Logger;
import it.integry.integrywmsnative.BuildConfig; import it.integry.integrywmsnative.BuildConfig;
import it.integry.integrywmsnative.core.exception.InvalidConnectionException;
import it.integry.integrywmsnative.core.exception.InvalidLUException;
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
import it.integry.integrywmsnative.core.rest.CommonRESTException; import it.integry.integrywmsnative.core.rest.CommonRESTException;
import it.integry.integrywmsnative.view.dialogs.DialogProgressView; import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView; import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
public class UtilityExceptions { public class UtilityExceptions {
private static final Class<? extends Exception>[] FIREBASE_IGNORED_EXCEPTIONS = new Class[] { private static final Class<?>[] FIREBASE_IGNORED_EXCEPTIONS = new Class[] {
InvalidConnectionException.class,
InvalidLUGestioneException.class,
InvalidLUException.class
}; };
public static void defaultException(Context context, Exception ex, DialogProgressView progressDialog) { public static void defaultException(Context context, Exception ex, DialogProgressView progressDialog) {

View File

@ -302,6 +302,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
} }
if (!filterLayoutView.isAdded())
filterLayoutView.show(getSupportFragmentManager(), "TAG"); filterLayoutView.show(getSupportFragmentManager(), "TAG");
} }
@ -825,6 +826,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
.setCanLUBeClosed(true) .setCanLUBeClosed(true)
.setCanOverflowOrderQuantity(canOverflowQuantity); .setCanOverflowOrderQuantity(canOverflowQuantity);
if (!mDialogInputQuantityV2View.isAdded())
mDialogInputQuantityV2View mDialogInputQuantityV2View
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete((resultDTO, shouldCloseLU) -> {

View File

@ -221,10 +221,16 @@ public class AccettazionePickingViewModel {
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) { if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
this.sendError(new NotCurrentYearLUException()); this.sendError(new NotCurrentYearLUException());
} else { } else {
int numCollo = -1;
try {
numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
this.createNewLU( this.createNewLU(
UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue()), numCollo,
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, true, onComplete); CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, true, onComplete);
} catch (Exception ex) {
this.sendError(ex);
}
} }
} else { } else {
this.sendError(new AlreadyUsedAnonymousLabelException()); this.sendError(new AlreadyUsedAnonymousLabelException());

View File

@ -249,6 +249,8 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
} }
return partitaMag; return partitaMag;
}); });
if (!dialogInputQuantityV2View.isAdded())
dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete((resultDTO, shouldCloseLU) -> {
this.onLoadingStarted(); this.onLoadingStarted();

View File

@ -75,10 +75,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
} }
public static MainFragment newInstance() { public static MainFragment newInstance() {
MainFragment fragment = new MainFragment(); return new MainFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
} }
@Override @Override

View File

@ -180,6 +180,8 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
for (Runnable onPreDestroy : mOnPreDestroyList) { for (Runnable onPreDestroy : mOnPreDestroyList) {
onPreDestroy.run(); onPreDestroy.run();
} }
mViewModel.setListener(null);
super.onDestroy(); super.onDestroy();
} }
@ -682,6 +684,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
break; break;
} }
if (!filterLayoutView.isAdded())
filterLayoutView.show(requireActivity().getSupportFragmentManager(), "TAG"); filterLayoutView.show(requireActivity().getSupportFragmentManager(), "TAG");
} }

View File

@ -337,6 +337,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
.setCanPartitaMagBeChanged(canPartitaMagBeChanged) .setCanPartitaMagBeChanged(canPartitaMagBeChanged)
.setCanLUBeClosed(canLUBeClosed); .setCanLUBeClosed(canLUBeClosed);
if (!mDialogInputQuantityV2View.isAdded())
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete((resultDTO, shouldCloseLU) -> {
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()

View File

@ -318,6 +318,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
.setCanLUBeClosed(false) .setCanLUBeClosed(false)
.setCanPartitaMagBeChanged(false); .setCanPartitaMagBeChanged(false);
if (!mDialogInputQuantityV2View.isAdded())
mDialogInputQuantityV2View mDialogInputQuantityV2View
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete((resultDTO, shouldCloseLU) -> {

View File

@ -302,10 +302,16 @@ public class PickingResiViewModel {
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) { if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
this.sendError(new NotCurrentYearLUException()); this.sendError(new NotCurrentYearLUException());
} else { } else {
int numCollo = -1;
try {
numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
this.createNewLU( this.createNewLU(
UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue()), numCollo,
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, onComplete); CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, onComplete);
} catch (Exception ex) {
this.sendError(ex);
}
} }
} else { } else {

View File

@ -274,6 +274,7 @@ public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements
break; break;
} }
if (!filterLayoutView.isAdded())
filterLayoutView.show(requireActivity().getSupportFragmentManager(), "TAG"); filterLayoutView.show(requireActivity().getSupportFragmentManager(), "TAG");
} }
@ -382,8 +383,6 @@ public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements
} }
private void initJtbComtCache(Runnable onComplete) { private void initJtbComtCache(Runnable onComplete) {
var jtbComts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrderList().getValue())) var jtbComts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrderList().getValue()))
.flatMap(x -> Stream.of(x.getCodJcom())) .flatMap(x -> Stream.of(x.getCodJcom()))

View File

@ -201,6 +201,7 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
.setCanOverflowOrderQuantity(canOverflowOrderQuantity) .setCanOverflowOrderQuantity(canOverflowOrderQuantity)
.setCanLUBeClosed(canLUBeClosed); .setCanLUBeClosed(canLUBeClosed);
if (!mDialogInputQuantityV2View.isAdded())
mDialogInputQuantityV2View mDialogInputQuantityV2View
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete((resultDTO, shouldCloseLU) -> {
@ -215,6 +216,7 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
}) })
.setOnAbort(this::onLoadingEnded) .setOnAbort(this::onLoadingEnded)
.show(requireActivity().getSupportFragmentManager(), "tag"); .show(requireActivity().getSupportFragmentManager(), "tag");
else this.onLoadingEnded();
} }
@Override @Override

View File

@ -378,6 +378,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
.setCanPartitaMagBeChanged(canPartitaMagBeChanged) .setCanPartitaMagBeChanged(canPartitaMagBeChanged)
.setCanLUBeClosed(canLUBeClosed); .setCanLUBeClosed(canLUBeClosed);
if (!mDialogInputQuantityV2View.isAdded())
mDialogInputQuantityV2View mDialogInputQuantityV2View
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete((resultDTO, shouldCloseLU) -> {
@ -391,10 +392,10 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
this.onLoadingStarted(); this.onLoadingStarted();
onComplete.run(pickedQuantityDTO, shouldCloseLU); onComplete.run(pickedQuantityDTO, shouldCloseLU);
}) })
.setOnAbort(() -> { .setOnAbort(this::onLoadingEnded)
this.onLoadingEnded();
})
.show(requireActivity().getSupportFragmentManager(), "tag"); .show(requireActivity().getSupportFragmentManager(), "tag");
else this.onLoadingEnded();
} }
@Override @Override

View File

@ -810,6 +810,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
.setCanLUBeClosed(true) .setCanLUBeClosed(true)
.setCanPartitaMagBeChanged(canPartitaMagBeChanged); .setCanPartitaMagBeChanged(canPartitaMagBeChanged);
if (!mDialogInputQuantityV2View.isAdded())
mDialogInputQuantityV2View mDialogInputQuantityV2View
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete((resultDTO, shouldCloseLU) -> {

View File

@ -210,9 +210,9 @@ public class SpedizioneViewModel {
.distinct() .distinct()
.toList(); .toList();
if (foundGestioni != null && foundGestioni.size() > 1) { if (foundGestioni.size() > 1) {
return; return;
} else if (foundGestioni != null && foundGestioni.size() == 1) { } else if (foundGestioni.size() == 1) {
mDefaultGestioneOfUL = foundGestioni.get(0); mDefaultGestioneOfUL = foundGestioni.get(0);
} else { } else {
mDefaultGestioneOfUL = GestioneEnum.VENDITA; mDefaultGestioneOfUL = GestioneEnum.VENDITA;
@ -511,10 +511,15 @@ public class SpedizioneViewModel {
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) { if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
this.sendError(new NotCurrentYearLUException()); this.sendError(new NotCurrentYearLUException());
} else { } else {
int numCollo = -1;
this.createNewLU( try {
UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue()), numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
this.createNewLU(numCollo,
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, onComplete); CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, onComplete);
} catch (Exception ex) {
this.sendError(ex);
}
} }
} else { } else {

View File

@ -203,6 +203,7 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
.setCanPartitaMagBeChanged(canBatchLotBeChanged) .setCanPartitaMagBeChanged(canBatchLotBeChanged)
.setCanLUBeClosed(false); .setCanLUBeClosed(false);
if (!mDialogInputQuantityV2View.isAdded())
this.requireActivity().runOnUiThread(() -> { this.requireActivity().runOnUiThread(() -> {
mDialogInputQuantityV2View mDialogInputQuantityV2View
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
@ -221,6 +222,7 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
.setOnAbort(this::onLoadingEnded) .setOnAbort(this::onLoadingEnded)
.show(requireActivity().getSupportFragmentManager(), "tag"); .show(requireActivity().getSupportFragmentManager(), "tag");
}); });
else this.onLoadingEnded();
} }
@Override @Override