Primo refactoring picking libero

This commit is contained in:
Giuseppe Scorrano 2020-07-21 11:38:56 +02:00
parent 79cf00fe2f
commit 0a581fed4d
39 changed files with 805 additions and 221 deletions

View File

@ -29,7 +29,6 @@ public class MainApplication extends Application {
private AppContext appContext = new AppContext(this);
private static AppDatabase appDb;
private static Context context;
// Called when the application is starting, before any other application objects have been created.
@ -38,10 +37,7 @@ public class MainApplication extends Application {
public void onCreate() {
super.onCreate();
context = this;
appModule = new MainApplicationModule(MainApplication.this);
appComponent = DaggerMainApplicationComponent.create();
appContext.init();

View File

@ -7,6 +7,8 @@ import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
@ -32,12 +34,24 @@ public class MainApplicationModule {
return new OrdiniRESTConsumer();
}
@Provides
@Singleton
ArticoloRESTConsumer provideArticoloRESTConsumer() {
return new ArticoloRESTConsumer();
}
@Provides
@Singleton
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer() {
return new ColliMagazzinoRESTConsumer();
}
@Provides
@Singleton
BarcodeRESTConsumer provideBarcodeRESTConsumer() {
return new BarcodeRESTConsumer();
}
@Provides
@Singleton
PrinterRESTConsumer providePrinterRESTConsumer() {

View File

@ -13,11 +13,13 @@ public class BaseCustomConfiguration implements ICustomConfiguration {
public static int MENU_CONFIGURATION = 0;
public static int FLAG_SHOW_COD_FORN_IN_SPEDIZIONE = 1;
public static int CUSTOM_DYNAMIC_VERSION_PATH = 2;
public static int FLAG_SPEDIZIONE_GROUP_BY_GRP_MERC = 3;
}
protected HashMap<Integer, Object> configurations = new HashMap<Integer, Object>() {{
put(Keys.MENU_CONFIGURATION, new MenuConfiguration());
put(Keys.FLAG_SHOW_COD_FORN_IN_SPEDIZIONE, true);
put(Keys.FLAG_SPEDIZIONE_GROUP_BY_GRP_MERC, false);
}};

View File

@ -96,7 +96,11 @@ public class BindableBoolean implements Observable {
}
public void set(boolean value) {
if (mValue != value) {
this.set(value, false);
}
public void set(boolean value, boolean forceRefresh) {
if (mValue != value || forceRefresh) {
this.mValue = value;
notifyChange();
}

View File

@ -386,8 +386,8 @@ public class Converters {
}
@BindingAdapter("visibility")
public static void bindView(View view, final BindableBoolean bindableBoolean) {
@BindingAdapter({"app:visibility"})
public static void bindViewVisibility(View view, final BindableBoolean bindableBoolean) {
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
view.setTag(R.id.bound_observable, bindableBoolean);
}

View File

@ -1,4 +1,4 @@
package it.integry.integrywmsnative.gest.spedizione_new.exceptions;
package it.integry.integrywmsnative.core.exception;
public class InvalidLUException extends Exception {
public InvalidLUException() {

View File

@ -22,15 +22,15 @@ public class MyExceptionHandler implements
StringWriter stackTrace = new StringWriter();
exception.printStackTrace(new PrintWriter(stackTrace));
System.err.println(stackTrace);// You can use LogCat too
Intent intent = new Intent(myContext, myActivityClass);
String s = stackTrace.toString();
//you can use this String to know what caused the exception and in which Activity
intent.putExtra("uncaughtException",
"Exception is: " + stackTrace.toString());
intent.putExtra("stacktrace", s);
myContext.startActivity(intent);
// Intent intent = new Intent(myContext, myActivityClass);
// String s = stackTrace.toString();
// //you can use this String to know what caused the exception and in which Activity
// intent.putExtra("uncaughtException",
// "Exception is: " + stackTrace.toString());
// intent.putExtra("stacktrace", s);
// myContext.startActivity(intent);
//for restarting the Activity
// Process.killProcess(Process.myPid());
System.exit(0);
// System.exit(0);
}
}

View File

@ -1,4 +1,4 @@
package it.integry.integrywmsnative.gest.spedizione_new.exceptions;
package it.integry.integrywmsnative.core.exception;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.utility.UtilityResources;

View File

@ -1,4 +1,4 @@
package it.integry.integrywmsnative.gest.spedizione_new.exceptions;
package it.integry.integrywmsnative.core.exception;
public final class NoLUFoundException extends Exception {

View File

@ -0,0 +1,10 @@
package it.integry.integrywmsnative.core.exception;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.utility.UtilityResources;
public class NoPrintersFoundException extends Exception {
public NoPrintersFoundException() {
super(UtilityResources.getString(R.string.exception_printer_not_found));
}
}

View File

@ -1,4 +1,4 @@
package it.integry.integrywmsnative.gest.spedizione_new.exceptions;
package it.integry.integrywmsnative.core.exception;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.utility.UtilityResources;

View File

@ -1,4 +1,4 @@
package it.integry.integrywmsnative.gest.spedizione_new.exceptions;
package it.integry.integrywmsnative.core.exception;
public final class ScannedPositionNotExistException extends Exception {
public ScannedPositionNotExistException() {

View File

@ -1,12 +0,0 @@
package it.integry.integrywmsnative.core.exception.printer;
import it.integry.integrywmsnative.MainApplication;
import it.integry.integrywmsnative.R;
public class PrinterNotFoundException extends Exception{
public PrinterNotFoundException() {
super(MainApplication.res.getString(R.string.exception_printer_not_found));
}
}

View File

@ -4,7 +4,7 @@ import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.util.HashMap;
import it.integry.integrywmsnative.core.exception.printer.PrinterNotFoundException;
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
/**
* Created by GiuseppeS on 22/03/2018.
@ -18,7 +18,7 @@ public class CommonRESTException {
private static HashMap<String, HashMap<String, Object>> bindingExceptions = new HashMap() {{
put("Printer not found", new HashMap<String, Object>(){{
put(MESSAGE_KEY, "Stampante non trovata");
put(EXCEPTION_KEY, PrinterNotFoundException.class);
put(EXCEPTION_KEY, NoPrintersFoundException.class);
}});

View File

@ -5,6 +5,8 @@ import com.annimon.stream.Stream;
import java.util.List;
import javax.inject.Singleton;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
@ -13,9 +15,10 @@ import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
public class ArticoloRESTConsumer extends _BaseRESTConsumer {
public static void getByBarcodeProd(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
public static void getByBarcodeProdStatic(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
articoloRESTConsumerService.getByBarcodeProd(barcodeProd).enqueue(new Callback<ServiceRESTResponse<MtbAart>>() {
@Override
@ -32,6 +35,10 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
});
}
public void getByBarcodeProd(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
getByBarcodeProdStatic(barcodeProd, onComplete, onFailed);
}
public static void getByCodMart(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.core.rest.consumers;
import javax.inject.Singleton;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.integrywmsnative.core.class_router.ClassRouter;
import it.integry.integrywmsnative.core.class_router.interfaces.IBarcodeCustomization;
@ -11,9 +13,10 @@ import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Singleton
public class BarcodeRESTConsumer extends _BaseRESTConsumer {
public static void decodeEan128(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
public static void decodeEan128Static(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
IBarcodeCustomization barcodeCustomization = ClassRouter.getInstance(ClassRouter.PATH.BARCODE_CUSTOMIZATION);
@ -38,6 +41,9 @@ public class BarcodeRESTConsumer extends _BaseRESTConsumer {
onFailed.run(new Exception(t));
}
});
}
public void decodeEan128(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
BarcodeRESTConsumer.decodeEan128Static(barcodeObj, onComplete, onFailed);
}
}

View File

@ -9,9 +9,9 @@ import java.util.List;
import javax.inject.Singleton;
import it.integry.integrywmsnative.BuildConfig;
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.exception.printer.PrinterNotFoundException;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
@ -131,7 +131,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
if(t.getMessage().contains("Printer not found")) {
onFailed.run(new PrinterNotFoundException());
onFailed.run(new NoPrintersFoundException());
} else onFailed.run(new Exception(t));
}
});

View File

@ -18,6 +18,12 @@ public class SitArtOrdDTO {
private String idViaggio;
private String codMdep;
private boolean flagEnablePickManuale;
private String codMgrp;
private String descrizioneMgrp;
private String codMsgr;
private String descrizioneMsgr;
private String codMsfa;
private String descrizioneMsfa;
public String getCodJcom() {
return codJcom;
@ -135,4 +141,59 @@ public class SitArtOrdDTO {
this.flagEnablePickManuale = flagEnablePickManuale;
return this;
}
public String getCodMgrp() {
return codMgrp;
}
public SitArtOrdDTO setCodMgrp(String codMgrp) {
this.codMgrp = codMgrp;
return this;
}
public String getDescrizioneMgrp() {
return descrizioneMgrp;
}
public SitArtOrdDTO setDescrizioneMgrp(String descrizioneMgrp) {
this.descrizioneMgrp = descrizioneMgrp;
return this;
}
public String getCodMsgr() {
return codMsgr;
}
public SitArtOrdDTO setCodMsgr(String codMsgr) {
this.codMsgr = codMsgr;
return this;
}
public String getDescrizioneMsgr() {
return descrizioneMsgr;
}
public SitArtOrdDTO setDescrizioneMsgr(String descrizioneMsgr) {
this.descrizioneMsgr = descrizioneMsgr;
return this;
}
public String getCodMsfa() {
return codMsfa;
}
public SitArtOrdDTO setCodMsfa(String codMsfa) {
this.codMsfa = codMsfa;
return this;
}
public String getDescrizioneMsfa() {
return descrizioneMsfa;
}
public SitArtOrdDTO setDescrizioneMsfa(String descrizioneMsfa) {
this.descrizioneMsfa = descrizioneMsfa;
return this;
}
}

View File

@ -88,6 +88,7 @@ public class SettingsManager {
RunnableArgs<Exception> tmpOnFailed = ex -> {
perfTrace.putAttribute("failed", "true");
if(!(ex instanceof SocketTimeoutException)) onFailed.run(ex);
else onFailed.run(new Exception("Errore durante il caricamento dei dati. Riavviare l'applicazione!"));
};
loadDatiAzienda(() ->

View File

@ -284,7 +284,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
BarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
String barcodeProd = null;
@ -328,7 +328,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
}
ArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
ArticoloRESTConsumer.getByBarcodeProdStatic(barcodeProd, mtbAartList -> {
if (mtbAartList != null && mtbAartList.size() > 0) {

View File

@ -4,8 +4,11 @@ import javax.inject.Singleton;
import dagger.Component;
import it.integry.integrywmsnative.MainApplicationComponent;
import it.integry.integrywmsnative.gest.spedizione_new.SpedizioneActivity;
@Singleton
@Component(modules = {PickingLiberoModule.class}, dependencies = {MainApplicationComponent.class})
public interface PickingLiberoComponent {
void inject(PickingLiberoFragment pickingLiberoFragment);
}

View File

@ -1,36 +1,60 @@
package it.integry.integrywmsnative.gest.picking_libero;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.databinding.DataBindingUtil;
import com.tfb.fbtoast.FBToast;
import javax.inject.Inject;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.integrywmsnative.MainApplication;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
import it.integry.integrywmsnative.core.di.BindableBoolean;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.VtbDest;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
import it.integry.integrywmsnative.core.utility.UtilityProgress;
import it.integry.integrywmsnative.core.utility.UtilityToast;
import it.integry.integrywmsnative.databinding.FragmentPickingLiberoBinding;
import it.integry.integrywmsnative.gest.picking_libero.viewmodel.PickingLiberoViewModel;
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.InvalidPesoKGException;
import it.integry.integrywmsnative.ui.ElevatedToolbar;
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskCliente;
/**
* A simple {@link Fragment} subclass.
*/
public class PickingLiberoFragment extends Fragment implements ITitledFragment, IScrollableFragment {
public class PickingLiberoFragment extends Fragment implements ITitledFragment, IScrollableFragment, PickingLiberoViewModelNEW.Listener {
private FragmentPickingLiberoBinding mBindings;
private PickingLiberoViewModel mViewModel;
@Inject
PickingLiberoViewModelNEW mViewModel;
public BindableBoolean thereIsAnOpenedUL = new BindableBoolean(false);
public BindableBoolean thereIsntAnOpenedUL = new BindableBoolean(true);
public BindableBoolean thereIsAnyRowInUL = new BindableBoolean(false);
public BindableBoolean thereIsAnOpenULWithoutRows = new BindableBoolean(false);
private Runnable mOnPreDestroy;
private ElevatedToolbar mToolbar;
@ -38,6 +62,8 @@ public class PickingLiberoFragment extends Fragment implements ITitledFragment,
private int barcodeScannerIstanceID = -1;
private Dialog mCurrentProgress;
public PickingLiberoFragment() {
// Required empty public constructor
}
@ -61,36 +87,101 @@ public class PickingLiberoFragment extends Fragment implements ITitledFragment,
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_picking_libero, container, false);
PickingLiberoComponent pickingLiberoComponent = DaggerPickingLiberoComponent.builder()
.mainApplicationModule(MainApplication.appModule)
.mainApplicationComponent(MainApplication.appComponent)
.build();
mViewModel = new PickingLiberoViewModel();
mViewModel.init(getActivity(), mBindings, mToolbarTitleText, () -> {
((IPoppableActivity) getActivity()).pop();
});
pickingLiberoComponent.inject(this);
mBindings.setViewmodel(mViewModel);
mViewModel.setListener(this);
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessfull(mViewModel.onScanSuccessfull)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
// mViewModel.init(getActivity(), mBindings, mToolbarTitleText, () -> {
// ((IPoppableActivity) getActivity()).pop();
// });
mBindings.setLifecycleOwner(this);
mBindings.setView(this);
// barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
// .setOnScanSuccessfull(mViewModel.onScanSuccessfull)
// .setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
mToolbar.setRecyclerView(mBindings.pickingLiberoMainList);
this.initVars();
this.initBarcodeReader();
boolean flagAskCliente = SettingsManager.iDB().isFlagAskClienteInPickingLibero();
mViewModel.init(flagAskCliente);
return mBindings.getRoot();
}
private void initVars() {
this.thereIsAnOpenedUL.addOnPropertyChangedCallback(() -> {
this.thereIsntAnOpenedUL.set(!thereIsntAnOpenedUL.get());
});
this.thereIsAnyRowInUL.addOnPropertyChangedCallback(() -> {
this.thereIsAnOpenULWithoutRows.set(!thereIsAnyRowInUL.get());
});
}
private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessfull(onScanSuccessful)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
}
private RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
BarcodeManager.disable();
this.openProgress();
this.mViewModel.processBarcodeDTO(data, () -> {
BarcodeManager.enable();
this.closeProgress();
});
};
public void createNewLU() {
this.openProgress();
this.mViewModel.createNewLU(null, null, () -> {
this.closeProgress();
});
}
public void closeLU() {
this.mViewModel.closeLU();
}
private void openProgress() {
if (this.mCurrentProgress == null) {
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
}
}
private void closeProgress() {
if (mCurrentProgress != null) {
mCurrentProgress.dismiss();
mCurrentProgress = null;
}
}
@Override
public void onDestroyView() {
mViewModel.closeLU();
// mViewModel.closeLU();
BarcodeManager.removeCallback(barcodeScannerIstanceID);
if(mOnPreDestroy != null) mOnPreDestroy.run();
if (mOnPreDestroy != null) mOnPreDestroy.run();
super.onDestroyView();
}
@ -103,4 +194,53 @@ public class PickingLiberoFragment extends Fragment implements ITitledFragment,
public void setOnPreDestroy(Runnable onPreDestroy) {
mOnPreDestroy = onPreDestroy;
}
@Override
public void onLoadingStarted() {
this.openProgress();
}
@Override
public void onLoadingEnded() {
this.closeProgress();
}
@Override
public void onLUOpened(MtbColt mtbColt) {
thereIsAnOpenedUL.set(true);
thereIsAnyRowInUL.set(mtbColt.getMtbColr().size() > 0, true);
FBToast.successToast(getActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
}
@Override
public void onLUClosed() {
thereIsAnyRowInUL.set(false);
thereIsAnOpenedUL.set(false);
}
@Override
public void onError(Exception ex) {
this.closeProgress();
if (ex instanceof InvalidPesoKGException) {
UtilityToast.showToast(ex.getMessage());
} else {
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
}
BarcodeManager.enable();
}
@Override
public void onLUClienteRequired(RunnableArgs<VtbDest> onComplete, Runnable onAbort) {
DialogAskCliente.makeBase(getActivity(), (status, result) -> {
if (status == DialogConsts.Results.YES) {
onComplete.run(result);
} else {
onAbort.run();
}
}).show();
}
}

View File

@ -5,6 +5,8 @@ import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import it.integry.integrywmsnative.MainApplicationModule;
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
@ -13,7 +15,10 @@ public class PickingLiberoModule {
@Provides
@Singleton
PickingLiberoViewModelNEW providesPickingLiberoViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, PrinterRESTConsumer printerRESTConsumer) {
return new PickingLiberoViewModelNEW(colliMagazzinoRESTConsumer, printerRESTConsumer);
PickingLiberoViewModelNEW providesPickingLiberoViewModel(ArticoloRESTConsumer articoloRESTConsumer,
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
PrinterRESTConsumer printerRESTConsumer,
BarcodeRESTConsumer barcodeRESTConsumer) {
return new PickingLiberoViewModelNEW(articoloRESTConsumer, colliMagazzinoRESTConsumer, printerRESTConsumer, barcodeRESTConsumer);
}
}

View File

@ -1,24 +1,290 @@
package it.integry.integrywmsnative.gest.picking_libero;
import android.app.Dialog;
import android.text.SpannableString;
import androidx.databinding.ObservableArrayList;
import javax.inject.Inject;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
import it.integry.integrywmsnative.core.di.BindableBoolean;
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.CommonModelConsts;
import it.integry.integrywmsnative.core.model.MtbAart;
import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.model.VtbDest;
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
public class PickingLiberoViewModelNEW {
private MtbColt mCurrentMtbColt = null;
private final ArticoloRESTConsumer mArticoloRESTConsumer;
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
private final PrinterRESTConsumer mPrinterRESTConsumer;
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
private boolean mFlagAskCliente;
private Listener mListener;
@Inject
public PickingLiberoViewModelNEW(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
PrinterRESTConsumer printerRESTConsumer) {
public PickingLiberoViewModelNEW( ArticoloRESTConsumer articoloRESTConsumer,
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
PrinterRESTConsumer printerRESTConsumer,
BarcodeRESTConsumer barcodeRESTConsumer) {
this.mArticoloRESTConsumer = articoloRESTConsumer;
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
this.mPrinterRESTConsumer = printerRESTConsumer;
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
}
public void init(boolean flagAskCliente) {
this.mFlagAskCliente = flagAskCliente;
}
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete){
if(UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)){
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onComplete);
} else if(UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
//Cerco tramite etichetta ean 128 (che può indicarmi una UL)
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
} else if(UtilityBarcode.isEanPeso(barcodeScanDTO)) {
//Cerco tramite etichetta ean 128 (che può indicarmi un articolo o una UL)
this.executeEtichettaEanPeso(barcodeScanDTO, onComplete);
} else {
this.loadArticolo(barcodeScanDTO.getStringValue(), null, onComplete);
}
}
private void executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
try {
Ean13PesoModel ean13PesoModel = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
this.loadArticolo(ean13PesoModel.getPrecode(), ean13PesoModel.toEan128(), onComplete);
} catch (Exception ex) {
this.sendError(ex);
}
}
private void executeEtichettaLU(String sscc, Runnable onComplete) {
mColliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, mtbColtScanned -> {
if(mtbColtScanned == null) {
this.sendError(new NoLUFoundException());
} else if((mtbColtScanned.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColtScanned.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && mtbColtScanned.getSegno() > 0) {
// pickMerceULtoUL(mtbColtScanned, mtbColt.get(), onComplete);
} else {
this.sendError(new NoLUFoundException());
}
}, this::sendError);
}
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
String barcodeProd = null;
if(!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
if(!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
if(!UtilityString.isNullOrEmpty(ean128Model.Content)) barcodeProd = ean128Model.Content;
if(!UtilityString.isNullOrEmpty(barcodeProd)) {
if(!UtilityString.isNullOrEmpty(ean128Model.Sscc)){
this.executeEtichettaLU(ean128Model.Sscc, onComplete);
} else if(!UtilityString.isNullOrEmpty(barcodeProd)) {
if (barcodeProd.startsWith("0") || barcodeProd.startsWith("9")) {
barcodeProd = barcodeProd.substring(1);
}
this.loadArticolo(barcodeProd, ean128Model, onComplete);
} else {
this.sendError(new NoLUFoundException());
}
} else {
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
this.sendError(new NoLUFoundException());
}
}, this::sendError);
}
private void loadArticolo(String barcodeProd, Ean128Model ean128Model, Runnable onComplete) {
if(barcodeProd.length() == 14) {
// barcodeProd = UtilityBarcode.convertITF14toNeutral(barcodeProd);
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
}
mArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
if(mtbAartList != null && mtbAartList.size() > 0) {
this.dispatchArt(mtbAartList.get(0), ean128Model);
} else {
this.sendError(new NoResultFromBarcodeException());
}
}, this::sendError);
}
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
if(this.mFlagAskCliente) {
this.sendLUClienteRequired(vtbDest -> {
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, vtbDest, onComplete);
}, onComplete);
} else {
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, null, onComplete);
}
}
private void createNewLU_PostClienteAsk(Integer customNumCollo, String customSerCollo, VtbDest vtbDest, Runnable onComplete) {
MtbColt mtbColt = new MtbColt();
mtbColt.initDefaultFields();
mtbColt .setGestione(GestioneEnum.VENDITA)
.setSegno(-1)
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
if(customNumCollo != null) {
mtbColt.setNumCollo(customNumCollo);
}
if(!UtilityString.isNullOrEmpty(customSerCollo)) {
mtbColt.setSerCollo(customSerCollo);
}
if(vtbDest != null) {
mtbColt.setCodAnag(vtbDest.getCodAnag());
mtbColt.setCodVdes(vtbDest.getCodVdes());
}
mColliMagazzinoRESTConsumer.saveCollo(mtbColt, value -> {
mtbColt
.setNumCollo(value.getNumCollo())
.setDataCollo(value.getDataColloS())
.setMtbColr(new ObservableArrayList<>());
this.mCurrentMtbColt = mtbColt;
if (onComplete != null) onComplete.run();
this.sendLUOpened(mtbColt);
}, this::sendError);
}
private void dispatchArt(MtbAart mtbAart, Ean128Model ean128Model){
}
private void pickMerceULtoUL(MtbColt sourceMtbColt, MtbColt destMtbColt) {
}
public void closeLU() {
}
private void sendOnLoadingStarted() {
if (this.mListener != null) mListener.onLoadingStarted();
}
private void sendOnLoadingEnded() {
if (this.mListener != null) mListener.onLoadingEnded();
}
private void sendError(Exception ex) {
if(this.mListener != null) mListener.onError(ex);
}
private void sendLUOpened(MtbColt mtbColt) {
if (this.mListener != null) mListener.onLUOpened(mtbColt);
}
private void sendLUClienteRequired(RunnableArgs<VtbDest> onComplete, Runnable onAbort) {
if(this.mListener != null) mListener.onLUClienteRequired(onComplete, onAbort);
}
public PickingLiberoViewModelNEW setListener(Listener listener) {
this.mListener = listener;
return this;
}
public interface Listener {
void onLoadingStarted();
void onLoadingEnded();
void onLUOpened(MtbColt mtbColt);
void onLUClosed();
void onError(Exception ex);
void onLUClienteRequired(RunnableArgs<VtbDest> onComplete, Runnable onAbort);
/*void onLUPrintRequest(RunnableArgs<Boolean> onComplete);
void onLUPrintError(Exception ex, Runnable onComplete);
void onFilterApplied(String newValue);
void onFilterRemoved();
void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete);
void onItemDispatched(PickingObjectDTO pickingObjectDTO,
MtbAart mtbAart,
BigDecimal initialNumCnf,
BigDecimal initialQtaCnf,
BigDecimal initialQtaTot,
BigDecimal totalQtaOrd,
BigDecimal totalNumCnfOrd,
BigDecimal qtaCnfOrd,
BigDecimal totalQtaToBeTaken,
BigDecimal totalNumCnfToBeTaken,
BigDecimal qtaCnfToBeTaken,
BigDecimal totalQtaAvailable,
BigDecimal totalNumCnfAvailable,
BigDecimal qtaCnfAvailable,
String partitaMag,
Date dataScad,
boolean canOverflowOrderQuantity,
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
void onRowSaved();
*/
}
}

