Finish v1.25.2(279)

This commit is contained in:
Giuseppe Scorrano 2022-04-13 17:25:18 +02:00
commit 718ffb3124
26 changed files with 282 additions and 212 deletions

View File

@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
android { android {
def appVersionCode = 278 def appVersionCode = 279
def appVersionName = '1.25.1' def appVersionName = '1.25.2'
signingConfigs { signingConfigs {
release { release {

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,37 +49,43 @@ 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
@Override .processSql(nativeSqlDTO)
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) { .enqueue(new Callback<>() {
analyzeAnswer(response, "ProcessSql", o -> { @Override
Gson gson = new GsonBuilder() public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
.registerTypeAdapter(Date.class, (JsonDeserializer) (json, typeOfT, context) -> { analyzeAnswer(response, "ProcessSql", o -> {
try { Gson gson = new GsonBuilder()
return UtilityDate.recognizeDate(json.getAsString()); .registerTypeAdapter(Date.class, (JsonDeserializer<?>) (json, typeOfT, context) -> {
} catch (Exception e) { try {
throw new JsonParseException(e); return UtilityDate.recognizeDate(json.getAsString());
} } catch (Exception e) {
}) throw new JsonParseException(e);
.create(); }
})
.create();
String json = gson.toJson(o); String json = gson.toJson(o);
InputStream ims = new ByteArrayInputStream(json.getBytes()); InputStream ims = new ByteArrayInputStream(json.getBytes());
Reader reader = new InputStreamReader(ims); Reader reader = new InputStreamReader(ims);
T gsonObj = gson.fromJson(reader, clazz); T gsonObj = gson.fromJson(reader, clazz);
onComplete.run(gsonObj); onComplete.run(gsonObj);
}, onFailed); }, onFailed);
} }
@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");
onFailed.run(new Exception(t));
} if (t instanceof ConnectException)
}); onFailed.run(new InvalidConnectionException(RESTBuilder.getDefaultHost(), RESTBuilder.getDefaultPort(), t));
else
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

@ -13,10 +13,10 @@ public class UtilityBarcode {
public static boolean isBarcodeOrdineV(BarcodeScanDTO barcodeScanDTO) { public static boolean isBarcodeOrdineV(BarcodeScanDTO barcodeScanDTO) {
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,12 +42,12 @@ 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);
} }
@ -124,10 +123,10 @@ 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,7 +302,8 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
} }
filterLayoutView.show(getSupportFragmentManager(), "TAG"); if (!filterLayoutView.isAdded())
filterLayoutView.show(getSupportFragmentManager(), "TAG");
} }
@Override @Override
@ -825,19 +826,20 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
.setCanLUBeClosed(true) .setCanLUBeClosed(true)
.setCanOverflowOrderQuantity(canOverflowQuantity); .setCanOverflowOrderQuantity(canOverflowQuantity);
mDialogInputQuantityV2View if (!mDialogInputQuantityV2View.isAdded())
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) mDialogInputQuantityV2View
.setOnComplete((resultDTO, shouldCloseLU) -> { .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() .setOnComplete((resultDTO, shouldCloseLU) -> {
.setNumCnf(resultDTO.getNumCnf()) PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setQtaCnf(resultDTO.getQtaCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaTot(resultDTO.getQtaTot()) .setQtaCnf(resultDTO.getQtaCnf())
.setPartitaMag(resultDTO.getPartitaMag()) .setQtaTot(resultDTO.getQtaTot())
.setDataScad(resultDTO.getDataScad()); .setPartitaMag(resultDTO.getPartitaMag())
onComplete.run(pickedQuantityDTO, shouldCloseLU); .setDataScad(resultDTO.getDataScad());
}) onComplete.run(pickedQuantityDTO, shouldCloseLU);
.setOnAbort(() -> this.mViewModel.resetMatchedRows()) })
.show(getSupportFragmentManager(), "tag"); .setOnAbort(() -> this.mViewModel.resetMatchedRows())
.show(getSupportFragmentManager(), "tag");
} }
@Override @Override

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;
this.createNewLU( try {
UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue()), numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, true, onComplete); this.createNewLU(
numCollo,
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,13 +249,15 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
} }
return partitaMag; return partitaMag;
}); });
dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { if (!dialogInputQuantityV2View.isAdded())
this.onLoadingStarted(); dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
this.viewModel.saveRow(row, resultDTO); .setOnComplete((resultDTO, shouldCloseLU) -> {
}) this.onLoadingStarted();
.setOnAbort(this::onLoadingEnded) this.viewModel.saveRow(row, resultDTO);
.show(getSupportFragmentManager(), "tag"); })
.setOnAbort(this::onLoadingEnded)
.show(getSupportFragmentManager(), "tag");
} }
@Override @Override

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,7 +684,8 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
break; break;
} }
filterLayoutView.show(requireActivity().getSupportFragmentManager(), "TAG"); if (!filterLayoutView.isAdded())
filterLayoutView.show(requireActivity().getSupportFragmentManager(), "TAG");
} }

