Aggiunta logica di fast picking in spedizione, scansionando un barcode di una UL all'interno di DialogInputQuantity verrà automaticamente chiusa l'ul attuale e riavviato il processo di scansione del barcode

This commit is contained in:
Giuseppe Scorrano 2025-02-24 12:05:39 +01:00
parent fa10973626
commit 2d48f6687c
80 changed files with 2538 additions and 1659 deletions

View File

@ -110,7 +110,7 @@ dependencies {
//Firebase //Firebase
// Import the Firebase BoM // Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:33.8.0') implementation platform('com.google.firebase:firebase-bom:33.9.0')
implementation 'com.google.firebase:firebase-analytics' implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics' implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-perf' implementation 'com.google.firebase:firebase-perf'
@ -121,6 +121,7 @@ dependencies {
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5' runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5' runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
implementation 'com.google.guava:guava:33.4.0-android'
implementation 'androidx.appcompat:appcompat:1.7.0' implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
@ -139,8 +140,7 @@ dependencies {
implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.annimon:stream:1.2.2' implementation 'com.annimon:stream:1.2.2'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7' implementation 'androidx.lifecycle:lifecycle-runtime:2.8.7'
// implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'org.apache.commons:commons-text:1.9' implementation 'org.apache.commons:commons-text:1.9'
//MVVM //MVVM

View File

@ -150,8 +150,8 @@ public class MainApplicationModule {
@Provides @Provides
@Singleton @Singleton
OrdiniRESTConsumer provideOrdiniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) { OrdiniRESTConsumer provideOrdiniRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
return new OrdiniRESTConsumer(restBuilder, systemRESTConsumer, entityRESTConsumer); return new OrdiniRESTConsumer(restBuilder, executorService, systemRESTConsumer, entityRESTConsumer);
} }
@Provides @Provides
@ -162,8 +162,8 @@ public class MainApplicationModule {
@Provides @Provides
@Singleton @Singleton
ArticoloRESTConsumer provideArticoloRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) { ArticoloRESTConsumer provideArticoloRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
return new ArticoloRESTConsumer(restBuilder, systemRESTConsumer); return new ArticoloRESTConsumer(restBuilder, executorService, systemRESTConsumer);
} }
@Provides @Provides
@ -198,18 +198,19 @@ public class MainApplicationModule {
@Provides @Provides
@Singleton @Singleton
EntityRESTConsumer provideEntityRESTConsumer(RESTBuilder restBuilder) { EntityRESTConsumer provideEntityRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
return new EntityRESTConsumer(restBuilder); return new EntityRESTConsumer(restBuilder, executorService);
} }
@Provides @Provides
@Singleton @Singleton
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(RESTBuilder restBuilder, ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(ExecutorService executorService,
RESTBuilder restBuilder,
SystemRESTConsumer systemRESTConsumer, SystemRESTConsumer systemRESTConsumer,
ArticoloRESTConsumer articoloRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer,
EntityRESTConsumer entityRESTConsumer, EntityRESTConsumer entityRESTConsumer,
SettingsManager settingsManager) { SettingsManager settingsManager) {
return new ColliMagazzinoRESTConsumer(restBuilder, systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer, settingsManager); return new ColliMagazzinoRESTConsumer(executorService, restBuilder, systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer, settingsManager);
} }
@Provides @Provides
@ -238,8 +239,8 @@ public class MainApplicationModule {
@Provides @Provides
@Singleton @Singleton
SystemRESTConsumer provideSystemRESTConsumer(RESTBuilder restBuilder) { SystemRESTConsumer provideSystemRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
return new SystemRESTConsumer(restBuilder); return new SystemRESTConsumer(restBuilder, executorService);
} }
@Provides @Provides
@ -250,8 +251,8 @@ public class MainApplicationModule {
@Provides @Provides
@Singleton @Singleton
PosizioniRESTConsumer providesPosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) { PosizioniRESTConsumer providesPosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, ExecutorService executorService) {
return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer); return new PosizioniRESTConsumer(restBuilder, systemRESTConsumer, executorService);
} }
@Provides @Provides
@ -310,20 +311,20 @@ public class MainApplicationModule {
@Provides @Provides
@Singleton @Singleton
ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer(RESTBuilder restBuilder) { ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
return new ColliSpedizioneRESTConsumer(restBuilder); return new ColliSpedizioneRESTConsumer(restBuilder, executorService);
} }
@Provides @Provides
@Singleton @Singleton
ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer(RESTBuilder restBuilder, SettingsManager settingsManager) { ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SettingsManager settingsManager) {
return new ColliLavorazioneRESTConsumer(restBuilder, settingsManager); return new ColliLavorazioneRESTConsumer(restBuilder, executorService, settingsManager);
} }
@Provides @Provides
@Singleton @Singleton
MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer(RESTBuilder restBuilder) { MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
return new MagazzinoAutomaticoRESTConsumer(restBuilder); return new MagazzinoAutomaticoRESTConsumer(executorService, restBuilder);
} }
@Provides @Provides

View File

@ -7,6 +7,7 @@ public class BarcodeCallbackDTO {
private int ID = -1; private int ID = -1;
private boolean enabled = true;
private RunnableArgs<BarcodeScanDTO> onScanSuccessfull; private RunnableArgs<BarcodeScanDTO> onScanSuccessfull;
private RunnableArgs<Exception> onScanFailed; private RunnableArgs<Exception> onScanFailed;
@ -19,6 +20,15 @@ public class BarcodeCallbackDTO {
return this; return this;
} }
public boolean isEnabled() {
return enabled;
}
public BarcodeCallbackDTO setEnabled(boolean enabled) {
this.enabled = enabled;
return this;
}
public RunnableArgs<BarcodeScanDTO> getOnScanSuccessfull() { public RunnableArgs<BarcodeScanDTO> getOnScanSuccessfull() {
return onScanSuccessfull; return onScanSuccessfull;
} }

View File

