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 {
def appVersionCode = 278
def appVersionName = '1.25.1'
def appVersionCode = 279
def appVersionName = '1.25.2'
signingConfigs {
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;
public final class NoResultFromBarcodeException extends Exception {
public NoResultFromBarcodeException() {
super(UtilityResources.getString(R.string.no_result_from_barcode));
}
public NoResultFromBarcodeException(String barcode) {
super(UtilityResources.getString(R.string.no_result_from_barcode) + " (" + barcode + ")");
}

View File

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

View File

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

View File

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

View File

@ -21,6 +21,7 @@ public class RESTBuilder {
return getService(service, SettingsManager.i().getServer().getHost(), SettingsManager.i().getServer().getPort(), true);
}
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);
@ -34,7 +35,7 @@ public class RESTBuilder {
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();
clientBuilder.connectTimeout(timeout, TimeUnit.SECONDS);
@ -43,7 +44,7 @@ public class RESTBuilder {
clientBuilder.retryOnConnectionFailure(true);
if(addInterceptors) clientBuilder.addInterceptor(new HttpInterceptor());
if (addInterceptors) clientBuilder.addInterceptor(new HttpInterceptor());
OkHttpClient client = clientBuilder.build();
@ -62,4 +63,13 @@ public class RESTBuilder {
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()
.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;
if (customNumCollo != null) {

View File

@ -15,6 +15,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.reflect.Type;
import java.net.ConnectException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -23,6 +24,7 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.BuildConfig;
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.model.Azienda;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
@ -47,37 +49,43 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
nativeSqlDTO.nativeSql = nativeSql;
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
service.processSql(nativeSqlDTO).enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "ProcessSql", o -> {
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, (JsonDeserializer) (json, typeOfT, context) -> {
try {
return UtilityDate.recognizeDate(json.getAsString());
} catch (Exception e) {
throw new JsonParseException(e);
}
})
.create();
service
.processSql(nativeSqlDTO)
.enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
analyzeAnswer(response, "ProcessSql", o -> {
Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, (JsonDeserializer<?>) (json, typeOfT, context) -> {
try {
return UtilityDate.recognizeDate(json.getAsString());
} catch (Exception e) {
throw new JsonParseException(e);
}
})
.create();
String json = gson.toJson(o);
String json = gson.toJson(o);
InputStream ims = new ByteArrayInputStream(json.getBytes());
Reader reader = new InputStreamReader(ims);
T gsonObj = gson.fromJson(reader, clazz);
InputStream ims = new ByteArrayInputStream(json.getBytes());
Reader reader = new InputStreamReader(ims);
T gsonObj = gson.fromJson(reader, clazz);
onComplete.run(gsonObj);
}, onFailed);
}
onComplete.run(gsonObj);
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
Logger.e(t, "ProcessSQL");
onFailed.run(new Exception(t));
}
});
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
Logger.e(t, "ProcessSQL");
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 {
Log.e(logTitle, response.body().getErrorMessage());
// callback.onFailed(new Exception(response.body().getErrorMessage()));
onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage()));
}
} else {

View File

@ -13,10 +13,10 @@ public class UtilityBarcode {
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");
}
@ -28,7 +28,7 @@ public class UtilityBarcode {
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);
}
@ -42,12 +42,12 @@ public class UtilityBarcode {
String barcode = barcodeScanDTO.getStringValue();
boolean isPosizione = false;
if(SettingsManager.iDB().getAvailablePosizioni() != null) {
if (SettingsManager.iDB().getAvailablePosizioni() != null) {
Stream<MtbDepoPosizione> tmpStream = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
.filter(x -> x.getPosizione().equalsIgnoreCase(barcode) && (!enableCheckCodMdep || currentCodMdep.equalsIgnoreCase(x.getCodMdep())));
if(tmpStream.count() > 0){
isPosizione = true;
if (tmpStream.count() > 0) {
isPosizione = true;
}
}
@ -59,7 +59,6 @@ public class UtilityBarcode {
}
public static boolean isEanPeso(BarcodeScanDTO barcodeScanDTO) {
return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("2");
}
@ -81,31 +80,31 @@ public class UtilityBarcode {
}
public static Integer getNumColloFromULAnonima(String barcode) {
if(!UtilityString.isNullOrEmpty(barcode)) {
public static Integer getNumColloFromULAnonima(String barcode) throws Exception {
if (!UtilityString.isNullOrEmpty(barcode)) {
barcode = barcode.trim();
return Integer.parseInt(barcode.substring(3));
try {
return Integer.parseInt(barcode.substring(3));
} catch (NumberFormatException nfex) {
throw new Exception("Impossibile leggere il numero collo dal barcode: " + barcode);
}
} else
return null;
}
public static Integer getAnnoColloFromULAnonima(String barcode) {
if(barcode != null){
if (barcode != null) {
return Integer.parseInt(barcode.substring(1, 3));
} else
return null;
}
public static String convertITF14toEAN13(String barcodeITF14) {
String barcodeEAN13 = null;
if(barcodeITF14.length() == 14) {
if (barcodeITF14.length() == 14) {
barcodeEAN13 = barcodeITF14.substring(1, barcodeITF14.length() - 1).trim();
barcodeEAN13 += getEAN13CheckDigit(barcodeEAN13);
}
@ -116,7 +115,7 @@ public class UtilityBarcode {
public static String convertITF14toNeutral(String barcodeITF14) {
String barcodeNeutral = null;
if(barcodeITF14.length() == 14) {
if (barcodeITF14.length() == 14) {
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) {
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;
}
long tot = 0;
@ -135,7 +134,7 @@ public class UtilityBarcode {
for (int i = 0; i < 12; i++) {
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 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.view.dialogs.DialogProgressView;
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
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) {

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

View File

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

View File

@ -249,13 +249,15 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
}
return partitaMag;
});
dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> {
this.onLoadingStarted();
this.viewModel.saveRow(row, resultDTO);
})
.setOnAbort(this::onLoadingEnded)
.show(getSupportFragmentManager(), "tag");
if (!dialogInputQuantityV2View.isAdded())
dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> {
this.onLoadingStarted();
this.viewModel.saveRow(row, resultDTO);
})
.setOnAbort(this::onLoadingEnded)
.show(getSupportFragmentManager(), "tag");
}
@Override

View File

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

View File

@ -180,6 +180,8 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
for (Runnable onPreDestroy : mOnPreDestroyList) {
onPreDestroy.run();
}
mViewModel.setListener(null);
super.onDestroy();
}
@ -682,7 +684,8 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
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)
.setCanLUBeClosed(canLUBeClosed);
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> {
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setNumCnf(resultDTO.getNumCnf())
.setQtaCnf(resultDTO.getQtaCnf())
.setQtaTot(resultDTO.getQtaTot())
.setPartitaMag(resultDTO.getPartitaMag())
.setDataScad(resultDTO.getDataScad());
if (!mDialogInputQuantityV2View.isAdded())
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> {
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setNumCnf(resultDTO.getNumCnf())
.setQtaCnf(resultDTO.getQtaCnf())
.setQtaTot(resultDTO.getQtaTot())
.setPartitaMag(resultDTO.getPartitaMag())
.setDataScad(resultDTO.getDataScad());
this.onLoadingStarted();
onComplete.run(pickedQuantityDTO, shouldCloseLU);
})
.setOnAbort(this::onLoadingEnded)
.show(requireActivity().getSupportFragmentManager(), "tag");
this.onLoadingStarted();
onComplete.run(pickedQuantityDTO, shouldCloseLU);
})
.setOnAbort(this::onLoadingEnded)
.show(requireActivity().getSupportFragmentManager(), "tag");
}
@Override

View File

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

View File

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

View File

@ -274,7 +274,8 @@ public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements
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) {
var jtbComts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrderList().getValue()))
.flatMap(x -> Stream.of(x.getCodJcom()))

