diff --git a/app/src/main/java/it/integry/integrywmsnative/MainApplicationComponent.java b/app/src/main/java/it/integry/integrywmsnative/MainApplicationComponent.java
index 3ad66620..d7f453f7 100644
--- a/app/src/main/java/it/integry/integrywmsnative/MainApplicationComponent.java
+++ b/app/src/main/java/it/integry/integrywmsnative/MainApplicationComponent.java
@@ -29,8 +29,12 @@ import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.ProdFabbisogn
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.ProdFabbisognoLineeProdModule;
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dialog_ask_mag_prossimita.DialogAskMagazzinoProssimitaComponent;
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.dialog_ask_mag_prossimita.DialogAskMagazzinoProssimitaModule;
+import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeComponent;
+import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeModule;
import it.integry.integrywmsnative.gest.prod_rientro_merce.ProdRientroMerceComponent;
import it.integry.integrywmsnative.gest.prod_rientro_merce.order_detail.ProdRientroMerceOrderDetailComponent;
+import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeComponent;
+import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeModule;
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditComponent;
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditModule;
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdineAcquistoGrigliaComponent;
@@ -88,7 +92,9 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
DialogAskMagazzinoProssimitaModule.class,
DialogChooseBatchLotModule.class,
DialogRowInfoProdFabbisognoLineeProdModule.class,
- ProdOrdineProduzioneElencoModule.class
+ ProdOrdineProduzioneElencoModule.class,
+ ProdRecuperoMaterialeModule.class,
+ ProdVersamentoMaterialeModule.class
})
public interface MainApplicationComponent {
@@ -120,6 +126,8 @@ public interface MainApplicationComponent {
ProdRientroMerceComponent.Factory prodRientroMerceComponent();
ProdRientroMerceOrderDetailComponent.Factory prodRientroMerceOrderDetailComponent();
ProdOrdineProduzioneElencoComponent.Factory prodOrdineProduzioneElencoComponent();
+ ProdRecuperoMaterialeComponent.Factory prodRecuperoMaterialeComponent();
+ ProdVersamentoMaterialeComponent.Factory prodVersamentoMaterialeComponent();
void inject(MainApplication mainApplication);
diff --git a/app/src/main/java/it/integry/integrywmsnative/MainApplicationModule.java b/app/src/main/java/it/integry/integrywmsnative/MainApplicationModule.java
index b8050226..eb1c98d5 100644
--- a/app/src/main/java/it/integry/integrywmsnative/MainApplicationModule.java
+++ b/app/src/main/java/it/integry/integrywmsnative/MainApplicationModule.java
@@ -9,12 +9,14 @@ import dagger.Provides;
import it.integry.integrywmsnative.core.context.AppContext;
import it.integry.integrywmsnative.core.context.MainContext;
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
+import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
import it.integry.integrywmsnative.core.menu.MenuRESTConsumer;
import it.integry.integrywmsnative.core.menu.MenuService;
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
+import it.integry.integrywmsnative.core.rest.consumers.EntityRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
@@ -47,8 +49,8 @@ public class MainApplicationModule {
@Provides
@Singleton
- MainContext providesMainContextNew(MenuService menuService) {
- return new MainContext(mApplication.getApplicationContext(), menuService);
+ MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase) {
+ return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase);
}
@Provides
@@ -109,8 +111,14 @@ public class MainApplicationModule {
@Provides
@Singleton
- ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(ArticoloRESTConsumer articoloRESTConsumer) {
- return new ColliMagazzinoRESTConsumer(articoloRESTConsumer);
+ EntityRESTConsumer provideEntityRESTConsumer() {
+ return new EntityRESTConsumer();
+ }
+
+ @Provides
+ @Singleton
+ ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer(SystemRESTConsumer systemRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
+ return new ColliMagazzinoRESTConsumer(systemRESTConsumer, articoloRESTConsumer, entityRESTConsumer);
}
@Provides
diff --git a/app/src/main/java/it/integry/integrywmsnative/SplashActivity.java b/app/src/main/java/it/integry/integrywmsnative/SplashActivity.java
index e9b0cec3..8b870565 100644
--- a/app/src/main/java/it/integry/integrywmsnative/SplashActivity.java
+++ b/app/src/main/java/it/integry/integrywmsnative/SplashActivity.java
@@ -21,7 +21,6 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.PermissionsHelper;
import it.integry.integrywmsnative.core.utility.UtilityContext;
-import it.integry.integrywmsnative.core.utility.UtilitySettings;
import it.integry.integrywmsnative.databinding.ActivitySplashBinding;
import it.integry.integrywmsnative.gest.login.LoginActivity;
import it.integry.integrywmsnative.gest.main.MainActivity;
@@ -147,9 +146,7 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
DialogSimpleMessageView.makeErrorDialog(
message, null, this::finish, R.string.logout, () -> {
- UtilitySettings.logout(() -> {
- MainApplication.exit();
- });
+ this.mainContext.logout(MainApplication::exit);
})
.show(this.getSupportFragmentManager(), "tag");
}
diff --git a/app/src/main/java/it/integry/integrywmsnative/core/class_router/ClassRouter.java b/app/src/main/java/it/integry/integrywmsnative/core/class_router/ClassRouter.java
index 969920f7..d234cebb 100644
--- a/app/src/main/java/it/integry/integrywmsnative/core/class_router/ClassRouter.java
+++ b/app/src/main/java/it/integry/integrywmsnative/core/class_router/ClassRouter.java
@@ -6,9 +6,6 @@ import android.util.Pair;
import java.util.ArrayList;
import java.util.List;
-import it.integry.integrywmsnative.core.class_router.exceptions.MethodPathNotRegisteredException;
-import it.integry.integrywmsnative.core.utility.UtilityExceptions;
-
public class ClassRouter {
public enum PATH {
@@ -68,15 +65,15 @@ public class ClassRouter {
try {
if (!checkIClassExists(path)) {
- throw new MethodPathNotRegisteredException(path);
+// throw new MethodPathNotRegisteredException(path);
}
Object instance = mRouteClasses.get(getClassIndex(path)).second;
return (T)instance;
- } catch (MethodPathNotRegisteredException ex) {
- UtilityExceptions.defaultException(null, ex, true);
+ } catch (Exception ex) {
+// UtilityExceptions.defaultException(null, ex, true);
}
return null;
diff --git a/app/src/main/java/it/integry/integrywmsnative/core/context/AppContext.java b/app/src/main/java/it/integry/integrywmsnative/core/context/AppContext.java
index d1148d7e..b50df297 100644
--- a/app/src/main/java/it/integry/integrywmsnative/core/context/AppContext.java
+++ b/app/src/main/java/it/integry/integrywmsnative/core/context/AppContext.java
@@ -16,7 +16,6 @@ import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.settings.Stash;
import it.integry.integrywmsnative.core.utility.UtilityContext;
import it.integry.integrywmsnative.core.utility.UtilityResources;
-import it.integry.integrywmsnative.core.utility.UtilitySettings;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.core.utility.UtilityToast;
@@ -75,7 +74,6 @@ public class AppContext {
UtilityContext.initApplicationContext(mApplicationContext);
UtilityResources.init(mApplicationContext);
UtilityToast.init(mApplicationContext);
- UtilitySettings.init(mAppDatabase);
}
private void initLogger() {
diff --git a/app/src/main/java/it/integry/integrywmsnative/core/context/MainContext.java b/app/src/main/java/it/integry/integrywmsnative/core/context/MainContext.java
index a94fb49f..8b13a429 100644
--- a/app/src/main/java/it/integry/integrywmsnative/core/context/MainContext.java
+++ b/app/src/main/java/it/integry/integrywmsnative/core/context/MainContext.java
@@ -13,21 +13,25 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
import it.integry.integrywmsnative.core.class_router.ClassRouter;
+import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
import it.integry.integrywmsnative.core.menu.MenuService;
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
import it.integry.integrywmsnative.core.settings.SettingsManager;
+import it.integry.integrywmsnative.core.utility.UtilityThread;
@Singleton
public class MainContext {
private final Context applicationContext;
private final MenuService menuService;
+ private final AppDatabase appDatabase;
private Listener mListener;
- public MainContext(Context applicationContext, MenuService menuService) {
+ public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase) {
this.applicationContext = applicationContext;
this.menuService = menuService;
+ this.appDatabase = appDatabase;
}
public void init() {
@@ -51,6 +55,16 @@ public class MainContext {
}
+ public void logout(Runnable onLoggedOut) {
+ UtilityThread.executeParallel(() -> {
+ SettingsManager.i().setUser(null);
+ SettingsManager.i().setUserSession(null);
+ SettingsManager.update();
+ appDatabase.clearAllTables();
+
+ onLoggedOut.run();
+ }, true);
+ }
private void initServerStatusChecker() {
ServerStatusChecker.init();
diff --git a/app/src/main/java/it/integry/integrywmsnative/core/di/BindableBigDecimal.java b/app/src/main/java/it/integry/integrywmsnative/core/di/BindableBigDecimal.java
new file mode 100644
index 00000000..7ee35f86
--- /dev/null
+++ b/app/src/main/java/it/integry/integrywmsnative/core/di/BindableBigDecimal.java
@@ -0,0 +1,110 @@
+package it.integry.integrywmsnative.core.di;
+
+import androidx.annotation.NonNull;
+import androidx.databinding.Bindable;
+import androidx.databinding.Observable;
+import androidx.databinding.PropertyChangeRegistry;
+
+import java.math.BigDecimal;
+
+public class BindableBigDecimal implements Observable {
+
+ BigDecimal mValue;
+
+ private transient PropertyChangeRegistry mCallbacks;
+
+ public BindableBigDecimal() {
+ }
+
+ public BindableBigDecimal(BigDecimal startValue) {
+ this.mValue = startValue;
+ }
+
+
+ @Override
+ public void addOnPropertyChangedCallback(@NonNull OnPropertyChangedCallback callback) {
+ synchronized (this) {
+ if (mCallbacks == null) {
+ mCallbacks = new PropertyChangeRegistry();
+ }
+ }
+ mCallbacks.add(callback);
+ }
+
+ public void addOnPropertyChangedCallback(@NonNull Runnable callback) {
+ synchronized (this) {
+ if (mCallbacks == null) {
+ mCallbacks = new PropertyChangeRegistry();
+ }
+ }
+ mCallbacks.add(new OnPropertyChangedCallback() {
+ @Override
+ public void onPropertyChanged(Observable sender, int propertyId) {
+ callback.run();
+ }
+ });
+ }
+
+ @Override
+ public void removeOnPropertyChangedCallback(@NonNull OnPropertyChangedCallback callback) {
+ synchronized (this) {
+ if (mCallbacks == null) {
+ return;
+ }
+ }
+ mCallbacks.remove(callback);
+ }
+
+ public void resetOnPropertyChangedCallback() {
+ synchronized (this) {
+ if (mCallbacks == null) {
+ return;
+ }
+ }
+ mCallbacks.clear();
+ mCallbacks = null;
+ }
+
+ /**
+ * Notifies listeners that all properties of this instance have changed.
+ */
+ public void notifyChange() {
+ synchronized (this) {
+ if (mCallbacks == null) {
+ return;
+ }
+ }
+ mCallbacks.notifyCallbacks(this, 0, null);
+ }
+
+ /**
+ * Notifies listeners that a specific property has changed. The getter for the property
+ * that changes should be marked with {@link Bindable} to generate a field in
+ * BR to be used as fieldId.
+ *
+ * @param fieldId The generated BR id for the Bindable field.
+ */
+ public void notifyPropertyChanged(int fieldId) {
+ synchronized (this) {
+ if (mCallbacks == null) {
+ return;
+ }
+ }
+ mCallbacks.notifyCallbacks(this, fieldId, null);
+ }
+
+ public BigDecimal get() {
+ return mValue;
+ }
+
+ public void set(BigDecimal value) {
+ this.set(value, false);
+ }
+
+ public void set(BigDecimal value, boolean forceRefresh) {
+ if (!mValue.equals(value) || forceRefresh) {
+ this.mValue = value;
+ notifyChange();
+ }
+ }
+}
diff --git a/app/src/main/java/it/integry/integrywmsnative/core/di/BindableBoolean.java b/app/src/main/java/it/integry/integrywmsnative/core/di/BindableBoolean.java
index f82a1b33..b32ac914 100644
--- a/app/src/main/java/it/integry/integrywmsnative/core/di/BindableBoolean.java
+++ b/app/src/main/java/it/integry/integrywmsnative/core/di/BindableBoolean.java
@@ -1,12 +1,11 @@
package it.integry.integrywmsnative.core.di;
import androidx.annotation.NonNull;
-import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;
import androidx.databinding.Observable;
import androidx.databinding.PropertyChangeRegistry;
-public class BindableBoolean implements Observable {
+public class BindableBoolean implements Observable {
boolean mValue;
diff --git a/app/src/main/java/it/integry/integrywmsnative/core/expansion/BaseFragment.java b/app/src/main/java/it/integry/integrywmsnative/core/expansion/BaseFragment.java
index 74dd8c0d..6f19b3a2 100644
--- a/app/src/main/java/it/integry/integrywmsnative/core/expansion/BaseFragment.java
+++ b/app/src/main/java/it/integry/integrywmsnative/core/expansion/BaseFragment.java
@@ -4,38 +4,40 @@ import android.app.Dialog;
import androidx.fragment.app.Fragment;
+import java.util.ArrayList;
+import java.util.List;
+
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
+import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
import it.integry.integrywmsnative.core.utility.UtilityProgress;
+import it.integry.integrywmsnative.ui.ElevatedToolbar;
-public class BaseFragment extends Fragment {
+public abstract class BaseFragment extends Fragment {
protected Dialog mCurrentProgress;
+ protected ElevatedToolbar mToolbar;
- protected void openProgress() {
+ protected final List mOnPreDestroyList = new ArrayList<>();
-// new Thread(() -> {
- getActivity().runOnUiThread(() -> {
- if (this.mCurrentProgress == null) {
- this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
- }
- });
-// }).start();
+
+
+
+ public void setScrollToolbar(ElevatedToolbar toolbar) {
+ mToolbar = toolbar;
}
- protected void closeProgress() {
-// new Thread(() -> {
- getActivity().runOnUiThread(() -> {
- if (mCurrentProgress != null) {
- mCurrentProgress.dismiss();
- mCurrentProgress = null;
- }
- });
-// }).start();
+
+ public void addOnPreDestroy(Runnable onPreDestroy) {
+ this.mOnPreDestroyList.add(onPreDestroy);
}
+
+
+
+
public void onLoadingStarted() {
new Thread(() -> {
BarcodeManager.disable();
@@ -57,4 +59,35 @@ public class BaseFragment extends Fragment {
BarcodeManager.enable();
});
}
+
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+
+ for (Runnable onPreDestroy : mOnPreDestroyList) {
+ onPreDestroy.run();
+ }
+ }
+
+ protected void openProgress() {
+ getActivity().runOnUiThread(() -> {
+ if (this.mCurrentProgress == null) {
+ this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
+ }
+ });
+ }
+
+ protected void closeProgress() {
+ getActivity().runOnUiThread(() -> {
+ if (mCurrentProgress != null) {
+ mCurrentProgress.dismiss();
+ mCurrentProgress = null;
+ }
+ });
+ }
+
+ protected void popMe() {
+ ((IPoppableActivity) requireActivity()).pop();
+ }
}
diff --git a/app/src/main/java/it/integry/integrywmsnative/core/model/CheckableOrdineLavoro.java b/app/src/main/java/it/integry/integrywmsnative/core/model/CheckableOrdineLavoro.java
deleted file mode 100644
index a5ca465c..00000000
--- a/app/src/main/java/it/integry/integrywmsnative/core/model/CheckableOrdineLavoro.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package it.integry.integrywmsnative.core.model;
-
-import androidx.databinding.Observable;
-
-import java.util.List;
-
-import it.integry.integrywmsnative.core.di.BindableBoolean;
-import it.integry.integrywmsnative.core.di.BindableFloat;
-import it.integry.integrywmsnative.gest.prod_versamento_materiale.core.ChooseOrdsLavFromListItemModel;
-
-public class CheckableOrdineLavoro {
-
-
- private ChooseOrdsLavFromListItemModel item;
- private BindableBoolean checked = new BindableBoolean(false);
-
- private String testata;
-
- public CheckableOrdineLavoro(ChooseOrdsLavFromListItemModel item) {
- this.item = item;
- }
-
- public ChooseOrdsLavFromListItemModel getItem() {
- return item;
- }
-
- public CheckableOrdineLavoro setItem(ChooseOrdsLavFromListItemModel item) {
- this.item = item;
-
- return this;
- }
-
- public BindableBoolean getChecked() {
- return checked;
- }
-
- public CheckableOrdineLavoro setChecked(BindableBoolean checked) {
- this.checked = checked;
- return this;
- }
-
- public BindableFloat getQtaCol() {
- return item.getOrdineLav().getQtaColVersamento();
- }
-
- public void setQtaCol(float qtaCnf) {
- this.item.getOrdineLav().setQtaColVersamento(qtaCnf);
- }
-
- public void toggleCheck() {
- this.checked.set(!this.checked.get());
- }
-
- public boolean isChecked() {
- return checked.get();
- }
-
- public String getTestata() {
- return testata;
- }
-
- public void setTestata(String testata) {
- this.testata = testata;
- }
-
- public BindableFloat getNumCnf() {
- return item.getOrdineLav().getNumCnfVersamento();
- }
-
- public void setNumCnf(float numCnf) {
- this.item.getOrdineLav().setNumCnfVersamento(numCnf);
- }
-}
diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumer.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumer.java
index cb86c5fd..e7cad6bd 100644
--- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumer.java
+++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ColliMagazzinoRESTConsumer.java
@@ -45,10 +45,16 @@ import retrofit2.Response;
@Singleton
public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
- private ArticoloRESTConsumer mArticoloRESTConsumer;
+ private final SystemRESTConsumer mSystemRESTConsumer;
+ private final ArticoloRESTConsumer mArticoloRESTConsumer;
+ private final EntityRESTConsumer mEntityRESTConsumer;
- public ColliMagazzinoRESTConsumer(ArticoloRESTConsumer articoloRESTConsumer) {
+ public ColliMagazzinoRESTConsumer(SystemRESTConsumer systemRESTConsumer,
+ ArticoloRESTConsumer articoloRESTConsumer,
+ EntityRESTConsumer entityRESTConsumer) {
+ this.mSystemRESTConsumer = systemRESTConsumer;
this.mArticoloRESTConsumer = articoloRESTConsumer;
+ this.mEntityRESTConsumer = entityRESTConsumer;
}
@@ -65,10 +71,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
public void saveCollo(MtbColt mtbColtToSave, RunnableArgs onComplete, RunnableArgs onFailed) {
- ColliMagazzinoRESTConsumer.saveColloStatic(mtbColtToSave, onComplete, onFailed);
- }
-
- public static void saveColloStatic(MtbColt mtbColtToSave, RunnableArgs onComplete, RunnableArgs onFailed) {
MtbColt mtbColtToSaveClone = (MtbColt) mtbColtToSave.clone();
mtbColtToSave.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
@@ -81,7 +83,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setMtbPartitaMag(null));
}
- EntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback() {
+ this.mEntityRESTConsumer.processEntity(mtbColtToSaveClone, new ISimpleOperationCallback() {
@Override
public void onSuccess(MtbColt value) {
if (onComplete != null) onComplete.run(value);
@@ -96,10 +98,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
public void saveColli(List mtbColtsToSave, RunnableArgs> onComplete, RunnableArgs onFailed) {
- saveColliStatic(mtbColtsToSave, onComplete, onFailed);
- }
-
- public static void saveColliStatic(List mtbColtsToSave, RunnableArgs> onComplete, RunnableArgs onFailed) {
for (MtbColt mtbColt : mtbColtsToSave) {
mtbColt.setMtbCols(null);
@@ -111,7 +109,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
}
- EntityRESTConsumer.processEntityList(mtbColtsToSave, new ISimpleOperationCallback>() {
+ this.mEntityRESTConsumer.processEntityList(mtbColtsToSave, new ISimpleOperationCallback>() {
@Override
public void onSuccess(List value) {
if (onComplete != null) onComplete.run(value);
@@ -143,7 +141,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
});
}
- public static void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs onComplete, RunnableArgs onFailed) {
+ public void createColloScaricoDaCarico(MtbColt sourceMtbColt, MtbDepoPosizione posizione, RunnableArgs onComplete, RunnableArgs onFailed) {
MtbColt newMtbColt = new MtbColt()
.initDefaultFields()
@@ -193,20 +191,10 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
- saveColloStatic(newMtbColt, new ISimpleOperationCallback() {
- @Override
- public void onSuccess(MtbColt value) {
- if (onComplete != null) onComplete.run(value);
- }
-
- @Override
- public void onFailed(Exception ex) {
- if (onFailed != null) onFailed.run(ex);
- }
- });
+ saveCollo(newMtbColt, onComplete, onFailed);
}
- public static void createColliScaricoDaOrdineLavorazione(MtbColt sourceMtbColt, MtbColr sourceMtbColr, MtbDepoPosizione posizione, List ordini, RunnableArgs onComplete, RunnableArgs onFailed) {
+ public void createColliScaricoDaOrdineLavorazione(MtbColt sourceMtbColt, MtbColr sourceMtbColr, MtbDepoPosizione posizione, List ordini, RunnableArgs onComplete, RunnableArgs onFailed) {
MtbColt newMtbColt = new MtbColt()
.initDefaultFields()
@@ -214,8 +202,8 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setGestione(GestioneEnum.LAVORAZIONE)
.setSegno(-1)
.setCodTcol(sourceMtbColt.getCodTcol())
- .setPesoKg(sourceMtbColt.getPesoKg())
- .setPesoNettoKg(sourceMtbColt.getPesoNettoKg())
+// .setPesoKg(sourceMtbColt.getPesoKg())
+// .setPesoNettoKg(sourceMtbColt.getPesoNettoKg())
.setLarghezzaCm(sourceMtbColt.getLarghezzaCm())
.setLunghezzaCm(sourceMtbColt.getLunghezzaCm())
.setAltezzaCm(sourceMtbColt.getAltezzaCm())
@@ -269,18 +257,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
-
- saveColloStatic(newMtbColt, new ISimpleOperationCallback() {
- @Override
- public void onSuccess(MtbColt value) {
- if (onComplete != null) onComplete.run(value);
- }
-
- @Override
- public void onFailed(Exception ex) {
- if (onFailed != null) onFailed.run(ex);
- }
- });
+ saveCollo(newMtbColt, onComplete, onFailed);
}
@@ -314,11 +291,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
mtbColtToCreate
.setOperation(CommonModelConsts.OPERATION.INSERT);
- saveCollo(mtbColtToCreate, value -> {
- if (onComplete != null) onComplete.run(value);
- }, ex -> {
- if (onFailed != null) onFailed.run(ex);
- });
+ saveCollo(mtbColtToCreate, onComplete, onFailed);
}
public void deleteCollo(MtbColt mtbColtToDelete, Runnable onComplete, RunnableArgs onFailed) {
@@ -327,9 +300,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
saveCollo(mtbColtToDelete, value -> {
if (onComplete != null) onComplete.run();
- }, ex -> {
- if (onFailed != null) onFailed.run(ex);
- });
+ }, onFailed);
}
public static void distribuisciCollo(MtbColt mtbColtToDistribute, DistribuzioneColloDTO.CriterioDistribuzione criterioDistribuzione, RunnableArgs> onComplete, RunnableArgs onFailed) {
@@ -374,10 +345,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs onComplete, RunnableArgs onFailed) {
- ColliMagazzinoRESTConsumer.getBySSCCStatic(ssccString, onlyResiduo, throwExcIfNull, onComplete, onFailed);
- }
-
- public static void getBySSCCStatic(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs onComplete, RunnableArgs onFailed) {
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull).enqueue(new Callback>() {
@Override
@@ -538,17 +505,13 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs onFailed) {
- ColliMagazzinoRESTConsumer.updateDataFineStatic(mtbColt, onComplete, onFailed);
- }
-
- public static void updateDataFineStatic(MtbColt mtbColt, Runnable onComplete, RunnableArgs onFailed) {
MtbColt cloneMtbColt = (MtbColt) mtbColt.clone();
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.UPDATE);
cloneMtbColt.setOraFinePrep(UtilityDate.getDateInstance());
cloneMtbColt.setMtbColr(new ObservableArrayList<>());
- ColliMagazzinoRESTConsumer.saveColloStatic(cloneMtbColt, value -> {
+ saveCollo(cloneMtbColt, value -> {
onComplete.run();
}, ex -> {
if (onFailed != null) onFailed.run(ex);
@@ -557,10 +520,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
public void canLUBeDeleted(MtbColt mtbColt, RunnableArgs onComplete, RunnableArgs onFailed) {
- ColliMagazzinoRESTConsumer.canLUBeDeletedStatic(mtbColt, onComplete, onFailed);
- }
-
- public static void canLUBeDeletedStatic(MtbColt mtbColt, RunnableArgs onComplete, RunnableArgs onFailed) {
HashMap params = new HashMap<>();
params.put("mtb_colt.gestione", mtbColt.getGestione());
@@ -602,7 +561,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
Type typeOfObjectsList = new TypeToken>() {
}.getType();
- SystemRESTConsumer.>processSqlStatic(query, typeOfObjectsList, data -> {
+ this.mSystemRESTConsumer.>processSql(query, typeOfObjectsList, data -> {
onComplete.run(data != null && data.size() > 0);
}, onFailed);
}
@@ -639,7 +598,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
colliMagazzinoRESTConsumerService.creaRettificaCollo(
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
rettificaULDTO
- ).enqueue(new Callback>() {
+ ).enqueue(new Callback<>() {
@Override
public void onResponse(Call> call, Response> response) {
analyzeAnswer(response, "creaRettificaCollo", onComplete, onFailed);
@@ -669,9 +628,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setDestinationMtbColt(mtbColtDestClone);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
- colliMagazzinoRESTConsumerService.spostaArtsTraUL(
- spostaArtsTraULRequestDTO
- ).enqueue(new Callback>() {
+ colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new Callback<>() {
@Override
public void onResponse(Call> call, Response> response) {
analyzeAnswer(response, "spostaArtsTraUL", data -> {
@@ -697,7 +654,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
}
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
- colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone).enqueue(new Callback>() {
+ colliMagazzinoRESTConsumerService.assegnaLottoSuColloScarico(sourceMtbColtClone).enqueue(new Callback<>() {
@Override
public void onResponse(Call> call, Response> response) {
analyzeAnswer(response, "assegnaLottoSuColloScarico", data -> {
diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/EntityRESTConsumer.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/EntityRESTConsumer.java
index 4af99fc4..6c3f35f4 100644
--- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/EntityRESTConsumer.java
+++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/EntityRESTConsumer.java
@@ -4,23 +4,23 @@ import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
-import com.google.gson.reflect.TypeToken;
-import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
+import javax.inject.Singleton;
+
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
+import it.integry.integrywmsnative.core.model.EntityBase;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.model.EsitoType;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
-import it.integry.integrywmsnative.core.model.EntityBase;
-import it.integry.integrywmsnative.core.utility.UtilityExceptions;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
-public class EntityRESTConsumer {
+@Singleton
+public class EntityRESTConsumer extends _BaseRESTConsumer {
public static void processEntity(T entityToSave, RunnableArgs onComplete, RunnableArgs onFailed, Class type) {
diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/MesRESTConsumer.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/MesRESTConsumer.java
index 0785c8f4..85d91398 100644
--- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/MesRESTConsumer.java
+++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/MesRESTConsumer.java
@@ -29,11 +29,11 @@ public class MesRESTConsumer extends _BaseRESTConsumer {
this.mSystemRESTConsumer = systemRESTConsumer;
}
- public static void getOrdiniLavorazioneMateriale(String codJfas, String idMateriale, RunnableArgs> onComplete, RunnableArgs onFailed) {
+ public void getOrdiniLavorazioneMateriale(String codJfas, String idMateriale, RunnableArgs> onComplete, RunnableArgs onFailed) {
MesRESTConsumerService mesRESTConsumerService = RESTBuilder.getService(MesRESTConsumerService.class);
mesRESTConsumerService.getOrdiniLavorazioneMateriale(codJfas, idMateriale)
- .enqueue(new Callback>>() {
+ .enqueue(new Callback<>() {
@Override
public void onResponse(Call>> call, Response>> response) {
analyzeAnswer(response, "getOrdiniLavorazioneMateriale", (m) -> onComplete.run(response.body().getDto()), onFailed);
diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/PVOrdiniAcquistoRESTConsumer.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/PVOrdiniAcquistoRESTConsumer.java
index dc73ded6..c50ac071 100644
--- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/PVOrdiniAcquistoRESTConsumer.java
+++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/PVOrdiniAcquistoRESTConsumer.java
@@ -59,7 +59,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
});
griglia.setGrigliaAcquistiChild(listaArticoli);
onSuccess.run(griglia);
- });
+ }, false);
}, onFailed);
}
diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/PrinterRESTConsumer.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/PrinterRESTConsumer.java
index 9136247d..b5a21cf6 100644
--- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/PrinterRESTConsumer.java
+++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/PrinterRESTConsumer.java
@@ -34,20 +34,12 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
public void getAvailablePrinters(String codMdep, final RunnableArgs> onComplete, final RunnableArgs onFailed) {
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
- printerService.getAvailablePrinters(codMdep).enqueue(new Callback>>() {
+ printerService.getAvailablePrinters(codMdep).enqueue(new Callback<>() {
@Override
public void onResponse(Call>> call, Response>> response) {
- analyzeAnswer(response, "GetAvailablePrinters", new ISimpleOperationCallback>() {
- @Override
- public void onSuccess(List value) {
- onComplete.run(value != null ? Stream.of(value).withoutNulls().toList() : null);
- }
-
- @Override
- public void onFailed(Exception ex) {
- onFailed.run(ex);
- }
- });
+ analyzeAnswer(response, "GetAvailablePrinters", printers -> {
+ onComplete.run(printers != null ? Stream.of(printers).withoutNulls().toList() : null);
+ }, onFailed);
}
@Override
@@ -61,15 +53,11 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
public void getAvailablePrinters(String codMdep, Type printerType, RunnableArgs> onComplete, RunnableArgs onFailed) {
- PrinterRESTConsumer.getAvailablePrintersStatic(codMdep, printerType, onComplete, onFailed);
- }
-
- public static void getAvailablePrintersStatic(String codMdep, Type printerType, RunnableArgs> onComplete, RunnableArgs onFailed) {
String printerTypeStr = printerType != null ? printerType.toString() : null;
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
- printerService.getAvailablePrinters(codMdep, printerTypeStr).enqueue(new Callback>>() {
+ printerService.getAvailablePrinters(codMdep, printerTypeStr).enqueue(new Callback<>() {
@Override
public void onResponse(Call>> call, Response>> response) {
analyzeAnswer(response, "GetAvailablePrinters", printerList -> {
@@ -88,17 +76,13 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
}
public void printCollo(String printerName, MtbColt testataColloToPrint, int quantity, String reportName, Runnable onComplete, RunnableArgs onFailed) {
- printColloStatic(printerName, testataColloToPrint, quantity, reportName, onComplete, onFailed);
- }
- public static void printColloStatic(String printerName, MtbColt testataColloToPrint, int quantity, String reportName, Runnable onComplete, RunnableArgs onFailed) {
-
- if(BuildConfig.DEBUG) {
+ if (BuildConfig.DEBUG) {
onComplete.run();
return;
}
- if(UtilityString.isNullOrEmpty(printerName)) {
+ if (UtilityString.isNullOrEmpty(printerName)) {
onFailed.run(new Exception("Nessuna stampante configurata: valore null"));
return;
}
@@ -113,7 +97,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
quantity,
reportName)
- .enqueue(new Callback>() {
+ .enqueue(new Callback<>() {
@Override
public void onResponse(Call> call, Response> response) {
analyzeAnswer(response, "printCollo", data -> {
@@ -123,7 +107,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
@Override
public void onFailure(Call> call, Throwable t) {
- if(t.getMessage().contains("Printer not found")) {
+ if (t.getMessage().contains("Printer not found")) {
onFailed.run(new NoPrintersFoundException());
} else onFailed.run(new Exception(t));
}
@@ -145,7 +129,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
printerService
.processPrintReport(printerName, quantity, jasperDTO)
- .enqueue(new Callback>() {
+ .enqueue(new Callback<>() {
@Override
public void onResponse(Call> call, Response> response) {
analyzeAnswer(response, "printReport", data -> {
@@ -155,11 +139,11 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
@Override
public void onFailure(Call> call, Throwable t) {
- if(t.getMessage().contains("Printer not found")) {
+ if (t.getMessage().contains("Printer not found")) {
onFailed.run(new NoPrintersFoundException());
} else onFailed.run(new Exception(t));
}
- });
+ });
}
}
diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/SystemRESTConsumer.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/SystemRESTConsumer.java
index 60c7e305..af2494ae 100644
--- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/SystemRESTConsumer.java
+++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/SystemRESTConsumer.java
@@ -42,27 +42,19 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
nativeSqlDTO.nativeSql = nativeSql;
SystemRESTConsumerService service = RESTBuilder.getService(SystemRESTConsumerService.class);
- service.processSql(nativeSqlDTO).enqueue(new Callback>() {
+ service.processSql(nativeSqlDTO).enqueue(new Callback<>() {
@Override
public void onResponse(Call> call, Response> response) {
- analyzeAnswer(response, "ProcessSql", new ISimpleOperationCallback