@ -24,10 +24,15 @@ public class BarcodeManager {
private static BarcodeReaderInterface mCurrentBarcodeInterface; private static BarcodeReaderInterface mCurrentBarcodeInterface;
private static final List<BarcodeCallbackDTO> mBarcodeCallbacksStacktrace = new ArrayList<>(); private static final List<BarcodeCallbackDTO> mBarcodeCallbacksStacktrace = new ArrayList<>();
private static boolean mEnabled = true; // private static boolean mEnabled = true;
private static final Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{PointMobileBarcodeReader.class, ZebraBarcodeReader.class, HoneyWellBarcodeReader.class, KeyboardEmulatorBarcodeReader.class}; private static final Class<? extends BarcodeReaderInterface>[] registeredBarcodeReaderInterfaces = new Class[]{
PointMobileBarcodeReader.class,
ZebraBarcodeReader.class,
HoneyWellBarcodeReader.class,
KeyboardEmulatorBarcodeReader.class
};
public static void init(Context applicationContext) throws Exception { public static void init(Context applicationContext) throws Exception {
@ -56,12 +61,12 @@ public class BarcodeManager {
mCurrentBarcodeInterface.register(data -> { mCurrentBarcodeInterface.register(data -> {
BarcodeCallbackDTO callback = getValidCallback(); BarcodeCallbackDTO callback = getValidCallback();
if (callback != null && mEnabled) { if (callback != null && callback.isEnabled()) {
callback.getOnScanSuccessfull().run(data); callback.getOnScanSuccessfull().run(data);
} }
}, ex -> { }, ex -> {
BarcodeCallbackDTO callback = getValidCallback(); BarcodeCallbackDTO callback = getValidCallback();
if (callback != null && mEnabled) { if (callback != null && callback.isEnabled()) {
callback.getOnScanFailed().run(ex); callback.getOnScanFailed().run(ex);
} }
}); });
@ -103,7 +108,6 @@ public class BarcodeManager {
} }
public static int addCallback(BarcodeCallbackDTO barcodeCallbackDTO) { public static int addCallback(BarcodeCallbackDTO barcodeCallbackDTO) {
int newID = -1; int newID = -1;
if (!mBarcodeCallbacksStacktrace.isEmpty()) { if (!mBarcodeCallbacksStacktrace.isEmpty()) {
@ -133,18 +137,39 @@ public class BarcodeManager {
} }
public static void disable() { public static void disable(int instanceId) {
mEnabled = false; mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
// UtilityLogger.info("Barcode reader disabled"); .findFirst().ifPresent(x -> x.setEnabled(false));
} }
public static void enable() { public static void disableLastCallback() {
mEnabled = true; BarcodeCallbackDTO validCallback = getValidCallback();
// UtilityLogger.info("Barcode reader enabled"); if (validCallback != null) {
validCallback.setEnabled(false);
}
} }
public static boolean isEnabled() { public static void enable(int instanceId) {
return mEnabled; mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
.findFirst().ifPresent(x -> x.setEnabled(true));
}
public static void enableLastCallback() {
BarcodeCallbackDTO validCallback = getValidCallback();
if (validCallback != null) {
validCallback.setEnabled(true);
}
}
public static boolean isEnabled(int instanceId) {
return mBarcodeCallbacksStacktrace.stream().filter(x -> x.getID() == instanceId)
.findFirst()
.map(BarcodeCallbackDTO::isEnabled)
.orElse(false);
}
public static boolean isLastCallbackEnabled() {
return getValidCallback() != null && getValidCallback().isEnabled();
} }
public static void changeSettings(List<Pair<String, Object>> settings) { public static void changeSettings(List<Pair<String, Object>> settings) {

View File

@ -24,6 +24,10 @@ import androidx.databinding.BindingAdapter;
import androidx.databinding.BindingConversion; import androidx.databinding.BindingConversion;
import androidx.databinding.Observable; import androidx.databinding.Observable;
import androidx.databinding.ObservableField; import androidx.databinding.ObservableField;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewTreeLifecycleOwner;
import com.google.android.material.datepicker.MaterialDatePicker; import com.google.android.material.datepicker.MaterialDatePicker;
import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputEditText;
@ -820,11 +824,11 @@ public class Converters {
@BindingAdapter("visibilityWhenNotNull") @BindingAdapter("visibilityWhenNotNull")
public static void bindViewVisibilityWhenNotNull(View view, ObservableField<?> bindableObject) { public static void bindViewVisibilityObservableFieldWhenNotNull(View view, ObservableField<?> bindableObject) {
if(bindableObject == null) return; if(bindableObject == null) return;
if (view.getTag(R.id.bound_observable) != bindableObject) { if (view.getTag(R.id.bound_observable_visibility) != bindableObject) {
view.setTag(R.id.bound_observable, bindableObject); view.setTag(R.id.bound_observable_visibility, bindableObject);
} }
bindableObject.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() { bindableObject.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@ -838,6 +842,36 @@ public class Converters {
} }
@BindingAdapter("visibilityWhenNotNull")
public static void bindViewVisibilityLiveDataWhenNotNull(View view, LiveData<?> liveData) {
// Se il LiveData è null, nascondi la view e esci
if (liveData == null) {
view.setVisibility(View.GONE);
return;
}
// Ottieni il LifecycleOwner dalla view
LifecycleOwner lifecycleOwner = ViewTreeLifecycleOwner.get(view);
if (lifecycleOwner == null) return;
// Rimuovi eventuali observer precedenti
Observer<Object> oldObserver = (Observer<Object>) view.getTag(R.id.bound_observable_visibility);
if (oldObserver != null) {
liveData.removeObserver(oldObserver);
}
// Crea e registra il nuovo observer
Observer<Object> newObserver = value ->
view.setVisibility(value == null ? View.GONE : View.VISIBLE);
liveData.observe(lifecycleOwner, newObserver);
view.setTag(R.id.bound_observable_visibility, newObserver);
// Imposta lo stato iniziale
view.setVisibility(liveData.getValue() == null ? View.GONE : View.VISIBLE);
}
@BindingAdapter("visibilityWhenNotNull") @BindingAdapter("visibilityWhenNotNull")
public static void bindViewVisibilityWhenNotNull(View view, Object genericObject) { public static void bindViewVisibilityWhenNotNull(View view, Object genericObject) {
view.setVisibility(genericObject == null ? View.GONE : View.VISIBLE); view.setVisibility(genericObject == null ? View.GONE : View.VISIBLE);
@ -845,7 +879,7 @@ public class Converters {
@BindingAdapter("visibilityWhenNull") @BindingAdapter("visibilityWhenNull")
public static void bindViewVisibilityWhenNull(View view, ObservableField<?> bindableObject) { public static void bindViewVisibilityObservableFieldWhenNull(View view, ObservableField<?> bindableObject) {
if (view.getTag(R.id.bound_observable_visibility) != bindableObject) { if (view.getTag(R.id.bound_observable_visibility) != bindableObject) {
view.setTag(R.id.bound_observable_visibility, bindableObject); view.setTag(R.id.bound_observable_visibility, bindableObject);
@ -864,6 +898,36 @@ public class Converters {
} }
@BindingAdapter("visibilityWhenNull")
public static void bindViewVisibilityLiveDataWhenNull(View view, LiveData<?> liveData) {
// Se il LiveData è null, nascondi la view e esci
if (liveData == null) {
view.setVisibility(View.VISIBLE);
return;
}
// Ottieni il LifecycleOwner dalla view
LifecycleOwner lifecycleOwner = ViewTreeLifecycleOwner.get(view);
if (lifecycleOwner == null) return;
// Rimuovi eventuali observer precedenti
Observer<Object> oldObserver = (Observer<Object>) view.getTag(R.id.bound_observable_visibility);
if (oldObserver != null) {
liveData.removeObserver(oldObserver);
}
// Crea e registra il nuovo observer
Observer<Object> newObserver = value ->
view.setVisibility(value == null ? View.VISIBLE : View.GONE);
liveData.observe(lifecycleOwner, newObserver);
view.setTag(R.id.bound_observable_visibility, newObserver);
// Imposta lo stato iniziale
view.setVisibility(liveData.getValue() == null ? View.VISIBLE : View.GONE);
}
@BindingAdapter({"reverse_visibility"}) @BindingAdapter({"reverse_visibility"})
public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) { public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) {
if (view.getTag(R.id.bound_reverse_visibility) != bindableBoolean) { if (view.getTag(R.id.bound_reverse_visibility) != bindableBoolean) {

View File

@ -34,7 +34,6 @@ public class BaseActivity extends AppCompatActivity {
} }
public void onLoadingStarted() { public void onLoadingStarted() {
BarcodeManager.disable();
this.openProgress(); this.openProgress();
} }
@ -52,14 +51,14 @@ public class BaseActivity extends AppCompatActivity {
private void openProgress() { private void openProgress() {
BarcodeManager.disable(); BarcodeManager.disableLastCallback();
// executorService.execute(() -> { // executorService.execute(() -> {
this.mCurrentProgress.show(getSupportFragmentManager()); this.mCurrentProgress.show(getSupportFragmentManager());
// }); // });
} }
private void closeProgress() { private void closeProgress() {
BarcodeManager.enable(); BarcodeManager.enableLastCallback();
// executorService.execute(() -> { // executorService.execute(() -> {
mCurrentProgress.dismiss(); mCurrentProgress.dismiss();
// }); // });
@ -67,7 +66,7 @@ public class BaseActivity extends AppCompatActivity {
@Override @Override
public boolean dispatchKeyEvent(KeyEvent event) { public boolean dispatchKeyEvent(KeyEvent event) {
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) { if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator()) {
if (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE && !isControlKey(event)) { if (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE && !isControlKey(event)) {
return BarcodeManager.onKeyDown(event.getKeyCode(), event); return BarcodeManager.onKeyDown(event.getKeyCode(), event);
} }

View File

@ -14,7 +14,7 @@ public class BaseDialog extends Dialog {
public BaseDialog(@NonNull Context context) { public BaseDialog(@NonNull Context context) {
super(context); super(context);
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) { if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator()) {
setOnKeyListener((dialog, keyCode, event) -> { setOnKeyListener((dialog, keyCode, event) -> {
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) { if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
return BarcodeManager.onKeyDown(event.getKeyCode(), event); return BarcodeManager.onKeyDown(event.getKeyCode(), event);

View File

@ -65,25 +65,23 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
} }
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() {
BarcodeManager.disable(); BarcodeManager.disableLastCallback();
// executorService.execute(() -> { // executorService.execute(() -> {
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager()); this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
// }); // });
} }
private void closeProgress() { private void closeProgress() {
BarcodeManager.enable(); BarcodeManager.enableLastCallback();
// executorService.execute(() -> { // executorService.execute(() -> {
mCurrentProgress.dismiss(); mCurrentProgress.dismiss();
// }); // });
@ -91,9 +89,8 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
public void onError(Exception ex) { public void onError(Exception ex) {
this.onLoadingEnded();
requireActivity().runOnUiThread(() -> { requireActivity().runOnUiThread(() -> {
this.onLoadingEnded();
UtilityExceptions.defaultException(requireActivity(), ex); UtilityExceptions.defaultException(requireActivity(), ex);
}); });
} }
@ -130,7 +127,7 @@ public abstract class BaseDialogFragment extends DialogFragment implements Dialo
.create() .create()
.inject(this); .inject(this);
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator() && getDialog() != null) { if (BarcodeManager.isLastCallbackEnabled() && BarcodeManager.isKeyboardEmulator() && getDialog() != null) {
getDialog().setOnKeyListener((dialog, keyCode, event) -> { getDialog().setOnKeyListener((dialog, keyCode, event) -> {
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) { if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
return BarcodeManager.onKeyDown(event.getKeyCode(), event); return BarcodeManager.onKeyDown(event.getKeyCode(), event);

View File

@ -65,14 +65,14 @@ public abstract class BaseFragment extends Fragment {
} }
private void openProgress() { private void openProgress() {
BarcodeManager.disable(); BarcodeManager.disableLastCallback();
// executorService.execute(() -> { // executorService.execute(() -> {
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager()); this.mCurrentProgress.show(requireActivity().getSupportFragmentManager());
// }); // });
} }
private void closeProgress() { private void closeProgress() {
BarcodeManager.enable(); BarcodeManager.enableLastCallback();
// executorService.execute(() -> { // executorService.execute(() -> {
mCurrentProgress.dismiss(); mCurrentProgress.dismiss();
// }); // });
@ -82,7 +82,6 @@ public abstract class BaseFragment extends Fragment {
requireActivity().runOnUiThread(() -> { requireActivity().runOnUiThread(() -> {
this.closeProgress(); this.closeProgress();
UtilityExceptions.defaultException(getActivity(), ex); UtilityExceptions.defaultException(getActivity(), ex);
BarcodeManager.enable();
}); });
} }

View File

@ -6,28 +6,19 @@ import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableList; import androidx.databinding.ObservableList;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.zhukic.sectionedrecyclerview.SectionedRecyclerViewAdapter;
import java.util.ArrayList;
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback; import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
public abstract class ExtendedSectionedRecyclerView<T, SH extends RecyclerView.ViewHolder, VH extends RecyclerView.ViewHolder> public abstract class ExtendedSectionedRecyclerView<T, SH extends RecyclerView.ViewHolder, VH extends RecyclerView.ViewHolder>
extends SectionedRecyclerViewAdapter<SH, VH> { extends SectionedRecyclerViewAdapter<SH, VH> {
protected ArrayList<T> mDataset = new ArrayList<>();
private View mEmptyView; private View mEmptyView;
public ExtendedSectionedRecyclerView(ObservableArrayList<T> myDataset) { public ExtendedSectionedRecyclerView(ObservableArrayList<T> myDataset) {
mDataset.addAll(myDataset); super();
myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback<T>() { myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback<T>() {
@Override @Override
public void onChanged(ObservableList<T> sender) { public void onChanged(ObservableList<T> sender) {
mDataset.clear();
mDataset.addAll(sender);
notifyDataChanged();
notifyDataSetChanged();
checkIfEmpty(); checkIfEmpty();
} }
}); });
@ -41,14 +32,11 @@ public abstract class ExtendedSectionedRecyclerView<T, SH extends RecyclerView.V
return this; return this;
} }
@Override
public int getItemSize() {
return this.mDataset.size();
}
private void checkIfEmpty() { private void checkIfEmpty() {
if (mEmptyView != null) { if (mEmptyView != null) {
final boolean emptyViewVisible = getItemSize() == 0; final boolean emptyViewVisible = getItemCount() == 0;
mEmptyView.setVisibility(emptyViewVisible ? View.VISIBLE : View.GONE); mEmptyView.setVisibility(emptyViewVisible ? View.VISIBLE : View.GONE);
} }
} }

View File

@ -1,6 +1,7 @@
package it.integry.integrywmsnative.core.model; package it.integry.integrywmsnative.core.model;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import it.integry.integrywmsnative.core.utility.UtilityString; import it.integry.integrywmsnative.core.utility.UtilityString;
@ -108,6 +109,104 @@ public class MtbAart extends EntityBase {
this.type = "mtb_aart"; this.type = "mtb_aart";
} }
public MtbAart(MtbAart other) {
this();
this.codMart = other.codMart;
this.descrizione = other.descrizione;
this.untMis = other.untMis;
this.barCode = other.barCode;
this.pesoKg = other.pesoKg; // BigDecimal è immutabile
this.qtaCnf = other.qtaCnf;
this.codAliq = other.codAliq;
this.codScoArt = other.codScoArt;
this.codTcolUi = other.codTcolUi;
this.codTcolUl = other.codTcolUl;
this.articoloComposto = other.articoloComposto;
this.esposizioneComp = other.esposizioneComp;
this.descrizioneEstesa = other.descrizioneEstesa;
this.codUltForn = other.codUltForn;
this.dataUltCar = other.dataUltCar;
this.valUltCar = other.valUltCar;
this.codUltClie = other.codUltClie;
this.dataUltScar = other.dataUltScar;
this.valUltScar = other.valUltScar;
this.tipoCodice = other.tipoCodice;
this.note = other.note;
this.posizione = other.posizione;
this.colliPedana = other.colliPedana;
this.untMis2 = other.untMis2;
this.rapConv2 = other.rapConv2;
this.flagInclListino = other.flagInclListino;
this.untMis3 = other.untMis3;
this.rapConv3 = other.rapConv3;
this.codMartStat = other.codMartStat;
this.codMcon = other.codMcon;
this.codMgrp = other.codMgrp;
this.codMsfa = other.codMsfa;
this.codMsgr = other.codMsgr;
this.codMstp = other.codMstp;
this.codMtip = other.codMtip;
this.descrizioneStat = other.descrizioneStat;
this.flagStato = other.flagStato;
this.cambioDiviCar = other.cambioDiviCar;
this.cambioDiviScar = other.cambioDiviScar;
this.ggScadPartita = other.ggScadPartita;
this.volumeMc = other.volumeMc;
this.flagEsponiPrz = other.flagEsponiPrz;
this.dataUltVar = other.dataUltVar;
this.percSfrido = other.percSfrido;
this.codBarreImb = other.codBarreImb;
this.flagCalcPrz = other.flagCalcPrz;
this.esposizioneCompAcq = other.esposizioneCompAcq;
this.flagCalcPrzAcq = other.flagCalcPrzAcq;
this.diacod = other.diacod;
this.plu = other.plu;
this.partIvaProd = other.partIvaProd;
this.ragSocProd = other.ragSocProd;
this.flagRapConvVariabile = other.flagRapConvVariabile;
this.flagMovArtMag = other.flagMovArtMag;
this.flagTracciabilita = other.flagTracciabilita;
this.taraKg = other.taraKg;
this.colliStrato = other.colliStrato;
this.flagQtaCnfFissa = other.flagQtaCnfFissa;
this.flagColliPedanaFisso = other.flagColliPedanaFisso;
this.codCconCosti = other.codCconCosti;
this.codCconRicavi = other.codCconRicavi;
this.codDgrpArt = other.codDgrpArt;
this.codDiviCar = other.codDiviCar;
this.codDiviScar = other.codDiviScar;
this.codEcrCat = other.codEcrCat;
this.codEcrMcat = other.codEcrMcat;
this.codEcrRep = other.codEcrRep;
this.codEcrStipo = other.codEcrStipo;
this.codEcrTipo = other.codEcrTipo;
this.codGrpBolla = other.codGrpBolla;
this.ingredienti = other.ingredienti;
this.idArtEqui = other.idArtEqui;
this.descrCassa = other.descrCassa;
this.codNcIntracee = other.codNcIntracee;
this.marchio = other.marchio;
this.sezione = other.sezione;
this.untMisRifPeso = other.untMisRifPeso; // Enum è immutabile
this.qtaEsistente = other.qtaEsistente;
this.qtaImpegnata = other.qtaImpegnata;
this.numCnfEsistente = other.numCnfEsistente;
this.numCnfImpegnata = other.numCnfImpegnata;
// Deep copy della lista
if (other.mtbUntMis != null) {
this.mtbUntMis = new ArrayList<>();
for (MtbUntMis untMis : other.mtbUntMis) {
this.mtbUntMis.add(new MtbUntMis(untMis)); // Assicurati che MtbUntMis abbia un costruttore di copia
}
}
}
public boolean isFlagTracciabilitaBoolean() { public boolean isFlagTracciabilitaBoolean() {
return flagTracciabilita != null && flagTracciabilita.equalsIgnoreCase("S"); return flagTracciabilita != null && flagTracciabilita.equalsIgnoreCase("S");
} }

View File

@ -67,6 +67,58 @@ public class MtbColr extends EntityBase {
} }
} }
public MtbColr(MtbColr other) {
this();
this.gestione = other.gestione;
this.serCollo = other.serCollo;
this.numCollo = other.numCollo;
this.dataCollo = other.dataCollo;
this.riga = other.riga;
this.rigaOrd = other.rigaOrd;
this.codMart = other.codMart;
this.codBarre = other.codBarre;
this.codCol = other.codCol;
this.codTagl = other.codTagl;
this.partitaMag = other.partitaMag;
this.gestioneRif = other.gestioneRif;
this.serColloRif = other.serColloRif;
this.note = other.note;
this.dataOrd = other.dataOrd; // LocalDate è immutabile
this.dataColloRif = other.dataColloRif;
this.qtaCnf = other.qtaCnf; // BigDecimal è immutabile
this.qtaCol = other.qtaCol;
this.numOrd = other.numOrd;
this.numEtich = other.numEtich;
this.numColloRif = other.numColloRif;
this.datetimeRow = other.datetimeRow;
this.codJcom = other.codJcom;
this.numCnf = other.numCnf;
this.insPartitaMag = other.insPartitaMag;
this.mtbPartitaMag_descrizione = other.mtbPartitaMag_descrizione;
this.dataScadPartita = other.dataScadPartita;
this.descrizione = other.descrizione;
this.untMis = other.untMis;
this.causale = other.causale;
this.utente = other.utente;
this.codAnagDoc = other.codAnagDoc;
this.codDtipDoc = other.codDtipDoc;
this.dataDoc = other.dataDoc;
this.serDoc = other.serDoc;
this.numDoc = other.numDoc;
this.idRigaDoc = other.idRigaDoc;
this.pesoNettoKg = other.pesoNettoKg;
this.pesoLordoKg = other.pesoLordoKg;
// Deep copy degli oggetti complessi
this.mtbAart = other.mtbAart != null ? new MtbAart(other.mtbAart) : null;
this.mtbPartitaMag = other.mtbPartitaMag != null ? new MtbPartitaMag(other.mtbPartitaMag) : null;
// Non copiamo i campi transient
// this.id = other.id;
// this.refMtbColr = other.refMtbColr;
}
public static class Causale { public static class Causale {
public static final int DEFAULT = 0; public static final int DEFAULT = 0;

View File

@ -3,7 +3,7 @@ package it.integry.integrywmsnative.core.model;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.databinding.ObservableArrayList; import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableField; import androidx.lifecycle.MutableLiveData;
import com.annimon.stream.Optional; import com.annimon.stream.Optional;
import com.annimon.stream.Stream; import com.annimon.stream.Stream;
@ -66,7 +66,7 @@ public class MtbColt extends EntityBase {
private BigDecimal altezzaCm; private BigDecimal altezzaCm;
private String codJcom; private String codJcom;
private final ObservableField<ObservableMtbTcol> mtbTCol = new ObservableField<>(); private final transient MutableLiveData<ObservableMtbTcol> mtbTCol = new MutableLiveData<>();
private Boolean disablePrint; private Boolean disablePrint;
private String ragSocCliente; private String ragSocCliente;
@ -261,7 +261,7 @@ public class MtbColt extends EntityBase {
public MtbColt setCodTcol(String codTcol) { public MtbColt setCodTcol(String codTcol) {
this.codTcol = codTcol; this.codTcol = codTcol;
if(!UtilityString.isNullOrEmpty(codTcol)) { if (!UtilityString.isNullOrEmpty(codTcol)) {
var fountMtbTcolObservable = SettingsManager.iDB().getInternalImballi().stream() var fountMtbTcolObservable = SettingsManager.iDB().getInternalImballi().stream()
.filter(x -> x.getCodTcol().equalsIgnoreCase(codTcol)) .filter(x -> x.getCodTcol().equalsIgnoreCase(codTcol))
.findFirst() .findFirst()
@ -545,15 +545,15 @@ public class MtbColt extends EntityBase {
} }
public ObservableMtbTcol getMtbTCol() { public ObservableMtbTcol getMtbTCol() {
return mtbTCol.get(); return mtbTCol.getValue();
} }
public MtbColt setMtbTCol(ObservableMtbTcol mtbTCol) { public MtbColt setMtbTCol(ObservableMtbTcol mtbTCol) {
this.mtbTCol.set(mtbTCol); this.mtbTCol.postValue(mtbTCol);
return this; return this;
} }
public ObservableField<ObservableMtbTcol> mtbTcolProperty() { public MutableLiveData<ObservableMtbTcol> mtbTcolProperty() {
return mtbTCol; return mtbTCol;
} }
@ -632,7 +632,13 @@ public class MtbColt extends EntityBase {
@Override @Override
public EntityBase clone() { public EntityBase clone() {
MtbColt mtbColt = (MtbColt) super.clone(); MtbColt mtbColt = (MtbColt) super.clone();
mtbColt.setMtbColr((ObservableArrayList<MtbColr>) mtbColt.getMtbColr().clone()); mtbColt.setMtbColr(new ObservableArrayList<>());
this.getMtbColr().stream()
.map(MtbColr::new) //Genera un clone
.forEach(mtbColr -> {
mtbColt.getMtbColr().add(mtbColr);
});
return mtbColt; return mtbColt;
} }
} }

View File

@ -4,34 +4,60 @@ import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
public class MtbPartitaMag extends EntityBase{ public class MtbPartitaMag extends EntityBase {
private String codMart; private String codMart;
private String partitaMag; private String partitaMag;
private String descrizione; private String descrizione;
private LocalDateTime dataIns; private LocalDateTime dataIns;
private LocalDate dataScad; private LocalDate dataScad;
private Integer scelta; private Integer scelta;
private BigDecimal costoUntUmMag; private BigDecimal costoUntUmMag;
private BigDecimal valUntUmMag; private BigDecimal valUntUmMag;
private BigDecimal taraCnfKg; private BigDecimal taraCnfKg;
private BigDecimal qtaCnf; private BigDecimal qtaCnf;
private String flagImballoArendere; private String flagImballoArendere;
private String flagStato; private String flagStato;
private String codDiviCont; private String codDiviCont;
private BigDecimal cambioDiviCont; private BigDecimal cambioDiviCont;
private String barcode; private String barcode;
private String note; private String note;
private BigDecimal rapConv2; private BigDecimal rapConv2;
private BigDecimal rapConv3; private BigDecimal rapConv3;
private String posizione; private String posizione;
private String dataAggPrz; private String dataAggPrz;
private String partitaMagSec; private String partitaMagSec;
private BigDecimal qtaAttesa; private BigDecimal qtaAttesa;
public MtbPartitaMag() { public MtbPartitaMag() {
this.type = "mtb_partita_mag"; this.type = "mtb_partita_mag";
} }
public MtbPartitaMag(MtbPartitaMag other) {
this();
this.codMart = other.codMart;
this.partitaMag = other.partitaMag;
this.descrizione = other.descrizione;
this.dataIns = other.dataIns; // LocalDateTime è immutabile
this.dataScad = other.dataScad; // LocalDate è immutabile
this.scelta = other.scelta;
this.costoUntUmMag = other.costoUntUmMag; // BigDecimal è immutabile
this.valUntUmMag = other.valUntUmMag;
this.taraCnfKg = other.taraCnfKg;
this.qtaCnf = other.qtaCnf;
this.flagImballoArendere = other.flagImballoArendere;
this.flagStato = other.flagStato;
this.codDiviCont = other.codDiviCont;
this.cambioDiviCont = other.cambioDiviCont;
this.barcode = other.barcode;
this.note = other.note;
this.rapConv2 = other.rapConv2;
this.rapConv3 = other.rapConv3;
this.posizione = other.posizione;
this.dataAggPrz = other.dataAggPrz;
this.partitaMagSec = other.partitaMagSec;
this.qtaAttesa = other.qtaAttesa;
}
public String getCodMart() { public String getCodMart() {

View File

@ -15,6 +15,18 @@ public class MtbUntMis extends EntityBase {
this.type = "mtb_unt_mis"; this.type = "mtb_unt_mis";
} }
// Costruttore di copia
public MtbUntMis(MtbUntMis other) {
this();
this.untMis = other.untMis;
this.flagDig = other.flagDig;
this.cifreDec = other.cifreDec; // BigDecimal è immutabile
this.tipoUm = other.tipoUm;
this.flagUnitaKg = other.flagUnitaKg;
this.flagAttivo = other.flagAttivo;
}
public String getUntMis() { public String getUntMis() {
return untMis; return untMis;
} }

View File

@ -36,7 +36,7 @@ public class HttpInterceptor implements Interceptor {
//Nel caso in cui il token è scaduto e devo richiamare la refresh non bisogna passare il vecchio token //Nel caso in cui il token è scaduto e devo richiamare la refresh non bisogna passare il vecchio token
if(SettingsManager.i().getUserSession().getAccessTokenExpiryDate() != null && if(SettingsManager.i().getUserSession().getAccessTokenExpiryDate() != null &&
UtilityDate.getNowTime().isBefore(SettingsManager.i().getUserSession().getAccessTokenExpiryDate())) { UtilityDate.getNowTime().isBefore(SettingsManager.i().getUserSession().getAccessTokenExpiryDate().minusSeconds(20))) {
accessToken = SettingsManager.i().getUserSession().getAccessToken(); accessToken = SettingsManager.i().getUserSession().getAccessToken();
} }

View File

@ -10,6 +10,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -26,7 +27,6 @@ import it.integry.integrywmsnative.core.rest.model.articolo.RetrieveArticoloByCo
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloRequestDTO; import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloRequestDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloResponseDTO; import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloResponseDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeRequestDTO; import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeRequestDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeResponseDTO;
import it.integry.integrywmsnative.core.rest.model.articolo.UpdateBarcodeImballoRequestDTO; import it.integry.integrywmsnative.core.rest.model.articolo.UpdateBarcodeImballoRequestDTO;
import it.integry.integrywmsnative.core.utility.UtilityQuery; import it.integry.integrywmsnative.core.utility.UtilityQuery;
import retrofit2.Call; import retrofit2.Call;
@ -36,10 +36,12 @@ import retrofit2.Response;
public class ArticoloRESTConsumer extends _BaseRESTConsumer { public class ArticoloRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
private final ExecutorService executorService;
private final SystemRESTConsumer systemRESTConsumer; private final SystemRESTConsumer systemRESTConsumer;
public ArticoloRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) { public ArticoloRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SystemRESTConsumer systemRESTConsumer) {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
this.executorService = executorService;
this.systemRESTConsumer = systemRESTConsumer; this.systemRESTConsumer = systemRESTConsumer;
} }
@ -78,28 +80,30 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
}); });
} }
public void searchByBarcode(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) { public List<MtbAart> searchByBarcodeSynchronized(String barcodeProd) throws Exception {
ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class); ArticoloRESTConsumerService articoloRESTConsumerService = restBuilder.getService(ArticoloRESTConsumerService.class);
var request = new SearchArticoloByBarcodeRequestDTO() var request = new SearchArticoloByBarcodeRequestDTO()
.setBarcode(barcodeProd) .setBarcode(barcodeProd)
.setOnlyActive(true); .setOnlyActive(true);
articoloRESTConsumerService var response = articoloRESTConsumerService
.searchByBarcode(request) .searchByBarcode(request)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> call, Response<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> response) {
analyzeAnswer(response, "searchByBarcode", (m) -> {
onComplete.run(response.body().getDto().getArts());
}, onFailed);
}
@Override analyzeAnswer(response, "searchByBarcode");
public void onFailure(Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> call, @NonNull final Exception e) { return response.body().getDto().getArts();
onFailed.run(e); }
}
}); public void searchByBarcode(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var mtbAarts = searchByBarcodeSynchronized(barcodeProd);
if (onComplete != null) onComplete.run(mtbAarts);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }
public void findIfIsKit(MtbAart mtbAart, RunnableArgs<MtbAart> onComplete, RunnableArgs<Exception> onFailed){ public void findIfIsKit(MtbAart mtbAart, RunnableArgs<MtbAart> onComplete, RunnableArgs<Exception> onFailed){
@ -122,45 +126,47 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
}); });
} }
public void getByCodMarts(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) { public List<MtbAart> getByCodMartsSynchronized(List<String> codMartToFind) throws Exception {
var codMarts = Stream.of(codMartToFind) var codMarts = Stream.of(codMartToFind)
.withoutNulls() .withoutNulls()
.distinct().toList(); .distinct().toList();
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class); ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
articoloRESTConsumer var response = articoloRESTConsumer
.getByCodMart(new RetrieveArticoloByCodMartRequestDTO() .getByCodMart(new RetrieveArticoloByCodMartRequestDTO()
.setCodMarts(codMarts)) .setCodMarts(codMarts))
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override return analyzeAnswer(response, "getByCodMart");
public void onResponse(Call<ServiceRESTResponse<List<MtbAart>>> call, Response<ServiceRESTResponse<List<MtbAart>>> response) { }
analyzeAnswer(response, "getByCodMart", onComplete, onFailed);
}
@Override public void getByCodMarts(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
public void onFailure(Call<ServiceRESTResponse<List<MtbAart>>> call, @NonNull final Exception e) { executorService.execute(() -> {
onFailed.run(e); try {
} var mtbAarts = getByCodMartsSynchronized(codMartToFind);
}); if (onComplete != null) onComplete.run(mtbAarts);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public List<StatoArticoloDTO> getStatoPartitaSynchronized(String codMart, String partitaMag) throws Exception {
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class);
var response = articoloRESTConsumer.getStatoPartita(codMart, partitaMag).execute();
var data = analyzeAnswer(response, "getStatoPartita");
return data;
} }
public void getStatoPartita(String codMart, String partitaMag, RunnableArgs<List<StatoArticoloDTO>> onComplete, RunnableArgs<Exception> onFailed) { public void getStatoPartita(String codMart, String partitaMag, RunnableArgs<List<StatoArticoloDTO>> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
ArticoloRESTConsumerService articoloRESTConsumer = restBuilder.getService(ArticoloRESTConsumerService.class); try {
articoloRESTConsumer.getStatoPartita(codMart, partitaMag).enqueue(new ManagedErrorCallback<>() { var response = getStatoPartitaSynchronized(codMart, partitaMag);
@Override if (onComplete != null) onComplete.run(response);
public void onResponse(Call<ServiceRESTResponse<List<StatoArticoloDTO>>> call, Response<ServiceRESTResponse<List<StatoArticoloDTO>>> response) { } catch (Exception ex) {
analyzeAnswer(response, "getStatoPartita", onComplete, onFailed); if (onFailed != null) onFailed.run(ex);
}
@Override
public void onFailure(Call<ServiceRESTResponse<List<StatoArticoloDTO>>> call, @NonNull final Exception e) {
onFailed.run(e);
} }
}); });
} }

View File

@ -16,6 +16,10 @@ public class BarcodeRESTConsumer extends _BaseRESTConsumer {
this.ean128Service = ean128Service; this.ean128Service = ean128Service;
} }
public Ean128Model decodeEan128Synchronized(BarcodeScanDTO barcodeScanDTO) throws Exception {
return this.ean128Service.decode(barcodeScanDTO);
}
public void decodeEan128(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) { public void decodeEan128(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
try { try {
onComplete.run(this.ean128Service.decode(barcodeObj)); onComplete.run(this.ean128Service.decode(barcodeObj));

View File

@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -27,10 +28,8 @@ import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO; import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSFromArtRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSFromArtRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO; import it.integry.integrywmsnative.core.rest.model.uds.InsertUDCRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
@ -44,10 +43,12 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
private final ExecutorService executorService;
private final SettingsManager settingsManager; private final SettingsManager settingsManager;
public ColliLavorazioneRESTConsumer(RESTBuilder restBuilder, SettingsManager settingsManager) { public ColliLavorazioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService, SettingsManager settingsManager) {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
this.executorService = executorService;
this.settingsManager = settingsManager; this.settingsManager = settingsManager;
} }
@ -123,93 +124,111 @@ public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements C
}); });
} }
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) { public MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class); ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO) var response = colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
}
@Override var data = analyzeAnswer(response, "lavorazione/createUDS");
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, @NonNull final Exception e) { return data.getMtbColt();
onFailed.run(e); }
}
});
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = createUDSSynchronized(createUDSRequestDTO);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public CloseUDSResponseDTO closeUDSSynchronized(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
var response = colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
.execute();
var data = analyzeAnswer(response, "lavorazione/closeUDS");
return data;
}
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = closeUDSSynchronized(closeUDSRequestDTO);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }
@Override @Override
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) { public MtbColr insertUDSRowSynchronized(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class); ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO) Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response = colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/closeUDS", onComplete, onFailed);
}
@Override var data = analyzeAnswer(response, "lavorazione/insertUDSRow");
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, @NonNull final Exception e) { return data.getSavedMtbColr();
onFailed.run(e);
}
});
} }
@Override @Override
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) { public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = insertUDSRowSynchronized(insertUDSRowRequestDTO);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public MtbColr editUDSRowSynchronized(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class); ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO) var response = colliLavorazioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
analyzeAnswer(response, "lavorazione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override var data = analyzeAnswer(response, "lavorazione/editUDSRow");
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, @NonNull final Exception e) { return data.getSavedMtbColr();
onFailed.run(e);
}
});
} }
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) { public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class); executorService.execute(() -> {
try {
colliLavorazioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO) var response = editUDSRowSynchronized(editUDSRowRequestDTO);
.enqueue(new ManagedErrorCallback<>() { if (onComplete != null) onComplete.run(response);
@Override } catch (Exception ex) {
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) { if (onFailed != null) onFailed.run(ex);
analyzeAnswer(response, "lavorazione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed); }
} });
@Override
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
} }
@Override public void deleteUDSRowSynchronized(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO) throws Exception {
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class); ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = restBuilder.getService(ColliLavorazioneRESTConsumerService.class);
colliLavorazioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO) var response = colliLavorazioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "lavorazione/deleteUDSRow", data -> onComplete.run(), onFailed);
}
@Override analyzeAnswer(response, "lavorazione/deleteUDSRow");
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) { }
onFailed.run(e);
} public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
}); executorService.execute(() -> {
try {
deleteUDSRowSynchronized(deleteUDSRowRequestDTO);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }
@Override @Override

View File

@ -16,6 +16,8 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -58,8 +60,9 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
private final ArticoloRESTConsumer mArticoloRESTConsumer; private final ArticoloRESTConsumer mArticoloRESTConsumer;
private final EntityRESTConsumer mEntityRESTConsumer; private final EntityRESTConsumer mEntityRESTConsumer;
private final SettingsManager mSettingsManager; private final SettingsManager mSettingsManager;
private final ExecutorService executorService;
public ColliMagazzinoRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, public ColliMagazzinoRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer,
ArticoloRESTConsumer articoloRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer,
EntityRESTConsumer entityRESTConsumer, EntityRESTConsumer entityRESTConsumer,
SettingsManager settingsManager) { SettingsManager settingsManager) {
@ -68,6 +71,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
this.mArticoloRESTConsumer = articoloRESTConsumer; this.mArticoloRESTConsumer = articoloRESTConsumer;
this.mEntityRESTConsumer = entityRESTConsumer; this.mEntityRESTConsumer = entityRESTConsumer;
this.mSettingsManager = settingsManager; this.mSettingsManager = settingsManager;
this.executorService = executorService;
} }
public void saveCollo(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) { public void saveCollo(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
@ -75,14 +79,10 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
mtbColtToSaveClone.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE); mtbColtToSaveClone.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
mtbColtToSaveClone.setOnlyPkMaster(false); mtbColtToSaveClone.setOnlyPkMaster(false);
mtbColtToSaveClone.setMtbColr(new ObservableArrayList<>());
for (int i = 0; i < mtbColtToSave.getMtbColr().size(); i++) { for (int i = 0; i < mtbColtToSave.getMtbColr().size(); i++) {
mtbColtToSaveClone.getMtbColr().add( mtbColtToSaveClone.getMtbColr().get(i)
((MtbColr) mtbColtToSave.getMtbColr().get(i).clone()) .setMtbAart(null)
.setMtbAart(null) .setMtbPartitaMag(null);
.setMtbPartitaMag(null));
} }
this.mEntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback<>() { this.mEntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback<>() {
@ -99,6 +99,19 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
} }
public List<MtbColt> saveColliSynchronized(List<MtbColt> mtbColtsToSave) throws Exception {
for (MtbColt mtbColt : mtbColtsToSave) {
for (int i = 0; i < mtbColt.getMtbColr().size(); i++) {
mtbColt.getMtbColr().get(i)
.setMtbAart(null)
.setMtbPartitaMag(null);
}
}
return this.mEntityRESTConsumer.processEntityListSynchronized(mtbColtsToSave, true, MtbColt.class);
}
public void saveColli(List<MtbColt> mtbColtsToSave, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) { public void saveColli(List<MtbColt> mtbColtsToSave, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
for (MtbColt mtbColt : mtbColtsToSave) { for (MtbColt mtbColt : mtbColtsToSave) {
@ -210,7 +223,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
} }
// if (sourceMtbColt.getMtbColr().size() != 1) { // if (sourceMtbColt.getMtbColr().getValue().size() != 1) {
// onFailed.run(new Exception()); // onFailed.run(new Exception());
// return; // return;
// } // }
@ -286,69 +299,82 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
saveCollo(mtbColtToCreate, onComplete, onFailed); saveCollo(mtbColtToCreate, onComplete, onFailed);
} }
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) { public MtbColt getBySsccSynchronized(String ssccString, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class); ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull).enqueue(new ManagedErrorCallback<>() { var colloResponse = colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull)
@Override .execute();
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) { var mtbColt = analyzeAnswer(colloResponse, "GetBySSCC");
analyzeAnswer(response, "GetBySSCC", mtbColt -> {
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) { if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
List<MtbColt> mtbColtList = new ArrayList<>(); List<MtbColt> mtbColtList = new ArrayList<>();
mtbColtList.add(mtbColt); mtbColtList.add(mtbColt);
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed); var mtbColts = fillMtbAartsOfMtbColtsSynchronized(mtbColtList);
} else { return mtbColts.get(0);
onComplete.run(mtbColt); }
}
}, onFailed); return mtbColt;
} }
@Override public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) { executorService.execute(() -> {
onFailed.run(e); try {
var mtbColt = getBySsccSynchronized(ssccString, onlyResiduo, throwExcIfNull);
if (onComplete != null) onComplete.run(mtbColt);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
} }
}); });
} }
public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) { public List<MtbColt> fillMtbAartsOfMtbColtsSynchronized(List<MtbColt> mtbColts) throws Exception {
List<String> codMarts = new ArrayList<>(); List<String> codMarts = new ArrayList<>();
for (MtbColt mtbColt : mtbColts) { for (MtbColt mtbColt : mtbColts) {
codMarts.addAll(Stream.of(mtbColt.getMtbColr()) codMarts.addAll(mtbColt.getMtbColr().stream()
.map(MtbColr::getCodMart) .map(MtbColr::getCodMart)
.withoutNulls() .filter(x -> !UtilityString.isNullOrEmpty(x))
.distinct() .distinct()
.toList()); .collect(Collectors.toList()));
} }
List<MtbAart> mtbAarts = mArticoloRESTConsumer.getByCodMartsSynchronized(codMarts);
mArticoloRESTConsumer.getByCodMarts(codMarts, arts -> { for (MtbColt mtbColt : mtbColts) {
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
if (arts != null && !arts.isEmpty()) { if (mtbAarts != null && !mtbAarts.isEmpty()) {
for (MtbColt mtbColt : mtbColts) { MtbAart foundMtbAart = null;
for (MtbColr mtbColr : mtbColt.getMtbColr()) {
MtbAart foundMtbAart = null; List<MtbAart> mtbAartStream = mtbAarts.parallelStream()
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
.collect(Collectors.toList());
List<MtbAart> mtbAartStream = Stream.of(arts) if (!mtbAartStream.isEmpty()) {
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart())).toList(); foundMtbAart = mtbAartStream.get(0);
if (mtbAartStream != null && !mtbAartStream.isEmpty()) {
foundMtbAart = mtbAartStream.get(0);
}
mtbColr.setMtbAart(foundMtbAart);
mtbColr.setGestione(mtbColt.getGestione());
mtbColr.setSerCollo(mtbColt.getSerCollo());
mtbColr.setNumCollo(mtbColt.getNumCollo());
mtbColr.setDataCollo(mtbColt.getDataColloS());
} }
}
}
onComplete.run(mtbColts); mtbColr.setMtbAart(foundMtbAart);
}, onFailed); }
mtbColr.setGestione(mtbColt.getGestione());
mtbColr.setSerCollo(mtbColt.getSerCollo());
mtbColr.setNumCollo(mtbColt.getNumCollo());
mtbColr.setDataCollo(mtbColt.getDataColloS());
}
}
return mtbColts;
}
public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
List<MtbColt> returnedMtbColts = fillMtbAartsOfMtbColtsSynchronized(mtbColts);
if (onComplete != null) onComplete.run(returnedMtbColts);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }
public void getMultipleByTestate(List<MtbColt> testate, boolean onlyResiduo, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) { public void getMultipleByTestate(List<MtbColt> testate, boolean onlyResiduo, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
@ -369,6 +395,15 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
} }
} }
public MtbColt getByChiaveColloSynchronized(GestioneEnum gestione, int numCollo, String dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
MtbColt mtbColtToRetrieve = new MtbColt()
.setGestione(gestione)
.setNumCollo(numCollo)
.setDataCollo(dataCollo)
.setSerCollo(serCollo);
return getByTestataSynchronized(mtbColtToRetrieve, onlyResiduo, throwExcIfNull);
}
public void getByChiaveCollo(GestioneEnum gestione, int numCollo, String dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) { public void getByChiaveCollo(GestioneEnum gestione, int numCollo, String dataCollo, String serCollo, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
MtbColt mtbColtToRetrieve = new MtbColt() MtbColt mtbColtToRetrieve = new MtbColt()
.setGestione(gestione) .setGestione(gestione)
@ -379,36 +414,36 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
getByTestata(mtbColtToRetrieve, onlyResiduo, throwExcIfNull, onComplete, onFailed); getByTestata(mtbColtToRetrieve, onlyResiduo, throwExcIfNull, onComplete, onFailed);
} }
public void getByTestata(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) { public MtbColt getByTestataSynchronized(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull) throws Exception {
testata.setMtbColr(new ObservableArrayList<>()); testata.setMtbColr(new ObservableArrayList<>());
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class); ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata) var response = colliMagazzinoRESTConsumerService.getColloInGiac(onlyResiduo, throwExcIfNull, testata)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override var mtbColt = analyzeAnswer(response, "getColloInGiac");
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) { if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
analyzeAnswer(response, "getColloInGiac", mtbColt -> { List<MtbColt> mtbColtList = new ArrayList<>();
mtbColtList.add(mtbColt);
var mtbColts = fillMtbAartsOfMtbColtsSynchronized(mtbColtList);
return mtbColts.get(0);
}
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) { return mtbColt;
List<MtbColt> mtbColtList = new ArrayList<>();
mtbColtList.add(mtbColt);
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
} else {
onComplete.run(mtbColt);
}
}, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<MtbColt>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
} }
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void getByTestata(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var data = getByTestataSynchronized(testata, onlyResiduo, throwExcIfNull);
if (onComplete != null) onComplete.run(data);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public void spostaUlSynchronized(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically) throws Exception {
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone(); MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) { for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
@ -424,21 +459,23 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setCreateDocAutomatically(createDocAutomatically); .setCreateDocAutomatically(createDocAutomatically);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class); ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
.spostaUL(spostaUlRequestDTO) .spostaUL(spostaUlRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "spostaUL", mtbColts -> {
onComplete.run();
}, onFailed);
}
@Override analyzeAnswer(response, "spostaUL");
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) { }
if (onFailed != null) onFailed.run(e);
}
}); public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
spostaUlSynchronized(mtbColtToMove, codMdep, posizione, createDocAutomatically);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }
public void spostaUL(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void spostaUL(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
@ -449,7 +486,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
spostaUL(mtbColtToMove, codMdep, posizioneString, true, onComplete, onFailed); spostaUL(mtbColtToMove, codMdep, posizioneString, true, onComplete, onFailed);
} }
public void updateTipoUL(MtbColt mtbColt, String codTcol, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void updateTipoULSynchronized(MtbColt mtbColt, String codTcol) throws Exception {
MtbColt mtbColtClone = (MtbColt) mtbColt.clone(); MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
mtbColtClone.setMtbColr(new ObservableArrayList<>()); mtbColtClone.setMtbColr(new ObservableArrayList<>());
@ -459,22 +496,23 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setCodTcol(codTcol); .setCodTcol(codTcol);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class); ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService Response<ServiceRESTResponse<Void>> response = colliMagazzinoRESTConsumerService
.updateTipoUL(updateTipoULRequest) .updateTipoUL(updateTipoULRequest)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "updateTipoUL", mtbColts -> {
onComplete.run();
}, onFailed);
}
@Override analyzeAnswer(response, "updateTipoUL");
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) { }
if (onFailed != null) onFailed.run(e);
}
});
public void updateTipoUL(MtbColt mtbColt, String codTcol, Runnable onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
updateTipoULSynchronized(mtbColt, codTcol);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
@ -538,7 +576,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
} }
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, boolean flagForceUseRefs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) { public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, boolean flagForceUseRefs, RunnableArgs<List<MtbColr>> onComplete, RunnableArgs<Exception> onFailed) {
new Thread(() -> { executorService.execute(() -> {
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone(); MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone(); MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
@ -569,7 +607,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
if (onFailed != null) onFailed.run(e); if (onFailed != null) onFailed.run(e);
} }
}); });
}).start(); });
} }
public void assegnaLottoSuColloScarico(MtbColt sourceMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void assegnaLottoSuColloScarico(MtbColt sourceMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
@ -698,42 +736,48 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
} }
public void canULBeDeleted(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) { public Boolean canULBeDeletedSynchronized(MtbColt mtbColt) throws Exception {
CanULBeDeletedRequestDTO canULBeDeletedRequestDTO = new CanULBeDeletedRequestDTO() CanULBeDeletedRequestDTO canULBeDeletedRequestDTO = new CanULBeDeletedRequestDTO()
.setMtbColt(mtbColt); .setMtbColt(mtbColt);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class); ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.canULBeDeleted(canULBeDeletedRequestDTO) var response = colliMagazzinoRESTConsumerService.canULBeDeleted(canULBeDeletedRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
analyzeAnswer(response, "generic/canULBeDeleted", onComplete, onFailed);
}
@Override var data = analyzeAnswer(response, "generic/canULBeDeleted");
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, @NonNull final Exception e) { return data;
onFailed.run(e); }
}
});
public void canULBeDeleted(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var result = canULBeDeletedSynchronized(mtbColt);
if (onComplete != null) onComplete.run(result);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public void deleteULSynchronized(DeleteULRequestDTO deleteULRequestDTO) throws Exception {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class);
var response = colliMagazzinoRESTConsumerService.deleteUL(deleteULRequestDTO)
.execute();
analyzeAnswer(response, "generic/deleteUL");
} }
public void deleteUL(DeleteULRequestDTO deleteULRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void deleteUL(DeleteULRequestDTO deleteULRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = restBuilder.getService(ColliMagazzinoRESTConsumerService.class); executorService.execute(() -> {
try {
colliMagazzinoRESTConsumerService.deleteUL(deleteULRequestDTO) deleteULSynchronized(deleteULRequestDTO);
.enqueue(new ManagedErrorCallback<>() { if (onComplete != null) onComplete.run();
@Override } catch (Exception ex) {
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) { if (onFailed != null) onFailed.run(ex);
analyzeAnswer(response, "generic/deleteUL", Void -> onComplete.run(), onFailed); }
} });
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
} }

View File

@ -1,6 +1,6 @@
package it.integry.integrywmsnative.core.rest.consumers; package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull; import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -9,134 +9,152 @@ import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt; import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.core.rest.RESTBuilder; import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface; import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
import it.integry.integrywmsnative.core.rest.handler.ManagedErrorCallback;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse; import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO; import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSResponseDTO; import it.integry.integrywmsnative.core.rest.model.uds.DuplicateUDSResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.EditUDSRowResponseDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO; import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO; import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
import retrofit2.Call;
import retrofit2.Response; import retrofit2.Response;
@Singleton @Singleton
public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface { public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface {
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
private final ExecutorService executorService;
public ColliSpedizioneRESTConsumer(RESTBuilder restBuilder) { public ColliSpedizioneRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
this.executorService = executorService;
}
public MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
var response = colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO)
.execute();
var data = analyzeAnswer(response, "spedizione/createUDS");
return data.getMtbColt();
} }
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) { public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = createUDSSynchronized(createUDSRequestDTO);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public CloseUDSResponseDTO closeUDSSynchronized(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class); ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO) var response = colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
analyzeAnswer(response, "spedizione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
var data = analyzeAnswer(response, "spedizione/closeUDS");
return data;
} }
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) { public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = closeUDSSynchronized(closeUDSRequestDTO);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public MtbColr insertUDSRowSynchronized(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class); ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO) Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response = colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
analyzeAnswer(response, "spedizione/closeUDS", onComplete, onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
var data = analyzeAnswer(response, "spedizione/insertUDSRow");
return data.getSavedMtbColr();
} }
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) { public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = insertUDSRowSynchronized(insertUDSRowRequestDTO);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public MtbColr editUDSRowSynchronized(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class); ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO) var response = colliSpedizioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
analyzeAnswer(response, "spedizione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override var data = analyzeAnswer(response, "spedizione/editUDSRow");
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, @NonNull final Exception e) { return data.getSavedMtbColr();
onFailed.run(e);
}
});
} }
public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) { public void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var response = editUDSRowSynchronized(editUDSRowRequestDTO);
if (onComplete != null) onComplete.run(response);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public void deleteUDSRowSynchronized(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO) throws Exception {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class); ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.editUDSRow(editUDSRowRequestDTO) var response = colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, Response<ServiceRESTResponse<EditUDSRowResponseDTO>> response) {
analyzeAnswer(response, "spedizione/editUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
}
@Override analyzeAnswer(response, "spedizione/deleteUDSRow");
public void onFailure(Call<ServiceRESTResponse<EditUDSRowResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
} }
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
deleteUDSRowSynchronized(deleteUDSRowRequestDTO);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
}
public DuplicateUDSResponseDTO duplicateUDSSynchronized(DuplicateUDSRequestDTO duplicateUDSRequestDTO) throws Exception {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class); ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class);
colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO) var response = colliSpedizioneRESTConsumerService.duplicateUDS(duplicateUDSRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "spedizione/deleteUDSRow", data -> onComplete.run(), onFailed);
}
@Override
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
var data = analyzeAnswer(response, "spedizione/duplicateUDS");
return data;
} }
public void duplicateUDS(DuplicateUDSRequestDTO duplicateUDSRequestDTO, RunnableArgs<DuplicateUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) { public void duplicateUDS(DuplicateUDSRequestDTO duplicateUDSRequestDTO, RunnableArgs<DuplicateUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = restBuilder.getService(ColliSpedizioneRESTConsumerService.class); executorService.execute(() -> {
try {
colliSpedizioneRESTConsumerService.duplicateUDS(duplicateUDSRequestDTO) var data = duplicateUDSSynchronized(duplicateUDSRequestDTO);
.enqueue(new ManagedErrorCallback<>() { if (onComplete != null) onComplete.run(data);
@Override } catch (Exception ex) {
public void onResponse(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull Response<ServiceRESTResponse<DuplicateUDSResponseDTO>> response) { if (onFailed != null) onFailed.run(ex);
analyzeAnswer(response, "spedizione/duplicateUDS", onComplete, onFailed); }
} });
@Override
public void onFailure(@NonNull Call<ServiceRESTResponse<DuplicateUDSResponseDTO>> call, @NonNull final Exception e) {
onFailed.run(new Exception());
}
});
} }
} }