View File

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

View File

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

View File

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

View File

@ -210,9 +210,9 @@ public class SpedizioneViewModel {
.distinct()
.toList();
if (foundGestioni != null && foundGestioni.size() > 1) {
if (foundGestioni.size() > 1) {
return;
} else if (foundGestioni != null && foundGestioni.size() == 1) {
} else if (foundGestioni.size() == 1) {
mDefaultGestioneOfUL = foundGestioni.get(0);
} else {
mDefaultGestioneOfUL = GestioneEnum.VENDITA;
@ -511,10 +511,15 @@ public class SpedizioneViewModel {
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
this.sendError(new NotCurrentYearLUException());
} else {
int numCollo = -1;
this.createNewLU(
UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue()),
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, onComplete);
try {
numCollo = UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue());
this.createNewLU(numCollo,
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, onComplete);
} catch (Exception ex) {
this.sendError(ex);
}
}
} else {
@ -1751,7 +1756,7 @@ public class SpedizioneViewModel {
this.sendOnLoadingStarted();
this.mCurrentMtbColt = mtbColt;
mMtbColtSessionID = this.mColliDataRecoverService.startNewSession(mtbColt, mTestateOrdini);
this.mCurrentMtbColt.generaFiltroOrdineFromDTO(mDefaultFiltroOrdine);
this.mColliMagazzinoRESTConsumer.saveCollo(this.mCurrentMtbColt, savedMtbColt -> {

View File

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