View File

@ -62,10 +62,10 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
public ObservableField<MtbColt> mtbColt = new ObservableField<>();
public BindableBoolean thereIsAnOpenedUL = new BindableBoolean();
public BindableBoolean thereIsntAnOpenedUL = new BindableBoolean();
public BindableBoolean thereIsAnyRowInUL = new BindableBoolean();
public BindableBoolean thereIsAnOpenULWithoutRows = new BindableBoolean();
public BindableBoolean thereIsAnOpenedUL = new BindableBoolean(false);
public BindableBoolean thereIsntAnOpenedUL = new BindableBoolean(true);
public BindableBoolean thereIsAnyRowInUL = new BindableBoolean(false);
public BindableBoolean thereIsAnOpenULWithoutRows = new BindableBoolean(false);
private BottomSheetBehavior mBottomSheetBehavior;
@ -297,7 +297,7 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
BarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
String barcodeProd = null;
@ -344,7 +344,7 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
}
ArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
ArticoloRESTConsumer.getByBarcodeProdStatic(barcodeProd, mtbAartList -> {
if(mtbAartList != null && mtbAartList.size() > 0) {
progressDialog.dismiss();

View File

@ -184,7 +184,7 @@ public class RettificaGiacenzeViewModel implements IRecyclerItemClicked<MtbColr>
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
BarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
String barcodeProd = null;
@ -216,7 +216,7 @@ public class RettificaGiacenzeViewModel implements IRecyclerItemClicked<MtbColr>
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
}
ArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
ArticoloRESTConsumer.getByBarcodeProdStatic(barcodeProd, mtbAartList -> {
if (mtbAartList != null && mtbAartList.size() > 0) {

View File

@ -65,7 +65,6 @@ import it.integry.integrywmsnative.view.dialogs.camera_barcode_reader.DialogCame
import it.integry.integrywmsnative.view.dialogs.input_peso_lu.DialogInputPeso;
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2;
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2ResultDTO;
import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArt;
public class SpedizioneActivity extends BaseActivity implements SpedizioneViewModel.Listeners, BottomSheetFragmentLUContentViewModel.Listener, BottomSheetFragmentLUContentView.Listener {
@ -87,6 +86,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
private boolean mEnableGiacenza;
private boolean mFlagShowCodForn;
private boolean mDivideByGrpMerc;
private int barcodeScannerIstanceID = -1;
private ArrayList<SitArtOrdDTO> mSitArtOrd;
@ -122,6 +122,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
ICustomConfiguration customConfiguration = ClassRouter.getInstance(ClassRouter.PATH.CUSTOM_CONFIGURATION);
mFlagShowCodForn = customConfiguration.getConfig(BaseCustomConfiguration.Keys.FLAG_SHOW_COD_FORN_IN_SPEDIZIONE);
mDivideByGrpMerc = customConfiguration.getConfig(BaseCustomConfiguration.Keys.FLAG_SPEDIZIONE_GROUP_BY_GRP_MERC);
mBindings.setLifecycleOwner(this);
mBindings.setSpedizioneView(this);
@ -206,112 +207,225 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
List<SpedizioneListModel> spedizioneListModels = new ArrayList<>();
Stream.of(tmpList)
.forEach(x -> {
SpedizioneListModel spedizioneListModel = new SpedizioneListModel();
String badge1 = "";
if (mFlagShowCodForn) {
badge1 += !UtilityString.isNullOrEmpty(x.getSitArtOrdDTO().getCodAlis()) ? (x.getSitArtOrdDTO().getCodAlis() + " - ") : "";
badge1 += (!UtilityString.isNullOrEmpty(x.getSitArtOrdDTO().getCodArtFor()) ? x.getSitArtOrdDTO().getCodArtFor() : x.getMtbAart().getCodMart());
} else {
badge1 += x.getMtbAart().getCodMart();
}
List<SpedizioneListModel> sortedList = null;
spedizioneListModel.setBadge1(badge1);
if(!mDivideByGrpMerc) {
Stream.of(tmpList)
.forEach(x -> {
SpedizioneListModel spedizioneListModel = new SpedizioneListModel();
if (UtilityString.isNullOrEmpty(x.getMtbAart().getDescrizioneEstesa())) {
spedizioneListModel.setDescrizione(getString(R.string.no_description));
spedizioneListModel.setDescrizionePresente(false);
} else {
spedizioneListModel.setDescrizione(x.getMtbAart().getDescrizioneEstesa());
spedizioneListModel.setDescrizionePresente(true);
}
boolean anyLUPresent = x.getMtbColts() != null && x.getMtbColts().size() > 0;
spedizioneListModel.setActive(!mEnableGiacenza || anyLUPresent);
AtomicBigDecimal numCnfWithdrawRows = new AtomicBigDecimal();
AtomicBigDecimal qtaColWithdrawRows = new AtomicBigDecimal();
Stream.of(x.getWithdrawMtbColr())
.forEach(row -> {
numCnfWithdrawRows.addAndGet(row.getNumCnf());
qtaColWithdrawRows.addAndGet(row.getQtaCol());
});
if (!anyLUPresent) {
spedizioneListModel.setGroupTitle(mEnableGiacenza ? getString(R.string.picking_not_available) : "");
spedizioneListModel.setBadge2(x.getSitArtOrdDTO().getCodJcom());
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().isFlagQtaCnfFissaBoolean())) {
spedizioneListModel.setUntMis("col");
spedizioneListModel.setQtaTot(x.getSitArtOrdDTO().getNumCnfOrd());
spedizioneListModel.setQtaEvasa(numCnfWithdrawRows.getBigDecimalValue());
String badge1 = "";
if (mFlagShowCodForn) {
badge1 += !UtilityString.isNullOrEmpty(x.getSitArtOrdDTO().getCodAlis()) ? (x.getSitArtOrdDTO().getCodAlis() + " - ") : "";
badge1 += (!UtilityString.isNullOrEmpty(x.getSitArtOrdDTO().getCodArtFor()) ? x.getSitArtOrdDTO().getCodArtFor() : x.getMtbAart().getCodMart());
} else {
spedizioneListModel.setQtaTot(x.getSitArtOrdDTO().getQtaOrd());
spedizioneListModel.setQtaEvasa(qtaColWithdrawRows.getBigDecimalValue());
if (x.getMtbAart() != null)
spedizioneListModel.setUntMis(x.getMtbAart().getUntMis());
badge1 += x.getMtbAart().getCodMart();
}
spedizioneListModel.setOriginalModel(x);
spedizioneListModels.add(spedizioneListModel);
} else {
spedizioneListModel.setBadge1(badge1);
for (MtbColt mtbColtToPick : x.getMtbColts()) {
if (UtilityString.isNullOrEmpty(x.getMtbAart().getDescrizioneEstesa())) {
spedizioneListModel.setDescrizione(getString(R.string.no_description));
spedizioneListModel.setDescrizionePresente(false);
} else {
spedizioneListModel.setDescrizione(x.getMtbAart().getDescrizioneEstesa());
spedizioneListModel.setDescrizionePresente(true);
}
SpedizioneListModel cloneModel = (SpedizioneListModel) spedizioneListModel.clone();
cloneModel.setGroupTitle(String.format("%s: %s", getString(R.string.position_text), UtilityString.isNullOrEmpty(mtbColtToPick.getPosizione()) ? "N.A." : mtbColtToPick.getPosizione()));
boolean anyLUPresent = x.getMtbColts() != null && x.getMtbColts().size() > 0;
MtbColr mtbColrToDispatch = mtbColtToPick.getMtbColr() != null && mtbColtToPick.getMtbColr().size() > 0 ? mtbColtToPick.getMtbColr().get(0) : null;
if (mtbColrToDispatch != null && !UtilityString.isNullOrEmpty(mtbColrToDispatch.getPartitaMag())) {
cloneModel.setSubDescrizione1(String.format(getString(R.string.batch_lot_text), mtbColrToDispatch.getPartitaMag()));
cloneModel.setBadge2(mtbColrToDispatch.getCodJcom());
}
spedizioneListModel.setActive(!mEnableGiacenza || anyLUPresent);
cloneModel.setSubDescrizione2(String.format(getString(R.string.lu_number_data_text), mtbColtToPick.getNumCollo(), UtilityDate.formatDate(mtbColtToPick.getDataColloD(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)));
AtomicBigDecimal numCnfWithdrawRows = new AtomicBigDecimal();
AtomicBigDecimal qtaColWithdrawRows = new AtomicBigDecimal();
Stream.of(x.getWithdrawMtbColr())
.forEach(row -> {
numCnfWithdrawRows.addAndGet(row.getNumCnf());
qtaColWithdrawRows.addAndGet(row.getQtaCol());
});
if (!anyLUPresent) {
spedizioneListModel.setGroupTitle(mEnableGiacenza ? getString(R.string.picking_not_available) : "");
spedizioneListModel.setBadge2(x.getSitArtOrdDTO().getCodJcom());
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().isFlagQtaCnfFissaBoolean())) {
cloneModel.setUntMis("col");
cloneModel.setQtaTot(mtbColrToDispatch != null ? mtbColrToDispatch.getNumCnf() : x.getSitArtOrdDTO().getNumCnfOrd());
cloneModel.setQtaEvasa(numCnfWithdrawRows.getBigDecimalValue());
spedizioneListModel.setUntMis("col");
spedizioneListModel.setQtaTot(x.getSitArtOrdDTO().getNumCnfOrd());
spedizioneListModel.setQtaEvasa(numCnfWithdrawRows.getBigDecimalValue());
} else {
cloneModel.setQtaTot(mtbColrToDispatch != null ? mtbColrToDispatch.getQtaCol() : x.getSitArtOrdDTO().getQtaOrd());
cloneModel.setQtaEvasa(qtaColWithdrawRows.getBigDecimalValue());
spedizioneListModel.setQtaTot(x.getSitArtOrdDTO().getQtaOrd());
spedizioneListModel.setQtaEvasa(qtaColWithdrawRows.getBigDecimalValue());
if (x.getMtbAart() != null)
cloneModel.setUntMis(x.getMtbAart().getUntMis());
spedizioneListModel.setUntMis(x.getMtbAart().getUntMis());
}
cloneModel.setOriginalModel(x);
cloneModel.setSourceMtbColt(mtbColtToPick);
spedizioneListModels.add(cloneModel);
spedizioneListModel.setOriginalModel(x);
spedizioneListModels.add(spedizioneListModel);
} else {
for (MtbColt mtbColtToPick : x.getMtbColts()) {
SpedizioneListModel cloneModel = (SpedizioneListModel) spedizioneListModel.clone();
cloneModel.setGroupTitle(String.format("%s: %s", getString(R.string.position_text), UtilityString.isNullOrEmpty(mtbColtToPick.getPosizione()) ? "N.A." : mtbColtToPick.getPosizione()));
MtbColr mtbColrToDispatch = mtbColtToPick.getMtbColr() != null && mtbColtToPick.getMtbColr().size() > 0 ? mtbColtToPick.getMtbColr().get(0) : null;
if (mtbColrToDispatch != null && !UtilityString.isNullOrEmpty(mtbColrToDispatch.getPartitaMag())) {
cloneModel.setSubDescrizione1(String.format(getString(R.string.batch_lot_text), mtbColrToDispatch.getPartitaMag()));
cloneModel.setBadge2(mtbColrToDispatch.getCodJcom());
}
cloneModel.setSubDescrizione2(String.format(getString(R.string.lu_number_data_text), mtbColtToPick.getNumCollo(), UtilityDate.formatDate(mtbColtToPick.getDataColloD(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)));
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().isFlagQtaCnfFissaBoolean())) {
cloneModel.setUntMis("col");
cloneModel.setQtaTot(mtbColrToDispatch != null ? mtbColrToDispatch.getNumCnf() : x.getSitArtOrdDTO().getNumCnfOrd());
cloneModel.setQtaEvasa(numCnfWithdrawRows.getBigDecimalValue());
} else {
cloneModel.setQtaTot(mtbColrToDispatch != null ? mtbColrToDispatch.getQtaCol() : x.getSitArtOrdDTO().getQtaOrd());
cloneModel.setQtaEvasa(qtaColWithdrawRows.getBigDecimalValue());
if (x.getMtbAart() != null)
cloneModel.setUntMis(x.getMtbAart().getUntMis());
}
cloneModel.setOriginalModel(x);
cloneModel.setSourceMtbColt(mtbColtToPick);
spedizioneListModels.add(cloneModel);
}
}
}
});
});
List<SpedizioneListModel> sortedList = Stream.of(spedizioneListModels)
.filter(x -> x.isActive() && (x.getSourceMtbColt() != null && !UtilityString.isNullOrEmpty(x.getSourceMtbColt().getPosizione())))
.sortBy(x -> x.getSourceMtbColt().getPosizione())
.toList();
sortedList = Stream.of(spedizioneListModels)
.filter(x -> x.isActive() && (x.getSourceMtbColt() != null && !UtilityString.isNullOrEmpty(x.getSourceMtbColt().getPosizione())))
.sortBy(x -> x.getSourceMtbColt().getPosizione())
.toList();
sortedList.addAll(
Stream.of(spedizioneListModels)
.filter(x -> x.isActive() && x.getSourceMtbColt() == null || (x.getSourceMtbColt() != null && UtilityString.isNullOrEmpty(x.getSourceMtbColt().getPosizione())))
.toList()
);
sortedList.addAll(
Stream.of(spedizioneListModels)
.filter(x -> x.isActive() && x.getSourceMtbColt() == null || (x.getSourceMtbColt() != null && UtilityString.isNullOrEmpty(x.getSourceMtbColt().getPosizione())))
.toList()
);
sortedList.addAll(
Stream.of(spedizioneListModels)
.filter(x -> !x.isActive())
.toList()
);
sortedList.addAll(
Stream.of(spedizioneListModels)
.filter(x -> !x.isActive())
.toList()
);
} else {
Stream.of(tmpList)
.forEach(x -> {
SpedizioneListModel spedizioneListModel = new SpedizioneListModel();
String badge1 = "";
if (mFlagShowCodForn) {
badge1 += !UtilityString.isNullOrEmpty(x.getSitArtOrdDTO().getCodAlis()) ? (x.getSitArtOrdDTO().getCodAlis() + " - ") : "";
badge1 += (!UtilityString.isNullOrEmpty(x.getSitArtOrdDTO().getCodArtFor()) ? x.getSitArtOrdDTO().getCodArtFor() : x.getMtbAart().getCodMart());
} else {
badge1 += x.getMtbAart().getCodMart();
}
spedizioneListModel.setBadge1(badge1);
if (UtilityString.isNullOrEmpty(x.getMtbAart().getDescrizioneEstesa())) {
spedizioneListModel.setDescrizione(getString(R.string.no_description));
spedizioneListModel.setDescrizionePresente(false);
} else {
spedizioneListModel.setDescrizione(x.getMtbAart().getDescrizioneEstesa());
spedizioneListModel.setDescrizionePresente(true);
}
boolean anyLUPresent = x.getMtbColts() != null && x.getMtbColts().size() > 0;
spedizioneListModel.setActive(!mEnableGiacenza || anyLUPresent);
AtomicBigDecimal numCnfWithdrawRows = new AtomicBigDecimal();
AtomicBigDecimal qtaColWithdrawRows = new AtomicBigDecimal();
Stream.of(x.getWithdrawMtbColr())
.forEach(row -> {
numCnfWithdrawRows.addAndGet(row.getNumCnf());
qtaColWithdrawRows.addAndGet(row.getQtaCol());
});
String groupTitle = String.format("%s - %s", x.getSitArtOrdDTO().getDescrizioneMgrp(), x.getSitArtOrdDTO().getDescrizioneMsgr());
if(!UtilityString.isNullOrEmpty(x.getSitArtOrdDTO().getDescrizioneMsfa())) {
groupTitle += " - " + x.getSitArtOrdDTO().getDescrizioneMsfa();
}
spedizioneListModel.setGroupTitle(groupTitle);
if (!anyLUPresent) {
spedizioneListModel.setBadge2(x.getSitArtOrdDTO().getCodJcom());
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().isFlagQtaCnfFissaBoolean())) {
spedizioneListModel.setUntMis("col");
spedizioneListModel.setQtaTot(x.getSitArtOrdDTO().getNumCnfOrd());
spedizioneListModel.setQtaEvasa(numCnfWithdrawRows.getBigDecimalValue());
} else {
spedizioneListModel.setQtaTot(x.getSitArtOrdDTO().getQtaOrd());
spedizioneListModel.setQtaEvasa(qtaColWithdrawRows.getBigDecimalValue());
if (x.getMtbAart() != null)
spedizioneListModel.setUntMis(x.getMtbAart().getUntMis());
}
spedizioneListModel.setOriginalModel(x);
spedizioneListModels.add(spedizioneListModel);
} else {
for (MtbColt mtbColtToPick : x.getMtbColts()) {
SpedizioneListModel cloneModel = (SpedizioneListModel) spedizioneListModel.clone();
MtbColr mtbColrToDispatch = mtbColtToPick.getMtbColr() != null && mtbColtToPick.getMtbColr().size() > 0 ? mtbColtToPick.getMtbColr().get(0) : null;
if (mtbColrToDispatch != null && !UtilityString.isNullOrEmpty(mtbColrToDispatch.getPartitaMag())) {
cloneModel.setSubDescrizione1(String.format(getString(R.string.batch_lot_text), mtbColrToDispatch.getPartitaMag()));
cloneModel.setBadge2(mtbColrToDispatch.getCodJcom());
}
cloneModel.setSubDescrizione2(String.format(getString(R.string.lu_number_data_text), mtbColtToPick.getNumCollo(), UtilityDate.formatDate(mtbColtToPick.getDataColloD(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)));
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().isFlagQtaCnfFissaBoolean())) {
cloneModel.setUntMis("col");
cloneModel.setQtaTot(mtbColrToDispatch != null ? mtbColrToDispatch.getNumCnf() : x.getSitArtOrdDTO().getNumCnfOrd());
cloneModel.setQtaEvasa(numCnfWithdrawRows.getBigDecimalValue());
} else {
cloneModel.setQtaTot(mtbColrToDispatch != null ? mtbColrToDispatch.getQtaCol() : x.getSitArtOrdDTO().getQtaOrd());
cloneModel.setQtaEvasa(qtaColWithdrawRows.getBigDecimalValue());
if (x.getMtbAart() != null)
cloneModel.setUntMis(x.getMtbAart().getUntMis());
}
cloneModel.setOriginalModel(x);
cloneModel.setSourceMtbColt(mtbColtToPick);
spedizioneListModels.add(cloneModel);
}
}
});
sortedList = Stream.of(spedizioneListModels)
.filter(SpedizioneListModel::isActive)
.sortBy(x -> x.getOriginalModel().getSitArtOrdDTO().getCodMgrp())
.toList();
sortedList.addAll(
Stream.of(spedizioneListModels)
.filter(x -> !x.isActive())
.toList()
);
}
return sortedList;
}