View File

@ -9,6 +9,7 @@ import com.google.gson.JsonObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -26,9 +27,11 @@ import retrofit2.Response;
public class EntityRESTConsumer extends _BaseRESTConsumer { public class EntityRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
private final ExecutorService executorService;
public EntityRESTConsumer(RESTBuilder restBuilder) { public EntityRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
this.executorService = executorService;
} }
public <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) { public <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) {
@ -73,53 +76,48 @@ public class EntityRESTConsumer extends _BaseRESTConsumer {
} }
public <T extends EntityBase> void processEntityList(List<T> entitiesToSave, boolean singleTransaction, Class<T> type, final RunnableArgs<List<T>> onComplete, final RunnableArgs<Exception> onFailed) { public <T extends EntityBase> List<T> processEntityListSynchronized(List<T> entitiesToSave, boolean singleTransaction, Class<T> type) throws Exception {
RunnableArgs<Exception> tmpFailed = ex -> {
// UtilityExceptions.defaultException(null, ex);
if (onFailed != null) onFailed.run(ex);
};
EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class); EntityRESTConsumerService service = restBuilder.getService(EntityRESTConsumerService.class);
Call<List<ServiceRESTResponse<JsonObject>>> request = service.processEntityList(singleTransaction, entitiesToSave); var response = service.processEntityList(singleTransaction, entitiesToSave)
request.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<List<ServiceRESTResponse<JsonObject>>> call, Response<List<ServiceRESTResponse<JsonObject>>> response) {
if (response.isSuccessful()) {
if (response.body() != null) { if (response.isSuccessful()) {
ArrayList<T> responseList = new ArrayList<>(); if (response.body() != null) {
Gson gson = UtilityGson.createObject();
// Type typeOfObjectsList = new TypeToken<T>() {}.getType();
for (ServiceRESTResponse<JsonObject> jsonSingleObject : response.body()) { ArrayList<T> responseList = new ArrayList<>();
Gson gson = UtilityGson.createObject();
if (jsonSingleObject.getEsito() == EsitoType.OK) { for (ServiceRESTResponse<JsonObject> jsonSingleObject : response.body()) {
String jsonText = gson.toJson(jsonSingleObject.getEntity());
responseList.add(gson.fromJson(jsonText, type));
} else {
Log.e("EntityRESTConsumer", jsonSingleObject.getErrorMessage());
tmpFailed.run(new Exception(jsonSingleObject.getErrorMessage()));
return; if (jsonSingleObject.getEsito() == EsitoType.OK) {
} String jsonText = gson.toJson(jsonSingleObject.getEntity());
} responseList.add(gson.fromJson(jsonText, type));
onComplete.run(responseList);
} else { } else {
Log.e("EntityRESTConsumer", response.message()); Log.e("EntityRESTConsumer", jsonSingleObject.getErrorMessage());
tmpFailed.run(new Exception(response.message())); throw new Exception(jsonSingleObject.getErrorMessage());
} }
} else {
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
tmpFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
} }
}
@Override return responseList;
public void onFailure(Call<List<ServiceRESTResponse<JsonObject>>> call, @NonNull final Exception e) { } else {
tmpFailed.run(e); Log.e("EntityRESTConsumer", response.message());
throw new Exception(response.message());
}
} else {
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
throw new Exception("Status " + response.code() + ": " + response.message());
}
}
public <T extends EntityBase> void processEntityList(List<T> entitiesToSave, boolean singleTransaction, Class<T> type, final RunnableArgs<List<T>> onComplete, final RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var data = processEntityListSynchronized(entitiesToSave, singleTransaction, type);
if (onComplete != null) onComplete.run(data);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
} }
}); });

View File