View File

@ -337,20 +337,21 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
.setCanPartitaMagBeChanged(canPartitaMagBeChanged) .setCanPartitaMagBeChanged(canPartitaMagBeChanged)
.setCanLUBeClosed(canLUBeClosed); .setCanLUBeClosed(canLUBeClosed);
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) if (!mDialogInputQuantityV2View.isAdded())
.setOnComplete((resultDTO, shouldCloseLU) -> { mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() .setOnComplete((resultDTO, shouldCloseLU) -> {
.setNumCnf(resultDTO.getNumCnf()) PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setQtaCnf(resultDTO.getQtaCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaTot(resultDTO.getQtaTot()) .setQtaCnf(resultDTO.getQtaCnf())
.setPartitaMag(resultDTO.getPartitaMag()) .setQtaTot(resultDTO.getQtaTot())
.setDataScad(resultDTO.getDataScad()); .setPartitaMag(resultDTO.getPartitaMag())
.setDataScad(resultDTO.getDataScad());
this.onLoadingStarted(); this.onLoadingStarted();
onComplete.run(pickedQuantityDTO, shouldCloseLU); onComplete.run(pickedQuantityDTO, shouldCloseLU);
}) })
.setOnAbort(this::onLoadingEnded) .setOnAbort(this::onLoadingEnded)
.show(requireActivity().getSupportFragmentManager(), "tag"); .show(requireActivity().getSupportFragmentManager(), "tag");
} }
@Override @Override

View File

@ -318,23 +318,24 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
.setCanLUBeClosed(false) .setCanLUBeClosed(false)
.setCanPartitaMagBeChanged(false); .setCanPartitaMagBeChanged(false);
mDialogInputQuantityV2View if (!mDialogInputQuantityV2View.isAdded())
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) mDialogInputQuantityV2View
.setOnComplete((resultDTO, shouldCloseLU) -> { .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() .setOnComplete((resultDTO, shouldCloseLU) -> {
.setNumCnf(resultDTO.getNumCnf()) PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setQtaCnf(resultDTO.getQtaCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaTot(resultDTO.getQtaTot()) .setQtaCnf(resultDTO.getQtaCnf())
.setPartitaMag(resultDTO.getPartitaMag()) .setQtaTot(resultDTO.getQtaTot())
.setDataScad(resultDTO.getDataScad()); .setPartitaMag(resultDTO.getPartitaMag())
.setDataScad(resultDTO.getDataScad());
this.onLoadingStarted(); this.onLoadingStarted();
onComplete.run(pickedQuantityDTO, shouldCloseLU); onComplete.run(pickedQuantityDTO, shouldCloseLU);
}) })
.setOnAbort(() -> { .setOnAbort(() -> {
this.mViewmodel.resetMatchedRows(); this.mViewmodel.resetMatchedRows();
}) })
.show(getSupportFragmentManager(), "tag"); .show(getSupportFragmentManager(), "tag");
} }
@Override @Override

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;
this.createNewLU( try {
UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue()), numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, onComplete); this.createNewLU(
numCollo,
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, onComplete);
} catch (Exception ex) {
this.sendError(ex);
}
} }
} else { } else {

View File

@ -274,7 +274,8 @@ public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements
break; break;
} }
filterLayoutView.show(requireActivity().getSupportFragmentManager(), "TAG"); if (!filterLayoutView.isAdded())
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,20 +201,22 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
.setCanOverflowOrderQuantity(canOverflowOrderQuantity) .setCanOverflowOrderQuantity(canOverflowOrderQuantity)
.setCanLUBeClosed(canLUBeClosed); .setCanLUBeClosed(canLUBeClosed);
mDialogInputQuantityV2View if (!mDialogInputQuantityV2View.isAdded())
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) mDialogInputQuantityV2View
.setOnComplete((resultDTO, shouldCloseLU) -> { .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() .setOnComplete((resultDTO, shouldCloseLU) -> {
.setNumCnf(resultDTO.getNumCnf()) PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setQtaCnf(resultDTO.getQtaCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaTot(resultDTO.getQtaTot()) .setQtaCnf(resultDTO.getQtaCnf())
.setPartitaMag(resultDTO.getPartitaMag()) .setQtaTot(resultDTO.getQtaTot())
.setDataScad(resultDTO.getDataScad()); .setPartitaMag(resultDTO.getPartitaMag())
.setDataScad(resultDTO.getDataScad());
this.mViewModel.onItemDispatched(item, pickedQuantityDTO, sourceMtbColt); this.mViewModel.onItemDispatched(item, pickedQuantityDTO, sourceMtbColt);
}) })
.setOnAbort(this::onLoadingEnded) .setOnAbort(this::onLoadingEnded)
.show(requireActivity().getSupportFragmentManager(), "tag"); .show(requireActivity().getSupportFragmentManager(), "tag");
else this.onLoadingEnded();
} }
@Override @Override

View File