View File

@ -51,16 +51,16 @@ import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.CurrentMonoLUPositionIsNotCorrectException;
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.InvalidLUException;
import it.integry.integrywmsnative.core.exception.InvalidLUException;
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.InvalidPesoKGException;
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.NoPrintersFoundException;
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.OrdersLoadException;
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.NoArtsFoundException;
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.NoLUFoundException;
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.NoOrdersSelectedException;
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.NoResultFromBarcodeException;
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.NotCurrentYearLUException;
import it.integry.integrywmsnative.gest.spedizione_new.exceptions.ScannedPositionNotExistException;
import it.integry.integrywmsnative.core.exception.ScannedPositionNotExistException;
import it.integry.integrywmsnative.gest.spedizione_new.model.PickDataDTO;
import it.integry.integrywmsnative.gest.spedizione_new.model.PickedQuantityDTO;
import it.integry.integrywmsnative.gest.spedizione_new.model.PickingObjectDTO;
@ -493,7 +493,7 @@ public class SpedizioneViewModel {
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
BarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
String barcodeProd = null;
@ -544,7 +544,7 @@ public class SpedizioneViewModel {
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
}
ArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
ArticoloRESTConsumer.getByBarcodeProdStatic(barcodeProd, mtbAartList -> {
if (mtbAartList != null && mtbAartList.size() > 0) {
this.searchArtFromAnag(mtbAartList.get(0), pickData, onComplete);

View File

@ -1,7 +0,0 @@
package it.integry.integrywmsnative.gest.spedizione_new.exceptions;
public class NoPrintersFoundException extends Exception {
public NoPrintersFoundException() {
super("Nessuna stampante configurata");
}
}

View File

@ -212,37 +212,8 @@ public class MainVenditaFragment extends Fragment implements ITitledFragment, IS
final Dialog progress = UtilityProgress.createDefaultProgressDialog(getActivity());
final String finalDataCons = dataCons;
checkSelectedOrders(selectedOrders, () -> {
// RunnableArgs<List<PickingObjectDTO>> onPostGetPickingList = ordini -> {
//
// mHelper.getBancaliVenditaGiaRegistrati(selectedOrders, mtbColtList -> {
// progress.dismiss();
//
// List<String> codMarts = Stream.of(ordini)
// .distinctBy(PickingObjectDTO::getCodMart)
// .map(PickingObjectDTO::getCodMart)
// .toList();
//
// int alreadyRegisteredUL = mtbColtList.size();
//
//
// DialogSimpleMessageHelper.makeInfoDialog(getActivity(),
// getText(R.string.orders).toString(),
// Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, selectedOrders.size()), selectedOrders.size())
// + "<br />" +
// "<b>" + codMarts.size() + "</b> " + getActivity().getResources().getQuantityString(R.plurals.available_articles, codMarts.size())
// + "<br />" +
// "<b>" + alreadyRegisteredUL + "</b> " + getActivity().getResources().getQuantityString(R.plurals.already_registered_lu, alreadyRegisteredUL)),
// null,
// () -> startVenditaActivity(ordini, selectedOrders, mtbColtList)
// ).show();
//
// }, ex -> UtilityExceptions.defaultException(getActivity(), ex, progress));
//
// };
RunnableArgs<List<SitArtOrdDTO>> onPostGetListaArts = sitArtsDTO -> {
mHelper.getBancaliVenditaGiaRegistrati(selectedOrders, mtbColtList -> {
progress.dismiss();

View File

@ -73,7 +73,7 @@ public class VenditaViewModel {
};
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
BarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
String barcodeProd = null;

View File

@ -149,7 +149,7 @@ public class VersamentoMerceViewModel {
}
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
BarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
String barcodeProd = null;

View File

@ -171,7 +171,7 @@ public class DialogChooseArtsFromListaArts {
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
BarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
String barcodeProd = null;
@ -214,7 +214,7 @@ public class DialogChooseArtsFromListaArts {
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
}
ArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
ArticoloRESTConsumer.getByBarcodeProdStatic(barcodeProd, mtbAartList -> {
if(mtbAartList != null && mtbAartList.size() > 0) {

View File

@ -436,7 +436,7 @@ public class DialogInputQuantity {
} else if(UtilityBarcode.isEtichetta128(data)){
final Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(currentContext);
BarcodeRESTConsumer.decodeEan128(data, ean128Model -> {
BarcodeRESTConsumer.decodeEan128Static(data, ean128Model -> {
progressDialog.dismiss();
BarcodeManager.enable();

View File

@ -1,7 +1,6 @@
package it.integry.integrywmsnative.view.dialogs.scan_art;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
@ -104,7 +103,7 @@ public class DialogScanArt {
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
BarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
String barcodeProd = null;
@ -149,7 +148,7 @@ public class DialogScanArt {
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
}
ArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
ArticoloRESTConsumer.getByBarcodeProdStatic(barcodeProd, mtbAartList -> {
if(mtbAartList != null && mtbAartList.size() > 0) {
BarcodeManager.enable();

View File

@ -222,7 +222,7 @@ public class DialogScanOrCreateLU {
private void executeEAN128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
BarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
if(ean128Model != null && !UtilityString.isNullOrEmpty(ean128Model.Sscc)) {

View File

@ -10,8 +10,8 @@
<import type="it.integry.integrywmsnative.core.utility.UtilityString" />
<variable
name="viewmodel"
type="it.integry.integrywmsnative.gest.picking_libero.viewmodel.PickingLiberoViewModel" />
name="view"
type="it.integry.integrywmsnative.gest.picking_libero.PickingLiberoFragment" />
</data>
@ -65,7 +65,7 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:alpha="0.4"
app:visibility="@{viewmodel.thereIsntAnOpenedUL}"
app:visibility="@{view.thereIsntAnOpenedUL}"
app:layout_constraintTop_toBottomOf="@id/free_picking__suggestion_1__guideline_top"
app:layout_constraintLeft_toRightOf="@id/free_picking__suggestion_1__guideline_left"
app:layout_constraintRight_toLeftOf="@id/free_picking__suggestion_1__guideline_right">
@ -85,7 +85,7 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:alpha="0.4"
app:visibility="@{viewmodel.thereIsAnOpenULWithoutRows}"
app:visibility="@{view.thereIsAnOpenULWithoutRows}"
app:layout_constraintTop_toBottomOf="@id/free_picking__suggestion_1__guideline_top"
app:layout_constraintLeft_toRightOf="@id/free_picking__suggestion_1__guideline_left"
app:layout_constraintRight_toLeftOf="@id/free_picking__suggestion_1__guideline_right">
@ -109,12 +109,12 @@
<com.github.clans.fab.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_gravity="bottom|end"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:src="@drawable/fab_add"
android:onClick="@{() -> viewmodel.createNewLU()}"
android:visibility="@{viewmodel.mtbColt == null ? View.VISIBLE : View.GONE}"
android:onClick="@{() -> view.createNewLU()}"
app:visibility="@{view.thereIsntAnOpenedUL}"
fab:fab_colorNormal="@color/colorPrimary"
fab:fab_colorPressed="@color/white_pressed"
fab:fab_colorRipple="#66FFFFFF"/>
@ -124,12 +124,12 @@
<com.github.clans.fab.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_gravity="bottom|end"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:src="@drawable/ic_check_white_24dp"
android:onClick="@{() -> viewmodel.closeLU()}"
android:visibility="@{viewmodel.mtbColt != null ? View.VISIBLE : View.GONE}"
android:onClick="@{() -> view.closeLU()}"
app:visibility="@{view.thereIsAnOpenedUL}"
fab:fab_colorNormal="@color/mainGreen"
fab:fab_colorPressed="@color/white_pressed"
fab:fab_colorRipple="#66FFFFFF"/>
@ -166,6 +166,7 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="8dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@id/bottom_sheet_actions_quantity"
app:layout_constraintStart_toStartOf="parent">
@ -175,10 +176,10 @@
android:layout_height="wrap_content"
tools:text="Descrizione articolo"
android:textColor="#444"
android:textSize="18dp"
android:textSize="18sp"
android:maxLines="1"
android:ellipsize="end"
android:paddingRight="8dp"
android:paddingEnd="8dp"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatTextView
@ -186,7 +187,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="ABF52IL"
android:textSize="14dp"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
@ -194,11 +195,12 @@
<TextView
android:id="@+id/bottom_sheet_actions_quantity"
android:layout_width="wrap_content"
android:gravity="right"
android:gravity="end"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="15dp"
android:textSize="15sp"
tools:text="250 PZ"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
@ -212,6 +214,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:gravity="center">

View File

@ -10,7 +10,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:perf-plugin:1.3.1'

View File

@ -8,6 +8,7 @@ public class CustomConfiguration extends BaseCustomConfiguration implements ICus
public CustomConfiguration() {
configurations.put(Keys.FLAG_SHOW_COD_FORN_IN_SPEDIZIONE, false);
configurations.put(Keys.MENU_CONFIGURATION, new MenuConfigurationVG());
configurations.put(Keys.FLAG_SPEDIZIONE_GROUP_BY_GRP_MERC, true);
}
}