@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.rest.consumers;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
@ -18,26 +20,31 @@ import retrofit2.Response;
public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer { public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
private final ExecutorService executorService;
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
public MagazzinoAutomaticoRESTConsumer(RESTBuilder restBuilder) { public MagazzinoAutomaticoRESTConsumer(ExecutorService executorService, RESTBuilder restBuilder) {
this.executorService = executorService;
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
} }
public void pickItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) { public void pickItemsSynchronous(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO) throws Exception {
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = restBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class); MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = restBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
magazzinoAutomaticoRESTConsumerService.pickItems(posizione.getPosizione(), magazzinoAutomaticoPickItemsRequestDTO) var response = magazzinoAutomaticoRESTConsumerService.pickItems(posizione.getPosizione(), magazzinoAutomaticoPickItemsRequestDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
analyzeAnswer(response, "magazzino-automatico/pickItems", data -> onComplete.run(), onFailed);
}
@Override analyzeAnswer(response, "magazzino-automatico/pickItems");
public void onFailure(Call<ServiceRESTResponse<Void>> call, @NonNull final Exception e) { }
onFailed.run(e);
} public void pickItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
}); executorService.execute(() -> {
try {
pickItemsSynchronous(posizione, magazzinoAutomaticoPickItemsRequestDTO);
if (onComplete != null) onComplete.run();
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }

View File

@ -5,13 +5,13 @@ import androidx.annotation.NonNull;
import com.annimon.stream.Optional; import com.annimon.stream.Optional;
import com.annimon.stream.Stream; import com.annimon.stream.Stream;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.orhanobut.logger.Logger;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -39,12 +39,14 @@ import retrofit2.Response;
public class OrdiniRESTConsumer extends _BaseRESTConsumer { public class OrdiniRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
private final ExecutorService executorService;
private final SystemRESTConsumer mSystemRESTConsumer; private final SystemRESTConsumer mSystemRESTConsumer;
private final EntityRESTConsumer mEntityRESTConsumer; private final EntityRESTConsumer mEntityRESTConsumer;
public OrdiniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) { public OrdiniRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService,SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
this.executorService = executorService;
this.mSystemRESTConsumer = systemRESTConsumer; this.mSystemRESTConsumer = systemRESTConsumer;
this.mEntityRESTConsumer = entityRESTConsumer; this.mEntityRESTConsumer = entityRESTConsumer;
} }
@ -61,7 +63,7 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
for (PickingObjectDTO pickingObjectDTO : pickingObjects) { for (PickingObjectDTO pickingObjectDTO : pickingObjects) {
for (MtbColt mtbColt : pickingObjectDTO.getMtbColts()) { for (MtbColt mtbColt : pickingObjectDTO.getMtbColts()) {
Stream.of(mtbColt.getMtbColr()) mtbColt.getMtbColr().stream()
.filter(x -> !UtilityString.isNullOrEmpty(x.getPartitaMag())) .filter(x -> !UtilityString.isNullOrEmpty(x.getPartitaMag()))
.forEach(x -> { .forEach(x -> {
@ -125,28 +127,24 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
this.mEntityRESTConsumer.processEntityList(partitaMag, true, MtbPartitaMag.class, onComplete, onFailed); this.mEntityRESTConsumer.processEntityList(partitaMag, true, MtbPartitaMag.class, onComplete, onFailed);
} }
public void getOrdiniInevasi(String codMdep, GestioneEnum gestione, RunnableArgs<List<OrdineUscitaInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed) { public List<OrdineUscitaInevasoDTO> getOrdiniInevasiSynchronized(String codMdep, GestioneEnum gestione) throws Exception {
OrdiniRESTConsumerService service = restBuilder.getService(OrdiniRESTConsumerService.class); OrdiniRESTConsumerService service = restBuilder.getService(OrdiniRESTConsumerService.class);
service.getOrdiniInevasi(codMdep, gestione.getText()) var response = service.getOrdiniInevasi(codMdep, gestione.getText())
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override var data = analyzeAnswer(response, "getOrdiniInevasi");
public void onResponse(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, Response<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> response) { return data == null ? new ArrayList<>() : data;
analyzeAnswer(response, "getOrdiniInevasi", responseDtoList -> { }
if (responseDtoList == null) responseDtoList = new ArrayList<>();
onComplete.run(responseDtoList);
}, ex -> {
Logger.e(ex, "Errore durante il caricamento degli ordini di lavorazione");
if (onFailed != null) onFailed.run(ex);
});
}
@Override public void getOrdiniInevasi(String codMdep, GestioneEnum gestione, RunnableArgs<List<OrdineUscitaInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
public void onFailure(Call<ServiceRESTResponse<List<OrdineUscitaInevasoDTO>>> call, @NonNull final Exception e) { executorService.execute(() -> {
if (onFailed != null) onFailed.run(e); try {
} var result = getOrdiniInevasiSynchronized(codMdep, gestione);
}); if (onComplete != null) onComplete.run(result);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
});
} }
public void retrieveListaArticoliFromOrdiniUscita(String codMdep, List<OrdineUscitaInevasoDTO> orders, RunnableArgs<List<SitArtOrdDTO>> onComplete, RunnableArgs<Exception> onFailed) { public void retrieveListaArticoliFromOrdiniUscita(String codMdep, List<OrdineUscitaInevasoDTO> orders, RunnableArgs<List<SitArtOrdDTO>> onComplete, RunnableArgs<Exception> onFailed) {

View File

@ -7,6 +7,7 @@ import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -25,10 +26,12 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
private final SystemRESTConsumer mSystemRESTConsumer; private final SystemRESTConsumer mSystemRESTConsumer;
private final ExecutorService executorService;
public PosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer) { public PosizioniRESTConsumer(RESTBuilder restBuilder, SystemRESTConsumer systemRESTConsumer, ExecutorService executorService) {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
this.mSystemRESTConsumer = systemRESTConsumer; this.mSystemRESTConsumer = systemRESTConsumer;
this.executorService = executorService;
} }
public void getAvailablePosizioni(RunnableArgs<List<MtbDepoPosizione>> onComplete, RunnableArgs<Exception> onFailed) { public void getAvailablePosizioni(RunnableArgs<List<MtbDepoPosizione>> onComplete, RunnableArgs<Exception> onFailed) {
@ -50,8 +53,7 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer {
}); });
} }
public ArrayList<MtbColt> getBancaliInPosizioneSynchronized(MtbDepoPosizione mtbDepoPosizione) throws Exception {
public void getBancaliInPosizione(MtbDepoPosizione mtbDepoPosizione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
String sql = "SELECT * FROM mtb_colt " + String sql = "SELECT * FROM mtb_colt " +
"WHERE segno > 0 " + "WHERE segno > 0 " +
"AND cod_mdep = " + UtilityDB.valueToString(mtbDepoPosizione.getCodMdep()) + " " + "AND cod_mdep = " + UtilityDB.valueToString(mtbDepoPosizione.getCodMdep()) + " " +
@ -61,10 +63,18 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer {
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() { Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {
}.getType(); }.getType();
mSystemRESTConsumer.<ArrayList<MtbColt>>processSql(sql, typeOfObjectsList, value -> { var value = mSystemRESTConsumer.<ArrayList<MtbColt>>processSqlSynchronized(sql, typeOfObjectsList);
if (onComplete != null) onComplete.run(value); return value;
}, ex -> { }
if (onFailed != null) onFailed.run(ex);
public void getBancaliInPosizione(MtbDepoPosizione mtbDepoPosizione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
try {
var result = getBancaliInPosizioneSynchronized(mtbDepoPosizione);
if (onComplete != null) onComplete.run(result);
} catch (Exception ex) {
if (onFailed != null) onFailed.run(ex);
}
}); });
} }

View File

@ -13,6 +13,7 @@ import java.io.InputStreamReader;
import java.io.Reader; import java.io.Reader;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -37,9 +38,11 @@ import retrofit2.Response;
public class SystemRESTConsumer extends _BaseRESTConsumer { public class SystemRESTConsumer extends _BaseRESTConsumer {
private final RESTBuilder restBuilder; private final RESTBuilder restBuilder;
private final ExecutorService executorService;
public SystemRESTConsumer(RESTBuilder restBuilder) { public SystemRESTConsumer(RESTBuilder restBuilder, ExecutorService executorService) {
this.restBuilder = restBuilder; this.restBuilder = restBuilder;
this.executorService = executorService;
} }
public void retrieveUpdatesInfo(final RunnableArgs<LatestAppVersionInfoDTO> onSuccess, final RunnableArgs<Exception> onFailed) { public void retrieveUpdatesInfo(final RunnableArgs<LatestAppVersionInfoDTO> onSuccess, final RunnableArgs<Exception> onFailed) {
@ -48,7 +51,7 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
.enqueue(new ManagedErrorCallback<>() { .enqueue(new ManagedErrorCallback<>() {
@Override @Override
public void onResponse(Call<LatestAppVersionInfoDTO> call, Response<LatestAppVersionInfoDTO> response) { public void onResponse(Call<LatestAppVersionInfoDTO> call, Response<LatestAppVersionInfoDTO> response) {
if(response.code() == 404) { if (response.code() == 404) {
onSuccess.run(null); onSuccess.run(null);
return; return;
} }
@ -84,35 +87,37 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
} }
public <T> void processSql(String nativeSql, final Type clazz, final RunnableArgs<T> onComplete, final RunnableArgs<Exception> onFailed) { public <T> T processSqlSynchronized(String nativeSql, final Type clazz) throws Exception {
NativeSqlRequestDTO nativeSqlDTO = new NativeSqlRequestDTO() NativeSqlRequestDTO nativeSqlDTO = new NativeSqlRequestDTO()
.setNativeSql(nativeSql); .setNativeSql(nativeSql);
SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class); SystemRESTConsumerService service = restBuilder.getService(SystemRESTConsumerService.class);
service var response = service
.processSql(nativeSqlDTO) .processSql(nativeSqlDTO)
.enqueue(new ManagedErrorCallback<>() { .execute();
@Override
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) { var data = analyzeAnswer(response, "processSql");
analyzeAnswer(response, "ProcessSql", o -> {
Gson gson = UtilityGson.createObject(); Gson gson = UtilityGson.createObject();
String json = gson.toJson(data);
InputStream ims = new ByteArrayInputStream(json.getBytes());
Reader reader = new InputStreamReader(ims);
T gsonObj = gson.fromJson(reader, clazz);
return gsonObj;
}
String json = gson.toJson(o); public <T> void processSql(String nativeSql, final Type clazz, final RunnableArgs<T> onComplete, final RunnableArgs<Exception> onFailed) {
executorService.execute(() -> {
InputStream ims = new ByteArrayInputStream(json.getBytes()); try {
Reader reader = new InputStreamReader(ims); T result = processSqlSynchronized(nativeSql, clazz);
T gsonObj = gson.fromJson(reader, clazz); if (onComplete != null) onComplete.run(result);
} catch (Exception ex) {
onComplete.run(gsonObj); if (onFailed != null) onFailed.run(ex);
}, onFailed); }
} });
@Override
public void onFailure(Call<ServiceRESTResponse<Object>> call, @NonNull final Exception e) {
onFailed.run(e);
}
});
} }

View File

@ -12,13 +12,23 @@ import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
public interface ColliScaricoRESTConsumerInterface { public interface ColliScaricoRESTConsumerInterface {
MtbColt createUDSSynchronized(CreateUDSRequestDTO createUDSRequestDTO) throws Exception;
void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed); void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed);
CloseUDSResponseDTO closeUDSSynchronized(CloseUDSRequestDTO closeUDSRequestDTO) throws Exception;
void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed); void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed);
MtbColr insertUDSRowSynchronized(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception;
void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed); void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
MtbColr editUDSRowSynchronized(EditUDSRowRequestDTO editUDSRowRequestDTO) throws Exception;
void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed); void editUDSRow(EditUDSRowRequestDTO editUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
void deleteUDSRowSynchronized(DeleteUDSRowRequestDTO deleteUDSRequestDTO) throws Exception;
void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed); void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
} }

View File

@ -0,0 +1,21 @@
package it.integry.integrywmsnative.core.rest.deserializer;
import androidx.lifecycle.MutableLiveData;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
public class MutableLiveDataDeserializer implements JsonDeserializer<MutableLiveData<?>> {
@Override
public MutableLiveData<?> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
Type type = ((ParameterizedType) typeOfT).getActualTypeArguments()[0];
MutableLiveData<Object> liveData = new MutableLiveData<>();
liveData.setValue(context.deserialize(json, type));
return liveData;
}
}

View File

@ -0,0 +1,16 @@
package it.integry.integrywmsnative.core.rest.serializer;
import androidx.lifecycle.MutableLiveData;
import com.google.gson.JsonElement;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import java.lang.reflect.Type;
public class MutableLiveDataSerializer implements JsonSerializer<MutableLiveData<?>> {
@Override
public JsonElement serialize(MutableLiveData<?> src, Type typeOfSrc, JsonSerializationContext context) {
return context.serialize(src.getValue());
}
}

View File

@ -40,4 +40,5 @@ public class UtilityDialog {
// dialog.getWindow().setLayout(width, LinearLayout.LayoutParams.WRAP_CONTENT); // dialog.getWindow().setLayout(width, LinearLayout.LayoutParams.WRAP_CONTENT);
// } // }
} }

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.core.utility; package it.integry.integrywmsnative.core.utility;
import androidx.lifecycle.MutableLiveData;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
@ -12,10 +14,12 @@ import it.integry.integrywmsnative.core.model.secondary.StatoPartitaMag;
import it.integry.integrywmsnative.core.rest.deserializer.LocalDateDeserializer; import it.integry.integrywmsnative.core.rest.deserializer.LocalDateDeserializer;
import it.integry.integrywmsnative.core.rest.deserializer.LocalDateTimeDeserializer; import it.integry.integrywmsnative.core.rest.deserializer.LocalDateTimeDeserializer;
import it.integry.integrywmsnative.core.rest.deserializer.MtbTcolFlagUiUlDeserializer; import it.integry.integrywmsnative.core.rest.deserializer.MtbTcolFlagUiUlDeserializer;
import it.integry.integrywmsnative.core.rest.deserializer.MutableLiveDataDeserializer;
import it.integry.integrywmsnative.core.rest.deserializer.StatoPartitaMagDeserializer; import it.integry.integrywmsnative.core.rest.deserializer.StatoPartitaMagDeserializer;
import it.integry.integrywmsnative.core.rest.serializer.LocalDateSerializer; import it.integry.integrywmsnative.core.rest.serializer.LocalDateSerializer;
import it.integry.integrywmsnative.core.rest.serializer.LocalDateTimeSerializer; import it.integry.integrywmsnative.core.rest.serializer.LocalDateTimeSerializer;
import it.integry.integrywmsnative.core.rest.serializer.MtbTcolFlagUiUlSerializer; import it.integry.integrywmsnative.core.rest.serializer.MtbTcolFlagUiUlSerializer;
import it.integry.integrywmsnative.core.rest.serializer.MutableLiveDataSerializer;
import it.integry.integrywmsnative.core.rest.serializer.StatoPartitaMagSerializer; import it.integry.integrywmsnative.core.rest.serializer.StatoPartitaMagSerializer;
public class UtilityGson { public class UtilityGson {
@ -24,6 +28,8 @@ public class UtilityGson {
return new GsonBuilder() return new GsonBuilder()
.setDateFormat("dd/MM/yyyy HH:mm:ss") .setDateFormat("dd/MM/yyyy HH:mm:ss")
.excludeFieldsWithModifiers(Modifier.TRANSIENT) .excludeFieldsWithModifiers(Modifier.TRANSIENT)
.registerTypeAdapter(MutableLiveData.class, new MutableLiveDataDeserializer())
.registerTypeAdapter(MutableLiveData.class, new MutableLiveDataSerializer())
.registerTypeAdapter(LocalDate.class, new LocalDateDeserializer()) .registerTypeAdapter(LocalDate.class, new LocalDateDeserializer())
.registerTypeAdapter(LocalDate.class, new LocalDateSerializer()) .registerTypeAdapter(LocalDate.class, new LocalDateSerializer())
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeDeserializer()) .registerTypeAdapter(LocalDateTime.class, new LocalDateTimeDeserializer())

View File

@ -98,7 +98,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
public BindableBoolean noLUPresent = new BindableBoolean(true); public BindableBoolean noLUPresent = new BindableBoolean(true);
public BindableBoolean bottomSheetEnabled = new BindableBoolean(false); public BindableBoolean bottomSheetEnabled = new BindableBoolean(false);
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
private boolean mShowSecondaryUntMis = true; private boolean mShowSecondaryUntMis = true;
private boolean mShouldCloseActivity; private boolean mShouldCloseActivity;
private AccettazioneBollaPickingOrderBy.Enum mCurrentOrderBy; private AccettazioneBollaPickingOrderBy.Enum mCurrentOrderBy;
@ -182,10 +182,10 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
this.mBindings.bottomSheetLuContent.collapse(); this.mBindings.bottomSheetLuContent.collapse();
} else if (!noLUPresent.get()) { } else if (!noLUPresent.get()) {
this.mShouldCloseActivity = true; this.mShouldCloseActivity = true;
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
this.mViewModel.closeLU(); this.mViewModel.closeLU();
} else { } else {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
super.onBackPressed(); super.onBackPressed();
} }
} }
@ -199,7 +199,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
} }
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false))); .setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
} }
@ -590,7 +590,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
UtilityExceptions.defaultException(this, ex); UtilityExceptions.defaultException(this, ex);
} }
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
@Override @Override
@ -600,7 +600,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal
totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String
partitaMag, LocalDate dataScad, boolean canPartitaMagBeChanged, partitaMag, LocalDate dataScad, boolean canPartitaMagBeChanged,
boolean canOverflowQuantity, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) { boolean canOverflowQuantity, RunnableArgs<PickedQuantityDTO> onComplete) {
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO() DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
.setMtbAart(mtbAart) .setMtbAart(mtbAart)
.setInitialNumCnf(initialNumCnf) .setInitialNumCnf(initialNumCnf)
@ -625,14 +625,19 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
if (!mDialogInputQuantityV2View.isVisible()) if (!mDialogInputQuantityV2View.isVisible())
mDialogInputQuantityV2View mDialogInputQuantityV2View
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete(resultDTO -> {
if(resultDTO.isAborted()) {
this.mViewModel.resetMatchedRows();
return;
}
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, shouldCloseLU); onComplete.run(pickedQuantityDTO);
}) })
.setOnAbort(() -> this.mViewModel.resetMatchedRows()) .setOnAbort(() -> this.mViewModel.resetMatchedRows())
.show(getSupportFragmentManager(), "tag"); .show(getSupportFragmentManager(), "tag");

View File

@ -594,14 +594,14 @@ public class AccettazioneBollaPickingViewModel {
partitaMag, partitaMag,
dataScad, dataScad,
true, true,
(pickedQuantityDTO, shouldCloseLU) -> { pickedQuantityDTO -> {
this.saveNewRow(pickingObjectDTO, this.saveNewRow(pickingObjectDTO,
pickedQuantityDTO.getNumCnf(), pickedQuantityDTO.getNumCnf(),
pickedQuantityDTO.getQtaCnf(), pickedQuantityDTO.getQtaCnf(),
pickedQuantityDTO.getQtaTot(), pickedQuantityDTO.getQtaTot(),
pickedQuantityDTO.getPartitaMag(), pickedQuantityDTO.getPartitaMag(),
pickedQuantityDTO.getDataScad(), pickedQuantityDTO.getDataScad(),
shouldCloseLU); pickedQuantityDTO.isShouldCloseLu());
}); });
} else { } else {
this.saveNewRow( this.saveNewRow(
@ -694,7 +694,9 @@ public class AccettazioneBollaPickingViewModel {
mtbColrToEdit.getPartitaMag(), mtbColrToEdit.getPartitaMag(),
mtbColrToEdit.getDataScadPartita(), mtbColrToEdit.getDataScadPartita(),
true, true,
(pickedQuantityDTO, shouldCloseLU) -> { pickedQuantityDTO -> {
if(pickedQuantityDTO == null)
return;
this.saveEditedRow(mtbColrToEdit, this.saveEditedRow(mtbColrToEdit,
pickedQuantityDTO.getNumCnf(), pickedQuantityDTO.getNumCnf(),
@ -702,7 +704,7 @@ public class AccettazioneBollaPickingViewModel {
pickedQuantityDTO.getQtaTot(), pickedQuantityDTO.getQtaTot(),
pickedQuantityDTO.getPartitaMag(), pickedQuantityDTO.getPartitaMag(),
pickedQuantityDTO.getDataScad(), pickedQuantityDTO.getDataScad(),
shouldCloseLU); pickedQuantityDTO.isShouldCloseLu());
}); });
} }
@ -982,7 +984,7 @@ public class AccettazioneBollaPickingViewModel {
String partitaMag, String partitaMag,
LocalDate dataScad, LocalDate dataScad,
boolean canPartitaMagBeChanged, boolean canPartitaMagBeChanged,
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) { RunnableArgs<PickedQuantityDTO> onComplete) {
if (this.mListener != null) mListener.onItemDispatched(pickingObjectDTO, if (this.mListener != null) mListener.onItemDispatched(pickingObjectDTO,
mtbAart, mtbAart,
initialNumCnf, initialNumCnf,
@ -1065,7 +1067,7 @@ public class AccettazioneBollaPickingViewModel {
LocalDate dataScad, LocalDate dataScad,
boolean canPartitaMagBeChanged, boolean canPartitaMagBeChanged,
boolean canOverflowQuantity, boolean canOverflowQuantity,
RunnableArgss<PickedQuantityDTO, Boolean> onComplete); RunnableArgs<PickedQuantityDTO> onComplete);
void onFilterCodMartApplied(String codMartToFilter); void onFilterCodMartApplied(String codMartToFilter);

View File

@ -103,7 +103,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
public BindableBoolean noLUPresent = new BindableBoolean(true); public BindableBoolean noLUPresent = new BindableBoolean(true);
public BindableBoolean bottomSheetEnabled = new BindableBoolean(false); public BindableBoolean bottomSheetEnabled = new BindableBoolean(false);
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
private List<OrdineAccettazioneInevasoDTO> mOrders; private List<OrdineAccettazioneInevasoDTO> mOrders;
private List<SitArtOrdDTO> mSitArts; private List<SitArtOrdDTO> mSitArts;
@ -306,10 +306,10 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
this.mBindings.bottomSheetLuContent.collapse(); this.mBindings.bottomSheetLuContent.collapse();
} else if (!noLUPresent.get()) { } else if (!noLUPresent.get()) {
this.mShouldCloseActivity = true; this.mShouldCloseActivity = true;
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
this.mViewModel.closeLU(); this.mViewModel.closeLU();
} else { } else {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
super.onBackPressed(); super.onBackPressed();
} }
} }
@ -340,7 +340,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
} }
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO().setOnScanSuccessful(onScanSuccessful).setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false))); mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO().setOnScanSuccessful(onScanSuccessful).setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
} }
private void initRecyclerView() { private void initRecyclerView() {
@ -753,7 +753,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
UtilityExceptions.defaultException(this, ex); UtilityExceptions.defaultException(this, ex);
} }
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
@Override @Override
@ -771,17 +771,24 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO().setMtbAart(mtbAart).setInitialNumCnf(initialNumCnf).setInitialQtaCnf(initialQtaCnf).setInitialQtaTot(initialQtaTot).setTotalQtaOrd(totalQtaOrd).setTotalNumCnfOrd(totalNumCnfOrd).setQtaCnfOrd(qtaCnfOrd).setTotalQtaToBeTaken(totalQtaToBeTaken).setTotalNumCnfToBeTaken(totalNumCnfToBeTaken).setQtaCnfToBeTaken(qtaCnfToBeTaken).setTotalQtaAvailable(totalQtaAvailable).setTotalNumCnfAvailable(totalNumCnfAvailable).setQtaCnfAvailable(qtaCnfAvailable).setPartitaMag(partitaMag).setDataScad(dataScad).setCanPartitaMagBeChanged(canPartitaMagBeChanged).setCanLUBeClosed(true).setCanOverflowOrderQuantity(canOverflowQuantity).setCustomArtDescription(customArtDescription); DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO().setMtbAart(mtbAart).setInitialNumCnf(initialNumCnf).setInitialQtaCnf(initialQtaCnf).setInitialQtaTot(initialQtaTot).setTotalQtaOrd(totalQtaOrd).setTotalNumCnfOrd(totalNumCnfOrd).setQtaCnfOrd(qtaCnfOrd).setTotalQtaToBeTaken(totalQtaToBeTaken).setTotalNumCnfToBeTaken(totalNumCnfToBeTaken).setQtaCnfToBeTaken(qtaCnfToBeTaken).setTotalQtaAvailable(totalQtaAvailable).setTotalNumCnfAvailable(totalNumCnfAvailable).setQtaCnfAvailable(qtaCnfAvailable).setPartitaMag(partitaMag).setDataScad(dataScad).setCanPartitaMagBeChanged(canPartitaMagBeChanged).setCanLUBeClosed(true).setCanOverflowOrderQuantity(canOverflowQuantity).setCustomArtDescription(customArtDescription);
if (!mDialogInputQuantityV2View.isVisible()) if (!mDialogInputQuantityV2View.isVisible())
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO).setOnComplete((resultDTO, shouldCloseLU) -> { mDialogInputQuantityV2View
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO().setNumCnf(resultDTO.getNumCnf()).setQtaCnf(resultDTO.getQtaCnf()).setQtaTot(resultDTO.getQtaTot()).setPartitaMag(resultDTO.getPartitaMag()).setDataScad(resultDTO.getDataScad()); .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO).setOnComplete(resultDTO -> {
onComplete.run(pickedQuantityDTO, shouldCloseLU); if (resultDTO == null) {
}).setOnAbort(() -> this.mViewModel.resetMatchedRows()).show(getSupportFragmentManager(), "tag"); this.mViewModel.resetMatchedRows();
return;
}
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO().setNumCnf(resultDTO.getNumCnf()).setQtaCnf(resultDTO.getQtaCnf()).setQtaTot(resultDTO.getQtaTot()).setPartitaMag(resultDTO.getPartitaMag()).setDataScad(resultDTO.getDataScad());
onComplete.run(pickedQuantityDTO, pickedQuantityDTO.isShouldCloseLu());
})
.setOnAbort(() -> this.mViewModel.resetMatchedRows())
.show(getSupportFragmentManager(), "tag");
} }
@Override @Override
public void onRowSaved() { public void onRowSaved() {
runOnUiThread(() -> { runOnUiThread(() -> {
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT) Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
.setBackgroundTint(getResources().getColor(R. color. green_500)) .setBackgroundTint(getResources().getColor(R.color.green_500))
.show(); .show();
}); });
} }
@ -828,7 +835,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
runOnUiThread(() -> { runOnUiThread(() -> {
noLUPresent.set(false); noLUPresent.set(false);
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT) Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
.setBackgroundTint(getResources().getColor(R. color. green_500)) .setBackgroundTint(getResources().getColor(R.color.green_500))
.show(); .show();
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(mtbColt); this.mBottomSheetFragmentLUContentViewModel.setMtbColt(mtbColt);

View File

@ -70,7 +70,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
DialogInputQuantityV2View dialogInputQuantityV2View; DialogInputQuantityV2View dialogInputQuantityV2View;
private int mBarcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
private ActivityContabDocInterniEditBinding binding; private ActivityContabDocInterniEditBinding binding;
public BindableString documentHeader = new BindableString(true); public BindableString documentHeader = new BindableString(true);
public BindableString documentRifHeader = new BindableString(true); public BindableString documentRifHeader = new BindableString(true);
@ -238,12 +238,12 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
} }
public void manualSearch() { public void manualSearch() {
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
DialogSimpleInputHelper.makeInputDialog(this, DialogSimpleInputHelper.makeInputDialog(this,
"Ricerca articolo", "Ricerca articolo",
null, null,
"Cod articolo / Barcode", "Cod articolo / Barcode",
barcodeProd -> this.viewModel.loadArticoloByCodMartOrBarcode(barcodeProd), BarcodeManager::enable).show(); barcodeProd -> this.viewModel.loadArticoloByCodMartOrBarcode(barcodeProd), () -> BarcodeManager.enable(mBarcodeScannerInstanceID)).show();
} }
@ -263,7 +263,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
return; return;
} }
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(this.viewModel::processBarcode) .setOnScanSuccessful(this.viewModel::processBarcode)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
this.viewModel.fetchDocumentRows(); this.viewModel.fetchDocumentRows();
@ -271,7 +271,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
@Override @Override
protected void onDestroy() { protected void onDestroy() {
BarcodeManager.removeCallback(mBarcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
super.onDestroy(); super.onDestroy();
} }
@ -356,7 +356,9 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
if (!dialogInputQuantityV2View.isAdded()) if (!dialogInputQuantityV2View.isAdded())
dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete(resultDTO -> {
if(resultDTO == null || resultDTO.isAborted()) return;
this.onLoadingStarted(); this.onLoadingStarted();
this.viewModel.saveRow(row, resultDTO); this.viewModel.saveRow(row, resultDTO);
}) })
@ -385,7 +387,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
@Override @Override
public void onBackPressed() { public void onBackPressed() {
BarcodeManager.removeCallback(mBarcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
super.onBackPressed(); super.onBackPressed();
} }

View File

@ -43,7 +43,7 @@ public class ElencoInventariFragment extends BaseFragment implements ITitledFrag
public ObservableField<Boolean> canCreateInventario = new ObservableField<>(false); public ObservableField<Boolean> canCreateInventario = new ObservableField<>(false);
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
public ElencoInventariFragment() { public ElencoInventariFragment() {
// Required empty public constructor // Required empty public constructor

View File

@ -61,7 +61,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
private static final String KEY_INVENTARIO = "key_inventario"; private static final String KEY_INVENTARIO = "key_inventario";
private static final String KEY_INVENTARIO_ARTS = "key_inventario_arts"; private static final String KEY_INVENTARIO_ARTS = "key_inventario_arts";
private int barcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
//Pass here all external parameters //Pass here all external parameters
public static void startActivity(Context context, InventarioRoomDTO inventarioRoomDTO, List<InventarioArtDTO> inventarioArts) { public static void startActivity(Context context, InventarioRoomDTO inventarioRoomDTO, List<InventarioArtDTO> inventarioArts) {
@ -125,7 +125,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
@Override @Override
public void onBackPressed() { public void onBackPressed() {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
super.onBackPressed(); super.onBackPressed();
} }
@ -177,7 +177,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
} }
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false))); .setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
} }
@ -209,14 +209,14 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
} }
public void manualSearch() { public void manualSearch() {
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
DialogSimpleInputHelper.makeInputDialog(this, DialogSimpleInputHelper.makeInputDialog(this,
"Ricerca articolo", "Ricerca articolo",
null, null,
"Cod articolo / Barcode", "Cod articolo / Barcode",
barcodeProd -> barcodeProd ->
this.mViewModel.loadArticoloByCodMartOrBarcode(barcodeProd, BarcodeManager::enable), this.mViewModel.loadArticoloByCodMartOrBarcode(barcodeProd, () -> BarcodeManager.enable(mBarcodeScannerInstanceID)),
BarcodeManager::enable) () -> BarcodeManager.enable(mBarcodeScannerInstanceID))
.show(); .show();
} }
@ -241,7 +241,9 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
if (!mDialogInputQuantityV2View.isVisible()) if (!mDialogInputQuantityV2View.isVisible())
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete(resultDTO -> {
if(resultDTO == null || resultDTO.isAborted()) return;
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setNumCnf(resultDTO.getNumCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaCnf(resultDTO.getQtaCnf()) .setQtaCnf(resultDTO.getQtaCnf())
@ -249,7 +251,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
.setPartitaMag(resultDTO.getPartitaMag()) .setPartitaMag(resultDTO.getPartitaMag())
.setDataScad(resultDTO.getDataScad()); .setDataScad(resultDTO.getDataScad());
onComplete.run(pickedQuantityDTO, shouldCloseLU); onComplete.run(pickedQuantityDTO, pickedQuantityDTO.isShouldCloseLu());
}) })
.show(getSupportFragmentManager(), "tag"); .show(getSupportFragmentManager(), "tag");
} }

View File