@ -378,23 +378,24 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
.setCanPartitaMagBeChanged(canPartitaMagBeChanged) .setCanPartitaMagBeChanged(canPartitaMagBeChanged)
.setCanLUBeClosed(canLUBeClosed); .setCanLUBeClosed(canLUBeClosed);
mDialogInputQuantityV2View if (!mDialogInputQuantityV2View.isAdded())
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) mDialogInputQuantityV2View
.setOnComplete((resultDTO, shouldCloseLU) -> { .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() .setOnComplete((resultDTO, shouldCloseLU) -> {
.setNumCnf(resultDTO.getNumCnf()) PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setQtaCnf(resultDTO.getQtaCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaTot(resultDTO.getQtaTot()) .setQtaCnf(resultDTO.getQtaCnf())
.setPartitaMag(resultDTO.getPartitaMag()) .setQtaTot(resultDTO.getQtaTot())
.setDataScad(resultDTO.getDataScad()); .setPartitaMag(resultDTO.getPartitaMag())
.setDataScad(resultDTO.getDataScad());
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,23 +810,24 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
.setCanLUBeClosed(true) .setCanLUBeClosed(true)
.setCanPartitaMagBeChanged(canPartitaMagBeChanged); .setCanPartitaMagBeChanged(canPartitaMagBeChanged);
mDialogInputQuantityV2View if (!mDialogInputQuantityV2View.isAdded())
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) mDialogInputQuantityV2View
.setOnComplete((resultDTO, shouldCloseLU) -> { .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() .setOnComplete((resultDTO, shouldCloseLU) -> {
.setNumCnf(resultDTO.getNumCnf()) PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setQtaCnf(resultDTO.getQtaCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaTot(resultDTO.getQtaTot()) .setQtaCnf(resultDTO.getQtaCnf())
.setPartitaMag(resultDTO.getPartitaMag()) .setQtaTot(resultDTO.getQtaTot())
.setDataScad(resultDTO.getDataScad()); .setPartitaMag(resultDTO.getPartitaMag())
.setDataScad(resultDTO.getDataScad());
this.onLoadingStarted(); this.onLoadingStarted();
onComplete.run(pickedQuantityDTO, shouldCloseLU); onComplete.run(pickedQuantityDTO, shouldCloseLU);
}) })
.setOnAbort(() -> { .setOnAbort(() -> {
this.mViewmodel.resetMatchedRows(); this.mViewmodel.resetMatchedRows();
}) })
.show(getSupportFragmentManager(), "tag"); .show(getSupportFragmentManager(), "tag");
} }
@Override @Override

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());
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, onComplete); this.createNewLU(numCollo,
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, onComplete);
} catch (Exception ex) {
this.sendError(ex);
}
} }
} else { } else {
@ -1751,7 +1756,7 @@ public class SpedizioneViewModel {
this.sendOnLoadingStarted(); this.sendOnLoadingStarted();
this.mCurrentMtbColt = mtbColt; this.mCurrentMtbColt = mtbColt;
mMtbColtSessionID = this.mColliDataRecoverService.startNewSession(mtbColt, mTestateOrdini); mMtbColtSessionID = this.mColliDataRecoverService.startNewSession(mtbColt, mTestateOrdini);
this.mCurrentMtbColt.generaFiltroOrdineFromDTO(mDefaultFiltroOrdine); this.mCurrentMtbColt.generaFiltroOrdineFromDTO(mDefaultFiltroOrdine);
this.mColliMagazzinoRESTConsumer.saveCollo(this.mCurrentMtbColt, savedMtbColt -> { this.mColliMagazzinoRESTConsumer.saveCollo(this.mCurrentMtbColt, savedMtbColt -> {

View File

@ -203,24 +203,26 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
.setCanPartitaMagBeChanged(canBatchLotBeChanged) .setCanPartitaMagBeChanged(canBatchLotBeChanged)
.setCanLUBeClosed(false); .setCanLUBeClosed(false);
this.requireActivity().runOnUiThread(() -> { if (!mDialogInputQuantityV2View.isAdded())
mDialogInputQuantityV2View this.requireActivity().runOnUiThread(() -> {
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) mDialogInputQuantityV2View
.setOnComplete((resultDTO, shouldCloseLU) -> { .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> {
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setNumCnf(resultDTO.getNumCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaCnf(resultDTO.getQtaCnf()) .setQtaCnf(resultDTO.getQtaCnf())
.setQtaTot(resultDTO.getQtaTot()) .setQtaTot(resultDTO.getQtaTot())
.setPartitaMag(resultDTO.getPartitaMag()) .setPartitaMag(resultDTO.getPartitaMag())
.setDataScad(resultDTO.getDataScad()); .setDataScad(resultDTO.getDataScad());
onComplete.run(pickedQuantityDTO); onComplete.run(pickedQuantityDTO);
}) })
.setOnAbort(this::onLoadingEnded) .setOnAbort(this::onLoadingEnded)
.show(requireActivity().getSupportFragmentManager(), "tag"); .show(requireActivity().getSupportFragmentManager(), "tag");
}); });
else this.onLoadingEnded();
} }
@Override @Override