@ -87,7 +87,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
private PickingLiberoListAdapter mAdapter; private PickingLiberoListAdapter mAdapter;
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
private GestioneEnum mCurrentGestione; private GestioneEnum mCurrentGestione;
private boolean mAskCliente; private boolean mAskCliente;
@ -171,11 +171,11 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
} }
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false))); .setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
@ -206,11 +206,11 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
} }
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> { private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
this.onLoadingStarted(); this.onLoadingStarted();
this.mViewModel.processBarcodeDTO(data, () -> { this.mViewModel.processBarcodeDTO(data, () -> {
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
this.onLoadingEnded(); this.onLoadingEnded();
}); });
}; };
@ -294,7 +294,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
UtilityExceptions.defaultException(getActivity(), ex); UtilityExceptions.defaultException(getActivity(), ex);
} }
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
}); });
} }
@ -321,7 +321,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
DialogChooseArtsFromMtbColrList DialogChooseArtsFromMtbColrList
.newInstance(mtbColrsToPick, mtbAart, onComplete, () -> { .newInstance(mtbColrsToPick, mtbAart, onComplete, () -> {
onAbort.run(); onAbort.run();
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
}) })
.show(requireActivity().getSupportFragmentManager(), DialogChooseArtsFromMtbColrList.class.getName()); .show(requireActivity().getSupportFragmentManager(), DialogChooseArtsFromMtbColrList.class.getName());
} }
@ -365,7 +365,12 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
if (!mDialogInputQuantityV2View.isVisible()) if (!mDialogInputQuantityV2View.isVisible())
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete(resultDTO -> {
if(resultDTO == null || resultDTO.isAborted()) {
this.onLoadingEnded();
return;
}
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setNumCnf(resultDTO.getNumCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaCnf(resultDTO.getQtaCnf()) .setQtaCnf(resultDTO.getQtaCnf())
@ -374,7 +379,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
.setDataScad(resultDTO.getDataScad()); .setDataScad(resultDTO.getDataScad());
this.onLoadingStarted(); this.onLoadingStarted();
onComplete.run(pickedQuantityDTO, shouldCloseLU); onComplete.run(pickedQuantityDTO, resultDTO.isShouldCloseLu());
}) })
.setOnAbort(this::onLoadingEnded) .setOnAbort(this::onLoadingEnded)
.show(requireActivity().getSupportFragmentManager(), "tag"); .show(requireActivity().getSupportFragmentManager(), "tag");
@ -402,7 +407,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
@Override @Override
public void onPreDestroy(Runnable onComplete) { public void onPreDestroy(Runnable onComplete) {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
if (thereIsAnOpenedUL.get()) mViewModel.closeLU(onComplete); if (thereIsAnOpenedUL.get()) mViewModel.closeLU(onComplete);
else onComplete.run(); else onComplete.run();
} }

View File

@ -79,7 +79,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
private String mTitle; private String mTitle;
private List<DocumentoResoDTO> mDocumentiResiList; private List<DocumentoResoDTO> mDocumentiResiList;
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
private boolean mShouldCloseActivity; private boolean mShouldCloseActivity;
@ -150,10 +150,10 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
this.mBindings.bottomSheetLuContent.collapse(); this.mBindings.bottomSheetLuContent.collapse();
} else if (!noLUPresent.get()) { } else if (!noLUPresent.get()) {
this.mShouldCloseActivity = true; this.mShouldCloseActivity = true;
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
this.mViewmodel.closeLU(true); this.mViewmodel.closeLU(true);
} else { } else {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
super.onBackPressed(); super.onBackPressed();
} }
} }
@ -166,7 +166,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
} }
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false))); .setOnScanFailed(ex -> UtilityExceptions.defaultException(this, ex, false)));
} }
@ -301,7 +301,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
UtilityExceptions.defaultException(this, ex); UtilityExceptions.defaultException(this, ex);
} }
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
@Override @Override
@ -332,7 +332,12 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
if (!mDialogInputQuantityV2View.isVisible()) if (!mDialogInputQuantityV2View.isVisible())
mDialogInputQuantityV2View mDialogInputQuantityV2View
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete(resultDTO -> {
if(resultDTO == null || resultDTO.isAborted()) {
this.mViewmodel.resetMatchedRows();
return;
}
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setNumCnf(resultDTO.getNumCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaCnf(resultDTO.getQtaCnf()) .setQtaCnf(resultDTO.getQtaCnf())
@ -341,7 +346,7 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
.setDataScad(resultDTO.getDataScad()); .setDataScad(resultDTO.getDataScad());
this.onLoadingStarted(); this.onLoadingStarted();
onComplete.run(pickedQuantityDTO, shouldCloseLU); onComplete.run(pickedQuantityDTO, resultDTO.isShouldCloseLu());
}) })
.setOnAbort(() -> { .setOnAbort(() -> {
this.mViewmodel.resetMatchedRows(); this.mViewmodel.resetMatchedRows();

View File

@ -56,7 +56,7 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
public final BindableString productDescription = new BindableString(); public final BindableString productDescription = new BindableString();
private Runnable onResumeRunnable = null; private Runnable onResumeRunnable = null;
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
@Inject @Inject
ProdDettaglioLineaViewModel mViewModel; ProdDettaglioLineaViewModel mViewModel;
@ -152,7 +152,7 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
@Override @Override
public void onSettingsRequest(ProdLineStatusDTO lineaProd) { public void onSettingsRequest(ProdLineStatusDTO lineaProd) {
BottomSheetLineAction.newInstance(lineaProd, this::requestResources, this::requestOrderChange, this::requestProductionStop, this::requestMaterialRecover, BarcodeManager::enable).show(getSupportFragmentManager(), "BottomSheetLineAction"); BottomSheetLineAction.newInstance(lineaProd, this::requestResources, this::requestOrderChange, this::requestProductionStop, this::requestMaterialRecover, () -> BarcodeManager.enable(mBarcodeScannerInstanceID)).show(getSupportFragmentManager(), "BottomSheetLineAction");
} }
@Override @Override
@ -166,7 +166,7 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
onConfirm, onConfirm,
() -> { () -> {
onLoadingEnded(); onLoadingEnded();
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
).show(getSupportFragmentManager(), "confirmOrderClose"); ).show(getSupportFragmentManager(), "confirmOrderClose");
}); });
@ -196,7 +196,12 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
onLoadingEnded(); onLoadingEnded();
mDialogInputQuantityV2View mDialogInputQuantityV2View
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete(resultDTO -> {
if(resultDTO == null || resultDTO.isAborted()) {
this.onLoadingEnded();
return;
}
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setNumCnf(resultDTO.getNumCnf()) .setNumCnf(resultDTO.getNumCnf())
@ -220,17 +225,17 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
public void requestResources() { public void requestResources() {
this.onLoadingEnded(); this.onLoadingEnded();
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
this.runOnUiThread(() -> { this.runOnUiThread(() -> {
@ -242,7 +247,7 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
this.onError(new Exception("Inserire un numero di risorse valido")); this.onError(new Exception("Inserire un numero di risorse valido"));
} }
}, BarcodeManager::enable, InputType.TYPE_CLASS_NUMBER).show(); }, () -> BarcodeManager.enable(mBarcodeScannerInstanceID), InputType.TYPE_CLASS_NUMBER).show();
}); });
} }
@ -257,7 +262,7 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
public void requestProductionStop() { public void requestProductionStop() {
this.onLoadingEnded(); this.onLoadingEnded();
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
ProdLineStatusDTO lineaProd = mViewModel.getLineaProd(); ProdLineStatusDTO lineaProd = mViewModel.getLineaProd();
if (UtilityString.isNullOrEmpty(lineaProd.getListaOrd())) { if (UtilityString.isNullOrEmpty(lineaProd.getListaOrd())) {
mViewModel.stopProduction(); mViewModel.stopProduction();
@ -272,7 +277,7 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
public void requestMaterialRecover() { public void requestMaterialRecover() {
this.onLoadingEnded(); this.onLoadingEnded();
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
this.runOnUiThread(() -> { this.runOnUiThread(() -> {
getSupportFragmentManager() getSupportFragmentManager()
.beginTransaction() .beginTransaction()
@ -288,7 +293,7 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
@Override @Override
public void successDialog(String message, Runnable onComplete) { public void successDialog(String message, Runnable onComplete) {
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
this.runOnUiThread(() -> DialogSimpleMessageView.makeSuccessDialog(getResources().getString(R.string.success), this.runOnUiThread(() -> DialogSimpleMessageView.makeSuccessDialog(getResources().getString(R.string.success),
new SpannableString(message), null, onComplete).show(getSupportFragmentManager(), "successDialog")); new SpannableString(message), null, onComplete).show(getSupportFragmentManager(), "successDialog"));
@ -296,10 +301,9 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
} }
@Override @Override
public void showToast(String message, Runnable onComplete) { public void showToast(String message) {
this.runOnUiThread(() -> { this.runOnUiThread(() -> {
UtilityToast.showToast(message); UtilityToast.showToast(message);
onComplete.run();
}); });
} }
@ -332,7 +336,7 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
onConfirm onConfirm
).show(getSupportFragmentManager(), "confirmOrderClose"); ).show(getSupportFragmentManager(), "confirmOrderClose");
}, },
BarcodeManager::enable () -> BarcodeManager.enable(mBarcodeScannerInstanceID)
).show(getSupportFragmentManager(), "confirmOrderClose"); ).show(getSupportFragmentManager(), "confirmOrderClose");
}); });
} }
@ -348,7 +352,7 @@ public class ProdDettaglioLineaActivity extends BaseActivity implements ProdDett
if (count > 0) { if (count > 0) {
getSupportFragmentManager().popBackStack(); getSupportFragmentManager().popBackStack();
} else { } else {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
super.onBackPressed(); super.onBackPressed();
} }
} }

View File

@ -5,7 +5,6 @@ import androidx.lifecycle.MutableLiveData;
import javax.inject.Inject; import javax.inject.Inject;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO; import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
import it.integry.integrywmsnative.core.exception.NoLUFoundException; import it.integry.integrywmsnative.core.exception.NoLUFoundException;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener; import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
@ -91,7 +90,7 @@ public class ProdDettaglioLineaViewModel {
this.colliMagazzinoRESTConsumer.createColloScaricoDaCarico(mtbColt, posizione, this.colliMagazzinoRESTConsumer.createColloScaricoDaCarico(mtbColt, posizione,
generatedMtbColt -> { generatedMtbColt -> {
this.sendOnLoadingEnded(); this.sendOnLoadingEnded();
this.mListener.showToast("Versamento completato!", BarcodeManager::enable); this.mListener.showToast("Versamento completato!");
}, this::sendError); }, this::sendError);
}); });
}); });
@ -221,7 +220,7 @@ public class ProdDettaglioLineaViewModel {
void successDialog(String message, Runnable onComplete); void successDialog(String message, Runnable onComplete);
void showToast(String message, Runnable onComplete); void showToast(String message);
void requestQtaVersamento(MtbColr mtbColr, RunnableArgs<PickedQuantityDTO> onComplete); void requestQtaVersamento(MtbColr mtbColr, RunnableArgs<PickedQuantityDTO> onComplete);

View File

@ -20,7 +20,7 @@ import it.integry.integrywmsnative.core.utility.UtilityBarcode;
import it.integry.integrywmsnative.databinding.DialogStartProductionBinding; import it.integry.integrywmsnative.databinding.DialogStartProductionBinding;
public class DialogRecoverUl extends BaseDialogFragment { public class DialogRecoverUl extends BaseDialogFragment {
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
private RunnableArgs<BarcodeScanDTO> onScanSuccessful; private RunnableArgs<BarcodeScanDTO> onScanSuccessful;
private DialogStartProductionBinding mBinding; private DialogStartProductionBinding mBinding;
@ -37,7 +37,7 @@ public class DialogRecoverUl extends BaseDialogFragment {
@Override @Override
public void onDismiss(@NonNull DialogInterface dialog) { public void onDismiss(@NonNull DialogInterface dialog) {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
super.onDismiss(dialog); super.onDismiss(dialog);
} }
@ -60,10 +60,10 @@ public class DialogRecoverUl extends BaseDialogFragment {
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(this::processBarcode) .setOnScanSuccessful(this::processBarcode)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
private void processBarcode(BarcodeScanDTO barcodeScanDTO) { private void processBarcode(BarcodeScanDTO barcodeScanDTO) {

View File

@ -21,7 +21,7 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.databinding.DialogStartProductionBinding; import it.integry.integrywmsnative.databinding.DialogStartProductionBinding;
public class DialogStartProduction extends BaseDialogFragment { public class DialogStartProduction extends BaseDialogFragment {
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
private RunnableArgs<BarcodeScanDTO> onScanSuccessful; private RunnableArgs<BarcodeScanDTO> onScanSuccessful;
private DialogStartProductionBinding mBinding; private DialogStartProductionBinding mBinding;
private String title; private String title;
@ -57,7 +57,7 @@ public class DialogStartProduction extends BaseDialogFragment {
@Override @Override
public void onDismiss(@NonNull DialogInterface dialog) { public void onDismiss(@NonNull DialogInterface dialog) {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
super.onDismiss(dialog); super.onDismiss(dialog);
} }
@ -88,10 +88,10 @@ public class DialogStartProduction extends BaseDialogFragment {
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(this::processBarcode) .setOnScanSuccessful(this::processBarcode)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
private void processBarcode(BarcodeScanDTO barcodeScanDTO) { private void processBarcode(BarcodeScanDTO barcodeScanDTO) {

View File

@ -41,7 +41,7 @@ public class ProdLineeProduzioneFragment extends BaseFragment implements ITitled
private final ObservableArrayList<ProdLineStatusDTO> mLinesObservableList = new ObservableArrayList<>(); private final ObservableArrayList<ProdLineStatusDTO> mLinesObservableList = new ObservableArrayList<>();
private FragmentLineeProdBinding mBinding; private FragmentLineeProdBinding mBinding;
private ElevatedToolbar mToolbar; private ElevatedToolbar mToolbar;
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
public static ProdLineeProduzioneFragment newInstance() { public static ProdLineeProduzioneFragment newInstance() {
return new ProdLineeProduzioneFragment(); return new ProdLineeProduzioneFragment();
@ -73,7 +73,7 @@ public class ProdLineeProduzioneFragment extends BaseFragment implements ITitled
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
} }
@ -112,7 +112,7 @@ public class ProdLineeProduzioneFragment extends BaseFragment implements ITitled
public void requestResources(ProdLineStatusDTO prodLine) { public void requestResources(ProdLineStatusDTO prodLine) {
this.onLoadingEnded(); this.onLoadingEnded();
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
requireActivity().runOnUiThread(() -> { requireActivity().runOnUiThread(() -> {
DialogSimpleInputHelper.makeInputDialog(requireContext(), "Inserisci il numero di risorse da allocare", prodLine.getQtaAllocate().toString(), "n. risorse", qta -> { DialogSimpleInputHelper.makeInputDialog(requireContext(), "Inserisci il numero di risorse da allocare", prodLine.getQtaAllocate().toString(), "n. risorse", qta -> {
@ -123,13 +123,13 @@ public class ProdLineeProduzioneFragment extends BaseFragment implements ITitled
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
this.onError(new Exception("Inserire un numero di risorse valido")); this.onError(new Exception("Inserire un numero di risorse valido"));
} }
}, BarcodeManager::enable, InputType.TYPE_CLASS_NUMBER).show(); }, () -> BarcodeManager.enable(mBarcodeScannerInstanceID), InputType.TYPE_CLASS_NUMBER).show();
}); });
} }
@Override @Override
public void successDialog(String message, Runnable onComplete) { public void successDialog(String message, Runnable onComplete) {
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
requireActivity().runOnUiThread(() -> DialogSimpleMessageView.makeSuccessDialog(getResources().getString(R.string.success), requireActivity().runOnUiThread(() -> DialogSimpleMessageView.makeSuccessDialog(getResources().getString(R.string.success),
new SpannableString(message), null, onComplete).show(getChildFragmentManager(), "successDialog")); new SpannableString(message), null, onComplete).show(getChildFragmentManager(), "successDialog"));
@ -138,7 +138,7 @@ public class ProdLineeProduzioneFragment extends BaseFragment implements ITitled
@Override @Override
public void selectLine(ProdLineStatusDTO dto) { public void selectLine(ProdLineStatusDTO dto) {
this.onLoadingEnded(); this.onLoadingEnded();
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
if (!dto.isStarted()) { if (!dto.isStarted()) {
this.requestResources(dto); this.requestResources(dto);

View File

@ -34,9 +34,9 @@ public class ProdLineeProduzioneViewModel {
private void reloadLines() { private void reloadLines() {
sendOnLoadingStarted(); sendOnLoadingStarted();
BarcodeManager.disable(); BarcodeManager.disableLastCallback();
this.productionLinesRESTConsumer.getStatoLinee(SettingsManager.i().getUserSession().getDepo().getCodMdep(), lineeProdList -> { this.productionLinesRESTConsumer.getStatoLinee(SettingsManager.i().getUserSession().getDepo().getCodMdep(), lineeProdList -> {
BarcodeManager.enable(); BarcodeManager.enableLastCallback();
prodLines.postValue(lineeProdList); prodLines.postValue(lineeProdList);
this.sendOnLoadingEnded(); this.sendOnLoadingEnded();
}, this::sendError); }, this::sendError);

View File

@ -56,7 +56,7 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
private FragmentProdRecuperoMaterialeBinding mBinding; private FragmentProdRecuperoMaterialeBinding mBinding;
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
private String codJfas; private String codJfas;
private String fragmentResultKeyString; private String fragmentResultKeyString;
@ -118,8 +118,8 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
this.addOnPreDestroy(() -> { this.addOnPreDestroy(() -> {
if (barcodeScannerIstanceID > -1) { if (mBarcodeScannerInstanceID > -1) {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
} }
}); });
mViewModel.init(codJfas); mViewModel.init(codJfas);
@ -133,11 +133,11 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
public String getCodJfas() { public String getCodJfas() {
@ -248,7 +248,12 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
if (!mDialogInputQuantityV2View.isVisible()) if (!mDialogInputQuantityV2View.isVisible())
mDialogInputQuantityV2View mDialogInputQuantityV2View
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete(resultDTO -> {
if(resultDTO == null || resultDTO.isAborted()) {
this.onLoadingEnded();
return;
}
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setNumCnf(resultDTO.getNumCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaCnf(resultDTO.getQtaCnf()) .setQtaCnf(resultDTO.getQtaCnf())

View File

@ -212,13 +212,13 @@ public class ProdRientroMerceFragment extends BaseFragment implements
@Override @Override
public void onOrderLoadingStarted() { public void onOrderLoadingStarted() {
BarcodeManager.disable(); BarcodeManager.disableLastCallback();
this.mProdRientroMerceOrderListFragment.onOrderLoadingStarted(); this.mProdRientroMerceOrderListFragment.onOrderLoadingStarted();
} }
@Override @Override
public void onOrderLoadingEnded() { public void onOrderLoadingEnded() {
BarcodeManager.enable(); BarcodeManager.enableLastCallback();
this.mProdRientroMerceOrderListFragment.onOrderLoadingEnded(); this.mProdRientroMerceOrderListFragment.onOrderLoadingEnded();
} }

View File

@ -278,7 +278,7 @@ public class ProdRientroMerceOrderListFragment extends Fragment {
requireActivity().runOnUiThread(() -> { requireActivity().runOnUiThread(() -> {
onOrderLoadingEnded(); onOrderLoadingEnded();
UtilityExceptions.defaultException(getActivity(), ex); UtilityExceptions.defaultException(getActivity(), ex);
BarcodeManager.enable(); BarcodeManager.enableLastCallback();
}); });
} }

View File

@ -55,7 +55,7 @@ public class ProdRiposizionamentoDaProdFragment extends BaseFragment implements
private ProdRiposizionamentoDaProdFilterViewModel mFilterViewModel = new ProdRiposizionamentoDaProdFilterViewModel(); private ProdRiposizionamentoDaProdFilterViewModel mFilterViewModel = new ProdRiposizionamentoDaProdFilterViewModel();
private final Handler mHandler = new Handler(); private final Handler mHandler = new Handler();
private final int mInterval = 120 * 1000; //2 minuti private final int mInterval = 120 * 1000; //2 minuti
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
private AppCompatTextView mAppBarTitle; private AppCompatTextView mAppBarTitle;
private String mTextFilter; private String mTextFilter;
@ -220,7 +220,7 @@ public class ProdRiposizionamentoDaProdFragment extends BaseFragment implements
public void onInfoClick(ArtsInGiacenzaDTO item) { public void onInfoClick(ArtsInGiacenzaDTO item) {
try { try {
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
DialogInfoGiacenzaView.newInstance(item).show(getChildFragmentManager(), DialogInfoGiacenzaView.class.getName()); DialogInfoGiacenzaView.newInstance(item).show(getChildFragmentManager(), DialogInfoGiacenzaView.class.getName());
} catch (Exception e) { } catch (Exception e) {
UtilityExceptions.defaultException(this.getContext(), e); UtilityExceptions.defaultException(this.getContext(), e);
@ -237,11 +237,11 @@ public class ProdRiposizionamentoDaProdFragment extends BaseFragment implements
}; };
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false))); .setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> { private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
@ -310,7 +310,7 @@ public class ProdRiposizionamentoDaProdFragment extends BaseFragment implements
@Override @Override
public void onDestroy() { public void onDestroy() {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
mHandler.removeCallbacks(mRunnable); mHandler.removeCallbacks(mRunnable);
mViewModel.setListener(null); mViewModel.setListener(null);

View File

@ -75,7 +75,7 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
public final ObservableField<Boolean> fabVisible = new ObservableField<>(false); public final ObservableField<Boolean> fabVisible = new ObservableField<>(false);
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
public ProdVersamentoMaterialeFragment() { public ProdVersamentoMaterialeFragment() {
// Required empty public constructor // Required empty public constructor
@ -193,11 +193,11 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(mViewModel::processBarcodeDTO) .setOnScanSuccessful(mViewModel::processBarcodeDTO)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
// private void openLU() { // private void openLU() {
@ -383,7 +383,12 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
if (!mDialogInputQuantityV2View.isVisible()) if (!mDialogInputQuantityV2View.isVisible())
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete(resultDTO -> {
if(resultDTO == null || resultDTO.isAborted()) {
this.onLoadingEnded();
return;
}
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setNumCnf(resultDTO.getNumCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaCnf(resultDTO.getQtaCnf()) .setQtaCnf(resultDTO.getQtaCnf())
@ -392,7 +397,7 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
.setDataScad(resultDTO.getDataScad()); .setDataScad(resultDTO.getDataScad());
this.onLoadingStarted(); this.onLoadingStarted();
onComplete.run(pickedQuantityDTO, shouldCloseLU); onComplete.run(pickedQuantityDTO, resultDTO.isShouldCloseLu());
}) })
.setOnAbort(this::onLoadingEnded) .setOnAbort(this::onLoadingEnded)
.show(requireActivity().getSupportFragmentManager(), "tag"); .show(requireActivity().getSupportFragmentManager(), "tag");

View File

@ -52,7 +52,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
private static String DATA_KEY_ORDER = "keyOrdine"; private static String DATA_KEY_ORDER = "keyOrdine";
private static String DATA_LIST_ARTS = "listArts"; private static String DATA_LIST_ARTS = "listArts";
private ActivityPvOrdineAcquistoEditBinding mBinding; private ActivityPvOrdineAcquistoEditBinding mBinding;
private int barcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
@Inject @Inject
PVOrdineAcquistoEditViewModel mViewModel; PVOrdineAcquistoEditViewModel mViewModel;
@ -130,11 +130,11 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
} }
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
private void initRecyclerView() { private void initRecyclerView() {
@ -159,7 +159,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
private void selectAction(ArticoloOrdine articoloOrdine) { private void selectAction(ArticoloOrdine articoloOrdine) {
mBinding.closeActivityFab.close(false); mBinding.closeActivityFab.close(false);
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
DialogAskActionView.newInstance(articoloOrdine.getDescrizione(), DialogAskActionView.newInstance(articoloOrdine.getDescrizione(),
articoloOrdine.getQtaOrd() + " " + articoloOrdine.getUntMis(), articoloOrdine.getQtaOrd() + " " + articoloOrdine.getUntMis(),
@ -168,8 +168,8 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
}), }),
() -> { () -> {
this.deleteArticolo(articoloOrdine); this.deleteArticolo(articoloOrdine);
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
}, BarcodeManager::enable).show(getSupportFragmentManager(), "tag"); }, () -> BarcodeManager.enable(mBarcodeScannerInstanceID)).show(getSupportFragmentManager(), "tag");
} }
@ -234,16 +234,16 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
@Override @Override
public void onBackPressed() { public void onBackPressed() {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
super.onBackPressed(); super.onBackPressed();
} }
public void manualSearch() { public void manualSearch() {
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
DialogSimpleInputHelper.makeInputDialog(this, "Inserisci il codice a barre/codice articolo da cercare", barcode -> { DialogSimpleInputHelper.makeInputDialog(this, "Inserisci il codice a barre/codice articolo da cercare", barcode -> {
this.onLoadingStarted(); this.onLoadingStarted();
this.mViewModel.processBarcode(barcode); this.mViewModel.processBarcode(barcode);
}, BarcodeManager::enable).show(); }, () -> BarcodeManager.enable(mBarcodeScannerInstanceID)).show();
} }
private boolean isOrderNewProdsForced() { private boolean isOrderNewProdsForced() {

View File

@ -157,8 +157,8 @@ public class PVOrdineAcquistoEditViewModel {
} }
public void processBarcode(String barcode) { public void processBarcode(String barcode) {
Runnable onComplete = BarcodeManager::enable; Runnable onComplete = BarcodeManager::enableLastCallback;
BarcodeManager.disable(); BarcodeManager.disableLastCallback();
try { try {
List<ArticoloOrdinabileDTO> listArticoli = findArticoliByBarcode(barcode); List<ArticoloOrdinabileDTO> listArticoli = findArticoliByBarcode(barcode);

View File

@ -50,7 +50,7 @@ public class DialogEditArticoloView extends BaseDialogFragment implements Dialog
private DialogPvEditArticoloBinding mBindings; private DialogPvEditArticoloBinding mBindings;
private boolean mEnableDataCallback = true; private boolean mEnableDataCallback = true;
private int barcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
public static DialogEditArticoloView newInstance(ArticoloOrdine articolo, RunnableArgs<ArticoloOrdine> onComplete, Runnable onAbort) { public static DialogEditArticoloView newInstance(ArticoloOrdine articolo, RunnableArgs<ArticoloOrdine> onComplete, Runnable onAbort) {
return new DialogEditArticoloView(articolo, onComplete, onAbort); return new DialogEditArticoloView(articolo, onComplete, onAbort);
@ -117,17 +117,17 @@ public class DialogEditArticoloView extends BaseDialogFragment implements Dialog
if (this.mOnAbort != null) { if (this.mOnAbort != null) {
this.mOnAbort.run(); this.mOnAbort.run();
} }
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
super.onDismiss(dialog); super.onDismiss(dialog);
} }
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful((barcodeScanDTO) -> { .setOnScanSuccessful((barcodeScanDTO) -> {
}) })
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
private void initBindings() { private void initBindings() {

View File

@ -105,7 +105,7 @@ public class PVOrdiniAcquistoGrigliaFragment extends BaseFragment implements ITi
} }
private void init() { private void init() {
BarcodeManager.enable(); BarcodeManager.enableLastCallback();
DialogScanGrigliaAcquistoView.newInstance((griglia, listArticoli) -> { DialogScanGrigliaAcquistoView.newInstance((griglia, listArticoli) -> {
if (griglia == null) { if (griglia == null) {
((IPoppableActivity) requireActivity()).pop(); ((IPoppableActivity) requireActivity()).pop();

View File

@ -36,7 +36,7 @@ import it.integry.integrywmsnative.databinding.DialogScanCodiceGrigliaBinding;
public class DialogScanGrigliaAcquistoView extends BaseDialogFragment { public class DialogScanGrigliaAcquistoView extends BaseDialogFragment {
private DialogScanCodiceGrigliaBinding mBinding; private DialogScanCodiceGrigliaBinding mBinding;
private int mBarcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
public boolean canIgnoreGrid; public boolean canIgnoreGrid;
private final RunnableArgss<Griglia, List<ArticoloOrdinabileDTO>> mOnDialogDismiss; private final RunnableArgss<Griglia, List<ArticoloOrdinabileDTO>> mOnDialogDismiss;
@ -89,18 +89,18 @@ public class DialogScanGrigliaAcquistoView extends BaseDialogFragment {
return; return;
} }
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
RunnableArgs<Exception> mOnError = exception -> { RunnableArgs<Exception> mOnError = exception -> {
this.onError(exception); this.onError(exception);
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
}; };
retrieveArticoli(null, mOnError); retrieveArticoli(null, mOnError);
} }
private void initBarcode() { private void initBarcode() {
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessfull) .setOnScanSuccessful(onScanSuccessfull)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
@ -109,18 +109,18 @@ public class DialogScanGrigliaAcquistoView extends BaseDialogFragment {
@Override @Override
public void onDismiss(@NonNull DialogInterface dialog) { public void onDismiss(@NonNull DialogInterface dialog) {
BarcodeManager.removeCallback(mBarcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
mOnDialogDismiss.run(mGriglia, mListArticoli); mOnDialogDismiss.run(mGriglia, mListArticoli);
super.onDismiss(dialog); super.onDismiss(dialog);
} }
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> { private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
RunnableArgs<Exception> mOnError = exception -> { RunnableArgs<Exception> mOnError = exception -> {
this.onError(exception); this.onError(exception);
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
}; };
retrieveArticoli(data.getStringValue(), mOnError); retrieveArticoli(data.getStringValue(), mOnError);

View File

@ -84,7 +84,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
private RettificaGiacenzeMainListAdapter mAdapter; private RettificaGiacenzeMainListAdapter mAdapter;
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
private GestioneEnum mCurrentGestione; private GestioneEnum mCurrentGestione;
public RettificaGiacenzeFragment() { public RettificaGiacenzeFragment() {
@ -165,7 +165,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
} }
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false))); .setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
} }
@ -370,7 +370,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
@Override @Override
public void onError(Exception ex) { public void onError(Exception ex) {
this.onLoadingEnded(); this.onLoadingEnded();
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
if (ex instanceof InvalidPesoKGException) { if (ex instanceof InvalidPesoKGException) {
UtilityToast.showToast(ex.getMessage()); UtilityToast.showToast(ex.getMessage());
@ -425,7 +425,9 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
if (!mDialogInputQuantityV2View.isVisible()) if (!mDialogInputQuantityV2View.isVisible())
mDialogInputQuantityV2View mDialogInputQuantityV2View
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete(resultDTO -> {
if(resultDTO == null || resultDTO.isAborted()) return;
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setNumCnf(resultDTO.getNumCnf()) .setNumCnf(resultDTO.getNumCnf())
.setQtaCnf(resultDTO.getQtaCnf()) .setQtaCnf(resultDTO.getQtaCnf())
@ -433,7 +435,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
.setPartitaMag(resultDTO.getPartitaMag()) .setPartitaMag(resultDTO.getPartitaMag())
.setDataScad(resultDTO.getDataScad()); .setDataScad(resultDTO.getDataScad());
onComplete.run(pickedQuantityDTO, shouldCloseLU); onComplete.run(pickedQuantityDTO, resultDTO.isShouldCloseLu());
}) })
.show(requireActivity().getSupportFragmentManager(), "tag"); .show(requireActivity().getSupportFragmentManager(), "tag");
}, () -> { }, () -> {
@ -555,7 +557,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
if (mViewModel.getCurrentMtbColt() != null) if (mViewModel.getCurrentMtbColt() != null)
mViewModel.closeLU(false); mViewModel.closeLU(false);
else { else {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
onComplete.run(); onComplete.run();
} }
} }

View File

@ -5,6 +5,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.text.Html; import android.text.Html;
import android.text.SpannableString; import android.text.SpannableString;
import android.view.Gravity; import android.view.Gravity;
@ -13,6 +14,7 @@ import android.widget.Toast;
import androidx.appcompat.widget.PopupMenu; import androidx.appcompat.widget.PopupMenu;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
import androidx.databinding.ObservableArrayList; import androidx.databinding.ObservableArrayList;
import androidx.lifecycle.MutableLiveData;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
@ -96,21 +98,23 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
@Inject @Inject
DialogInputQuantityV2View mDialogInputQuantityV2View; DialogInputQuantityV2View mDialogInputQuantityV2View;
@Inject
Handler handler;
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel; private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
private final ObservableArrayList<SpedizioneListModel> mSpedizioneMutableData = new ObservableArrayList<>(); private final ObservableArrayList<SpedizioneListModel> mSpedizioneMutableData = new ObservableArrayList<>();
public BindableBoolean addExtraItemsEnabled = new BindableBoolean(false); public BindableBoolean addExtraItemsEnabled = new BindableBoolean(false);
public BindableBoolean noItemsToPick = new BindableBoolean(false); public BindableBoolean noItemsToPick = new BindableBoolean(false);
public BindableBoolean noLUPresent = new BindableBoolean(true); public MutableLiveData<Boolean> noLUPresent = new MutableLiveData<>(true);
public BindableBoolean bottomSheetEnabled = new BindableBoolean(false); public BindableBoolean bottomSheetEnabled = new BindableBoolean(false);
private boolean mEnableFakeGiacenza; private boolean mEnableFakeGiacenza;
private boolean mFlagShowCodForn; private boolean mFlagShowCodForn;
private boolean mDivideByGrpMerc; private boolean mDivideByGrpMerc;
private boolean mEnableQuantityReset; private boolean mEnableQuantityReset;
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
private ArrayList<SitArtOrdDTO> mSitArtOrd; private ArrayList<SitArtOrdDTO> mSitArtOrd;
private ArrayList<OrdineUscitaInevasoDTO> mTestateOrdini; private ArrayList<OrdineUscitaInevasoDTO> mTestateOrdini;
@ -239,31 +243,36 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (this.mBindings.bottomSheetLuContent.isExpanded()) { if (this.mBindings.bottomSheetLuContent.isExpanded()) {
this.mBindings.bottomSheetLuContent.collapse(); this.mBindings.bottomSheetLuContent.collapse();
} else if (!noLUPresent.get()) { } else if (!noLUPresent.getValue()) {
this.mShouldCloseActivity = true; this.mShouldCloseActivity = true;
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
this.mViewmodel.requestCloseLU(true); executorService.execute(() -> {
try {
this.mViewmodel.requestCloseLU(true);
} catch (Exception e) {
onError(e);
}
});
} else { } else {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
super.onBackPressed(); super.onBackPressed();
} }
} }
private void initVars() { private void initVars() {
this.noLUPresent.addOnPropertyChangedCallback(() -> { this.noLUPresent.observeForever(newValue -> {
this.bottomSheetEnabled.set(!this.noLUPresent.get()); this.bottomSheetEnabled.set(!newValue);
}); });
} }
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
@ -320,13 +329,19 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
this.mBindings.spedizionePickingList.setLayoutManager(new LinearLayoutManager(this)); this.mBindings.spedizionePickingList.setLayoutManager(new LinearLayoutManager(this));
RunnableArgssss<PickingObjectDTO, MtbColt, MtbColr, Boolean> onItemClicked = (clickedItem, refMtbColt, refMtbColr, executeImmediately) -> { RunnableArgssss<PickingObjectDTO, MtbColt, MtbColr, Boolean> onItemClicked = (clickedItem, refMtbColt, refMtbColr, executeImmediately) -> {
if (!noLUPresent.get() && executorService.execute(() -> {
((SettingsManager.iDB().isFlagSpedizioneEnableManualPick() && if (!noLUPresent.getValue() &&
clickedItem.getSitArtOrdDTO().isFlagEnablePickManuale()) || ((SettingsManager.iDB().isFlagSpedizioneEnableManualPick() &&
clickedItem.getTempPickData() != null)) { clickedItem.getSitArtOrdDTO().isFlagEnablePickManuale()) ||
this.mViewmodel.dispatchOrdineRow(clickedItem, refMtbColt, refMtbColr, clickedItem.getTempPickData() != null)) {
SettingsManager.iDB().isFlagSpedizioneEnableManualPick() && clickedItem.getSitArtOrdDTO().isFlagEnablePickManuale(), executeImmediately); try {
} this.mViewmodel.dispatchOrdineRow(clickedItem, refMtbColt, refMtbColr,
SettingsManager.iDB().isFlagSpedizioneEnableManualPick() && clickedItem.getSitArtOrdDTO().isFlagEnablePickManuale(), executeImmediately);
} catch (Exception e) {
onError(e);
}
}
});
}; };
spedizioneListAdapter.setOnItemClicked(onItemClicked); spedizioneListAdapter.setOnItemClicked(onItemClicked);
@ -709,36 +724,64 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> { private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
this.onLoadingStarted(); this.onLoadingStarted();
this.mViewmodel.processBarcodeDTO(data, () -> { executorService.execute(() -> {
this.onLoadingEnded(); try {
this.mViewmodel.processBarcodeDTO(data);
} catch (Exception e) {
onError(e);
}
}); });
this.onLoadingEnded();
}; };
public void addExtraItem() { public void addExtraItem() {
DialogScanArtView handler.post(() -> {
.newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, mtbColr) -> { DialogScanArtView
if (status == DialogConsts.Results.YES) { .newInstance(!mEnableFakeGiacenza, (status, mtbAart, ean128Model, mtbColr) -> {
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColr); if (status == DialogConsts.Results.YES) {
}
}, pickMagazzinoAutomaticoPosizione -> { executorService.execute(() -> {
this.onLoadingStarted(); try {
this.mViewmodel.executeEmptyMagazzinoAutomaticoRequest(pickMagazzinoAutomaticoPosizione, this::onLoadingEnded); this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColr);
}) } catch (Exception e) {
.show(getSupportFragmentManager(), "tag"); onError(e);
}
});
}
}, pickMagazzinoAutomaticoPosizione -> {
this.onLoadingStarted();
executorService.execute(() -> {
try {
this.mViewmodel.executeEmptyMagazzinoAutomaticoRequest(pickMagazzinoAutomaticoPosizione);
} catch (Exception e) {
onError(e);
}
this.onLoadingEnded();
});
})
.show(getSupportFragmentManager(), "tag");
});
} }
public void startManualSearch() { public void startManualSearch() {
BarcodeManager.disable(); handler.post(() -> {
DialogSimpleInputHelper.makeInputDialog(this, "Inserisci il codice a barre", codice -> { BarcodeManager.disable(mBarcodeScannerInstanceID);
DialogSimpleInputHelper.makeInputDialog(this, "Inserisci il codice a barre", codice -> {
this.onScanSuccessful.run(new BarcodeScanDTO().setStringValue(codice).setType(BarcodeType.CODE128)); this.onScanSuccessful.run(new BarcodeScanDTO().setStringValue(codice).setType(BarcodeType.CODE128));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
}, BarcodeManager::enable).show(); }, () -> BarcodeManager.enable(mBarcodeScannerInstanceID)).show();
});
} }
public void removeListFilter() { public void removeListFilter() {
this.mViewmodel.resetMatchedRows(); handler.post(() -> {
this.mViewmodel.resetMatchedRows();
});
} }
@ -747,88 +790,109 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
this.onLoadingStarted(); this.onLoadingStarted();
this.mViewmodel.createNewLU(null, null, () -> { executorService.execute(() -> {
this.onLoadingEnded(); try {
this.mViewmodel.createNewLU(null, null);
this.onLoadingEnded();
} catch (Exception e) {
onError(e);
}
}); });
} }
public void trackPackaging() { public void trackPackaging() {
this.fabPopupMenu.dismiss(); handler.post(() -> {
this.fabPopupMenu.dismiss();
DialogTracciamentoImballiView.newInstance(imballiData -> { DialogTracciamentoImballiView.newInstance(imballiData -> {
if (imballiData != null && !imballiData.isEmpty()) { if (imballiData != null && !imballiData.isEmpty()) {
DialogAskVettoreView.newInstance(mViewmodel.getDefaultVettore(), vettoreData -> { DialogAskVettoreView.newInstance(mViewmodel.getDefaultVettore(), vettoreData -> {
mViewmodel.registraImballi(vettoreData, imballiData); mViewmodel.registraImballi(vettoreData, imballiData);
}) })
.show(getSupportFragmentManager(), DialogAskVettoreView.class.getName()); .show(getSupportFragmentManager(), DialogAskVettoreView.class.getName());
} }
}).show(getSupportFragmentManager(), DialogTracciamentoImballiView.class.getName()); }).show(getSupportFragmentManager(), DialogTracciamentoImballiView.class.getName());
});
} }
public void showCreatedUL() { public void showCreatedUL() {
this.fabPopupMenu.dismiss(); handler.post(() -> {
this.fabPopupMenu.dismiss();
ArrayList<MtbColt> createdMtbColts = this.mViewmodel.getCreatedMtbColts(); ArrayList<MtbColt> createdMtbColts = this.mViewmodel.getCreatedMtbColts();
Intent myIntent = ListaBancaliActivity.createIntent(this, createdMtbColts, true, false); Intent myIntent = ListaBancaliActivity.createIntent(this, createdMtbColts, true, false);
this.startActivityForResult(myIntent, PICK_UL_REQUEST); this.startActivityForResult(myIntent, PICK_UL_REQUEST);
});
} }
public void closeOrder() { public void closeOrder() {
this.fabPopupMenu.dismiss(); handler.post(() -> {
this.fabPopupMenu.dismiss();
this.mViewmodel.closeOrder(); this.mViewmodel.closeOrder();
});
} }
@Override @Override
public void onLUOpened(MtbColt mtbColt) { public void onLUOpened(MtbColt mtbColt) {
this.addExtraItemsEnabled.set(SettingsManager.iDB().isFlagCanAddExtraItemSpedizione()); handler.post(() -> {
noLUPresent.set(false); this.addExtraItemsEnabled.set(SettingsManager.iDB().isFlagCanAddExtraItemSpedizione());
noLUPresent.postValue(false);
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT) Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
.setBackgroundTint(getResources().getColor(R. color. green_500)) .setBackgroundTint(getResources().getColor(R.color.green_500))
.show(); .show();
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(mtbColt); this.mBottomSheetFragmentLUContentViewModel.setMtbColt(mtbColt);
});
} }
@Override @Override
public void onLUClosed() { public void onLUClosed() {
this.addExtraItemsEnabled.set(false); handler.post(() -> {
noLUPresent.set(true); this.addExtraItemsEnabled.set(false);
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(null); noLUPresent.postValue(true);
this.mBottomSheetFragmentLUContentViewModel.setMtbColt(null);
if (this.mShouldCloseActivity) super.onBackPressed(); if (this.mShouldCloseActivity) super.onBackPressed();
});
} }
@Override @Override
public void onLUPesoRequired(String codTcol, BigDecimal netWeightKG, BigDecimal grossWeightKG, RunnableArgsss<String, BigDecimal, BigDecimal> onComplete) { public void onLUPesoRequired(String codTcol, BigDecimal netWeightKG, BigDecimal grossWeightKG, RunnableArgsss<String, BigDecimal, BigDecimal> onComplete) {
DialogInputPesoLUView.newInstance(null, new BigDecimal(50), new BigDecimal(55), (newCodTcol, newNetWeight, newGrossWeight) -> { handler.post(() -> {
onComplete.run(newCodTcol, netWeightKG, grossWeightKG); DialogInputPesoLUView.newInstance(null, new BigDecimal(50), new BigDecimal(55), (newCodTcol, newNetWeight, newGrossWeight) -> {
}) onComplete.run(newCodTcol, netWeightKG, grossWeightKG);
.show(getSupportFragmentManager(), "tag"); })
.show(getSupportFragmentManager(), "tag");
});
} }
@Override @Override
public void onLUSuccessullyPrinted() { public void onLUSuccessullyPrinted() {
Resources res = getResources(); handler.post(() -> {
String errorMessage = res.getText(R.string.alert_print_completed_message).toString(); Resources res = getResources();
DialogSimpleMessageView String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null) DialogSimpleMessageView
.show(getSupportFragmentManager(), "tag"); .makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
.show(getSupportFragmentManager(), "tag");
});
} }
@Override @Override
public void onLUPrintRequest(RunnableArgs<Boolean> onComplete) { public void onLUPrintRequest(RunnableArgs<Boolean> onComplete) {
DialogYesNoView.newInstance(getString(R.string.action_print), handler.post(() -> {
String.format(getString(R.string.message_print_packing_list), "Packing List"), DialogYesNoView.newInstance(getString(R.string.action_print),
result -> { String.format(getString(R.string.message_print_packing_list), "Packing List"),
onComplete.run(result == DialogConsts.Results.YES); result -> {
}) onComplete.run(result == DialogConsts.Results.YES);
.show(getSupportFragmentManager(), "dialog-print"); })
.show(getSupportFragmentManager(), "dialog-print");
});
} }
@Override @Override
@ -845,41 +909,52 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
@Override @Override
public void onFilterApplied(String newValue) { public void onFilterApplied(String newValue) {
this.mBindings.filteredArtsInListExpandableLayout.expand(true); handler.post(() -> {
this.mBindings.descriptionFilterText.setText(!UtilityString.isNullOrEmpty(newValue) ? newValue : ""); this.mBindings.filteredArtsInListExpandableLayout.expand(true);
this.mBindings.descriptionFilterText.setText(!UtilityString.isNullOrEmpty(newValue) ? newValue : "");
});
} }
@Override @Override
public void onFilterRemoved() { public void onFilterRemoved() {
this.mBindings.filteredArtsInListExpandableLayout.collapse(true); handler.post(() -> {
this.mBindings.descriptionFilterText.setText(""); this.mBindings.filteredArtsInListExpandableLayout.collapse(true);
this.mBindings.descriptionFilterText.setText("");
});
} }
@Override @Override
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) { public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
String text = getResources().getString(R.string.alert_delete_mtb_colr); handler.post(() -> {
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text), String text = getResources().getString(R.string.alert_delete_mtb_colr);
null, DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
() -> onComplete.run(true), null,
() -> onComplete.run(false) () -> onComplete.run(true),
) () -> onComplete.run(false)
.show(getSupportFragmentManager(), "tag"); )
.show(getSupportFragmentManager(), "tag");
});
} }
@Override @Override
public void onError(Exception ex, boolean useSnackbar) { public void onError(Exception ex, boolean useSnackbar) {
this.onLoadingEnded();
if (ex instanceof InvalidPesoKGException) { handler.post(() -> {
UtilityToast.showToast(ex.getMessage());
} else {
if(useSnackbar)
Snackbar.make(mBindings.getRoot(), Objects.requireNonNull(ex.getMessage()), Snackbar.LENGTH_LONG).show();
else
UtilityExceptions.defaultException(this, ex);
}
BarcodeManager.enable(); this.onLoadingEnded();
if (ex instanceof InvalidPesoKGException) {
UtilityToast.showToast(ex.getMessage());
} else {
if (useSnackbar)
Snackbar.make(mBindings.getRoot(), Objects.requireNonNull(ex.getMessage()), Snackbar.LENGTH_LONG).show();
else
UtilityExceptions.defaultException(this, ex);
}
BarcodeManager.enable(mBarcodeScannerInstanceID);
});
} }
@Override @Override
@ -901,7 +976,8 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
LocalDate dataScad, LocalDate dataScad,
boolean canOverflowOrderQuantity, boolean canOverflowOrderQuantity,
boolean canPartitaMagBeChanged, boolean canPartitaMagBeChanged,
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) { RunnableArgs<PickedQuantityDTO> onComplete,
Runnable onAbort) {
if (dataScad == null && pickingObjectDTO.getMtbAart().getGgScadPartita() != null && pickingObjectDTO.getMtbAart().getGgScadPartita() > 0) { if (dataScad == null && pickingObjectDTO.getMtbAart().getGgScadPartita() != null && pickingObjectDTO.getMtbAart().getGgScadPartita() > 0) {
dataScad = UtilityDate.getNow(); dataScad = UtilityDate.getNow();
@ -935,20 +1011,23 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
if (!mDialogInputQuantityV2View.isVisible()) if (!mDialogInputQuantityV2View.isVisible())
mDialogInputQuantityV2View mDialogInputQuantityV2View
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete(resultDTO -> {
if (resultDTO == null || resultDTO.isAborted()) {
onAbort.run();
return;
}
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())
.setShouldCloseLu(resultDTO.isShouldCloseLu())
this.onLoadingStarted(); .setNextUlBarcode(resultDTO.getNextUlBarcode());
onComplete.run(pickedQuantityDTO, shouldCloseLU); onComplete.run(pickedQuantityDTO);
})
.setOnAbort(() -> {
this.mViewmodel.resetMatchedRows();
}) })
.setOnAbort(onAbort)
.show(getSupportFragmentManager(), "tag"); .show(getSupportFragmentManager(), "tag");
else Toast.makeText(this, "Dialog già a video", Toast.LENGTH_LONG).show(); else Toast.makeText(this, "Dialog già a video", Toast.LENGTH_LONG).show();
} }
@ -1043,8 +1122,8 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
} }
@Override @Override
public void onChooseArtsRequest(List<MtbAart> artsList, RunnableArgs<List<MtbAart>> onComplete) { public void onChooseArtsRequest(List<MtbAart> artsList, RunnableArgs<List<MtbAart>> onComplete, Runnable onAbort) {
DialogChooseArtsFromMtbAartListView.newInstance(artsList, onComplete, this::onLoadingEnded) DialogChooseArtsFromMtbAartListView.newInstance(artsList, onComplete, onAbort)
.show(getSupportFragmentManager(), "tag"); .show(getSupportFragmentManager(), "tag");
} }
@ -1057,7 +1136,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
@Override @Override
public void onRowSaved() { public void onRowSaved() {
Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT) Snackbar.make(mBindings.getRoot(), R.string.data_saved, Snackbar.LENGTH_SHORT)
.setBackgroundTint(getResources().getColor(R. color. green_500)) .setBackgroundTint(getResources().getColor(R.color.green_500))
.show(); .show();
} }
@ -1073,17 +1152,37 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
@Override @Override
public void onBottomSheetLUClose() { public void onBottomSheetLUClose() {
this.mViewmodel.requestCloseLU(true); executorService.execute(() -> {
try {
this.mViewmodel.requestCloseLU(true);
} catch (Exception e) {
onError(e);
}
});
} }
@Override @Override
public void onMtbColrEdit(MtbColr mtbColr) { public void onMtbColrEdit(MtbColr mtbColr) {
this.mViewmodel.dispatchRowEdit(mtbColr); executorService.execute(() -> {
this.onLoadingStarted();
try {
this.mViewmodel.dispatchRowEdit(mtbColr);
} catch (Exception e) {
onError(e);
}
this.onLoadingEnded();
});
} }
@Override @Override
public void onMtbColrDelete(MtbColr mtbColr) { public void onMtbColrDelete(MtbColr mtbColr) {
this.mViewmodel.requestDeleteRow(mtbColr); executorService.execute(() -> {
try {
this.mViewmodel.requestDeleteRow(mtbColr);
} catch (Exception e) {
onError(e);
}
});
} }

View File

@ -1,5 +1,7 @@
package it.integry.integrywmsnative.gest.spedizione; package it.integry.integrywmsnative.gest.spedizione;
import java.util.concurrent.ExecutorService;
import dagger.Module; import dagger.Module;
import dagger.Provides; import dagger.Provides;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService; import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
@ -38,7 +40,8 @@ public class SpedizioneModule {
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer, ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer, MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer,
ImballiRESTConsumer imballiRESTConsumer, ImballiRESTConsumer imballiRESTConsumer,
MagazzinoRESTConsumer magazzinoRESTConsumer) { MagazzinoRESTConsumer magazzinoRESTConsumer,
ExecutorService executorService) {
return new SpedizioneViewModel(articoloRESTConsumer, return new SpedizioneViewModel(articoloRESTConsumer,
barcodeRESTConsumer, barcodeRESTConsumer,
colliDataRecoverService, colliDataRecoverService,
@ -51,7 +54,8 @@ public class SpedizioneModule {
colliLavorazioneRESTConsumer, colliLavorazioneRESTConsumer,
magazzinoAutomaticoRESTConsumer, magazzinoAutomaticoRESTConsumer,
imballiRESTConsumer, imballiRESTConsumer,
magazzinoRESTConsumer); magazzinoRESTConsumer,
executorService);
} }
} }

View File

@ -3,6 +3,8 @@ package it.integry.integrywmsnative.gest.spedizione.model;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
public class PickedQuantityDTO { public class PickedQuantityDTO {
private String partitaMag; private String partitaMag;
@ -12,6 +14,9 @@ public class PickedQuantityDTO {
private BigDecimal qtaCnf; private BigDecimal qtaCnf;
private BigDecimal qtaTot; private BigDecimal qtaTot;
private BarcodeScanDTO nextUlBarcode;
private boolean shouldCloseLu;
public String getPartitaMag() { public String getPartitaMag() {
return partitaMag; return partitaMag;
} }
@ -56,4 +61,22 @@ public class PickedQuantityDTO {
this.qtaTot = qtaTot; this.qtaTot = qtaTot;
return this; return this;
} }
public BarcodeScanDTO getNextUlBarcode() {
return nextUlBarcode;
}
public PickedQuantityDTO setNextUlBarcode(BarcodeScanDTO nextUlBarcode) {
this.nextUlBarcode = nextUlBarcode;
return this;
}
public boolean isShouldCloseLu() {
return shouldCloseLu;
}
public PickedQuantityDTO setShouldCloseLu(boolean shouldCloseLu) {
this.shouldCloseLu = shouldCloseLu;
return this;
}
} }

View File

@ -47,7 +47,7 @@ public class UltimeConsegneClienteFragment extends BaseFragment implements Ultim
private final List<Runnable> mOnPreDestroyList = new ArrayList<>(); private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
private ElevatedToolbar mToolbar; private ElevatedToolbar mToolbar;
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
private final ObservableArrayList<DocumentoResoDTO> mDocumentiMutableData = new ObservableArrayList<>(); private final ObservableArrayList<DocumentoResoDTO> mDocumentiMutableData = new ObservableArrayList<>();
@ -138,18 +138,18 @@ public class UltimeConsegneClienteFragment extends BaseFragment implements Ultim
} }
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false))); .setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> { private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
this.mViewModel.processBarcodeDTO(data, () -> { this.mViewModel.processBarcodeDTO(data, () -> {
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
}); });
}; };

View File

@ -54,7 +54,7 @@ public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitl
private final List<Runnable> mOnPreDestroyList = new ArrayList<>(); private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
private ElevatedToolbar mToolbar; private ElevatedToolbar mToolbar;
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
private final ObservableArrayList<DocumentoResoDTO> mDocumentiMutableData = new ObservableArrayList<>(); private final ObservableArrayList<DocumentoResoDTO> mDocumentiMutableData = new ObservableArrayList<>();
@ -142,18 +142,18 @@ public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitl
} }
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false))); .setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> { private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
this.mViewModel.processBarcodeDTO(data, () -> { this.mViewModel.processBarcodeDTO(data, () -> {
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
}); });
}; };
@ -222,7 +222,7 @@ public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitl
@Override @Override
public void onDestroy() { public void onDestroy() {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
for (Runnable onPreDestroy : mOnPreDestroyList) { for (Runnable onPreDestroy : mOnPreDestroyList) {
onPreDestroy.run(); onPreDestroy.run();

View File

@ -55,7 +55,7 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
private final List<Runnable> mOnPreDestroyList = new ArrayList<>(); private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
private int barcodeScannerIstanceID = -1; private int mBarcodeScannerInstanceID = -1;
public static VersamentoMerceFragment newInstance() { public static VersamentoMerceFragment newInstance() {
@ -94,7 +94,7 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
@Override @Override
public void onDestroy() { public void onDestroy() {
BarcodeManager.removeCallback(barcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
for (Runnable onPreDestroy : mOnPreDestroyList) { for (Runnable onPreDestroy : mOnPreDestroyList) {
onPreDestroy.run(); onPreDestroy.run();
@ -122,11 +122,11 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
private void initBarcodeReader() { private void initBarcodeReader() {
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false))); .setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> { private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
@ -211,7 +211,12 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
this.requireActivity().runOnUiThread(() -> { this.requireActivity().runOnUiThread(() -> {
mDialogInputQuantityV2View mDialogInputQuantityV2View
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO) .setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
.setOnComplete((resultDTO, shouldCloseLU) -> { .setOnComplete(resultDTO -> {
if(resultDTO == null || resultDTO.isAborted()) {
this.onLoadingEnded();
return;
}
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO() PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
.setNumCnf(resultDTO.getNumCnf()) .setNumCnf(resultDTO.getNumCnf())

View File

@ -1,6 +1,8 @@
package it.integry.integrywmsnative.view.bottom_sheet__lu_content; package it.integry.integrywmsnative.view.bottom_sheet__lu_content;
import android.content.Context; import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -48,10 +50,12 @@ public class BottomSheetFragmentLUContentListAdapter extends RecyclerView.Adapte
this.mContext = context; this.mContext = context;
this.mDataset = mtbColrs != null ? mtbColrs : new ArrayList<>(); this.mDataset = mtbColrs != null ? mtbColrs : new ArrayList<>();
Handler handler = new Handler(Looper.getMainLooper());
mtbColrs.addOnListChangedCallback(new OnListGeneralChangedCallback() { mtbColrs.addOnListChangedCallback(new OnListGeneralChangedCallback() {
@Override @Override
public void onChanged(ObservableList sender) { public void onChanged(ObservableList sender) {
notifyDataSetChanged(); handler.post(() -> notifyDataSetChanged());
} }
}); });
} }

View File

@ -1,6 +1,8 @@
package it.integry.integrywmsnative.view.bottom_sheet__lu_content; package it.integry.integrywmsnative.view.bottom_sheet__lu_content;
import android.content.Context; import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -76,25 +78,31 @@ public class BottomSheetFragmentLUContentView extends BottomSheetFragmentBaseVie
} }
private void initCallbacks() { private void initCallbacks() {
Handler handler = new Handler(Looper.getMainLooper());
this.mViewModel.getObservableMtbColt().addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() { this.mViewModel.getObservableMtbColt().addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override @Override
public void onPropertyChanged(Observable sender, int propertyId) { public void onPropertyChanged(Observable sender, int propertyId) {
var mtbColt = mViewModel.getObservableMtbColt().get(); handler.post(() -> {
if (mtbColt != null) { var mtbColt = mViewModel.getObservableMtbColt().get();
initAdapter();
onMtbColrItemChanged(); if (mtbColt != null) {
initAdapter();
mtbColt.getMtbColr().addOnListChangedCallback(new OnListGeneralChangedCallback() { onMtbColrItemChanged();
@Override
public void onChanged(ObservableList sender) { mtbColt.getMtbColr().addOnListChangedCallback(new OnListGeneralChangedCallback() {
onMtbColrItemChanged(); @Override
} public void onChanged(ObservableList sender) {
}); handler.post(() -> {
} else { onMtbColrItemChanged();
mBinding.mtbColrRecyclerView.setAdapter(null); });
} }
});
} else {
mBinding.mtbColrRecyclerView.setAdapter(null);
}
});
} }
}); });
} }

View File

@ -61,7 +61,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(mContext, ex, false))); .setOnScanFailed(ex -> UtilityExceptions.defaultException(mContext, ex, false)));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
this.mBinding.buttonYes.setOnClickListener(v -> { this.mBinding.buttonYes.setOnClickListener(v -> {
if (validateCliente()) { if (validateCliente()) {
@ -91,7 +91,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> { private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
String barcode = data.getStringValue(); String barcode = data.getStringValue();
@ -118,7 +118,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
} }
} }
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
}; };

View File

@ -44,7 +44,7 @@ public class DialogAskCommessaView extends BaseDialogFragment implements DialogA
private DialogAskCommessaBinding mBindings; private DialogAskCommessaBinding mBindings;
private Context mContext; private Context mContext;
private int mBarcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
private JtbComt selectedJtbComt; private JtbComt selectedJtbComt;
@ -113,7 +113,7 @@ public class DialogAskCommessaView extends BaseDialogFragment implements DialogA
public void onDismiss(@NonNull DialogInterface dialog) { public void onDismiss(@NonNull DialogInterface dialog) {
super.onDismiss(dialog); super.onDismiss(dialog);
BarcodeManager.removeCallback(mBarcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
} }
@Override @Override
@ -125,15 +125,15 @@ public class DialogAskCommessaView extends BaseDialogFragment implements DialogA
} }
private void initBarcode() { private void initBarcode() {
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> { private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
// this.mViewModel.processBarcodeDTO(data, BarcodeManager::enable); // this.mViewModel.processBarcodeDTO(data, BarcodeManager::enable);
}; };

View File

@ -35,7 +35,7 @@ public class DialogAskLineaProdView extends BaseDialogFragment implements Dialog
private Context mContext; private Context mContext;
private int mBarcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
//Pass here all external parameters //Pass here all external parameters
public static DialogAskLineaProdView newInstance(RunnableArgs<DialogAskLineaProdResponse> onComplete, Runnable onAbort) { public static DialogAskLineaProdView newInstance(RunnableArgs<DialogAskLineaProdResponse> onComplete, Runnable onAbort) {
@ -89,16 +89,16 @@ public class DialogAskLineaProdView extends BaseDialogFragment implements Dialog
} }
private void initBarcode() { private void initBarcode() {
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> { private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
this.mViewModel.processBarcodeDTO(data, BarcodeManager::enable); this.mViewModel.processBarcodeDTO(data, () -> BarcodeManager.enable(mBarcodeScannerInstanceID));
}; };
@Override @Override
@ -110,7 +110,7 @@ public class DialogAskLineaProdView extends BaseDialogFragment implements Dialog
@Override @Override
public void onDismiss(@NonNull DialogInterface dialog) { public void onDismiss(@NonNull DialogInterface dialog) {
BarcodeManager.removeCallback(mBarcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
super.onDismiss(dialog); super.onDismiss(dialog);
} }
} }

View File

@ -37,7 +37,7 @@ public class DialogAskPositionOfLUView extends BaseDialogFragment implements Dia
private DialogAskPositionOfLuBinding mBindings; private DialogAskPositionOfLuBinding mBindings;
private DialogAskPositionOfLUAdapter viewpagerAdapter; private DialogAskPositionOfLUAdapter viewpagerAdapter;
private int mBarcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
private boolean mCheckForLineaProd; private boolean mCheckForLineaProd;
@ -142,23 +142,23 @@ public class DialogAskPositionOfLUView extends BaseDialogFragment implements Dia
} }
private void initBarcode() { private void initBarcode() {
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessfull) .setOnScanSuccessful(onScanSuccessfull)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
@Override @Override
public void onDismiss(@NonNull DialogInterface dialog) { public void onDismiss(@NonNull DialogInterface dialog) {
BarcodeManager.removeCallback(mBarcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
if (!completedFlow) onComplete.run(DialogConsts.Results.ABORT, null); if (!completedFlow) onComplete.run(DialogConsts.Results.ABORT, null);
super.onDismiss(dialog); super.onDismiss(dialog);
} }
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> { private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
BarcodeManager.disable(); BarcodeManager.disable(mBarcodeScannerInstanceID);
if (!isOnLivelloPage()) { if (!isOnLivelloPage()) {
@ -169,11 +169,11 @@ public class DialogAskPositionOfLUView extends BaseDialogFragment implements Dia
if (!mCheckForLineaProd && !currentMtbDepoPosizione.isFlagLineaProduzione() && UtilityPosizione.isPosizioneWithLivello(foundPosizione)) { if (!mCheckForLineaProd && !currentMtbDepoPosizione.isFlagLineaProduzione() && UtilityPosizione.isPosizioneWithLivello(foundPosizione)) {
askLivello(); askLivello();
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} else { } else {
completedFlow = true; completedFlow = true;
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
if (onComplete != null) if (onComplete != null)
onComplete.run(DialogConsts.Results.YES, foundPosizione); onComplete.run(DialogConsts.Results.YES, foundPosizione);
@ -181,14 +181,14 @@ public class DialogAskPositionOfLUView extends BaseDialogFragment implements Dia
} }
} else { } else {
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
Toast.makeText(requireContext(), "Barcode non riconosciuto", Toast.LENGTH_SHORT) Toast.makeText(requireContext(), "Barcode non riconosciuto", Toast.LENGTH_SHORT)
.show(); .show();
} }
} else { } else {
Toast.makeText(requireContext(), "Barcode non riconosciuto", Toast.LENGTH_SHORT) Toast.makeText(requireContext(), "Barcode non riconosciuto", Toast.LENGTH_SHORT)
.show(); .show();
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
}; };

View File

@ -37,7 +37,7 @@ public class DialogAskUnknownBarcodeNotesView extends BaseDialogFragment {
private final Runnable onAbort; private final Runnable onAbort;
private int mBarcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
//Pass here all external parameters //Pass here all external parameters
public static DialogAskUnknownBarcodeNotesView newInstance(String unknownBarcode, RunnableArgs<String> onComplete, Runnable onAbort) { public static DialogAskUnknownBarcodeNotesView newInstance(String unknownBarcode, RunnableArgs<String> onComplete, Runnable onAbort) {
@ -108,17 +108,17 @@ public class DialogAskUnknownBarcodeNotesView extends BaseDialogFragment {
@Override @Override
public void onDismiss(@NonNull DialogInterface dialog) { public void onDismiss(@NonNull DialogInterface dialog) {
BarcodeManager.removeCallback(mBarcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
super.onDismiss(dialog); super.onDismiss(dialog);
} }
private void initBarcode() { private void initBarcode() {
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessfull) .setOnScanSuccessful(onScanSuccessfull)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
setBarcodeListener(true); setBarcodeListener(true);
} }
@ -137,6 +137,6 @@ public class DialogAskUnknownBarcodeNotesView extends BaseDialogFragment {
@Override @Override
public void onError(Exception ex) { public void onError(Exception ex) {
super.onError(ex); super.onError(ex);
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
} }

View File

@ -35,7 +35,7 @@ public class DialogBindProductBarcodeWithPackageView extends BaseDialogFragment
private final Runnable onAbort; private final Runnable onAbort;
private int mBarcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
//Pass here all external parameters //Pass here all external parameters
public static DialogBindProductBarcodeWithPackageView newInstance(String unknownBarcode,Runnable onAbort) { public static DialogBindProductBarcodeWithPackageView newInstance(String unknownBarcode,Runnable onAbort) {
@ -85,8 +85,8 @@ public class DialogBindProductBarcodeWithPackageView extends BaseDialogFragment
@Override @Override
public void onDismiss(@NonNull DialogInterface dialog) { public void onDismiss(@NonNull DialogInterface dialog) {
BarcodeManager.removeCallback(mBarcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
super.onDismiss(dialog); super.onDismiss(dialog);
} }
@ -94,10 +94,10 @@ public class DialogBindProductBarcodeWithPackageView extends BaseDialogFragment
private void initBarcode() { private void initBarcode() {
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessfull) .setOnScanSuccessful(onScanSuccessfull)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
setBarcodeListener(true); setBarcodeListener(true);
} }
@ -116,6 +116,6 @@ public class DialogBindProductBarcodeWithPackageView extends BaseDialogFragment
@Override @Override
public void onError(Exception ex) { public void onError(Exception ex) {
super.onError(ex); super.onError(ex);
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
} }

View File

@ -50,7 +50,7 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
ArticoloRESTConsumer articoloRESTConsumer; ArticoloRESTConsumer articoloRESTConsumer;
private int mBarcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
private final List<MtbColr> inputMtbColrList; private final List<MtbColr> inputMtbColrList;
private MtbAart selectedArt; private MtbAart selectedArt;
private final RunnableArgs<List<MtbColr>> onConfirmed; private final RunnableArgs<List<MtbColr>> onConfirmed;
@ -231,9 +231,9 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
} }
private void setupBarcode() { private void setupBarcode() {
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessfull) .setOnScanSuccessful(onScanSuccessfull)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(mContext, ex, false))); .setOnScanFailed(ex -> UtilityExceptions.defaultException(mContext, ex, false)));
} }
@ -241,7 +241,7 @@ public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implemen
@Override @Override
public void onDismiss(@NonNull DialogInterface dialog) { public void onDismiss(@NonNull DialogInterface dialog) {
BarcodeManager.removeCallback(mBarcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
this.onAbort.run(); this.onAbort.run();
super.onDismiss(dialog); super.onDismiss(dialog);
} }

View File

@ -53,7 +53,7 @@ public class DialogCreateNewArtView extends BaseDialogFragment implements Dialog
private Context mContext; private Context mContext;
public final BarcodeScanDTO mScannedBarcode; public final BarcodeScanDTO mScannedBarcode;
private int mBarcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
private final String initialPosizione; private final String initialPosizione;
private final RunnableArgs<String> onArticleCreated; private final RunnableArgs<String> onArticleCreated;
@ -187,7 +187,7 @@ public class DialogCreateNewArtView extends BaseDialogFragment implements Dialog
} }
private void initBarcodeReader() { private void initBarcodeReader() {
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(data -> { .setOnScanSuccessful(data -> {
requireActivity().runOnUiThread(() -> { requireActivity().runOnUiThread(() -> {
@ -205,7 +205,7 @@ public class DialogCreateNewArtView extends BaseDialogFragment implements Dialog
@Override @Override
public void onDismiss(@NonNull DialogInterface dialog) { public void onDismiss(@NonNull DialogInterface dialog) {
super.onDismiss(dialog); super.onDismiss(dialog);
BarcodeManager.removeCallback(mBarcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
} }
private void initObservable() { private void initObservable() {

View File

@ -0,0 +1,25 @@
package it.integry.integrywmsnative.view.dialogs.input_quantity_v2;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class DialogInputQuantityV2ResponseViewModel extends ViewModel {
private MutableLiveData<DialogInputQuantityV2ResultDTO> result = new MutableLiveData<>();
public LiveData<DialogInputQuantityV2ResultDTO> getResult() {
return result;
}
public DialogInputQuantityV2ResponseViewModel setResult(MutableLiveData<DialogInputQuantityV2ResultDTO> result) {
this.result = result;
return this;
}
public DialogInputQuantityV2ResponseViewModel setResultValue(DialogInputQuantityV2ResultDTO result) {
this.result.postValue(result);
return this;
}
}

View File

@ -3,6 +3,8 @@ package it.integry.integrywmsnative.view.dialogs.input_quantity_v2;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
public class DialogInputQuantityV2ResultDTO { public class DialogInputQuantityV2ResultDTO {
private String partitaMag; private String partitaMag;
@ -13,6 +15,12 @@ public class DialogInputQuantityV2ResultDTO {
private BigDecimal qtaCnf; private BigDecimal qtaCnf;
private BigDecimal qtaTot; private BigDecimal qtaTot;
private BarcodeScanDTO nextUlBarcode;
private boolean shouldCloseLu = false;
private boolean aborted = true;
public String getPartitaMag() { public String getPartitaMag() {
return partitaMag; return partitaMag;
} }
@ -66,4 +74,31 @@ public class DialogInputQuantityV2ResultDTO {
this.qtaTot = qtaTot; this.qtaTot = qtaTot;
return this; return this;
} }
public BarcodeScanDTO getNextUlBarcode() {
return nextUlBarcode;
}
public DialogInputQuantityV2ResultDTO setNextUlBarcode(BarcodeScanDTO nextUlBarcode) {
this.nextUlBarcode = nextUlBarcode;
return this;
}
public boolean isShouldCloseLu() {
return shouldCloseLu;
}
public DialogInputQuantityV2ResultDTO setShouldCloseLu(boolean shouldCloseLu) {
this.shouldCloseLu = shouldCloseLu;
return this;
}
public boolean isAborted() {
return aborted;
}
public DialogInputQuantityV2ResultDTO setAborted(boolean aborted) {
this.aborted = aborted;
return this;
}
} }

View File

@ -4,7 +4,6 @@ import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.text.Html; import android.text.Html;
import android.text.InputType; import android.text.InputType;
import android.text.SpannableString; import android.text.SpannableString;
@ -39,7 +38,6 @@ import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager; import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment; import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
import it.integry.integrywmsnative.core.model.MtbAart; import it.integry.integrywmsnative.core.model.MtbAart;
import it.integry.integrywmsnative.core.model.MtbUntMis; import it.integry.integrywmsnative.core.model.MtbUntMis;
import it.integry.integrywmsnative.core.settings.SettingsManager; import it.integry.integrywmsnative.core.settings.SettingsManager;
@ -59,7 +57,8 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
DialogInputQuantityV2ViewModel mViewModel; DialogInputQuantityV2ViewModel mViewModel;
private DialogInputQuantityV2DTO mDialogInputQuantityV2DTO; private DialogInputQuantityV2DTO mDialogInputQuantityV2DTO;
private RunnableArgss<DialogInputQuantityV2ResultDTO, Boolean> mOnComplete; //1: Result / 2: ShouldCloseLu / 3: Aborted
private RunnableArgs<DialogInputQuantityV2ResultDTO> mOnComplete;
private Runnable mOnAbort; private Runnable mOnAbort;
public ObservableField<Integer> currentTextNumCnfToTake = new ObservableField<>(0); public ObservableField<Integer> currentTextNumCnfToTake = new ObservableField<>(0);
@ -88,15 +87,13 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
public ObservableField<Boolean> enabledLUCloseButton = new ObservableField<>(true); public ObservableField<Boolean> enabledLUCloseButton = new ObservableField<>(true);
public ObservableField<Boolean> showProductLotStatus = new ObservableField<>(false); public ObservableField<Boolean> showProductLotStatus = new ObservableField<>(false);
private final Handler mHandler = new Handler();
private Context context; private Context context;
private DialogInputQuantityV2Binding mBindings; private DialogInputQuantityV2Binding mBindings;
private boolean mEnableDataCallback = true; private boolean mEnableDataCallback = true;
private boolean mObservablesInitated = false; private boolean mObservablesInitated = false;
private int mBarcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
private boolean mAbort = true; private boolean mAbort = true;
@ -105,7 +102,7 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
return this; return this;
} }
public DialogInputQuantityV2View setOnComplete(RunnableArgss<DialogInputQuantityV2ResultDTO, Boolean> mOnComplete) { public DialogInputQuantityV2View setOnComplete(RunnableArgs<DialogInputQuantityV2ResultDTO> mOnComplete) {
this.mOnComplete = mOnComplete; this.mOnComplete = mOnComplete;
return this; return this;
} }
@ -130,7 +127,6 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NORMAL, R.style.AppTheme_NewMaterial_Dialog_FullscreenDialog); setStyle(DialogFragment.STYLE_NORMAL, R.style.AppTheme_NewMaterial_Dialog_FullscreenDialog);
this.initBarcode(); this.initBarcode();
} }
@NonNull @NonNull
@ -241,12 +237,14 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
BarcodeManager.removeCallback(mBarcodeScannerIstanceID); mViewModel.destroy();
BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
if (mAbort && this.mOnAbort != null) this.mOnAbort.run(); if (mAbort && this.mOnAbort != null) this.mOnAbort.run();
} }
private void initBarcode() { private void initBarcode() {
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessful) .setOnScanSuccessful(onScanSuccessful)
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this.context, ex, false))); .setOnScanFailed(ex -> UtilityExceptions.defaultException(this.context, ex, false)));
} }
@ -254,7 +252,14 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> { private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
this.onLoadingStarted(); this.onLoadingStarted();
this.mViewModel.processBarcodeDTO(data, this::onLoadingEnded); executorService.execute(() -> {
try {
this.mViewModel.processBarcodeDTO(data);
this.onLoadingEnded();
} catch (Exception ex) {
onError(ex);
}
});
}; };
public void save() { public void save() {
@ -266,9 +271,10 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
this.onLoadingEnded(); this.onLoadingEnded();
if (validated) { if (validated) {
this.mAbort = false; var result = this.mViewModel.getResult()
dismiss(); .setAborted(false)
this.mOnComplete.run(this.mViewModel.getResult(), false); .setShouldCloseLu(false);
dismiss(result);
} }
}); });
}); });
@ -277,15 +283,32 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
public void saveAndCloseLU() { public void saveAndCloseLU() {
this.mViewModel.validate(validated -> { this.mViewModel.validate(validated -> {
if (validated) { if (validated) {
this.mAbort = false; var result = this.mViewModel.getResult()
dismiss(); .setAborted(false)
this.mOnComplete.run(this.mViewModel.getResult(), true); .setShouldCloseLu(true);
} else {
this.onLoadingEnded(); dismiss(result);
} }
}); });
} }
@Override
public void dismiss() {
dismiss(null);
}
private void dismiss(DialogInputQuantityV2ResultDTO result) {
if (this.mOnComplete != null) {
if(result == null) {
result = new DialogInputQuantityV2ResultDTO()
.setAborted(true);
}
this.mOnComplete.run(result);
}
super.dismiss();
}
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
@ -544,4 +567,9 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
() -> result.run(false) () -> result.run(false)
).show(requireActivity().getSupportFragmentManager(), "tag"); ).show(requireActivity().getSupportFragmentManager(), "tag");
} }
@Override
public void onULCloseRequested() {
saveAndCloseLU();
}
} }

View File

@ -1,7 +1,5 @@
package it.integry.integrywmsnative.view.dialogs.input_quantity_v2; package it.integry.integrywmsnative.view.dialogs.input_quantity_v2;
import android.text.SpannableString;
import androidx.databinding.ObservableField; import androidx.databinding.ObservableField;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -18,12 +16,12 @@ import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.di.BindableString; import it.integry.integrywmsnative.core.di.BindableString;
import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.expansion.RunnableArgsWithReturn; import it.integry.integrywmsnative.core.expansion.RunnableArgsWithReturn;
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
import it.integry.integrywmsnative.core.model.MtbAart; import it.integry.integrywmsnative.core.model.MtbAart;
import it.integry.integrywmsnative.core.model.MtbPartitaMag; import it.integry.integrywmsnative.core.model.MtbPartitaMag;
import it.integry.integrywmsnative.core.model.secondary.StatoPartitaMag; import it.integry.integrywmsnative.core.model.secondary.StatoPartitaMag;
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer; import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel; import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
import it.integry.integrywmsnative.core.settings.SettingsManager; import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityBarcode; import it.integry.integrywmsnative.core.utility.UtilityBarcode;
@ -31,8 +29,6 @@ import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
import it.integry.integrywmsnative.core.utility.UtilityDate; import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.core.utility.UtilityResources; import it.integry.integrywmsnative.core.utility.UtilityResources;
import it.integry.integrywmsnative.core.utility.UtilityString; import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
import it.integry.integrywmsnative.view.dialogs.exception.InactiveBatchLotException;
import it.integry.integrywmsnative.view.dialogs.exception.InvalidBatchLotException; import it.integry.integrywmsnative.view.dialogs.exception.InvalidBatchLotException;
import it.integry.integrywmsnative.view.dialogs.exception.InvalidExpireDateException; import it.integry.integrywmsnative.view.dialogs.exception.InvalidExpireDateException;
import it.integry.integrywmsnative.view.dialogs.exception.InvalidNotesException; import it.integry.integrywmsnative.view.dialogs.exception.InvalidNotesException;
@ -88,6 +84,8 @@ public class DialogInputQuantityV2ViewModel {
private String internalNote; private String internalNote;
private LocalDate internalDataScad; private LocalDate internalDataScad;
private BarcodeScanDTO internalNextUlBarcode;
private RunnableArgsWithReturn<DialogInputQuantityV2ViewModel, String> suggestPartitaMagRunnable; private RunnableArgsWithReturn<DialogInputQuantityV2ViewModel, String> suggestPartitaMagRunnable;
private boolean canInputZeroQuantity; private boolean canInputZeroQuantity;
@ -150,17 +148,16 @@ public class DialogInputQuantityV2ViewModel {
this.mListener.onDataChanged(); this.mListener.onDataChanged();
} }
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) { public void destroy() {
if (UtilityBarcode.isEanPeso(barcodeScanDTO)) { this.internalPartitaMag = null;
Ean13PesoModel ean13PesoModel; this.internalNote = null;
this.internalDataScad = null;
this.internalNextUlBarcode = null;
}
try { public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO) throws Exception {
ean13PesoModel = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue()); if (UtilityBarcode.isEanPeso(barcodeScanDTO)) {
} catch (Exception ex) { Ean13PesoModel ean13PesoModel = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
this.mListener.onError(ex);
onComplete.run();
return;
}
if (this.mtbAart.get() != null && if (this.mtbAart.get() != null &&
this.mtbAart.get().getBarCode() != null && this.mtbAart.get().getBarCode() != null &&
@ -178,57 +175,48 @@ public class DialogInputQuantityV2ViewModel {
this.unlockQtaCnf(); this.unlockQtaCnf();
} }
onComplete.run();
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) { } else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> { var ean128Model = this.mBarcodeRESTConsumer.decodeEan128Synchronized(barcodeScanDTO);
if (ean128Model == null) { if (ean128Model == null) {
onComplete.run(); return;
return; }
if (canPartitaMagBeChanged) {
if (!UtilityString.isNullOrEmpty(ean128Model.BatchLot)) {
this.setPartitaMag(ean128Model.BatchLot);
} }
if (canPartitaMagBeChanged) { if (!UtilityString.isNullOrEmpty(ean128Model.BestBefore)) {
this.setDataScad(UtilityDate.recognizeLocalDate(ean128Model.BestBefore));
} else if (!UtilityString.isNullOrEmpty(ean128Model.Expiry)) {
this.setDataScad(UtilityDate.recognizeLocalDate(ean128Model.Expiry));
}
}
if (!UtilityString.isNullOrEmpty(ean128Model.BatchLot)) { if (ean128Model.Count != null && ean128Model.Count > 0) {
this.setPartitaMag(ean128Model.BatchLot); this.setNumCnf(BigDecimal.valueOf(ean128Model.Count));
} } else if (ean128Model.NetWeightKg != null && ean128Model.NetWeightKg > 0) {
this.setQtaTot(BigDecimal.valueOf(ean128Model.NetWeightKg));
this.setNumCnf(UtilityBigDecimal.divideAndRoundToInteger(this.getQtaTot(), this.mtbAart.get().getQtaCnf()));
try { if (!this.mtbAart.get().isFlagQtaCnfFissaBoolean()) {
if (!UtilityString.isNullOrEmpty(ean128Model.BestBefore)) { if (UtilityBigDecimal.equalsTo(this.getNumCnf(), BigDecimal.ZERO))
this.setDataScad(UtilityDate.recognizeLocalDate(ean128Model.BestBefore)); this.setNumCnf(BigDecimal.ONE);
} else if (!UtilityString.isNullOrEmpty(ean128Model.Expiry)) { this.setQtaCnf(UtilityBigDecimal.divide(this.getQtaTot(), this.getNumCnf()));
this.setDataScad(UtilityDate.recognizeLocalDate(ean128Model.Expiry));
}
} catch (Exception ex) {
this.mListener.onError(ex);
}
} }
if (ean128Model.Count != null && ean128Model.Count > 0) { this.unlockNumCnf();
this.setNumCnf(BigDecimal.valueOf(ean128Model.Count)); this.unlockQtaCnf();
} else if (ean128Model.NetWeightKg != null && ean128Model.NetWeightKg > 0) { } else if (ean128Model.Sscc != null) {
this.setQtaTot(BigDecimal.valueOf(ean128Model.NetWeightKg)); //Close current UDS and open another one with new SSCC
this.setNumCnf(UtilityBigDecimal.divideAndRoundToInteger(this.getQtaTot(), this.mtbAart.get().getQtaCnf())); this.internalNextUlBarcode = barcodeScanDTO;
this.sendOnULCloseRequested();
return;
}
if (!this.mtbAart.get().isFlagQtaCnfFissaBoolean()) { this.mListener.onDataChanged();
if (UtilityBigDecimal.equalsTo(this.getNumCnf(), BigDecimal.ZERO))
this.setNumCnf(BigDecimal.ONE);
this.setQtaCnf(UtilityBigDecimal.divide(this.getQtaTot(), this.getNumCnf()));
}
this.unlockNumCnf();
this.unlockQtaCnf();
}
this.mListener.onDataChanged();
onComplete.run();
}, ex -> {
this.mListener.onError(ex);
onComplete.run();
});
} else {
onComplete.run();
} }
} }
@ -527,144 +515,142 @@ public class DialogInputQuantityV2ViewModel {
} }
public void validate(RunnableArgs<Boolean> onValidated) { public void validate(RunnableArgs<Boolean> onValidated) {
new Thread(() -> { if (this.internalQtaCnf == null || UtilityBigDecimal.equalsTo(this.internalQtaCnf, BigDecimal.ZERO)) {
if (this.internalQtaCnf == null || UtilityBigDecimal.equalsTo(this.internalQtaCnf, BigDecimal.ZERO)) {
this.sendError(new InvalidQtaCnfQuantityException()); this.sendError(new InvalidQtaCnfQuantityException());
onValidated.run(false); onValidated.run(false);
return; return;
} }
if (!disableTracciabilitaCheck && mtbAart.get().isFlagTracciabilitaBoolean()) { if (!disableTracciabilitaCheck && mtbAart.get().isFlagTracciabilitaBoolean()) {
if (UtilityString.isNullOrEmpty(internalPartitaMag)) { if (UtilityString.isNullOrEmpty(internalPartitaMag)) {
if (suggestPartitaMagRunnable != null) { if (suggestPartitaMagRunnable != null) {
internalPartitaMag = suggestPartitaMagRunnable.run(this); internalPartitaMag = suggestPartitaMagRunnable.run(this);
if (internalPartitaMag == null) { if (internalPartitaMag == null) {
this.sendError(new InvalidBatchLotException());
onValidated.run(false);
return;
}
} else {
this.sendError(new InvalidBatchLotException()); this.sendError(new InvalidBatchLotException());
onValidated.run(false); onValidated.run(false);
return; return;
} }
} else { } else {
if (SettingsManager.iDB().isFlagWarningNewPartitaMag()) { this.sendError(new InvalidBatchLotException());
MtbPartitaMag mtbPartitaMag = null; onValidated.run(false);
try { return;
mtbPartitaMag = retrievePartitaMag(internalPartitaMag, this.getMtbAart().getCodMart()); }
} catch (Exception e) { } else {
this.sendError(e); if (SettingsManager.iDB().isFlagWarningNewPartitaMag()) {
MtbPartitaMag mtbPartitaMag = null;
try {
mtbPartitaMag = retrievePartitaMag(internalPartitaMag, this.getMtbAart().getCodMart());
} catch (Exception e) {
this.sendError(e);
onValidated.run(false);
return;
}
if (mtbPartitaMag == null) {
boolean result = runWarningDialogSyncronized(UtilityResources.getString(R.string.batch_lot_inexistent_error_message));
if (!result) {
onValidated.run(false); onValidated.run(false);
return; return;
} }
if (mtbPartitaMag == null) {
boolean result = runWarningDialogSyncronized(UtilityResources.getString(R.string.batch_lot_inexistent_error_message));
if (!result) {
onValidated.run(false);
return;
}
}
} }
} }
} }
}
if (this.statoArt == StatoPartitaMag.DISATTIVO) { if (this.statoArt == StatoPartitaMag.DISATTIVO) {
boolean result = runWarningDialogSyncronized(String.format(UtilityResources.getString(R.string.batch_lot_not_enabled), internalPartitaMag)); boolean result = runWarningDialogSyncronized(String.format(UtilityResources.getString(R.string.batch_lot_not_enabled), internalPartitaMag));
if (!result) { if (!result) {
onValidated.run(false);
return;
}
}
if (this.shouldAskDataScad && UtilityString.isNullOrEmpty(internalPartitaMag)) {
this.sendError(new InvalidBatchLotException());
onValidated.run(false); onValidated.run(false);
return; return;
} }
}
if (this.shouldAskDataScad && this.internalDataScad == null) { if (this.shouldAskDataScad && UtilityString.isNullOrEmpty(internalPartitaMag)) {
this.sendError(new InvalidExpireDateException()); this.sendError(new InvalidBatchLotException());
onValidated.run(false);
return;
}
if (this.shouldAskDataScad && this.internalDataScad == null) {
this.sendError(new InvalidExpireDateException());
onValidated.run(false);
return;
}
if (!this.canOverflowOrderQuantity && UtilityBigDecimal.greaterThan(this.internalQtaTot, this.totalQtaOrd) &&
this.mtbAart.get().isFlagQtaCnfFissaBoolean()) {
this.sendError(new OverflowQtaTotOrderedQuantityException());
onValidated.run(false);
return;
}
if (!this.canOverflowOrderQuantity && UtilityBigDecimal.greaterThan(this.internalNumCnf, this.totalNumCnfOrd) &&
!this.mtbAart.get().isFlagQtaCnfFissaBoolean()) {
this.sendError(new OverflowNumCnfOrderedQuantityException());
onValidated.run(false);
return;
}
if (UtilityBigDecimal.greaterThan(this.internalQtaTot, this.totalQtaAvailable)) {
this.sendError(new OverflowQtaTotAvailableQuantityException());
onValidated.run(false);
return;
}
if (UtilityBigDecimal.greaterThan(this.internalNumCnf, this.totalNumCnfAvailable) &&
!this.mtbAart.get().isFlagQtaCnfFissaBoolean()) {
this.sendError(new OverflowNumCnfAvailableQuantityException());
onValidated.run(false);
return;
}
if (!this.canInputZeroQuantity && (this.internalNumCnf == null || this.internalQtaCnf == null || this.internalQtaTot == null ||
UtilityBigDecimal.equalsOrLowerThan(this.internalNumCnf, BigDecimal.ZERO) ||
UtilityBigDecimal.equalsOrLowerThan(this.internalQtaCnf, BigDecimal.ZERO) ||
UtilityBigDecimal.equalsOrLowerThan(this.internalQtaTot, BigDecimal.ZERO))) {
this.sendError(new InvalidQuantityException());
onValidated.run(false);
return;
}
if (this.isNoteMandatory() && (this.internalNote == null || this.internalNote.length() <= 0)) {
this.sendError(new InvalidNotesException());
onValidated.run(false);
return;
}
if (!UtilityString.isNullOrEmpty(this.internalPartitaMag))
this.internalPartitaMag = this.internalPartitaMag.toUpperCase();
if (this.warnOnQuantityOverflow && UtilityBigDecimal.greaterThan(this.internalQtaTot, this.totalQtaOrd) &&
this.mtbAart.get().isFlagQtaCnfFissaBoolean()) {
boolean result = runWarningDialogSyncronized(UtilityResources.getString(R.string.confirm_ordered_quantity_overflow_error_message));
if (!result) {
onValidated.run(false); onValidated.run(false);
return; return;
} }
}
if (!this.canOverflowOrderQuantity && UtilityBigDecimal.greaterThan(this.internalQtaTot, this.totalQtaOrd) && if (this.warnOnQuantityOverflow && UtilityBigDecimal.greaterThan(this.internalNumCnf, this.totalNumCnfOrd) &&
this.mtbAart.get().isFlagQtaCnfFissaBoolean()) { !this.mtbAart.get().isFlagQtaCnfFissaBoolean()) {
this.sendError(new OverflowQtaTotOrderedQuantityException()); boolean result = runWarningDialogSyncronized(UtilityResources.getString(R.string.confirm_ordered_num_cnf_overflow_error_message));
if (!result) {
onValidated.run(false); onValidated.run(false);
return; return;
} }
}
if (!this.canOverflowOrderQuantity && UtilityBigDecimal.greaterThan(this.internalNumCnf, this.totalNumCnfOrd) && onValidated.run(true);
!this.mtbAart.get().isFlagQtaCnfFissaBoolean()) {
this.sendError(new OverflowNumCnfOrderedQuantityException());
onValidated.run(false);
return;
}
if (UtilityBigDecimal.greaterThan(this.internalQtaTot, this.totalQtaAvailable)) {
this.sendError(new OverflowQtaTotAvailableQuantityException());
onValidated.run(false);
return;
}
if (UtilityBigDecimal.greaterThan(this.internalNumCnf, this.totalNumCnfAvailable) &&
!this.mtbAart.get().isFlagQtaCnfFissaBoolean()) {
this.sendError(new OverflowNumCnfAvailableQuantityException());
onValidated.run(false);
return;
}
if (!this.canInputZeroQuantity && (this.internalNumCnf == null || this.internalQtaCnf == null || this.internalQtaTot == null ||
UtilityBigDecimal.equalsOrLowerThan(this.internalNumCnf, BigDecimal.ZERO) ||
UtilityBigDecimal.equalsOrLowerThan(this.internalQtaCnf, BigDecimal.ZERO) ||
UtilityBigDecimal.equalsOrLowerThan(this.internalQtaTot, BigDecimal.ZERO))) {
this.sendError(new InvalidQuantityException());
onValidated.run(false);
return;
}
if (this.isNoteMandatory() && (this.internalNote == null || this.internalNote.length() <= 0)) {
this.sendError(new InvalidNotesException());
onValidated.run(false);
return;
}
if (!UtilityString.isNullOrEmpty(this.internalPartitaMag))
this.internalPartitaMag = this.internalPartitaMag.toUpperCase();
if (this.warnOnQuantityOverflow && UtilityBigDecimal.greaterThan(this.internalQtaTot, this.totalQtaOrd) &&
this.mtbAart.get().isFlagQtaCnfFissaBoolean()) {
boolean result = runWarningDialogSyncronized(UtilityResources.getString(R.string.confirm_ordered_quantity_overflow_error_message));
if (!result) {
onValidated.run(false);
return;
}
}
if (this.warnOnQuantityOverflow && UtilityBigDecimal.greaterThan(this.internalNumCnf, this.totalNumCnfOrd) &&
!this.mtbAart.get().isFlagQtaCnfFissaBoolean()) {
boolean result = runWarningDialogSyncronized(UtilityResources.getString(R.string.confirm_ordered_num_cnf_overflow_error_message));
if (!result) {
onValidated.run(false);
return;
}
}
onValidated.run(true);
}).start();
} }
private boolean runWarningDialogSyncronized(String text) { private boolean runWarningDialogSyncronized(String text) {
@ -696,7 +682,8 @@ public class DialogInputQuantityV2ViewModel {
.setNumCnf(this.internalNumCnf) .setNumCnf(this.internalNumCnf)
.setQtaCnf(this.internalQtaCnf) .setQtaCnf(this.internalQtaCnf)
.setNote(this.internalNote) .setNote(this.internalNote)
.setQtaTot(this.internalQtaTot); .setQtaTot(this.internalQtaTot)
.setNextUlBarcode(this.internalNextUlBarcode);
} }
public void setListener(Listener listener) { public void setListener(Listener listener) {
@ -738,11 +725,17 @@ public class DialogInputQuantityV2ViewModel {
if (this.mListener != null) mListener.onLoadingEnded(); if (this.mListener != null) mListener.onLoadingEnded();
} }
private void sendOnULCloseRequested() {
if (this.mListener != null) mListener.onULCloseRequested();
}
public interface Listener extends ILoadingListener { public interface Listener extends ILoadingListener {
void onDataChanged(); void onDataChanged();
void onError(Exception ex); void onError(Exception ex);
void onWarning(String text, RunnableArgs<Boolean> result); void onWarning(String text, RunnableArgs<Boolean> result);
void onULCloseRequested();
} }
} }

View File

@ -41,7 +41,7 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
private DialogScanArtBinding mBindings; private DialogScanArtBinding mBindings;
private int mBarcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onPickingCompleted = null; private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onPickingCompleted = null;
private RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest = null; private RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest = null;
@ -89,17 +89,17 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
@Override @Override
public void onDismiss(@NonNull DialogInterface dialog) { public void onDismiss(@NonNull DialogInterface dialog) {
BarcodeManager.removeCallback(mBarcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
super.onDismiss(dialog); super.onDismiss(dialog);
} }
private void initBarcode() { private void initBarcode() {
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessfull) .setOnScanSuccessful(onScanSuccessfull)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
setBarcodeListener(true); setBarcodeListener(true);
} }
@ -145,6 +145,6 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
@Override @Override
public void onError(Exception ex) { public void onError(Exception ex) {
super.onError(ex); super.onError(ex);
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
} }
} }

View File

@ -35,7 +35,7 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
DialogScanOrCreateLUViewModel mViewModel; DialogScanOrCreateLUViewModel mViewModel;
private DialogScanOrCreateLuBinding mBindings; private DialogScanOrCreateLuBinding mBindings;
private int mBarcodeScannerIstanceID; private int mBarcodeScannerInstanceID;
private final RunnableArgss<MtbColt, Boolean> mOnComplete; private final RunnableArgss<MtbColt, Boolean> mOnComplete;
private MtbColt openedMtbColt; private MtbColt openedMtbColt;
@ -116,8 +116,8 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
@Override @Override
public void onDismiss(@NonNull DialogInterface dialog) { public void onDismiss(@NonNull DialogInterface dialog) {
BarcodeManager.removeCallback(mBarcodeScannerIstanceID); BarcodeManager.removeCallback(mBarcodeScannerInstanceID);
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
if (openedMtbColt == null) { if (openedMtbColt == null) {
mOnComplete.run(null, false); mOnComplete.run(null, false);
} }
@ -126,10 +126,10 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
private void initBarcode() { private void initBarcode() {
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO() mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
.setOnScanSuccessful(onScanSuccessfull) .setOnScanSuccessful(onScanSuccessfull)
.setOnScanFailed(this::onError)); .setOnScanFailed(this::onError));
BarcodeManager.enable(); BarcodeManager.enable(mBarcodeScannerInstanceID);
setBarcodeListener(true); setBarcodeListener(true);
} }

View File

@ -11,7 +11,7 @@
</data> </data>
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -27,7 +27,7 @@
android:layout_width="8dp" android:layout_width="8dp"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<androidx.appcompat.widget.LinearLayoutCompat <LinearLayout
android:id="@+id/ordine_lavorazione_main_list_group_item_container_root" android:id="@+id/ordine_lavorazione_main_list_group_item_container_root"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -93,9 +93,9 @@
android:layout_toStartOf="@id/right_sub_descrizione"/> android:layout_toStartOf="@id/right_sub_descrizione"/>
</RelativeLayout> </RelativeLayout>
</androidx.appcompat.widget.LinearLayoutCompat> </LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat> </LinearLayout>
</layout> </layout>