Finish v1.13.8
This commit is contained in:
commit
6d3050845f
15
.idea/jarRepositories.xml
generated
15
.idea/jarRepositories.xml
generated
@ -11,11 +11,6 @@
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Google" />
|
||||
<option name="name" value="Google" />
|
||||
<option name="url" value="https://maven.google.com/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="BintrayJCenter" />
|
||||
<option name="name" value="BintrayJCenter" />
|
||||
@ -26,11 +21,21 @@
|
||||
<option name="name" value="maven" />
|
||||
<option name="url" value="https://jitpack.io" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Google" />
|
||||
<option name="name" value="Google" />
|
||||
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="MavenRepo" />
|
||||
<option name="name" value="MavenRepo" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Google" />
|
||||
<option name="name" value="Google" />
|
||||
<option name="url" value="https://maven.google.com/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="maven2" />
|
||||
<option name="name" value="maven2" />
|
||||
|
||||
@ -1,21 +1,19 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="app" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
|
||||
<configuration default="false" name="app_gramm" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
|
||||
<module name="app" />
|
||||
<option name="DEPLOY" value="true" />
|
||||
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
|
||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||
<option name="ARTIFACT_NAME" value="" />
|
||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="dynamic_frudis,dynamic_ime,dynamic_saporiveri,dynamic_saporiveri_pv,dynamic_vgalimenti" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="dynamic__base,dynamic_frudis,dynamic_ime,dynamic_saporiveri,dynamic_saporiveri_pv,dynamic_vgalimenti" />
|
||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||
<option name="MODE" value="default_activity" />
|
||||
<option name="CLEAR_LOGCAT" value="true" />
|
||||
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
|
||||
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
|
||||
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="false" />
|
||||
<option name="FORCE_STOP_RUNNING_APP" value="true" />
|
||||
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
|
||||
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
|
||||
<option name="PREFERRED_AVD" value="" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
|
||||
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
|
||||
<option name="DEBUGGER_TYPE" value="Auto" />
|
||||
2
.idea/runConfigurations/app_ime.xml
generated
2
.idea/runConfigurations/app_ime.xml
generated
@ -6,7 +6,7 @@
|
||||
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||
<option name="ARTIFACT_NAME" value="" />
|
||||
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="dynamic__base,dynamic_frudis,dynamic_saporiveri,dynamic_saporiveri_pv,dynamic_vgalimenti" />
|
||||
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="dynamic__base,dynamic_frudis,dynamic_gramm,dynamic_saporiveri,dynamic_saporiveri_pv,dynamic_vgalimenti" />
|
||||
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||
<option name="MODE" value="default_activity" />
|
||||
<option name="CLEAR_LOGCAT" value="true" />
|
||||
|
||||
@ -1,24 +1,14 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url 'https://maven.fabric.io/public' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'io.fabric.tools:gradle:1.27.0'
|
||||
}
|
||||
}
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'com.google.firebase.firebase-perf'
|
||||
apply plugin: 'io.fabric'
|
||||
apply plugin: 'com.google.firebase.crashlytics'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 148
|
||||
def appVersionName = '1.12.19'
|
||||
def appVersionCode = 154
|
||||
def appVersionName = '1.13.8'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
@ -35,13 +25,12 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion '28.0.3'
|
||||
compileSdkVersion 29
|
||||
|
||||
defaultConfig {
|
||||
applicationId "it.integry.integrywmsnative"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
targetSdkVersion 29
|
||||
versionCode appVersionCode
|
||||
versionName appVersionName
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
@ -49,15 +38,18 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
ext.enableCrashlytics = false
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
}
|
||||
dataBinding {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
android.buildFeatures.dataBinding true
|
||||
|
||||
compileOptions {
|
||||
targetCompatibility 1.8
|
||||
sourceCompatibility 1.8
|
||||
@ -83,66 +75,62 @@ android {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
dynamicFeatures = [":dynamic__base", ":dynamic_vgalimenti", ":dynamic_ime", ":dynamic_frudis", ":dynamic_saporiveri_pv", ":dynamic_saporiveri"]
|
||||
dynamicFeatures = [":dynamic__base", ":dynamic_vgalimenti", ":dynamic_ime", ":dynamic_frudis", ":dynamic_saporiveri_pv", ":dynamic_saporiveri", ':dynamic_gramm']
|
||||
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.1', {
|
||||
androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'com.orhanobut:logger:2.2.0'
|
||||
implementation 'com.google.firebase:firebase-core:17.2.2'
|
||||
implementation 'com.google.firebase:firebase-core:17.5.0'
|
||||
implementation 'com.google.firebase:firebase-crash:16.2.1'
|
||||
implementation 'com.google.firebase:firebase-perf:19.0.5'
|
||||
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'com.google.firebase:firebase-perf:19.0.8'
|
||||
implementation 'com.google.firebase:firebase-crashlytics:17.2.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.1.0-beta01'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
|
||||
implementation 'com.google.android.material:material:1.3.0-alpha02'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||
implementation 'androidx.preference:preference:1.1.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.5.0'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.8.1'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
|
||||
implementation 'com.annimon:stream:1.2.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime:2.2.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-common-java8:2.2.0'
|
||||
implementation 'org.apache.commons:commons-text:1.6'
|
||||
//kapt "androidx.lifecycle:lifecycle-compiler:2.0.0"
|
||||
implementation 'org.apache.commons:commons-text:1.8'
|
||||
|
||||
//MVVM
|
||||
def dagger2_version = '2.27'
|
||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||
implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0"
|
||||
implementation 'com.jakewharton.rxbinding2:rxbinding:2.2.0'
|
||||
implementation 'com.jakewharton.rxbinding2:rxbinding-support-v4:2.2.0'
|
||||
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.2.0'
|
||||
implementation 'com.jakewharton.rxbinding2:rxbinding-design:2.2.0'
|
||||
implementation 'com.jakewharton.rxbinding2:rxbinding-recyclerview-v7:2.2.0'
|
||||
implementation 'br.com.zbra:android-linq:1.1.0'
|
||||
api "com.google.dagger:dagger:$dagger2_version"
|
||||
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
|
||||
api "com.google.dagger:dagger-android:$dagger2_version"
|
||||
api "com.google.dagger:dagger-android-support:$dagger2_version" // if you use the support libraries
|
||||
annotationProcessor "com.google.dagger:dagger-android-processor:$dagger2_version"
|
||||
|
||||
//FAB
|
||||
implementation 'com.github.clans:fab:1.6.4'
|
||||
//CUSTOM VIEWS
|
||||
implementation 'com.github.NaimishTrivedi:FBToast:1.0'
|
||||
implementation 'de.hdodenhof:circleimageview:3.0.1'
|
||||
implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
|
||||
implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
|
||||
implementation 'com.github.andrefrsousa:SuperBottomSheet:1.2.1@aar'
|
||||
implementation 'com.fede987:status-bar-alert:1.0.1'
|
||||
implementation 'com.fxn769:stash:1.2'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
implementation 'com.mikhaellopez:lazydatepicker:1.0.0'
|
||||
implementation 'com.github.demoNo:AutoScrollViewPager:v1.0.2'
|
||||
testImplementation 'junit:junit:4.13'
|
||||
implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
|
||||
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
|
||||
implementation 'com.github.pedromassango:doubleClick:3.0'
|
||||
|
||||
//SQLite ROOM
|
||||
def room_version = "2.2.3"
|
||||
def room_version = "2.2.5"
|
||||
|
||||
implementation "androidx.room:room-runtime:$room_version"
|
||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||
@ -153,11 +141,14 @@ dependencies {
|
||||
//Barcode
|
||||
implementation project(':pointmobilescannerlibrary')
|
||||
implementation project(':zebrascannerlibrary')
|
||||
implementation project(path: ':barcode_base_android_library')
|
||||
implementation project(path: ':honeywellscannerlibrary')
|
||||
implementation project(':barcode_base_android_library')
|
||||
implementation project(':honeywellscannerlibrary')
|
||||
implementation project(':keyobardemulatorscannerlibrary')
|
||||
implementation project(':barcode_kaiteki')
|
||||
androidTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.1'
|
||||
androidTestImplementation 'org.testng:testng:7.1.0'
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://maven.fabric.io/public' }
|
||||
google()
|
||||
}
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
package it.integry.integrywmsnative.gest.spedizione;
|
||||
|
||||
class SpedizioneViewModelTest {
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void createNewLU() {
|
||||
}
|
||||
}
|
||||
@ -18,6 +18,11 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity
|
||||
android:name=".gest.spedizione.SpedizioneActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light"
|
||||
android:windowSoftInputMode="adjustNothing" ></activity>
|
||||
<activity android:name=".gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditActivity" />
|
||||
<activity
|
||||
android:name=".gest.picking_resi.PickingResiActivity"
|
||||
@ -41,7 +46,7 @@
|
||||
android:theme="@style/Light"
|
||||
android:windowSoftInputMode="adjustNothing" />
|
||||
<activity
|
||||
android:name=".gest.vendita_ordine_inevaso.VenditaOrdineInevasoActivity"
|
||||
android:name=".gest.spedizione.VenditaOrdineInevasoActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light"
|
||||
android:windowSoftInputMode="adjustNothing" />
|
||||
@ -60,9 +65,6 @@
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Light" />
|
||||
|
||||
<meta-data
|
||||
android:name="io.fabric.ApiKey"
|
||||
android:value="26f0d16c00d20fe74582627c831f26e30646a187" />
|
||||
<meta-data
|
||||
android:name="firebase_crashlytics_collection_enabled"
|
||||
android:value="true" />
|
||||
|
||||
@ -1,46 +1,49 @@
|
||||
package it.integry.integrywmsnative;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.class_router.BaseCustomConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||
import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
|
||||
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.expansion.OnSingleClickListener;
|
||||
import it.integry.integrywmsnative.core.interfaces.IFilterableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ILifecycleFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ISearcableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.update.UpdatesManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilitySettings;
|
||||
import it.integry.integrywmsnative.databinding.ActivityMainBinding;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
||||
import it.integry.integrywmsnative.gest.main.MainFragment;
|
||||
import it.integry.integrywmsnative.gest.settings.MainSettingsFragment;
|
||||
@ -53,11 +56,17 @@ public class MainActivity extends BaseActivity
|
||||
private boolean firstCheckExecution = true;
|
||||
private boolean mIsOnline = false;
|
||||
|
||||
@Inject
|
||||
AppDatabase mAppDatabase;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
MainApplication.appComponent
|
||||
.mainActivityComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_main, null, false);
|
||||
setContentView(mBinding.getRoot());
|
||||
@ -90,6 +99,22 @@ public class MainActivity extends BaseActivity
|
||||
startActivity(myIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@ -103,7 +128,10 @@ public class MainActivity extends BaseActivity
|
||||
if (count == 0) {
|
||||
super.onBackPressed();
|
||||
} else {
|
||||
pop();
|
||||
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.frame_container);
|
||||
if (fragment instanceof ILifecycleFragment) {
|
||||
((ILifecycleFragment) fragment).onPreDestroy(this::pop);
|
||||
} else pop();
|
||||
// getSupportFragmentManager().popBackStack();
|
||||
|
||||
}
|
||||
@ -133,7 +161,7 @@ public class MainActivity extends BaseActivity
|
||||
BaseMenuConfiguration.MenuItem menuItem = getMenuItem(id);
|
||||
|
||||
if(menuItem != null) {
|
||||
fragment = menuItem.getFragmentClass();
|
||||
fragment = menuItem.getFragmentFactory().run();
|
||||
this.adaptViewToFragment(fragment);
|
||||
} else {
|
||||
switch (id) {
|
||||
@ -147,7 +175,7 @@ public class MainActivity extends BaseActivity
|
||||
break;
|
||||
|
||||
case R.id.nav_logout:
|
||||
UtilitySettings.logout();
|
||||
UtilitySettings.logout(this.mAppDatabase);
|
||||
ServerStatusChecker.dispose();
|
||||
|
||||
startLoginActivity();
|
||||
@ -233,9 +261,6 @@ public class MainActivity extends BaseActivity
|
||||
for(int i = 0; i < count; i++) {
|
||||
getSupportFragmentManager().popBackStack();
|
||||
}
|
||||
|
||||
openMain();
|
||||
|
||||
}
|
||||
|
||||
private void adaptViewToFragment(Fragment fragment){
|
||||
@ -278,7 +303,12 @@ public class MainActivity extends BaseActivity
|
||||
|
||||
if(fragment instanceof ISelectAllFragment && ((ISelectAllFragment)fragment).isEnabled()) {
|
||||
mBinding.appBarMain.mainSelectAll.setVisibility(View.VISIBLE);
|
||||
mBinding.appBarMain.mainSelectAll.setOnClickListener(v -> ((ISelectAllFragment)fragment).onSelectAll());
|
||||
mBinding.appBarMain.mainSelectAll.setOnClickListener(new OnSingleClickListener() {
|
||||
@Override
|
||||
public void onSingleClick(View v) {
|
||||
((ISelectAllFragment)fragment).onSelectAll();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mBinding.appBarMain.mainSelectAll.setVisibility(View.GONE);
|
||||
mBinding.appBarMain.mainSelectAll.setOnClickListener(null);
|
||||
@ -286,7 +316,12 @@ public class MainActivity extends BaseActivity
|
||||
|
||||
if(fragment instanceof IFilterableFragment) {
|
||||
mBinding.appBarMain.mainFilter.setVisibility(View.VISIBLE);
|
||||
mBinding.appBarMain.mainFilter.setOnClickListener(v -> ((IFilterableFragment)fragment).onFilterClick());
|
||||
mBinding.appBarMain.mainFilter.setOnClickListener(new OnSingleClickListener() {
|
||||
@Override
|
||||
public void onSingleClick(View v) {
|
||||
((IFilterableFragment)fragment).onFilterClick();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mBinding.appBarMain.mainFilter.setVisibility(View.GONE);
|
||||
mBinding.appBarMain.mainFilter.setOnClickListener(null);
|
||||
@ -315,23 +350,23 @@ public class MainActivity extends BaseActivity
|
||||
|
||||
private void init(){
|
||||
|
||||
ServerStatusChecker.getInstance().addCallback(value -> {
|
||||
if(value && (!mIsOnline || firstCheckExecution)){
|
||||
|
||||
SettingsManager.loadDBVariables(() -> {
|
||||
mIsOnline = true;
|
||||
firstCheckExecution = false;
|
||||
|
||||
}, ex -> {
|
||||
//mNoConnectionLayout.expand(true);
|
||||
if(mIsOnline) mIsOnline = false;
|
||||
}
|
||||
);
|
||||
|
||||
} else if(!value && mIsOnline){
|
||||
mIsOnline = false;
|
||||
}
|
||||
});
|
||||
// ServerStatusChecker.getInstance().addCallback(value -> {
|
||||
// if(value && (!mIsOnline || firstCheckExecution)){
|
||||
//
|
||||
// SettingsManager.loadDBVariables(() -> {
|
||||
// mIsOnline = true;
|
||||
// firstCheckExecution = false;
|
||||
//
|
||||
// }, ex -> {
|
||||
// //mNoConnectionLayout.expand(true);
|
||||
// if(mIsOnline) mIsOnline = false;
|
||||
// }
|
||||
// );
|
||||
//
|
||||
// } else if(!value && mIsOnline){
|
||||
// mIsOnline = false;
|
||||
// }
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface MainActivityComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
|
||||
MainActivityComponent create();
|
||||
}
|
||||
|
||||
void inject(MainActivity mainActivity);
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package it.integry.integrywmsnative;
|
||||
|
||||
import dagger.Module;
|
||||
|
||||
@Module(subcomponents = MainActivityComponent.class)
|
||||
public class MainActivityModule {
|
||||
}
|
||||
@ -5,19 +5,20 @@ import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
|
||||
import it.integry.integrywmsnative.core.context.AppContext;
|
||||
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.GrigliaDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.RoomModule;
|
||||
|
||||
|
||||
public class MainApplication extends Application {
|
||||
|
||||
public static Resources res;
|
||||
|
||||
// Reference to the application graph that is used across the whole app
|
||||
public static MainApplicationComponent appComponent;
|
||||
public static MainApplicationModule appModule;
|
||||
public static RoomModule roomModule;
|
||||
|
||||
private AppContext appContext = new AppContext(this);
|
||||
|
||||
private static AppDatabase appDb;
|
||||
|
||||
|
||||
// Called when the application is starting, before any other application objects have been created.
|
||||
@ -26,11 +27,14 @@ public class MainApplication extends Application {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
appModule = new MainApplicationModule(MainApplication.this, this);
|
||||
roomModule = new RoomModule(this);
|
||||
appComponent = DaggerMainApplicationComponent.builder()
|
||||
.mainApplicationModule(appModule)
|
||||
.roomModule(roomModule)
|
||||
.build();
|
||||
|
||||
appContext.init();
|
||||
|
||||
appDb = AppDatabase.getDatabase(this);
|
||||
//Stash.init(this);
|
||||
|
||||
res = getResources();
|
||||
}
|
||||
|
||||
@ -49,25 +53,8 @@ public class MainApplication extends Application {
|
||||
super.onLowMemory();
|
||||
}
|
||||
|
||||
|
||||
// DATABASE REPOSITORY FUNCTIONS
|
||||
public static GrigliaDao getGrigliaRepository() {
|
||||
return appDb.grigliaDao();
|
||||
public static void exit() {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public static ArticoloGrigliaDao getArticoliGrigliaRepository() {
|
||||
return appDb.articoloGrigliaDao();
|
||||
}
|
||||
|
||||
public static OrdineDao getOrdiniRepository() {
|
||||
return appDb.ordineDao();
|
||||
}
|
||||
|
||||
public static ArticoloOrdineDao getArticoliOrdineRepository() {
|
||||
return appDb.articoloOrdineDao();
|
||||
}
|
||||
|
||||
public static void clearDB() {
|
||||
new Thread(() -> appDb.clearAllTables()).start();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
package it.integry.integrywmsnative;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Component;
|
||||
import it.integry.integrywmsnative.core.data_store.db.RoomModule;
|
||||
import it.integry.integrywmsnative.gest.picking_libero.PickingLiberoComponent;
|
||||
import it.integry.integrywmsnative.gest.picking_libero.PickingLiberoModule;
|
||||
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;
|
||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdineAcquistoGrigliaModule;
|
||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeComponent;
|
||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeModule;
|
||||
import it.integry.integrywmsnative.gest.spedizione.SpedizioneComponent;
|
||||
import it.integry.integrywmsnative.gest.spedizione.SpedizioneModule;
|
||||
|
||||
// Definition of the Application graph
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
MainApplicationModule.class,
|
||||
RoomModule.class,
|
||||
MainActivityModule.class,
|
||||
PVOrdineAcquistoGrigliaModule.class,
|
||||
PVOrdineAcquistoEditModule.class,
|
||||
PickingLiberoModule.class,
|
||||
RettificaGiacenzeModule.class,
|
||||
SpedizioneModule.class})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
MainActivityComponent.Factory mainActivityComponent();
|
||||
PVOrdineAcquistoGrigliaComponent.Factory pvOrdineAcquistoGrigliaComponent();
|
||||
PVOrdineAcquistoEditComponent.Factory pvOrdineAcquistoEditComponent();
|
||||
PickingLiberoComponent.Factory pickingLiberoComponent();
|
||||
RettificaGiacenzeComponent.Factory rettificaGiacenzeComponent();
|
||||
SpedizioneComponent.Factory spedizioneComponent();
|
||||
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package it.integry.integrywmsnative;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
|
||||
@Module
|
||||
public class MainApplicationModule {
|
||||
|
||||
private final Context mContext;
|
||||
private final Application mApplication;
|
||||
|
||||
public MainApplicationModule(Context context, Application application) {
|
||||
this.mContext = context;
|
||||
this.mApplication = application;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
Application providesApplication() {
|
||||
return mApplication;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ColliDataRecoverService provideColliDataRecoverService() {
|
||||
return new ColliDataRecoverService(mContext);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
OrdiniRESTConsumer provideOrdiniRESTConsumer() {
|
||||
return new OrdiniRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ArticoloRESTConsumer provideArticoloRESTConsumer() {
|
||||
return new ArticoloRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ColliMagazzinoRESTConsumer provideColliMagazzinoRESTConsumer() {
|
||||
return new ColliMagazzinoRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
BarcodeRESTConsumer provideBarcodeRESTConsumer() {
|
||||
return new BarcodeRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PrinterRESTConsumer providePrinterRESTConsumer() {
|
||||
return new PrinterRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
SystemRESTConsumer provideSystemRESTConsumer() {
|
||||
return new SystemRESTConsumer();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -13,11 +13,13 @@ public class BaseCustomConfiguration implements ICustomConfiguration {
|
||||
public static int MENU_CONFIGURATION = 0;
|
||||
public static int FLAG_SHOW_COD_FORN_IN_SPEDIZIONE = 1;
|
||||
public static int CUSTOM_DYNAMIC_VERSION_PATH = 2;
|
||||
public static int FLAG_SPEDIZIONE_GROUP_BY_GRP_MERC = 3;
|
||||
}
|
||||
|
||||
protected HashMap<Integer, Object> configurations = new HashMap<Integer, Object>() {{
|
||||
put(Keys.MENU_CONFIGURATION, new MenuConfiguration());
|
||||
put(Keys.FLAG_SHOW_COD_FORN_IN_SPEDIZIONE, true);
|
||||
put(Keys.FLAG_SPEDIZIONE_GROUP_BY_GRP_MERC, false);
|
||||
}};
|
||||
|
||||
|
||||
|
||||
@ -7,7 +7,6 @@ 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 {
|
||||
|
||||
@ -20,7 +19,7 @@ public class ClassRouter {
|
||||
|
||||
private static Context context;
|
||||
|
||||
private static List<Pair<PATH, Class>> mRouteClasses = new ArrayList<>();
|
||||
private static List<Pair<PATH, Object>> mRouteClasses = new ArrayList<>();
|
||||
|
||||
public static void init(Context context) {
|
||||
ClassRouter.context = context;
|
||||
@ -50,7 +49,13 @@ public class ClassRouter {
|
||||
//throw new MethodPathAlreadyDeclaredException(path);
|
||||
}
|
||||
|
||||
mRouteClasses.add(new Pair<>(path, clazz));
|
||||
try {
|
||||
mRouteClasses.add(new Pair<>(path, clazz.newInstance()));
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void deregisterPath(PATH path) {
|
||||
@ -67,11 +72,11 @@ public class ClassRouter {
|
||||
throw new MethodPathNotRegisteredException(path);
|
||||
}
|
||||
|
||||
Class clazz = mRouteClasses.get(getClassIndex(path)).second;
|
||||
Object instance = mRouteClasses.get(getClassIndex(path)).second;
|
||||
|
||||
return (T)clazz.newInstance();
|
||||
return (T)instance;
|
||||
|
||||
} catch (InstantiationException | MethodPathNotRegisteredException | IllegalAccessException ex) {
|
||||
} catch (MethodPathNotRegisteredException ex) {
|
||||
// UtilityExceptions.defaultException(null, ex, true);
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,8 @@ import androidx.fragment.app.Fragment;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableWithReturn;
|
||||
|
||||
public class BaseMenuConfiguration {
|
||||
|
||||
|
||||
@ -65,7 +67,7 @@ public class BaseMenuConfiguration {
|
||||
@StringRes private int mTitleText;
|
||||
@DrawableRes private int mTitleIcon;
|
||||
@DrawableRes private int mDrawerIcon;
|
||||
private Fragment fragmentClass;
|
||||
private RunnableWithReturn<Fragment> fragmentFactory;
|
||||
|
||||
public int getID() {
|
||||
return mID;
|
||||
@ -103,12 +105,12 @@ public class BaseMenuConfiguration {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Fragment getFragmentClass() {
|
||||
return fragmentClass;
|
||||
public RunnableWithReturn<Fragment> getFragmentFactory() {
|
||||
return fragmentFactory;
|
||||
}
|
||||
|
||||
public MenuItem setFragmentClass(Fragment fragmentClass) {
|
||||
this.fragmentClass = fragmentClass;
|
||||
public MenuItem setFragmentFactory(RunnableWithReturn<Fragment> fragmentFactory) {
|
||||
this.fragmentFactory = fragmentFactory;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.class_router.configs;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.gest.accettazione.MainAccettazioneFragment;
|
||||
import it.integry.integrywmsnative.gest.picking_libero.PickingLiberoFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.ProdOrdineProduzioneElencoFragment;
|
||||
@ -16,112 +17,114 @@ import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceFragment
|
||||
public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
|
||||
|
||||
|
||||
public MenuConfiguration() {
|
||||
|
||||
this
|
||||
.addGroup(
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.purchase)
|
||||
.setGroupId(R.id.nav_group_acquisto)
|
||||
.addGroup(
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.purchase)
|
||||
.setGroupId(R.id.nav_group_acquisto)
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_accettazione)
|
||||
.setTitleText(R.string.accettazione_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_accettazione)
|
||||
.setDrawerIcon(R.drawable.ic_black_download)
|
||||
.setFragmentClass(MainAccettazioneFragment.newInstance()))
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_accettazione)
|
||||
.setTitleText(R.string.accettazione_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_accettazione)
|
||||
.setDrawerIcon(R.drawable.ic_black_download)
|
||||
.setFragmentFactory(MainAccettazioneFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_resi_fornitore)
|
||||
.setTitleText(R.string.fragment_ultime_arrivi_fornitore_title)
|
||||
.setTitleIcon(R.drawable.ic_latest_delivery)
|
||||
.setDrawerIcon(R.drawable.ic_black_latest_delivery)
|
||||
.setFragmentClass(UltimiArriviFornitoreFragment.newInstance()))
|
||||
).addGroup(
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.checkout)
|
||||
.setGroupId(R.id.nav_group_spedizione)
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_resi_fornitore)
|
||||
.setTitleText(R.string.fragment_ultime_arrivi_fornitore_title)
|
||||
.setTitleIcon(R.drawable.ic_latest_delivery)
|
||||
.setDrawerIcon(R.drawable.ic_black_latest_delivery)
|
||||
.setFragmentFactory(UltimiArriviFornitoreFragment::newInstance))
|
||||
).addGroup(
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.checkout)
|
||||
.setGroupId(R.id.nav_group_spedizione)
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_spedizione)
|
||||
.setTitleText(R.string.vendita_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_spedizione)
|
||||
.setDrawerIcon(R.drawable.ic_black_upload)
|
||||
.setFragmentClass(MainVenditaFragment.newInstance()))
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_spedizione)
|
||||
.setTitleText(R.string.vendita_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_spedizione)
|
||||
.setDrawerIcon(R.drawable.ic_black_upload)
|
||||
.setFragmentFactory(MainVenditaFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_free_picking)
|
||||
.setTitleText(R.string.free_picking)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_picking_libero)
|
||||
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
|
||||
.setFragmentClass(PickingLiberoFragment.newInstance()))
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_free_picking)
|
||||
.setTitleText(R.string.free_picking)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_picking_libero)
|
||||
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
|
||||
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(GestioneEnum.VENDITA)))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_resi_cliente)
|
||||
.setTitleText(R.string.fragment_ultime_consegne_cliente_title)
|
||||
.setTitleIcon(R.drawable.ic_latest_delivery_customer)
|
||||
.setDrawerIcon(R.drawable.ic_black_latest_delivery)
|
||||
.setFragmentClass(UltimeConsegneClienteFragment.newInstance()))
|
||||
).addGroup(new MenuGroup()
|
||||
.setGroupText(R.string.manufacture)
|
||||
.setGroupId(R.id.nav_group_produzione)
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_resi_cliente)
|
||||
.setTitleText(R.string.fragment_ultime_consegne_cliente_title)
|
||||
.setTitleIcon(R.drawable.ic_latest_delivery_customer)
|
||||
.setDrawerIcon(R.drawable.ic_black_latest_delivery)
|
||||
.setFragmentFactory(UltimeConsegneClienteFragment::newInstance))
|
||||
).addGroup(new MenuGroup()
|
||||
.setGroupText(R.string.manufacture)
|
||||
.setGroupId(R.id.nav_group_produzione)
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_ordine_produzione)
|
||||
.setTitleText(R.string.prod_ordine_produzione_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_accettazione)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentClass(ProdOrdineProduzioneElencoFragment.newInstance()))
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_ordine_produzione)
|
||||
.setTitleText(R.string.prod_ordine_produzione_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_accettazione_produzione)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdOrdineProduzioneElencoFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_ordine_lavorazione)
|
||||
.setTitleText(R.string.prod_ordine_lavorazione_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_spedizione)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentClass(ProdOrdineLavorazioneElencoFragment.newInstance()))
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_ordine_lavorazione)
|
||||
.setTitleText(R.string.prod_ordine_lavorazione_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_lavorazione)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdOrdineLavorazioneElencoFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_versamento_materiale)
|
||||
.setTitleText(R.string.prod_versamento_materiale_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_materiale)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentClass(ProdVersamentoMaterialeFragment.newInstance()))
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_free_lav_picking)
|
||||
.setTitleText(it.integry.integrywmsnative.R.string.free_lav_picking)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_libero)
|
||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_black_barcode_scanner)
|
||||
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(GestioneEnum.LAVORAZIONE)))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_recupero_materiale)
|
||||
.setTitleText(R.string.prod_recupero_materiale_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_recupero_materiale)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentClass(ProdRecuperoMaterialeFragment.newInstance()))
|
||||
)
|
||||
.addGroup(
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.internal_handling)
|
||||
.setGroupId(R.id.nav_group_movimentazione_interna)
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_versamento_materiale)
|
||||
.setTitleText(R.string.prod_versamento_materiale_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_materiale)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdVersamentoMaterialeFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_versamento_merce)
|
||||
.setTitleText(R.string.versamento_merce_fragment_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_versamento_merce)
|
||||
.setDrawerIcon(R.drawable.ic_black_load_shelf)
|
||||
.setFragmentClass(VersamentoMerceFragment.newInstance()))
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_recupero_materiale)
|
||||
.setTitleText(R.string.prod_recupero_materiale_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_recupero_materiale)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdRecuperoMaterialeFragment::newInstance))
|
||||
)
|
||||
.addGroup(
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.internal_handling)
|
||||
.setGroupId(R.id.nav_group_movimentazione_interna)
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_rettifica_giacenze)
|
||||
.setTitleText(R.string.rettifica_giacenze_fragment_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_rettifica_giacenze)
|
||||
.setDrawerIcon(R.drawable.ic_black_empty_box)
|
||||
.setFragmentClass(RettificaGiacenzeFragment.newInstance()))
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_versamento_merce)
|
||||
.setTitleText(R.string.versamento_merce_fragment_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_versamento_merce)
|
||||
.setDrawerIcon(R.drawable.ic_black_load_shelf)
|
||||
.setFragmentFactory(VersamentoMerceFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_rettifica_giacenze)
|
||||
.setTitleText(R.string.rettifica_giacenze_fragment_title)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_rettifica_giacenze)
|
||||
.setDrawerIcon(R.drawable.ic_black_empty_box)
|
||||
.setFragmentFactory(RettificaGiacenzeFragment::newInstance))
|
||||
|
||||
|
||||
);
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -11,6 +11,6 @@ import it.integry.integrywmsnative.gest.vendita.dto.OrdineVenditaInevasoDTO;
|
||||
|
||||
public interface IOrdiniVendita {
|
||||
|
||||
void distribuisciCollo(Dialog progress, MtbColt mtbColt, List<OrdineVenditaInevasoDTO> testateOrdini, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed);
|
||||
void distribuisciCollo(MtbColt mtbColt, List<OrdineVenditaInevasoDTO> testateOrdini, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
}
|
||||
|
||||
@ -2,15 +2,15 @@ package it.integry.integrywmsnative.core.context;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.crashlytics.android.Crashlytics;
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
import com.orhanobut.logger.AndroidLogAdapter;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecover;
|
||||
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.UtilityString;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityToast;
|
||||
@ -47,19 +47,20 @@ public class AppContext {
|
||||
|
||||
private void initCrashlytics() {
|
||||
if(!BuildConfig.DEBUG) {
|
||||
Fabric.with(mContext, new Crashlytics());
|
||||
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
|
||||
|
||||
if( SettingsManager.isInstanceAvailable() &&
|
||||
(SettingsManager.i().userSession != null && !UtilityString.isNullOrEmpty(SettingsManager.i().userSession.profileDB)) &&
|
||||
(SettingsManager.i().user != null && !UtilityString.isNullOrEmpty(SettingsManager.i().user.fullname))) {
|
||||
|
||||
Crashlytics.setString("user_fullname", SettingsManager.i().user.fullname);
|
||||
Crashlytics.setString("profile_db", SettingsManager.i().userSession.profileDB);
|
||||
crashlytics.setUserId(SettingsManager.i().user.fullname);
|
||||
crashlytics.setCustomKey("profile_db", SettingsManager.i().userSession.profileDB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initUtilities() {
|
||||
UtilityContext.initApplicationContext(mContext);
|
||||
UtilityResources.init(mContext);
|
||||
UtilityToast.init(mContext);
|
||||
}
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
package it.integry.integrywmsnative.core.data_recover;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.gest.vendita.dto.OrdineVenditaInevasoDTO;
|
||||
|
||||
public class ColliDataRecoverDTO {
|
||||
|
||||
private int id;
|
||||
private int numCollo;
|
||||
private String serCollo;
|
||||
private String dataCollo;
|
||||
private String gestioneCollo;
|
||||
private String filtro;
|
||||
|
||||
private List<OrdineVenditaInevasoDTO> testateOrdini;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public ColliDataRecoverDTO setId(int id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getNumCollo() {
|
||||
return numCollo;
|
||||
}
|
||||
|
||||
public ColliDataRecoverDTO setNumCollo(int numCollo) {
|
||||
this.numCollo = numCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerCollo() {
|
||||
return serCollo;
|
||||
}
|
||||
|
||||
public ColliDataRecoverDTO setSerCollo(String serCollo) {
|
||||
this.serCollo = serCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDataCollo() {
|
||||
return dataCollo;
|
||||
}
|
||||
|
||||
public ColliDataRecoverDTO setDataCollo(String dataCollo) {
|
||||
this.dataCollo = dataCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGestioneCollo() {
|
||||
return gestioneCollo;
|
||||
}
|
||||
|
||||
public ColliDataRecoverDTO setGestioneCollo(String gestioneCollo) {
|
||||
this.gestioneCollo = gestioneCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFiltro() {
|
||||
return filtro;
|
||||
}
|
||||
|
||||
public ColliDataRecoverDTO setFiltro(String filtro) {
|
||||
this.filtro = filtro;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<OrdineVenditaInevasoDTO> getTestateOrdini() {
|
||||
return testateOrdini;
|
||||
}
|
||||
|
||||
public ColliDataRecoverDTO setTestateOrdini(List<OrdineVenditaInevasoDTO> testateOrdini) {
|
||||
this.testateOrdini = testateOrdini;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MtbColt getMtbColt() {
|
||||
return new MtbColt()
|
||||
.setNumCollo(getNumCollo())
|
||||
.setSerCollo(getSerCollo())
|
||||
.setGestione(getGestioneCollo())
|
||||
.setDataCollo(getDataCollo())
|
||||
.setFiltroOrdini(getFiltro());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,152 @@
|
||||
package it.integry.integrywmsnative.core.data_recover;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.android.gms.common.util.IOUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.gest.vendita.dto.OrdineVenditaInevasoDTO;
|
||||
|
||||
@Singleton
|
||||
public class ColliDataRecoverService {
|
||||
|
||||
|
||||
private final Context mContext;
|
||||
private List<ColliDataRecoverDTO> mtbColtsSessions = new ArrayList<>();
|
||||
|
||||
@Inject
|
||||
public ColliDataRecoverService(Context context) {
|
||||
this.mContext = context;
|
||||
|
||||
if(isFilePresent(CommonConst.Files.RECOVER_COLLO_FILE)) {
|
||||
loadLocalFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean thereIsAnExistantSession() {
|
||||
return mtbColtsSessions.size() > 0;
|
||||
}
|
||||
|
||||
public List<Integer> getAllSessionIDs() {
|
||||
if(thereIsAnExistantSession()) {
|
||||
|
||||
return Stream.of(mtbColtsSessions)
|
||||
.map(ColliDataRecoverDTO::getId)
|
||||
.toList();
|
||||
|
||||
} else return null;
|
||||
}
|
||||
|
||||
public ColliDataRecoverDTO getSession(Integer sessionID) {
|
||||
|
||||
if(sessionID == null) return null;
|
||||
|
||||
return getIfExists(sessionID);
|
||||
}
|
||||
|
||||
private ColliDataRecoverDTO getIfExists(int id) {
|
||||
Optional<ColliDataRecoverDTO> recoverDTOOptional = Stream.of(mtbColtsSessions)
|
||||
.filter(x -> x.getId() == id)
|
||||
.findSingle();
|
||||
|
||||
|
||||
return recoverDTOOptional.isPresent() ? recoverDTOOptional.get() : null;
|
||||
}
|
||||
|
||||
public int startNewSession(MtbColt mtbColtSession, List<OrdineVenditaInevasoDTO> testateOrdini) {
|
||||
Integer newId = null;
|
||||
|
||||
while(newId == null) {
|
||||
int randomId = new Random().nextInt(1000);
|
||||
ColliDataRecoverDTO dto = getIfExists(randomId);
|
||||
if(dto == null) newId = randomId;
|
||||
}
|
||||
|
||||
|
||||
ColliDataRecoverDTO recoverDTO = new ColliDataRecoverDTO()
|
||||
.setId(newId)
|
||||
.setDataCollo(mtbColtSession.getDataColloS())
|
||||
.setNumCollo(mtbColtSession.getNumCollo())
|
||||
.setSerCollo(mtbColtSession.getSerCollo())
|
||||
.setGestioneCollo(mtbColtSession.getGestione())
|
||||
.setFiltro(mtbColtSession.getFiltroOrdini())
|
||||
.setTestateOrdini(testateOrdini);
|
||||
|
||||
mtbColtsSessions.add(recoverDTO);
|
||||
updateLocalFile();
|
||||
return newId;
|
||||
}
|
||||
|
||||
public void closeSession(int ID) {
|
||||
ColliDataRecoverDTO dto = getIfExists(ID);
|
||||
|
||||
if(dto != null) {
|
||||
mtbColtsSessions.remove(dto);
|
||||
updateLocalFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void loadLocalFile() {
|
||||
InputStream inputStream;
|
||||
Gson gson = new Gson();
|
||||
|
||||
try {
|
||||
inputStream = mContext.openFileInput(CommonConst.Files.RECOVER_COLLO_FILE);
|
||||
|
||||
byte[] bytes = IOUtils.readInputStreamFully(inputStream);
|
||||
String jsonString = new String(bytes);
|
||||
|
||||
Type listType = new TypeToken<ArrayList<ColliDataRecoverDTO>>(){}.getType();
|
||||
mtbColtsSessions = gson.fromJson(jsonString, listType);
|
||||
|
||||
inputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
UtilityExceptions.defaultException(mContext, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateLocalFile() {
|
||||
FileOutputStream outputStream;
|
||||
|
||||
Gson gson = new Gson();
|
||||
String jsonText = gson.toJson(mtbColtsSessions);
|
||||
|
||||
try {
|
||||
outputStream = mContext.openFileOutput(CommonConst.Files.RECOVER_COLLO_FILE, Context.MODE_PRIVATE);
|
||||
outputStream.write(jsonText.getBytes());
|
||||
outputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
UtilityExceptions.defaultException(mContext, e);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isFilePresent(String fileName) {
|
||||
String path = mContext.getFilesDir().getAbsolutePath() + "/" + fileName;
|
||||
File file = new File(path);
|
||||
return file.exists();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,9 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.room.Database;
|
||||
import androidx.room.Room;
|
||||
import androidx.room.RoomDatabase;
|
||||
import androidx.room.TypeConverters;
|
||||
|
||||
@ -23,7 +20,7 @@ import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
})
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
|
||||
private static volatile AppDatabase INSTANCE;
|
||||
// private AppDatabase mRoomInstance;
|
||||
|
||||
public abstract ArticoloGrigliaDao articoloGrigliaDao();
|
||||
|
||||
@ -33,19 +30,26 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
|
||||
public abstract ArticoloOrdineDao articoloOrdineDao();
|
||||
|
||||
public static AppDatabase getDatabase(final Context context) {
|
||||
if (INSTANCE == null) {
|
||||
synchronized (AppDatabase.class) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
|
||||
AppDatabase.class, "integry_wms")
|
||||
.fallbackToDestructiveMigration()
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
// public static AppDatabase getDatabase(final Context context) {
|
||||
// if (INSTANCE == null) {
|
||||
// synchronized (AppDatabase.class) {
|
||||
// if (INSTANCE == null) {
|
||||
// INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
|
||||
// AppDatabase.class, "integry_wms")
|
||||
// .fallbackToDestructiveMigration()
|
||||
// .build();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return INSTANCE;
|
||||
// }
|
||||
|
||||
// public AppDatabase(Application application) {
|
||||
// mRoomInstance = Room.databaseBuilder(application,
|
||||
// AppDatabase.class, "integry_wms")
|
||||
// .fallbackToDestructiveMigration()
|
||||
// .build();
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Component;
|
||||
|
||||
@Singleton
|
||||
@Component(modules = {RoomModule.class})
|
||||
public interface RoomComponent {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db;
|
||||
|
||||
public interface RoomComponentProvider {
|
||||
|
||||
RoomComponent provideRoomComponent();
|
||||
|
||||
}
|
||||
@ -0,0 +1,99 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import androidx.room.Room;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.GrigliaDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.ArticoliGrigliaDataSource;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.ArticoliOrdineDataSource;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.GrigliaDataSource;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.implementations.OrdineDataSource;
|
||||
|
||||
@Module
|
||||
public class RoomModule {
|
||||
|
||||
private AppDatabase appDatabase;
|
||||
|
||||
public RoomModule(Application application) {
|
||||
appDatabase = Room.databaseBuilder(application,
|
||||
AppDatabase.class, "integry_wms")
|
||||
.fallbackToDestructiveMigration()
|
||||
.build();
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
AppDatabase providesRoomDatabase() {
|
||||
return appDatabase;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
ArticoloGrigliaDao providesArticoloGrigliaDao(AppDatabase appDatabase) {
|
||||
return appDatabase.articoloGrigliaDao();
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
GrigliaDao providesGrigliaDao(AppDatabase appDatabase) {
|
||||
return appDatabase.grigliaDao();
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
OrdineDao providesOrdineDao(AppDatabase appDatabase) {
|
||||
return appDatabase.ordineDao();
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
ArticoloOrdineDao providesArticoloOrdineDao(AppDatabase appDatabase) {
|
||||
return appDatabase.articoloOrdineDao();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
ArticoloGrigliaRepository providesArticoloGrigliaRepository(ArticoloGrigliaDao articoloGrigliaDao) {
|
||||
return new ArticoliGrigliaDataSource(articoloGrigliaDao);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
ArticoliOrdineRepository providesArticoliOrdineRepository(ArticoloOrdineDao articoloOrdineDao) {
|
||||
return new ArticoliOrdineDataSource(articoloOrdineDao);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
GrigliaRepository providesGrigliaRepository(GrigliaDao grigliaDao) {
|
||||
return new GrigliaDataSource(grigliaDao);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
OrdineRepository providesOrdineRepository(OrdineDao ordineDao) {
|
||||
return new OrdineDataSource(ordineDao);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,88 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.repository;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public class ArticoliGrigliaRepository extends Repository{
|
||||
|
||||
ArticoloGrigliaDao mRepository;
|
||||
|
||||
public ArticoliGrigliaRepository() {
|
||||
this.mRepository = MainApplication.getArticoliGrigliaRepository();
|
||||
}
|
||||
|
||||
public void saveArticoliToGriglia(List<ArticoloGriglia> articoli, Griglia griglia, Runnable onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(()->{
|
||||
try{
|
||||
List<ArticoloGriglia> toUpdate = new ArrayList<>();
|
||||
List<ArticoloGriglia> toInsert = new ArrayList<>();
|
||||
List<String> codMarts = new ArrayList<>();
|
||||
for (ArticoloGriglia art : articoli){
|
||||
Integer id = mRepository.getIdArticoloByGrigliaAndBarcodeAndCodMart(griglia.getGrigliaId(),art.getBarCode(),art.getCodMart());
|
||||
codMarts.add(art.getCodMart());
|
||||
if (id != null){
|
||||
art.setArticoloGrigliaId(id);
|
||||
toUpdate.add(art);
|
||||
}else{
|
||||
toInsert.add(art);
|
||||
}
|
||||
}
|
||||
mRepository.insertAll(toInsert);
|
||||
mRepository.updateAll(toUpdate);
|
||||
List<ArticoloGriglia> articoliGriglia = mRepository.getArticoliFromGriglia(griglia.getGrigliaId());
|
||||
List<ArticoloGriglia> toDelete =Stream.of(articoliGriglia).filter(articolo-> !codMarts.contains(articolo.getCodMart())).toList();
|
||||
mRepository.deleteList(toDelete);
|
||||
onSuccess.run();
|
||||
}catch (Exception e){
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void findArticoloByBarcodeAndGriglia(String barcode, int idGriglia,RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail ){
|
||||
execute(()->{
|
||||
try{
|
||||
onSuccess.run(mRepository.findArticoloByBarcodeAndGriglia(barcode, idGriglia));
|
||||
}catch (Exception e){
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
public void findArticoloByCodMartAndGriglia(String codMart, int idGriglia,RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail ){
|
||||
execute(()->{
|
||||
try{
|
||||
onSuccess.run(mRepository.findArticoloByCodMartAndGriglia(codMart, idGriglia));
|
||||
}catch (Exception e){
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
public void findArticoloByScanAndGriglia(String scan, int idGriglia,RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail ){
|
||||
execute(()->{
|
||||
try{
|
||||
ArticoloGriglia articolo = mRepository.findArticoloByCodMartAndGriglia(scan, idGriglia);
|
||||
if (articolo == null){
|
||||
articolo = mRepository.findArticoloByBarcodeAndGriglia(scan,idGriglia);
|
||||
if (articolo==null){
|
||||
String barcode= StringUtils.leftPad(scan,13,"0");
|
||||
articolo = mRepository.findArticoloByBarcodeAndGriglia(barcode,idGriglia);
|
||||
}
|
||||
}
|
||||
onSuccess.run(articolo);
|
||||
}catch (Exception e){
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -1,109 +1,24 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.repository;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public class ArticoliOrdineRepository extends Repository {
|
||||
public interface ArticoliOrdineRepository {
|
||||
|
||||
ArticoloOrdineDao mRepository;
|
||||
void saveArticoliToOrdine(List<ArticoloOrdine> articoli, Runnable onSuccess, RunnableArgs<Exception> onFail);
|
||||
|
||||
public ArticoliOrdineRepository() {
|
||||
this.mRepository = MainApplication.getArticoliOrdineRepository();
|
||||
}
|
||||
void saveArticoloToOrdine(ArticoloOrdine articolo, Runnable onSuccess, RunnableArgs<Exception> onFail);
|
||||
|
||||
public void saveArticoliToOrdine(List<ArticoloOrdine> articoli, Runnable onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
List<ArticoloOrdine> toUpdate = new ArrayList<>();
|
||||
List<ArticoloOrdine> toInsert = new ArrayList<>();
|
||||
for (ArticoloOrdine art : articoli) {
|
||||
if (art.getArticoloOrdineId() > 0) {
|
||||
toUpdate.add(art);
|
||||
} else {
|
||||
toInsert.add(art);
|
||||
}
|
||||
}
|
||||
mRepository.insertAll(toInsert);
|
||||
mRepository.updateAll(toUpdate);
|
||||
onSuccess.run();
|
||||
void findArticoloByOrdineAndBarcode(Ordine ordine, String barcode, RunnableArgs<ArticoloOrdine> onSuccess, RunnableArgs<Exception> onFail);
|
||||
|
||||
void findArticoloByScanAndOrdine(Ordine ordine, String barcode, RunnableArgs<ArticoloOrdine> onSuccess, RunnableArgs<Exception> onFail);
|
||||
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
public void saveArticoloToOrdine(ArticoloOrdine articolo, Runnable onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
if (articolo.getArticoloOrdineId() > 0) {
|
||||
mRepository.update(articolo);
|
||||
} else {
|
||||
mRepository.insert(articolo);
|
||||
}
|
||||
onSuccess.run();
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
void findArticoliByOrdine(Ordine ordine, RunnableArgs<List<ArticoloOrdine>> onLoad, RunnableArgs<Exception> onError);
|
||||
|
||||
public void findArticoloByOrdineAndBarcode(Ordine ordine, String barcode, RunnableArgs<ArticoloOrdine> onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
ArticoloOrdine articolo = mRepository.findArticoloByOrdineAndBarcode(ordine.getOrdineId(), barcode);
|
||||
onSuccess.run(articolo);
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
public void findArticoloByScanAndOrdine(Ordine ordine, String barcode, RunnableArgs<ArticoloOrdine> onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
String scannedCode = barcode;
|
||||
ArticoloOrdine articolo = mRepository.findArticoloByCodMartAndOrdine(ordine.getOrdineId(), scannedCode);
|
||||
if (articolo == null){
|
||||
articolo = mRepository.findArticoloByBarcodeAndOrdine(ordine.getOrdineId(), scannedCode);
|
||||
if (articolo == null){
|
||||
scannedCode= StringUtils.leftPad(scannedCode,13,'0');
|
||||
articolo = mRepository.findArticoloByBarcodeAndOrdine(ordine.getOrdineId(), scannedCode);
|
||||
}
|
||||
}
|
||||
onSuccess.run(articolo);
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
void deleteArticolo(ArticoloOrdine articolo, Runnable onSave, RunnableArgs<Exception> onError);
|
||||
|
||||
public void findArticoliByOrdine(Ordine ordine, RunnableArgs<List<ArticoloOrdine>> onLoad, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
onLoad.run(mRepository.findArticoliByOrdine(ordine.getOrdineId()));
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void deleteArticolo(ArticoloOrdine articolo, Runnable onSave, RunnableArgs<Exception> onError) {
|
||||
execute(()->{
|
||||
try{
|
||||
mRepository.delete(articolo);
|
||||
onSave.run();
|
||||
}catch (Exception e){
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public interface ArticoloGrigliaRepository {
|
||||
|
||||
void saveArticoliToGriglia(List<ArticoloGriglia> articoli, Griglia griglia, Runnable onSuccess, RunnableArgs<Exception> onFail);
|
||||
|
||||
void findArticoloByBarcodeAndGriglia(String barcode, int idGriglia, RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail);
|
||||
|
||||
void findArticoloByCodMartAndGriglia(String codMart, int idGriglia, RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail);
|
||||
|
||||
void findArticoloByScanAndGriglia(String scan, int idGriglia, RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail);
|
||||
|
||||
}
|
||||
@ -2,66 +2,17 @@ package it.integry.integrywmsnative.core.data_store.db.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.GrigliaDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.GrigliaWrapper;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public class GrigliaRepository extends Repository{
|
||||
public interface GrigliaRepository {
|
||||
|
||||
private GrigliaDao mRepository;
|
||||
void selectAll(RunnableArgs<List<Griglia>> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
public GrigliaRepository() {
|
||||
this.mRepository = MainApplication.getGrigliaRepository();
|
||||
}
|
||||
void findByCodAlis(String codAlis , RunnableArgs<GrigliaWrapper> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
public void selectAll(RunnableArgs<List<Griglia>> onSuccess, RunnableArgs<Exception> onError){
|
||||
Runnable query = ()->{
|
||||
try{
|
||||
onSuccess.run(mRepository.getAll());
|
||||
}catch (Exception e){
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
void saveGriglia(Griglia griglia, RunnableArgs<Integer> onSuccess,RunnableArgs<Exception> onFail);
|
||||
|
||||
public void findByCodAlis(String codAlis , RunnableArgs<GrigliaWrapper> onSuccess, RunnableArgs<Exception> onError){
|
||||
Runnable query = ()->{
|
||||
try{
|
||||
onSuccess.run(mRepository.findByCodAlis(codAlis));
|
||||
}catch (Exception e){
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
|
||||
|
||||
public void saveGriglia(Griglia griglia, RunnableArgs<Integer> onSuccess,RunnableArgs<Exception> onFail) {
|
||||
execute(()->{
|
||||
try{
|
||||
if (griglia.getGrigliaId() <= 0){
|
||||
griglia.setGrigliaId((int) mRepository.insert(griglia));
|
||||
}else{
|
||||
mRepository.update(griglia);
|
||||
}
|
||||
onSuccess.run(griglia.getGrigliaId());
|
||||
}catch (Exception e){
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void findGrigliaById(int idGriglia, RunnableArgs<Griglia> onLoad, RunnableArgs<Exception> onFail) {
|
||||
execute(()->{
|
||||
try{
|
||||
onLoad.run(mRepository.findGrigliaById(idGriglia));
|
||||
}catch (Exception e){
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
void findGrigliaById(int idGriglia, RunnableArgs<Griglia> onLoad, RunnableArgs<Exception> onFail);
|
||||
}
|
||||
|
||||
@ -2,86 +2,25 @@ package it.integry.integrywmsnative.core.data_store.db.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.view_model.OrdineWithGriglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.OrdineWrapper;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public class OrdineRepository extends Repository {
|
||||
public interface OrdineRepository {
|
||||
|
||||
private OrdineDao mRepository;
|
||||
void selectAll(RunnableArgs<List<Ordine>> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
public OrdineRepository() {
|
||||
this.mRepository = MainApplication.getOrdiniRepository();
|
||||
}
|
||||
void selectAllTransmitted(RunnableArgs<List<OrdineWithGriglia>> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
public void selectAll(RunnableArgs<List<Ordine>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
Runnable query = () -> {
|
||||
try {
|
||||
onSuccess.run(mRepository.getAll());
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
void selectAllOpenOrders(Griglia griglia, RunnableArgs<List<OrdineWrapper>> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
public void selectAllTransmitted(RunnableArgs<List<OrdineWithGriglia>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
Runnable query = () -> {
|
||||
try {
|
||||
onSuccess.run(mRepository.getAllTrasnmitted());
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
void insert(Ordine ordine, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
public void selectAllOpenOrders(Griglia griglia, RunnableArgs<List<OrdineWrapper>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
Runnable query = () -> {
|
||||
try {
|
||||
onSuccess.run(mRepository.getAllOpenOrdersByGriglia(griglia.getGrigliaId()));
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
void updateOrder(Ordine ordine, RunnableArgs<Ordine> onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
public void insert(Ordine ordine, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
Long id = mRepository.insert(ordine);
|
||||
onSuccess.run(id.intValue());
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
void delete(Ordine ordine, Runnable onSuccess, RunnableArgs<Exception> onError);
|
||||
|
||||
|
||||
public void updateOrder(Ordine ordine, RunnableArgs<Ordine> onSuccess, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
mRepository.update(ordine);
|
||||
onSuccess.run(ordine);
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void delete(Ordine ordine, Runnable onSuccess, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
mRepository.delete(ordine);
|
||||
onSuccess.run();
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,92 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public class ArticoliGrigliaDataSource extends Repository implements ArticoloGrigliaRepository {
|
||||
|
||||
private final ArticoloGrigliaDao mArticoloGrigliaDao;
|
||||
|
||||
@Inject
|
||||
public ArticoliGrigliaDataSource(ArticoloGrigliaDao articoloGrigliaDao) {
|
||||
this.mArticoloGrigliaDao = articoloGrigliaDao;
|
||||
}
|
||||
|
||||
public void saveArticoliToGriglia(List<ArticoloGriglia> articoli, Griglia griglia, Runnable onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
List<ArticoloGriglia> toUpdate = new ArrayList<>();
|
||||
List<ArticoloGriglia> toInsert = new ArrayList<>();
|
||||
List<String> codMarts = new ArrayList<>();
|
||||
for (ArticoloGriglia art : articoli) {
|
||||
Integer id = mArticoloGrigliaDao.getIdArticoloByGrigliaAndBarcodeAndCodMart(griglia.getGrigliaId(), art.getBarCode(), art.getCodMart());
|
||||
codMarts.add(art.getCodMart());
|
||||
if (id != null) {
|
||||
art.setArticoloGrigliaId(id);
|
||||
toUpdate.add(art);
|
||||
} else {
|
||||
toInsert.add(art);
|
||||
}
|
||||
}
|
||||
mArticoloGrigliaDao.insertAll(toInsert);
|
||||
mArticoloGrigliaDao.updateAll(toUpdate);
|
||||
List<ArticoloGriglia> articoliGriglia = mArticoloGrigliaDao.getArticoliFromGriglia(griglia.getGrigliaId());
|
||||
List<ArticoloGriglia> toDelete = Stream.of(articoliGriglia).filter(articolo -> !codMarts.contains(articolo.getCodMart())).toList();
|
||||
mArticoloGrigliaDao.deleteList(toDelete);
|
||||
onSuccess.run();
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void findArticoloByBarcodeAndGriglia(String barcode, int idGriglia, RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
onSuccess.run(mArticoloGrigliaDao.findArticoloByBarcodeAndGriglia(barcode, idGriglia));
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void findArticoloByCodMartAndGriglia(String codMart, int idGriglia, RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
onSuccess.run(mArticoloGrigliaDao.findArticoloByCodMartAndGriglia(codMart, idGriglia));
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void findArticoloByScanAndGriglia(String scan, int idGriglia, RunnableArgs<ArticoloGriglia> onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
ArticoloGriglia articolo = mArticoloGrigliaDao.findArticoloByCodMartAndGriglia(scan, idGriglia);
|
||||
if (articolo == null) {
|
||||
articolo = mArticoloGrigliaDao.findArticoloByBarcodeAndGriglia(scan, idGriglia);
|
||||
if (articolo == null) {
|
||||
String barcode = StringUtils.leftPad(scan, 13, "0");
|
||||
articolo = mArticoloGrigliaDao.findArticoloByBarcodeAndGriglia(barcode, idGriglia);
|
||||
}
|
||||
}
|
||||
onSuccess.run(articolo);
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,114 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public class ArticoliOrdineDataSource extends Repository implements ArticoliOrdineRepository {
|
||||
|
||||
private final ArticoloOrdineDao mArticoloOrdineDao;
|
||||
|
||||
@Inject
|
||||
public ArticoliOrdineDataSource(ArticoloOrdineDao articoloOrdineDao) {
|
||||
this.mArticoloOrdineDao = articoloOrdineDao;
|
||||
}
|
||||
|
||||
public void saveArticoliToOrdine(List<ArticoloOrdine> articoli, Runnable onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
List<ArticoloOrdine> toUpdate = new ArrayList<>();
|
||||
List<ArticoloOrdine> toInsert = new ArrayList<>();
|
||||
for (ArticoloOrdine art : articoli) {
|
||||
if (art.getArticoloOrdineId() > 0) {
|
||||
toUpdate.add(art);
|
||||
} else {
|
||||
toInsert.add(art);
|
||||
}
|
||||
}
|
||||
mArticoloOrdineDao.insertAll(toInsert);
|
||||
mArticoloOrdineDao.updateAll(toUpdate);
|
||||
onSuccess.run();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void saveArticoloToOrdine(ArticoloOrdine articolo, Runnable onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
if (articolo.getArticoloOrdineId() > 0) {
|
||||
mArticoloOrdineDao.update(articolo);
|
||||
} else {
|
||||
mArticoloOrdineDao.insert(articolo);
|
||||
}
|
||||
onSuccess.run();
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void findArticoloByOrdineAndBarcode(Ordine ordine, String barcode, RunnableArgs<ArticoloOrdine> onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
ArticoloOrdine articolo = mArticoloOrdineDao.findArticoloByOrdineAndBarcode(ordine.getOrdineId(), barcode);
|
||||
onSuccess.run(articolo);
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void findArticoloByScanAndOrdine(Ordine ordine, String barcode, RunnableArgs<ArticoloOrdine> onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
String scannedCode = barcode;
|
||||
ArticoloOrdine articolo = mArticoloOrdineDao.findArticoloByCodMartAndOrdine(ordine.getOrdineId(), scannedCode);
|
||||
if (articolo == null) {
|
||||
articolo = mArticoloOrdineDao.findArticoloByBarcodeAndOrdine(ordine.getOrdineId(), scannedCode);
|
||||
if (articolo == null) {
|
||||
scannedCode = StringUtils.leftPad(scannedCode, 13, '0');
|
||||
articolo = mArticoloOrdineDao.findArticoloByBarcodeAndOrdine(ordine.getOrdineId(), scannedCode);
|
||||
}
|
||||
}
|
||||
onSuccess.run(articolo);
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void findArticoliByOrdine(Ordine ordine, RunnableArgs<List<ArticoloOrdine>> onLoad, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
onLoad.run(mArticoloOrdineDao.findArticoliByOrdine(ordine.getOrdineId()));
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void deleteArticolo(ArticoloOrdine articolo, Runnable onSave, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
mArticoloOrdineDao.delete(articolo);
|
||||
onSave.run();
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.GrigliaDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.GrigliaWrapper;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public class GrigliaDataSource extends Repository implements GrigliaRepository {
|
||||
|
||||
private final GrigliaDao mGrigliaDao;
|
||||
|
||||
@Inject
|
||||
public GrigliaDataSource(GrigliaDao grigliaDao) {
|
||||
this.mGrigliaDao = grigliaDao;
|
||||
}
|
||||
|
||||
public void selectAll(RunnableArgs<List<Griglia>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
Runnable query = () -> {
|
||||
try {
|
||||
onSuccess.run(mGrigliaDao.getAll());
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
|
||||
public void findByCodAlis(String codAlis, RunnableArgs<GrigliaWrapper> onSuccess, RunnableArgs<Exception> onError) {
|
||||
Runnable query = () -> {
|
||||
try {
|
||||
onSuccess.run(mGrigliaDao.findByCodAlis(codAlis));
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
|
||||
|
||||
public void saveGriglia(Griglia griglia, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
if (griglia.getGrigliaId() <= 0) {
|
||||
griglia.setGrigliaId((int) mGrigliaDao.insert(griglia));
|
||||
} else {
|
||||
mGrigliaDao.update(griglia);
|
||||
}
|
||||
onSuccess.run(griglia.getGrigliaId());
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void findGrigliaById(int idGriglia, RunnableArgs<Griglia> onLoad, RunnableArgs<Exception> onFail) {
|
||||
execute(() -> {
|
||||
try {
|
||||
onLoad.run(mGrigliaDao.findGrigliaById(idGriglia));
|
||||
} catch (Exception e) {
|
||||
onFail.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.view_model.OrdineWithGriglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.OrdineWrapper;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public class OrdineDataSource extends Repository implements OrdineRepository {
|
||||
|
||||
private OrdineDao mOrdineDao;
|
||||
|
||||
@Inject
|
||||
public OrdineDataSource(OrdineDao ordineDao) {
|
||||
this.mOrdineDao = ordineDao;
|
||||
}
|
||||
|
||||
public void selectAll(RunnableArgs<List<Ordine>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
Runnable query = () -> {
|
||||
try {
|
||||
onSuccess.run(mOrdineDao.getAll());
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
|
||||
public void selectAllTransmitted(RunnableArgs<List<OrdineWithGriglia>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
Runnable query = () -> {
|
||||
try {
|
||||
onSuccess.run(mOrdineDao.getAllTrasnmitted());
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
|
||||
public void selectAllOpenOrders(Griglia griglia, RunnableArgs<List<OrdineWrapper>> onSuccess, RunnableArgs<Exception> onError) {
|
||||
Runnable query = () -> {
|
||||
try {
|
||||
onSuccess.run(mOrdineDao.getAllOpenOrdersByGriglia(griglia.getGrigliaId()));
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
};
|
||||
execute(query);
|
||||
}
|
||||
|
||||
public void insert(Ordine ordine, RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
Long id = mOrdineDao.insert(ordine);
|
||||
onSuccess.run(id.intValue());
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void updateOrder(Ordine ordine, RunnableArgs<Ordine> onSuccess, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
mOrdineDao.update(ordine);
|
||||
onSuccess.run(ordine);
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void delete(Ordine ordine, Runnable onSuccess, RunnableArgs<Exception> onError) {
|
||||
execute(() -> {
|
||||
try {
|
||||
mOrdineDao.delete(ordine);
|
||||
onSuccess.run();
|
||||
} catch (Exception e) {
|
||||
onError.run(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package it.integry.integrywmsnative.core.data_store.db.repository;
|
||||
package it.integry.integrywmsnative.core.data_store.db.repository.implementations;
|
||||
|
||||
public class Repository {
|
||||
|
||||
@ -29,6 +29,19 @@ public class BindableBoolean implements Observable {
|
||||
}
|
||||
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) {
|
||||
@ -83,7 +96,11 @@ public class BindableBoolean implements Observable {
|
||||
}
|
||||
|
||||
public void set(boolean value) {
|
||||
if (mValue != value) {
|
||||
this.set(value, false);
|
||||
}
|
||||
|
||||
public void set(boolean value, boolean forceRefresh) {
|
||||
if (mValue != value || forceRefresh) {
|
||||
this.mValue = value;
|
||||
notifyChange();
|
||||
}
|
||||
|
||||
@ -3,7 +3,13 @@ package it.integry.integrywmsnative.core.di;
|
||||
import androidx.databinding.BaseObservable;
|
||||
|
||||
public class BindableInteger extends BaseObservable {
|
||||
Integer value;
|
||||
Integer mValue;
|
||||
|
||||
public BindableInteger() {}
|
||||
|
||||
public BindableInteger(int startValue) {
|
||||
this.mValue = startValue;
|
||||
}
|
||||
|
||||
public Integer get() {
|
||||
return get(true);
|
||||
@ -11,21 +17,21 @@ public class BindableInteger extends BaseObservable {
|
||||
|
||||
public Integer get(boolean defaultIfNull) {
|
||||
|
||||
if(value == null){
|
||||
if(mValue == null){
|
||||
if(defaultIfNull) return 0;
|
||||
else return null;
|
||||
} else return value;
|
||||
} else return mValue;
|
||||
}
|
||||
|
||||
public void set(Integer value) {
|
||||
if (!Objects.equals(this.value, value)) {
|
||||
this.value = value;
|
||||
if (!Objects.equals(this.mValue, value)) {
|
||||
this.mValue = value;
|
||||
notifyChange();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return value == null;
|
||||
return mValue == null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,38 +3,60 @@ package it.integry.integrywmsnative.core.di;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView;
|
||||
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.databinding.BindingAdapter;
|
||||
import androidx.databinding.BindingConversion;
|
||||
import androidx.constraintlayout.widget.Guideline;
|
||||
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
import androidx.core.util.Pair;
|
||||
import androidx.appcompat.widget.AppCompatCheckBox;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
import android.app.DatePickerDialog;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Locale;
|
||||
|
||||
import androidx.databinding.Observable;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityContext;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
|
||||
public class Converters {
|
||||
|
||||
|
||||
@BindingConversion
|
||||
public static String convertBindableToString(BindableString bindableString) {
|
||||
return bindableString.get();
|
||||
if(bindableString != null) return bindableString.get();
|
||||
return "";
|
||||
}
|
||||
|
||||
@BindingConversion
|
||||
@ -42,6 +64,33 @@ public class Converters {
|
||||
return bindableBoolean.get();
|
||||
}
|
||||
|
||||
@BindingConversion
|
||||
public static boolean convertObservableToBoolean(ObservableField<Boolean> bindableBoolean) {
|
||||
return bindableBoolean.get();
|
||||
}
|
||||
|
||||
@BindingAdapter("binding")
|
||||
public static void bindEditText(AppCompatTextView view, final BindableInteger bindableInteger) {
|
||||
Pair<BindableInteger, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||
if (pair == null || pair.first != bindableInteger) {
|
||||
if (pair != null) {
|
||||
view.removeTextChangedListener(pair.second);
|
||||
}
|
||||
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if(bindableInteger != null) bindableInteger.set(Integer.parseInt(s.toString()));
|
||||
}
|
||||
};
|
||||
view.setTag(R.id.bound_observable, new Pair<>(bindableInteger, watcher));
|
||||
view.addTextChangedListener(watcher);
|
||||
}
|
||||
String newValue = bindableInteger != null && bindableInteger.get() != null ? bindableInteger.get().toString() : "0";
|
||||
if (!view.getText().toString().equals(newValue)) {
|
||||
view.setText(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("binding")
|
||||
public static void bindEditText(EditText view, final BindableString bindableString) {
|
||||
Pair<BindableString, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||
@ -50,7 +99,8 @@ public class Converters {
|
||||
view.removeTextChangedListener(pair.second);
|
||||
}
|
||||
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||
@Override public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
bindableString.set(s.toString());
|
||||
}
|
||||
};
|
||||
@ -71,7 +121,8 @@ public class Converters {
|
||||
view.removeTextChangedListener(pair.second);
|
||||
}
|
||||
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||
@Override public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
bindableString.set(s.toString());
|
||||
}
|
||||
};
|
||||
@ -84,6 +135,103 @@ public class Converters {
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("binding")
|
||||
public static void bindTextInputEditTextBigDecimal(TextInputEditText view, final ObservableField<BigDecimal> observableBigDecimal) {
|
||||
Pair<ObservableField<BigDecimal>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||
if (pair == null || pair.first != observableBigDecimal) {
|
||||
if (pair != null) {
|
||||
view.removeTextChangedListener(pair.second);
|
||||
}
|
||||
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
BigDecimal value = null;
|
||||
if(!UtilityString.isNullOrEmpty(s.toString())) value = new BigDecimal(s.toString());
|
||||
observableBigDecimal.set(value);
|
||||
}
|
||||
};
|
||||
view.setTag(R.id.bound_observable, new Pair<>(observableBigDecimal, watcher));
|
||||
view.addTextChangedListener(watcher);
|
||||
}
|
||||
BigDecimal newValue = observableBigDecimal.get();
|
||||
BigDecimal viewValue = view.getText().toString().trim().length() > 0 ? new BigDecimal(view.getText().toString()) : null;
|
||||
|
||||
if(!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||
view.setText(UtilityNumber.decimalToString(newValue));
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("binding")
|
||||
public static void bindTextInputEditTextString(TextInputEditText view, final ObservableField<String> observableString) {
|
||||
Pair<ObservableField<String>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||
if (pair == null || pair.first != observableString) {
|
||||
if (pair != null) {
|
||||
view.removeTextChangedListener(pair.second);
|
||||
}
|
||||
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
observableString.set(s.toString());
|
||||
}
|
||||
};
|
||||
view.setTag(R.id.bound_observable, new Pair<>(observableString, watcher));
|
||||
view.addTextChangedListener(watcher);
|
||||
}
|
||||
String newValue = observableString.get();
|
||||
String viewValue = view.getText().toString().trim();
|
||||
|
||||
if(!viewValue.equalsIgnoreCase(newValue)) {
|
||||
view.setText(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter({"binding"})
|
||||
public static void bindTextInputEditTextDate(TextInputEditText view, final ObservableField<Date> observableDate) {
|
||||
Pair<ObservableField<Date>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||
if (pair == null || pair.first != observableDate) {
|
||||
if (pair != null) {
|
||||
view.removeTextChangedListener(pair.second);
|
||||
}
|
||||
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
};
|
||||
view.setTag(R.id.bound_observable, new Pair<>(observableDate, watcher));
|
||||
view.addTextChangedListener(watcher);
|
||||
|
||||
RunnableArgs<View> onClick = v -> {
|
||||
// Get Current Date
|
||||
Calendar c = UtilityDate.getCalendarInstance();
|
||||
|
||||
if(observableDate.get() != null) {
|
||||
c.setTime(observableDate.get());
|
||||
}
|
||||
|
||||
int mYear = c.get(Calendar.YEAR);
|
||||
int mMonth = c.get(Calendar.MONTH);
|
||||
int mDay = c.get(Calendar.DAY_OF_MONTH);
|
||||
|
||||
DatePickerDialog datePickerDialog = new DatePickerDialog(view.getContext(),
|
||||
(cView, year, month, day) -> {
|
||||
Date resultDate = new GregorianCalendar(year, month, day).getTime();
|
||||
view.setText(UtilityDate.formatDate(resultDate, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
|
||||
observableDate.set(resultDate);
|
||||
}, mYear, mMonth, mDay);
|
||||
datePickerDialog.show();
|
||||
};
|
||||
|
||||
//Adding click-listener
|
||||
view.setOnClickListener(onClick::run);
|
||||
if(view.getParent() != null && view.getParent().getParent() != null && view.getParent().getParent() instanceof TextInputLayout) {
|
||||
((FrameLayout)view.getParent()).setOnClickListener(onClick::run);
|
||||
((TextInputLayout) view.getParent().getParent()).setOnClickListener(onClick::run);
|
||||
}
|
||||
}
|
||||
Date newValue = observableDate.get();
|
||||
view.setText(UtilityDate.formatDate(newValue, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
|
||||
}
|
||||
|
||||
@BindingAdapter("binding")
|
||||
public static void bindAutoCompleteTextView(AutoCompleteTextView view, final BindableString bindableString) {
|
||||
Pair<BindableString, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||
@ -92,7 +240,8 @@ public class Converters {
|
||||
view.removeTextChangedListener(pair.second);
|
||||
}
|
||||
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||
@Override public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
bindableString.set(s.toString());
|
||||
}
|
||||
};
|
||||
@ -113,7 +262,8 @@ public class Converters {
|
||||
view.removeTextChangedListener(pair.second);
|
||||
}
|
||||
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||
@Override public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
bindableString.set(s.toString());
|
||||
}
|
||||
};
|
||||
@ -134,7 +284,8 @@ public class Converters {
|
||||
view.removeTextChangedListener(pair.second);
|
||||
}
|
||||
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||
@Override public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
bindableString.set(s.toString());
|
||||
}
|
||||
};
|
||||
@ -164,12 +315,13 @@ public class Converters {
|
||||
view.removeTextChangedListener(pair.second);
|
||||
}
|
||||
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||
@Override public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
try {
|
||||
if(s.toString().trim().isEmpty()){
|
||||
if (s.toString().trim().isEmpty()) {
|
||||
bindableFloat.set(null);
|
||||
} else bindableFloat.set(decimalFormat.parse(s.toString()).floatValue());
|
||||
} catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
Log.e("FloatFormat", ex.getMessage());
|
||||
}
|
||||
}
|
||||
@ -225,7 +377,7 @@ public class Converters {
|
||||
|
||||
@BindingAdapter({"layout_constraintGuide_percent"})
|
||||
public static void bindFloatPercetageOnGuideline(View view, final float percentage) {
|
||||
((Guideline)view).setGuidelinePercent(percentage);
|
||||
((Guideline) view).setGuidelinePercent(percentage);
|
||||
}
|
||||
|
||||
@BindingAdapter({"backgroundTintResID"})
|
||||
@ -234,13 +386,10 @@ public class Converters {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@BindingAdapter("visibility")
|
||||
public static void bindCheckbox(LinearLayout view, final BindableBoolean bindableBoolean) {
|
||||
@BindingAdapter({"app:visibility"})
|
||||
public static void bindViewVisibility(View view, final BindableBoolean bindableBoolean) {
|
||||
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
||||
view.setTag(R.id.bound_observable, bindableBoolean);
|
||||
//view.setOnCheckedChangeListener((compoundButton, b) -> bindableBoolean.set(b));
|
||||
}
|
||||
bindableBoolean.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||
@Override
|
||||
@ -254,7 +403,7 @@ public class Converters {
|
||||
|
||||
|
||||
@BindingAdapter("visibility")
|
||||
public static void bindView(View view, final BindableBoolean bindableBoolean) {
|
||||
public static void bindView(View view, final ObservableField<Boolean> bindableBoolean) {
|
||||
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
||||
view.setTag(R.id.bound_observable, bindableBoolean);
|
||||
}
|
||||
@ -268,4 +417,13 @@ public class Converters {
|
||||
view.setVisibility(bindableBoolean.get() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
|
||||
@BindingAdapter("android:layout_weight")
|
||||
public static void setLayoutWeight(View view, final Float weight) {
|
||||
|
||||
LinearLayoutCompat.LayoutParams layoutParams = (LinearLayoutCompat.LayoutParams) view.getLayoutParams();
|
||||
layoutParams.weight = weight;
|
||||
view.setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package it.integry.integrywmsnative.core.di;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.core.util.Pair;
|
||||
import androidx.databinding.BindingAdapter;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.OnSingleClickListener;
|
||||
|
||||
public class ViewConverters {
|
||||
|
||||
|
||||
|
||||
@BindingAdapter("singleClick")
|
||||
public static void bindViewSingleClick(View view, final Runnable callback) {
|
||||
view.setFocusable(true);
|
||||
view.setClickable(true);
|
||||
view.setOnClickListener(new OnSingleClickListener() {
|
||||
@Override
|
||||
public void onSingleClick(View v) {
|
||||
callback.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -10,7 +10,7 @@ import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import it.integry.integrywmsnative.view.dialogs.exception.DialogException;
|
||||
|
||||
@ -41,7 +41,7 @@ public class ExceptionsHandler implements Thread.UncaughtExceptionHandler {
|
||||
UtilityLogger.errorMe(new Exception(ex));
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Exception Logger failed!", e);
|
||||
System.exit(0);
|
||||
MainApplication.exit();
|
||||
}
|
||||
|
||||
appendToFile(new Exception(ex));
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
public class InvalidLUException extends Exception {
|
||||
public InvalidLUException() {
|
||||
super("L'unità logistica scansionata non è valida");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
|
||||
public class InvalidLUGestioneException extends Exception {
|
||||
|
||||
public InvalidLUGestioneException() {
|
||||
super("La GESTIONE dell'unità logistica scansionata non è valida");
|
||||
}
|
||||
|
||||
public InvalidLUGestioneException(GestioneEnum gestioneEnum) {
|
||||
super("La GESTIONE " + gestioneEnum.getText() + " dell'unità logistica scansionata non è valida");
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
public class MyExceptionHandler implements
|
||||
java.lang.Thread.UncaughtExceptionHandler {
|
||||
private final Context myContext;
|
||||
private final Class<?> myActivityClass;
|
||||
|
||||
public MyExceptionHandler(Context context, Class<?> c) {
|
||||
|
||||
myContext = context;
|
||||
myActivityClass = c;
|
||||
}
|
||||
|
||||
public void uncaughtException(Thread thread, Throwable exception) {
|
||||
|
||||
StringWriter stackTrace = new StringWriter();
|
||||
exception.printStackTrace(new PrintWriter(stackTrace));
|
||||
System.err.println(stackTrace);// You can use LogCat too
|
||||
// Intent intent = new Intent(myContext, myActivityClass);
|
||||
// String s = stackTrace.toString();
|
||||
// //you can use this String to know what caused the exception and in which Activity
|
||||
// intent.putExtra("uncaughtException",
|
||||
// "Exception is: " + stackTrace.toString());
|
||||
// intent.putExtra("stacktrace", s);
|
||||
// myContext.startActivity(intent);
|
||||
//for restarting the Activity
|
||||
// Process.killProcess(Process.myPid());
|
||||
// System.exit(0);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public final class NoArtsFoundException extends Exception {
|
||||
public NoArtsFoundException() {
|
||||
super(UtilityResources.getString(R.string.no_result_from_barcode));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
public final class NoLUFoundException extends Exception {
|
||||
|
||||
public NoLUFoundException() {
|
||||
super("Nessuna UL trovata");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public class NoPrintersFoundException extends Exception {
|
||||
public NoPrintersFoundException() {
|
||||
super(UtilityResources.getString(R.string.exception_printer_not_found));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public final class NoResultFromBarcodeException extends Exception {
|
||||
public NoResultFromBarcodeException() {
|
||||
super(UtilityResources.getString(R.string.no_result_from_barcode));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
public final class ScannedPositionNotExistException extends Exception {
|
||||
public ScannedPositionNotExistException() {
|
||||
super("Nessuna posizione trovata con il barcode scansionato");
|
||||
}
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.exception.printer;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
|
||||
public class PrinterNotFoundException extends Exception{
|
||||
|
||||
public PrinterNotFoundException() {
|
||||
super(MainApplication.res.getString(R.string.exception_printer_not_found));
|
||||
}
|
||||
|
||||
}
|
||||
@ -5,10 +5,15 @@ import android.view.KeyEvent;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.exception.MyExceptionHandler;
|
||||
|
||||
public class BaseActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
public BaseActivity() {
|
||||
Thread.setDefaultUncaughtExceptionHandler(new MyExceptionHandler(this, BaseActivity.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
package it.integry.integrywmsnative.core.expansion;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableList;
|
||||
|
||||
public abstract class OnListGeneralChangedCallback extends ObservableList.OnListChangedCallback {
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemRangeChanged(ObservableList sender, int positionStart, int itemCount) {
|
||||
onChanged(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeInserted(ObservableList sender, int positionStart, int itemCount) {
|
||||
onChanged(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeMoved(ObservableList sender, int fromPosition, int toPosition, int itemCount) {
|
||||
onChanged(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeRemoved(ObservableList sender, int positionStart, int itemCount) {
|
||||
onChanged(sender);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package it.integry.integrywmsnative.core.expansion;
|
||||
|
||||
import android.util.Config;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of {@link View.OnClickListener} that ignores subsequent clicks that happen too quickly after the first one.<br/>
|
||||
* To use this class, implement {@link #onSingleClick(View)} instead of {@link View.OnClickListener#onClick(View)}.
|
||||
*/
|
||||
public abstract class OnSingleClickListener implements View.OnClickListener {
|
||||
private static final String TAG = OnSingleClickListener.class.getSimpleName();
|
||||
|
||||
private static final long MIN_DELAY_MS = 500;
|
||||
|
||||
private long mLastClickTime;
|
||||
|
||||
@Override
|
||||
public final void onClick(View v) {
|
||||
long lastClickTime = mLastClickTime;
|
||||
long now = System.currentTimeMillis();
|
||||
mLastClickTime = now;
|
||||
if (now - lastClickTime < MIN_DELAY_MS) {
|
||||
// Too fast: ignore
|
||||
if (Config.LOGD) Log.d(TAG, "onClick Clicked too quickly: ignored");
|
||||
} else {
|
||||
// Register the click
|
||||
onSingleClick(v);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a view has been clicked.
|
||||
*
|
||||
* @param v The view that was clicked.
|
||||
*/
|
||||
public abstract void onSingleClick(View v);
|
||||
|
||||
/**
|
||||
* Wraps an {@link View.OnClickListener} into an {@link OnSingleClickListener}.<br/>
|
||||
* The argument's {@link View.OnClickListener#onClick(View)} method will be called when a single click is registered.
|
||||
*
|
||||
* @param onClickListener The listener to wrap.
|
||||
* @return the wrapped listener.
|
||||
*/
|
||||
public static View.OnClickListener wrap(final View.OnClickListener onClickListener) {
|
||||
return new OnSingleClickListener() {
|
||||
@Override
|
||||
public void onSingleClick(View v) {
|
||||
onClickListener.onClick(v);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.expansion;
|
||||
|
||||
public interface RunnableWithReturn<R> {
|
||||
|
||||
R run();
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package it.integry.integrywmsnative.core.expansion;
|
||||
|
||||
import android.widget.BaseAdapter;
|
||||
|
||||
import androidx.databinding.ObservableList;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public class WeakReferenceOnListChangedCallback extends ObservableList.OnListChangedCallback {
|
||||
|
||||
private final WeakReference<BaseAdapter> adapterReference;
|
||||
|
||||
public WeakReferenceOnListChangedCallback(BaseAdapter baseAdapter) {
|
||||
this.adapterReference = new WeakReference<>(baseAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChanged(ObservableList sender) {
|
||||
BaseAdapter adapter = adapterReference.get();
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeChanged(ObservableList sender, int positionStart, int itemCount) {
|
||||
BaseAdapter adapter = adapterReference.get();
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeInserted(ObservableList sender, int positionStart, int itemCount) {
|
||||
BaseAdapter adapter = adapterReference.get();
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeMoved(ObservableList sender, int fromPosition, int toPosition, int itemCount) {
|
||||
BaseAdapter adapter = adapterReference.get();
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRangeRemoved(ObservableList sender, int positionStart, int itemCount) {
|
||||
BaseAdapter adapter = adapterReference.get();
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package it.integry.integrywmsnative.core.expansion.view;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableList;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||
|
||||
public abstract class ExtendedRecyclerView<T, VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> {
|
||||
protected ArrayList<T> mDataset;
|
||||
private View mEmptyView;
|
||||
|
||||
public ExtendedRecyclerView(ObservableArrayList<T> myDataset) {
|
||||
mDataset = myDataset;
|
||||
|
||||
myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
||||
@Override
|
||||
public void onChanged(ObservableList sender) {
|
||||
notifyDataSetChanged();
|
||||
checkIfEmpty();
|
||||
}
|
||||
});
|
||||
|
||||
checkIfEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(VH holder) {
|
||||
super.onViewRecycled(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mDataset.size();
|
||||
}
|
||||
|
||||
public ExtendedRecyclerView<T, VH> setEmptyView(View emptyView) {
|
||||
this.mEmptyView = emptyView;
|
||||
return this;
|
||||
}
|
||||
|
||||
private void checkIfEmpty() {
|
||||
if (mEmptyView != null) {
|
||||
final boolean emptyViewVisible = getItemCount() == 0;
|
||||
mEmptyView.setVisibility(emptyViewVisible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.interfaces;
|
||||
|
||||
public interface ILifecycleFragment {
|
||||
|
||||
void onPreDestroy(Runnable onComplete);
|
||||
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package it.integry.integrywmsnative.core.interfaces.viewmodel_listeners;
|
||||
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
|
||||
public interface ILUPositionListener {
|
||||
|
||||
void onLUPositionChangeRequest(RunnableArgss<Boolean, MtbDepoPosizione> onComplete);
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package it.integry.integrywmsnative.core.interfaces.viewmodel_listeners;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public interface ILUPrintListener {
|
||||
|
||||
void onLUSuccessullyPrinted();
|
||||
|
||||
void onLUPrintRequest(RunnableArgs<Boolean> onComplete);
|
||||
|
||||
void onLUPrintError(Exception ex, Runnable onComplete);
|
||||
|
||||
}
|
||||
@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.model;
|
||||
|
||||
public class CommonModelConsts {
|
||||
|
||||
public static String ENTITY_NULL_STRING = "[NULL]";
|
||||
|
||||
public static class OPERATION {
|
||||
public static String INSERT_OR_UPDATE = "INSERT_OR_UPDATE";
|
||||
public static String INSERT = "INSERT";
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
|
||||
/**
|
||||
* Created by GiuseppeS on 06/03/2018.
|
||||
*/
|
||||
|
||||
public class MtbAart implements Parcelable{
|
||||
public class MtbAart extends EntityBase{
|
||||
|
||||
private String codMart;
|
||||
private String descrizione;
|
||||
@ -88,103 +87,32 @@ public class MtbAart implements Parcelable{
|
||||
private String codNcIntracee;
|
||||
private String marchio;
|
||||
private Integer sezione;
|
||||
private UntMisRifPesoEnum untMisRifPeso;
|
||||
|
||||
private List<MtbUntMis> mtbUntMis;
|
||||
|
||||
|
||||
public MtbAart(){}
|
||||
public enum UntMisRifPesoEnum {
|
||||
C,
|
||||
M;
|
||||
}
|
||||
|
||||
|
||||
public boolean isFlagTracciabilita() {
|
||||
|
||||
public MtbAart() {
|
||||
this.type = "mtb_aart";
|
||||
}
|
||||
|
||||
public boolean isFlagTracciabilitaBoolean() {
|
||||
return flagTracciabilita != null && flagTracciabilita.equalsIgnoreCase("S");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected MtbAart(Parcel in) {
|
||||
codMart = in.readString();
|
||||
descrizione = in.readString();
|
||||
untMis = in.readString();
|
||||
barCode = in.readString();
|
||||
pesoKg = (BigDecimal) in.readValue(BigDecimal.class.getClassLoader());
|
||||
qtaCnf = (BigDecimal) in.readValue(BigDecimal.class.getClassLoader());
|
||||
codAliq = in.readString();
|
||||
codScoArt = in.readString();
|
||||
codTcolUi = in.readString();
|
||||
codTcolUl = in.readString();
|
||||
articoloComposto = in.readString();
|
||||
esposizioneComp = in.readString();
|
||||
descrizioneEstesa = in.readString();
|
||||
codUltForn = in.readString();
|
||||
dataUltCar = in.readString();
|
||||
valUltCar = (BigDecimal) in.readValue(BigDecimal.class.getClassLoader());
|
||||
codUltClie = in.readString();
|
||||
dataUltScar = in.readString();
|
||||
valUltScar = (BigDecimal) in.readValue(BigDecimal.class.getClassLoader());
|
||||
tipoCodice = in.readString();
|
||||
note = in.readString();
|
||||
posizione = in.readString();
|
||||
colliPedana = (BigDecimal) in.readValue(BigDecimal.class.getClassLoader());
|
||||
untMis2 = in.readString();
|
||||
rapConv2 = (BigDecimal) in.readValue(BigDecimal.class.getClassLoader());
|
||||
flagInclListino = in.readString();
|
||||
untMis3 = in.readString();
|
||||
rapConv3 = (BigDecimal) in.readValue(BigDecimal.class.getClassLoader());
|
||||
codMartStat = in.readString();
|
||||
codMcon = in.readString();
|
||||
codMgrp = in.readString();
|
||||
codMsfa = in.readString();
|
||||
codMsgr = in.readString();
|
||||
codMstp = in.readString();
|
||||
codMtip = in.readString();
|
||||
descrizioneStat = in.readString();
|
||||
flagStato = in.readString();
|
||||
cambioDiviCar = (BigDecimal) in.readValue(BigDecimal.class.getClassLoader());
|
||||
cambioDiviScar = (BigDecimal) in.readValue(BigDecimal.class.getClassLoader());
|
||||
ggScadPartita = in.readByte() == 0x00 ? null : in.readInt();
|
||||
volumeMc = (BigDecimal) in.readValue(BigDecimal.class.getClassLoader());
|
||||
flagEsponiPrz = in.readString();
|
||||
dataUltVar = in.readString();
|
||||
percSfrido = (BigDecimal) in.readValue(BigDecimal.class.getClassLoader());
|
||||
codBarreImb = in.readString();
|
||||
flagCalcPrz = in.readString();
|
||||
esposizioneCompAcq = in.readString();
|
||||
flagCalcPrzAcq = in.readString();
|
||||
diacod = in.readString();
|
||||
plu = in.readString();
|
||||
partIvaProd = in.readString();
|
||||
ragSocProd = in.readString();
|
||||
flagRapConvVariabile = in.readString();
|
||||
flagMovArtMag = in.readString();
|
||||
flagTracciabilita = in.readString();
|
||||
taraKg = (BigDecimal) in.readValue(BigDecimal.class.getClassLoader());
|
||||
colliStrato = (BigDecimal) in.readValue(BigDecimal.class.getClassLoader());
|
||||
flagQtaCnfFissa = in.readString();
|
||||
flagColliPedanaFisso = in.readString();
|
||||
codCconCosti = in.readString();
|
||||
codCconRicavi = in.readString();
|
||||
codDgrpArt = in.readString();
|
||||
codDiviCar = in.readString();
|
||||
codDiviScar = in.readString();
|
||||
codEcrCat = in.readString();
|
||||
codEcrMcat = in.readString();
|
||||
codEcrRep = in.readString();
|
||||
codEcrStipo = in.readString();
|
||||
codEcrTipo = in.readString();
|
||||
codGrpBolla = in.readString();
|
||||
ingredienti = in.readString();
|
||||
idArtEqui = in.readString();
|
||||
descrCassa = in.readString();
|
||||
codNcIntracee = in.readString();
|
||||
marchio = in.readString();
|
||||
sezione = in.readByte() == 0x00 ? null : in.readInt();
|
||||
public boolean isFlagQtaCnfFissaBoolean() {
|
||||
return "S".equalsIgnoreCase(flagQtaCnfFissa);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
@ -658,6 +586,10 @@ public class MtbAart implements Parcelable{
|
||||
return flagRapConvVariabile;
|
||||
}
|
||||
|
||||
public boolean getFlagRapConvVariabileBoolean() {
|
||||
return !UtilityString.isNullOrEmpty(flagRapConvVariabile) && flagRapConvVariabile.equalsIgnoreCase("S");
|
||||
}
|
||||
|
||||
public MtbAart setFlagRapConvVariabile(String flagRapConvVariabile) {
|
||||
this.flagRapConvVariabile = flagRapConvVariabile;
|
||||
return this;
|
||||
@ -703,10 +635,6 @@ public class MtbAart implements Parcelable{
|
||||
return flagQtaCnfFissa;
|
||||
}
|
||||
|
||||
public boolean isFlagQtaCnfFissa() {
|
||||
return "S".equalsIgnoreCase(flagQtaCnfFissa);
|
||||
}
|
||||
|
||||
public MtbAart setFlagQtaCnfFissa(String flagQtaCnfFissa) {
|
||||
this.flagQtaCnfFissa = flagQtaCnfFissa;
|
||||
return this;
|
||||
@ -874,111 +802,21 @@ public class MtbAart implements Parcelable{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(codMart);
|
||||
dest.writeString(descrizione);
|
||||
dest.writeString(untMis);
|
||||
dest.writeString(barCode);
|
||||
dest.writeValue(pesoKg);
|
||||
dest.writeValue(qtaCnf);
|
||||
dest.writeString(codAliq);
|
||||
dest.writeString(codScoArt);
|
||||
dest.writeString(codTcolUi);
|
||||
dest.writeString(codTcolUl);
|
||||
dest.writeString(articoloComposto);
|
||||
dest.writeString(esposizioneComp);
|
||||
dest.writeString(descrizioneEstesa);
|
||||
dest.writeString(codUltForn);
|
||||
dest.writeString(dataUltCar);
|
||||
dest.writeValue(valUltCar);
|
||||
dest.writeString(codUltClie);
|
||||
dest.writeString(dataUltScar);
|
||||
dest.writeValue(valUltScar);
|
||||
dest.writeString(tipoCodice);
|
||||
dest.writeString(note);
|
||||
dest.writeString(posizione);
|
||||
dest.writeValue(colliPedana);
|
||||
dest.writeString(untMis2);
|
||||
dest.writeValue(rapConv2);
|
||||
dest.writeString(flagInclListino);
|
||||
dest.writeString(untMis3);
|
||||
dest.writeValue(rapConv3);
|
||||
dest.writeString(codMartStat);
|
||||
dest.writeString(codMcon);
|
||||
dest.writeString(codMgrp);
|
||||
dest.writeString(codMsfa);
|
||||
dest.writeString(codMsgr);
|
||||
dest.writeString(codMstp);
|
||||
dest.writeString(codMtip);
|
||||
dest.writeString(descrizioneStat);
|
||||
dest.writeString(flagStato);
|
||||
dest.writeValue(cambioDiviCar);
|
||||
dest.writeValue(cambioDiviScar);
|
||||
if (ggScadPartita == null) {
|
||||
dest.writeByte((byte) (0x00));
|
||||
} else {
|
||||
dest.writeByte((byte) (0x01));
|
||||
dest.writeInt(ggScadPartita);
|
||||
}
|
||||
dest.writeValue(volumeMc);
|
||||
dest.writeString(flagEsponiPrz);
|
||||
dest.writeString(dataUltVar);
|
||||
dest.writeValue(percSfrido);
|
||||
dest.writeString(codBarreImb);
|
||||
dest.writeString(flagCalcPrz);
|
||||
dest.writeString(esposizioneCompAcq);
|
||||
dest.writeString(flagCalcPrzAcq);
|
||||
dest.writeString(diacod);
|
||||
dest.writeString(plu);
|
||||
dest.writeString(partIvaProd);
|
||||
dest.writeString(ragSocProd);
|
||||
dest.writeString(flagRapConvVariabile);
|
||||
dest.writeString(flagMovArtMag);
|
||||
dest.writeString(flagTracciabilita);
|
||||
dest.writeValue(taraKg);
|
||||
dest.writeValue(colliStrato);
|
||||
dest.writeString(flagQtaCnfFissa);
|
||||
dest.writeString(flagColliPedanaFisso);
|
||||
dest.writeString(codCconCosti);
|
||||
dest.writeString(codCconRicavi);
|
||||
dest.writeString(codDgrpArt);
|
||||
dest.writeString(codDiviCar);
|
||||
dest.writeString(codDiviScar);
|
||||
dest.writeString(codEcrCat);
|
||||
dest.writeString(codEcrMcat);
|
||||
dest.writeString(codEcrRep);
|
||||
dest.writeString(codEcrStipo);
|
||||
dest.writeString(codEcrTipo);
|
||||
dest.writeString(codGrpBolla);
|
||||
dest.writeString(ingredienti);
|
||||
dest.writeString(idArtEqui);
|
||||
dest.writeString(descrCassa);
|
||||
dest.writeString(codNcIntracee);
|
||||
dest.writeString(marchio);
|
||||
if (sezione == null) {
|
||||
dest.writeByte((byte) (0x00));
|
||||
} else {
|
||||
dest.writeByte((byte) (0x01));
|
||||
dest.writeInt(sezione);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public List<MtbUntMis> getMtbUntMis() {
|
||||
return mtbUntMis;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static final Parcelable.Creator<MtbAart> CREATOR = new Parcelable.Creator<MtbAart>() {
|
||||
@Override
|
||||
public MtbAart createFromParcel(Parcel in) {
|
||||
return new MtbAart(in);
|
||||
}
|
||||
public MtbAart setMtbUntMis(List<MtbUntMis> mtbUntMis) {
|
||||
this.mtbUntMis = mtbUntMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MtbAart[] newArray(int size) {
|
||||
return new MtbAart[size];
|
||||
}
|
||||
};
|
||||
public UntMisRifPesoEnum getUntMisRifPeso() {
|
||||
return untMisRifPeso;
|
||||
}
|
||||
|
||||
public MtbAart setUntMisRifPeso(UntMisRifPesoEnum untMisRifPeso) {
|
||||
this.untMisRifPeso = untMisRifPeso;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,9 +50,10 @@ public class MtbColr extends EntityBase {
|
||||
private BigDecimal pesoLordoKg;
|
||||
|
||||
private MtbAart mtbAart;
|
||||
|
||||
private MtbPartitaMag mtbPartitaMag;
|
||||
|
||||
private transient MtbColr refMtbColr;
|
||||
|
||||
public MtbColr() {
|
||||
type = "mtb_colr";
|
||||
}
|
||||
@ -69,6 +70,10 @@ public class MtbColr extends EntityBase {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public GestioneEnum getGestioneEnum() {
|
||||
return GestioneEnum.fromString(gestione);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public MtbColr setGestione(GestioneEnum gestione) {
|
||||
@ -180,6 +185,10 @@ public class MtbColr extends EntityBase {
|
||||
return gestioneRif;
|
||||
}
|
||||
|
||||
public GestioneEnum getGestioneRifEnum() {
|
||||
return GestioneEnum.fromString(gestioneRif);
|
||||
}
|
||||
|
||||
public MtbColr setGestioneRif(String gestioneRif) {
|
||||
this.gestioneRif = gestioneRif;
|
||||
return this;
|
||||
@ -501,4 +510,13 @@ public class MtbColr extends EntityBase {
|
||||
this.pesoLordoKg = pesoLordoKg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbColr getRefMtbColr() {
|
||||
return refMtbColr;
|
||||
}
|
||||
|
||||
public MtbColr setRefMtbColr(MtbColr refMtbColr) {
|
||||
this.refMtbColr = refMtbColr;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,8 +5,6 @@ import androidx.databinding.ObservableArrayList;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -560,4 +558,12 @@ public class MtbColt extends EntityBase {
|
||||
result = 31 * result + numCollo.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EntityBase clone() {
|
||||
MtbColt mtbColt = (MtbColt) super.clone();
|
||||
mtbColt.setMtbColr((ObservableArrayList<MtbColr>) mtbColt.getMtbColr().clone());
|
||||
return mtbColt;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,75 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class MtbUntMis extends EntityBase {
|
||||
|
||||
private String untMis;
|
||||
private String flagDig;
|
||||
private BigDecimal cifreDec;
|
||||
private String tipoUm;
|
||||
private String flagUnitaKg;
|
||||
private String flagAttivo;
|
||||
|
||||
public MtbUntMis() {
|
||||
this.type = "mtb_unt_mis";
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public MtbUntMis setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagDig() {
|
||||
return "S".equalsIgnoreCase(flagDig);
|
||||
}
|
||||
|
||||
public String getFlagDig() {
|
||||
return flagDig;
|
||||
}
|
||||
|
||||
public MtbUntMis setFlagDig(String flagDig) {
|
||||
this.flagDig = flagDig;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getCifreDec() {
|
||||
return cifreDec;
|
||||
}
|
||||
|
||||
public MtbUntMis setCifreDec(BigDecimal cifreDec) {
|
||||
this.cifreDec = cifreDec;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTipoUm() {
|
||||
return tipoUm;
|
||||
}
|
||||
|
||||
public MtbUntMis setTipoUm(String tipoUm) {
|
||||
this.tipoUm = tipoUm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagUnitaKg() {
|
||||
return flagUnitaKg;
|
||||
}
|
||||
|
||||
public MtbUntMis setFlagUnitaKg(String flagUnitaKg) {
|
||||
this.flagUnitaKg = flagUnitaKg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagAttivo() {
|
||||
return flagAttivo;
|
||||
}
|
||||
|
||||
public MtbUntMis setFlagAttivo(String flagAttivo) {
|
||||
this.flagAttivo = flagAttivo;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package it.integry.integrywmsnative.core.model.dto;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
|
||||
public class WithdrawableMtbColr extends MtbColr {
|
||||
|
||||
private transient MtbColr withdrawRow;
|
||||
|
||||
public WithdrawableMtbColr() {
|
||||
super();
|
||||
}
|
||||
|
||||
public MtbColr getWithdrawRow() {
|
||||
return withdrawRow;
|
||||
}
|
||||
|
||||
public WithdrawableMtbColr setWithdrawRow(MtbColr withdrawRow) {
|
||||
this.withdrawRow = withdrawRow;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,13 @@
|
||||
package it.integry.integrywmsnative.core.report;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
|
||||
public class ReportManager {
|
||||
|
||||
|
||||
public static void getRightReportNameByGestione(GestioneEnum gestione, RunnableArgs<String> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
public static void getReportNameLUFromGestione(GestioneEnum gestione, RunnableArgs<String> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
if(gestione != null){
|
||||
|
||||
@ -34,7 +34,7 @@ public class ReportManager {
|
||||
|
||||
}
|
||||
|
||||
public static String getRightReportNameByGestione(GestioneEnum gestione) {
|
||||
public static String getReportNameLUFromGestione(GestioneEnum gestione) {
|
||||
|
||||
if(gestione != null){
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import it.integry.integrywmsnative.core.exception.printer.PrinterNotFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
||||
|
||||
/**
|
||||
* Created by GiuseppeS on 22/03/2018.
|
||||
@ -18,7 +18,7 @@ public class CommonRESTException {
|
||||
private static HashMap<String, HashMap<String, Object>> bindingExceptions = new HashMap() {{
|
||||
put("Printer not found", new HashMap<String, Object>(){{
|
||||
put(MESSAGE_KEY, "Stampante non trovata");
|
||||
put(EXCEPTION_KEY, PrinterNotFoundException.class);
|
||||
put(EXCEPTION_KEY, NoPrintersFoundException.class);
|
||||
}});
|
||||
|
||||
|
||||
|
||||
@ -5,6 +5,8 @@ import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
@ -13,9 +15,10 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public static void getByBarcodeProd(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static void getByBarcodeProdStatic(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
articoloRESTConsumerService.getByBarcodeProd(barcodeProd).enqueue(new Callback<ServiceRESTResponse<MtbAart>>() {
|
||||
@Override
|
||||
@ -32,6 +35,10 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void getByBarcodeProd(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
getByBarcodeProdStatic(barcodeProd, onComplete, onFailed);
|
||||
}
|
||||
|
||||
|
||||
public static void getByCodMart(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||
import it.integry.integrywmsnative.core.class_router.interfaces.IBarcodeCustomization;
|
||||
@ -11,9 +13,10 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class BarcodeRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public static void decodeEan128(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static void decodeEan128Static(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
IBarcodeCustomization barcodeCustomization = ClassRouter.getInstance(ClassRouter.PATH.BARCODE_CUSTOMIZATION);
|
||||
|
||||
@ -38,6 +41,9 @@ public class BarcodeRESTConsumer extends _BaseRESTConsumer {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void decodeEan128(BarcodeScanDTO barcodeObj, RunnableArgs<Ean128Model> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
BarcodeRESTConsumer.decodeEan128Static(barcodeObj, onComplete, onFailed);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
@ -20,6 +17,8 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
@ -36,7 +35,6 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavorazioneDTO;
|
||||
@ -44,9 +42,10 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public static void saveCollo(MtbColt mtbColtToSave, final ISimpleOperationCallback<MtbColt> callback) {
|
||||
public static void saveColloStatic(MtbColt mtbColtToSave, final ISimpleOperationCallback<MtbColt> callback) {
|
||||
|
||||
for (int i = 0; i < mtbColtToSave.getMtbColr().size(); i++) {
|
||||
mtbColtToSave.getMtbColr().get(i)
|
||||
@ -58,8 +57,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
}
|
||||
|
||||
public void saveCollo(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliMagazzinoRESTConsumer.saveColloStatic(mtbColtToSave, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void saveCollo(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static void saveColloStatic(MtbColt mtbColtToSave, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColtToSaveClone = (MtbColt) mtbColtToSave.clone();
|
||||
mtbColtToSave.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
|
||||
@ -113,25 +115,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
}
|
||||
|
||||
public static void saveRigaCollo(MtbColr mtbColrToSave, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
mtbColrToSave.setMtbAart(null);
|
||||
mtbColrToSave.setMtbPartitaMag(null);
|
||||
|
||||
EntityRESTConsumer.processEntity(mtbColrToSave, new ISimpleOperationCallback<MtbColr>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColr value) {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
}, MtbColr.class);
|
||||
|
||||
}
|
||||
|
||||
public static void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColtToCreate = new MtbColt()
|
||||
.setSegno(segno)
|
||||
@ -143,7 +126,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||
|
||||
|
||||
saveCollo(mtbColtToCreate, new ISimpleOperationCallback<MtbColt>() {
|
||||
saveColloStatic(mtbColtToCreate, new ISimpleOperationCallback<MtbColt>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
@ -206,7 +189,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
saveCollo(newMtbColt, new ISimpleOperationCallback<MtbColt>() {
|
||||
saveColloStatic(newMtbColt, new ISimpleOperationCallback<MtbColt>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
@ -283,7 +266,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
saveCollo(newMtbColt, new ISimpleOperationCallback<MtbColt>() {
|
||||
saveColloStatic(newMtbColt, new ISimpleOperationCallback<MtbColt>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
@ -328,7 +311,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
mtbColtToCreate
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||
|
||||
saveCollo(mtbColtToCreate, new ISimpleOperationCallback<MtbColt>() {
|
||||
saveColloStatic(mtbColtToCreate, new ISimpleOperationCallback<MtbColt>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
if (onComplete != null) onComplete.run(value);
|
||||
@ -341,11 +324,15 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public static void deleteCollo(MtbColt mtbColtToDelete, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void deleteCollo(MtbColt mtbColtToDelete, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliMagazzinoRESTConsumer.deleteColloStatic(mtbColtToDelete, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void deleteColloStatic(MtbColt mtbColtToDelete, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
mtbColtToDelete.setOperation(CommonModelConsts.OPERATION.DELETE);
|
||||
|
||||
saveCollo(mtbColtToDelete, new ISimpleOperationCallback<MtbColt>() {
|
||||
saveColloStatic(mtbColtToDelete, new ISimpleOperationCallback<MtbColt>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
if (onComplete != null) onComplete.run();
|
||||
@ -401,7 +388,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
}
|
||||
|
||||
public static void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliMagazzinoRESTConsumer.getBySSCCStatic(ssccString, onlyResiduo, throwExcIfNull, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void getBySSCCStatic(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull).enqueue(new Callback<ServiceRESTResponse<MtbColt>>() {
|
||||
@Override
|
||||
@ -417,8 +408,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
}, onFailed);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -469,7 +458,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
public static 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) {
|
||||
ColliMagazzinoRESTConsumer.getMultipleByTestateStatic(testate, onlyResiduo, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void getMultipleByTestateStatic(List<MtbColt> testate, boolean onlyResiduo, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ArrayList<MtbColt> resultMtbColt = new ArrayList<>();
|
||||
cyclicGetMultipleByTestate(testate.iterator(), onlyResiduo, resultMtbColt, () -> {
|
||||
onComplete.run(resultMtbColt);
|
||||
@ -479,7 +472,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
private static void cyclicGetMultipleByTestate(@NotNull Iterator<MtbColt> sourceMtbColts, boolean onlyResiduo, ArrayList<MtbColt> resultMtbColt, Runnable onComplete, RunnableArgs<Exception> onAbort) {
|
||||
if (sourceMtbColts.hasNext()) {
|
||||
getByTestata(sourceMtbColts.next(), onlyResiduo, false, mtbColt -> {
|
||||
getByTestataStatic(sourceMtbColts.next(), onlyResiduo, false, mtbColt -> {
|
||||
resultMtbColt.add(mtbColt);
|
||||
cyclicGetMultipleByTestate(sourceMtbColts, onlyResiduo, resultMtbColt, onComplete, onAbort);
|
||||
}, onAbort);
|
||||
@ -488,7 +481,21 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
}
|
||||
|
||||
public static void getByTestata(MtbColt testata, 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()
|
||||
.setGestione(gestione)
|
||||
.setNumCollo(numCollo)
|
||||
.setDataCollo(dataCollo)
|
||||
.setSerCollo(serCollo);
|
||||
|
||||
ColliMagazzinoRESTConsumer.getByTestataStatic(mtbColtToRetrieve, onlyResiduo, throwExcIfNull, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void getByTestata(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliMagazzinoRESTConsumer.getByTestataStatic(testata, onlyResiduo, throwExcIfNull, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void getByTestataStatic(MtbColt testata, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
String ssccString = null;
|
||||
|
||||
if (testata.getSerCollo().equalsIgnoreCase(CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE)) {
|
||||
@ -522,7 +529,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
ssccString += "0";
|
||||
}
|
||||
|
||||
getBySSCC(ssccString, onlyResiduo, throwExcIfNull, onComplete, onFailed);
|
||||
getBySSCCStatic(ssccString, onlyResiduo, throwExcIfNull, onComplete, onFailed);
|
||||
}
|
||||
|
||||
|
||||
@ -535,7 +542,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
if (posizione == null) mtbColtToSaveClone.setPosizione(null);
|
||||
else mtbColtToSaveClone.setPosizione(posizione.getPosizione());
|
||||
|
||||
ColliMagazzinoRESTConsumer.saveCollo(mtbColtToSaveClone, mtbColt -> {
|
||||
ColliMagazzinoRESTConsumer.saveColloStatic(mtbColtToSaveClone, mtbColt -> {
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, ex -> {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
@ -544,69 +551,52 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public static void deleteRiga(MtbColr mtbColrToDelete, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColr newMtbColr = new MtbColr();
|
||||
|
||||
newMtbColr.setNumCollo(mtbColrToDelete.getNumCollo());
|
||||
newMtbColr.setDataCollo(mtbColrToDelete.getDataColloS());
|
||||
newMtbColr.setSerCollo(mtbColrToDelete.getSerCollo());
|
||||
newMtbColr.setGestione(mtbColrToDelete.getGestione());
|
||||
newMtbColr.setRiga(mtbColrToDelete.getRiga());
|
||||
|
||||
|
||||
newMtbColr.setOperation(CommonModelConsts.OPERATION.DELETE);
|
||||
|
||||
EntityRESTConsumer.processEntity(newMtbColr, new ISimpleOperationCallback<MtbColr>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColr value) {
|
||||
if (onComplete != null) onComplete.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
}, MtbColr.class);
|
||||
|
||||
public void updateRiga(MtbColr mtbColrToUpdate, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
updateRigaStatic(mtbColrToUpdate, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void updateRiga(MtbColr mtbColrToUpdate, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static void updateRigaStatic(MtbColr mtbColrToUpdate, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColt = new MtbColt()
|
||||
.setGestione(mtbColrToUpdate.getGestioneEnum())
|
||||
.setNumCollo(mtbColrToUpdate.getNumCollo())
|
||||
.setSerCollo(mtbColrToUpdate.getSerCollo())
|
||||
.setDataCollo(mtbColrToUpdate.getDataColloS());
|
||||
|
||||
mtbColt.getMtbColr().add(mtbColrToUpdate);
|
||||
|
||||
mtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
|
||||
mtbColrToUpdate.setOperation(CommonModelConsts.OPERATION.UPDATE);
|
||||
|
||||
EntityRESTConsumer.processEntity(mtbColrToUpdate, new ISimpleOperationCallback<MtbColr>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColr value) {
|
||||
if (onComplete != null) onComplete.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
}, MtbColr.class);
|
||||
EntityRESTConsumer.processEntity(mtbColt, value -> {
|
||||
if(onComplete != null) onComplete.run();
|
||||
}, onFailed, MtbColt.class);
|
||||
|
||||
}
|
||||
|
||||
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliMagazzinoRESTConsumer.updateDataFineStatic(mtbColt, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void updateDataFine(Context context, Dialog progress, MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static void updateDataFineStatic(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
MtbColt cloneMtbColt = (MtbColt) mtbColt.clone();
|
||||
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.UPDATE);
|
||||
cloneMtbColt.setOraFinePrep(UtilityDate.getDateInstance());
|
||||
cloneMtbColt.setMtbColr(new ObservableArrayList<>());
|
||||
|
||||
ColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, value -> {
|
||||
ColliMagazzinoRESTConsumer.saveColloStatic(cloneMtbColt, value -> {
|
||||
onComplete.run();
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(context, ex, progress);
|
||||
if(onFailed != null) onFailed.run(ex);
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void canLUBeDeleted(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliMagazzinoRESTConsumer.canLUBeDeletedStatic(mtbColt, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void canLUBeDeleted(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static void canLUBeDeletedStatic(MtbColt mtbColt, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
params.put("mtb_colt.gestione", mtbColt.getGestione());
|
||||
@ -648,27 +638,25 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {
|
||||
}.getType();
|
||||
SystemRESTConsumer.<ArrayList<MtbColt>>processSql(query, typeOfObjectsList, data -> {
|
||||
SystemRESTConsumer.<ArrayList<MtbColt>>processSqlStatic(query, typeOfObjectsList, data -> {
|
||||
onComplete.run(data != null && data.size() > 0);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void retrieveBasketColli(RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.getColliInBasket(SettingsManager.i().getUserSession().getDepo().getCodMdep()).enqueue(new Callback<ServiceRESTResponse<List<MtbColt>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<MtbColt>>> call, Response<ServiceRESTResponse<List<MtbColt>>> response) {
|
||||
analyzeAnswer(response, "GetBySSCC", mtbColts -> {
|
||||
analyzeAnswer(response, "getColliInBasket", mtbColts -> {
|
||||
fillMtbAartsOfMtbColts(mtbColts, onComplete, onFailed);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<MtbColt>>> call, Throwable t) {
|
||||
if(onFailed != null) onFailed.run(new Exception(t));
|
||||
if (onFailed != null) onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -678,7 +666,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
|
||||
public static void creaRettificaCollo(MtbColr sourceMtbColrOriginal, BigDecimal newNumCnf, BigDecimal newQtaTot, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static void creaRettificaColloStatic(MtbColr sourceMtbColrOriginal, BigDecimal newNumCnf, BigDecimal newQtaTot, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColr sourceMtbColr = (MtbColr) sourceMtbColrOriginal.clone();
|
||||
sourceMtbColr.setMtbPartitaMag(null);
|
||||
sourceMtbColr.setMtbAart(null);
|
||||
@ -692,19 +680,25 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
colliMagazzinoRESTConsumerService.creaRettificaCollo(
|
||||
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
|
||||
rettificaULDTO
|
||||
).enqueue(new Callback<ServiceRESTResponse<JsonObject>>() {
|
||||
).enqueue(new Callback<ServiceRESTResponse<MtbColr>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||
analyzeAnswer(response, "GetBySSCC", data -> {
|
||||
onComplete.run();
|
||||
public void onResponse(Call<ServiceRESTResponse<MtbColr>> call, Response<ServiceRESTResponse<MtbColr>> response) {
|
||||
analyzeAnswer(response, "creaRettificaCollo", data -> {
|
||||
onComplete.run(data);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
||||
public void onFailure(Call<ServiceRESTResponse<MtbColr>> call, Throwable t) {
|
||||
if(onFailed != null) onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void creaRettificaCollo(MtbColr sourceMtbColrOriginal, BigDecimal newNumCnf, BigDecimal newQtaTot, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
creaRettificaColloStatic(sourceMtbColrOriginal, newNumCnf, newQtaTot, onComplete, onFailed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,10 +4,11 @@ import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
@ -26,6 +27,6 @@ public interface ColliMagazzinoRESTConsumerService {
|
||||
Call<ServiceRESTResponse<List<MtbColt>>> getColliInBasket(@Query("codMdep") String codMdep);
|
||||
|
||||
@POST("creaRettificaCollo")
|
||||
Call<ServiceRESTResponse<JsonObject>> creaRettificaCollo(@Query("codMdep") String codMdep, @Body RettificaULDTO rettificaULDTO);
|
||||
Call<ServiceRESTResponse<MtbColr>> creaRettificaCollo(@Query("codMdep") String codMdep, @Body RettificaULDTO rettificaULDTO);
|
||||
|
||||
}
|
||||
|
||||
@ -22,54 +22,71 @@ import retrofit2.Response;
|
||||
|
||||
public class EntityRESTConsumer {
|
||||
|
||||
public static <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type){
|
||||
public static <T extends EntityBase> void processEntity(T entityToSave, RunnableArgs<T> onComplete, RunnableArgs<Exception> onFailed, Class<T> type) {
|
||||
|
||||
RunnableArgs<Exception> tmpFailed = ex -> {
|
||||
// UtilityExceptions.defaultException(null, ex);
|
||||
if(callback != null) callback.onFailed(ex);
|
||||
};
|
||||
|
||||
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<JsonObject>> request = service.processEntity(entityToSave);
|
||||
request.enqueue(new Callback<ServiceRESTResponse<JsonObject>>() {
|
||||
processEntity(entityToSave, new ISimpleOperationCallback<T>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||
if(response.isSuccessful()) {
|
||||
|
||||
if(response.body() != null) {
|
||||
if(response.body().getEsito() == EsitoType.OK) {
|
||||
Gson gson = new Gson();
|
||||
T object = gson.fromJson(response.body().getEntity(), type);
|
||||
|
||||
callback.onSuccess(object);
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", response.body().getErrorMessage());
|
||||
tmpFailed.run(new Exception(response.body().getErrorMessage()));
|
||||
}
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", response.message());
|
||||
tmpFailed.run(new Exception(response.message()));
|
||||
}
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
||||
tmpFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||
}
|
||||
public void onSuccess(T value) {
|
||||
if(onComplete != null) onComplete.run(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
||||
Log.e("EntityRESTConsumer", t.toString());
|
||||
tmpFailed.run(new Exception(t));
|
||||
public void onFailed(Exception ex) {
|
||||
if(onFailed != null) onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}, type);
|
||||
|
||||
}
|
||||
|
||||
public static <T extends EntityBase> void processEntityList(List<T> entitiesToSave, final ISimpleOperationCallback<List<T>> callback, boolean singleTransaction, Class<T> type){
|
||||
|
||||
public static <T extends EntityBase> void processEntity(T entityToSave, final ISimpleOperationCallback<T> callback, Class<T> type) {
|
||||
|
||||
RunnableArgs<Exception> tmpFailed = ex -> {
|
||||
if (callback != null) callback.onFailed(ex);
|
||||
};
|
||||
|
||||
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
||||
service
|
||||
.processEntity(entityToSave)
|
||||
.enqueue(new Callback<ServiceRESTResponse<JsonObject>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||
if (response.isSuccessful()) {
|
||||
|
||||
if (response.body() != null) {
|
||||
if (response.body().getEsito() == EsitoType.OK) {
|
||||
Gson gson = new Gson();
|
||||
T object = gson.fromJson(response.body().getEntity(), type);
|
||||
|
||||
callback.onSuccess(object);
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", response.body().getErrorMessage());
|
||||
tmpFailed.run(new Exception(response.body().getErrorMessage()));
|
||||
}
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", response.message());
|
||||
tmpFailed.run(new Exception(response.message()));
|
||||
}
|
||||
} else {
|
||||
Log.e("EntityRESTConsumer", "Status " + response.code() + ": " + response.message());
|
||||
tmpFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
||||
Log.e("EntityRESTConsumer", t.toString());
|
||||
tmpFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static <T extends EntityBase> void processEntityList(List<T> entitiesToSave, final ISimpleOperationCallback<List<T>> callback, boolean singleTransaction, Class<T> type) {
|
||||
|
||||
RunnableArgs<Exception> tmpFailed = ex -> {
|
||||
// UtilityExceptions.defaultException(null, ex);
|
||||
if(callback != null) callback.onFailed(ex);
|
||||
if (callback != null) callback.onFailed(ex);
|
||||
};
|
||||
|
||||
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
||||
@ -77,15 +94,15 @@ public class EntityRESTConsumer {
|
||||
request.enqueue(new Callback<List<ServiceRESTResponse<JsonObject>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<List<ServiceRESTResponse<JsonObject>>> call, Response<List<ServiceRESTResponse<JsonObject>>> response) {
|
||||
if(response.isSuccessful()) {
|
||||
if (response.isSuccessful()) {
|
||||
|
||||
if(response.body() != null) {
|
||||
if (response.body() != null) {
|
||||
|
||||
ArrayList<T> responseList = new ArrayList<>();
|
||||
Gson gson = new Gson();
|
||||
// Type typeOfObjectsList = new TypeToken<T>() {}.getType();
|
||||
|
||||
for(ServiceRESTResponse<JsonObject> jsonSingleObject : response.body()) {
|
||||
for (ServiceRESTResponse<JsonObject> jsonSingleObject : response.body()) {
|
||||
|
||||
if (jsonSingleObject.getEsito() == EsitoType.OK) {
|
||||
String jsonText = gson.toJson(jsonSingleObject.getEntity());
|
||||
@ -119,26 +136,24 @@ public class EntityRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static <T extends EntityBase> void selectEntity(T entityToSave, final ISimpleOperationCallback<List<T>> callback, Class type){
|
||||
public static <T extends EntityBase> void selectEntity(T entityToSave, final ISimpleOperationCallback<List<T>> callback, Class type) {
|
||||
|
||||
EntityRESTConsumerService service = RESTBuilder.getService(EntityRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<JsonObject>> request = service.processEntity(entityToSave);
|
||||
request.enqueue(new Callback<ServiceRESTResponse<JsonObject>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||
if(response.isSuccessful()) {
|
||||
if (response.isSuccessful()) {
|
||||
|
||||
if(response.body() != null) {
|
||||
if(response.body().getEsito() == EsitoType.OK) {
|
||||
if (response.body() != null) {
|
||||
if (response.body().getEsito() == EsitoType.OK) {
|
||||
Gson gson = new Gson();
|
||||
List<JsonObject> jsons = response.body().getEntityList();
|
||||
|
||||
List<T> newList = new ArrayList<T>();
|
||||
|
||||
if(jsons != null) {
|
||||
for (int i = 0; i < jsons.size(); i ++){
|
||||
if (jsons != null) {
|
||||
for (int i = 0; i < jsons.size(); i++) {
|
||||
JsonObject jsonTmp = jsons.get(i);
|
||||
|
||||
newList.add((T) gson.fromJson(jsonTmp, type));
|
||||
|
||||
@ -7,7 +7,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||
|
||||
@ -21,7 +20,7 @@ public class MagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
"WHERE cod_tcol = " + UtilityDB.valueToString(codTcol);
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbTCol>>() {}.getType();
|
||||
SystemRESTConsumer.processSql(baseSql, typeOfObjectsList, new ISimpleOperationCallback<List<MtbTCol>>() {
|
||||
SystemRESTConsumer.processSqlStatic(baseSql, typeOfObjectsList, new ISimpleOperationCallback<List<MtbTCol>>() {
|
||||
@Override
|
||||
public void onSuccess(List<MtbTCol> values) {
|
||||
if(onComplete != null) {
|
||||
@ -42,7 +41,7 @@ public class MagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
"FROM mtb_tcol ";
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbTCol>>() {}.getType();
|
||||
SystemRESTConsumer.processSql(baseSql, typeOfObjectsList, new ISimpleOperationCallback<List<MtbTCol>>() {
|
||||
SystemRESTConsumer.processSqlStatic(baseSql, typeOfObjectsList, new ISimpleOperationCallback<List<MtbTCol>>() {
|
||||
@Override
|
||||
public void onSuccess(List<MtbTCol> values) {
|
||||
if(onComplete != null) {
|
||||
|
||||
@ -0,0 +1,72 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.GetPickingListDTO;
|
||||
import it.integry.integrywmsnative.gest.vendita.dto.OrdineVenditaInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public static void retrieveListaArticoliFromOrdiniUscita(List<OrdineVenditaInevasoDTO> orders, RunnableArgs<List<SitArtOrdDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
List<GetPickingListDTO> getPickingListDTOs = Stream.of(orders)
|
||||
.map(x -> new GetPickingListDTO()
|
||||
.setData(x.getDataOrdS())
|
||||
.setGestione(x.getGestione())
|
||||
.setNumero(x.getNumOrd())
|
||||
.setDataConsegna(x.getDataConsS())
|
||||
.setIdViaggio(x.getIdViaggio()))
|
||||
.toList();
|
||||
|
||||
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class, 90);
|
||||
|
||||
service.getArticoliFromOrdini(getPickingListDTOs).enqueue(new Callback<ServiceRESTResponse<List<SitArtOrdDTO>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, Response<ServiceRESTResponse<List<SitArtOrdDTO>>> response) {
|
||||
analyzeAnswer(response, "retrieveListaArticoliFromOrdiniVendita", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<SitArtOrdDTO>>> call, Throwable t) {
|
||||
UtilityLogger.errorMe(new Exception(t));
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getSuggestedPickingList(String codMdep, List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<PickingObjectDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class, 90);
|
||||
|
||||
service
|
||||
.getSuggestedPickingList(codMdep, sitArtOrdList)
|
||||
.enqueue(new Callback<ServiceRESTResponse<List<PickingObjectDTO>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<PickingObjectDTO>>> call, Response<ServiceRESTResponse<List<PickingObjectDTO>>> response) {
|
||||
analyzeAnswer(response, "getSuggestedPickingList", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<PickingObjectDTO>>> call, Throwable t) {
|
||||
UtilityLogger.errorMe(new Exception(t));
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.GetPickingListDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface OrdiniRESTConsumerService {
|
||||
|
||||
@POST("wms/getArticoliFromOrdini")
|
||||
Call<ServiceRESTResponse<List<SitArtOrdDTO>>> getArticoliFromOrdini(@Body List<GetPickingListDTO> pickingListDTO);
|
||||
|
||||
@POST("wms/getSuggestedPickingList")
|
||||
Call<ServiceRESTResponse<List<PickingObjectDTO>>> getSuggestedPickingList(@Query("codMdep") String codMdep, @Body List<SitArtOrdDTO> sitArtOrdDTOList);
|
||||
}
|
||||
@ -8,20 +8,18 @@ import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepository;
|
||||
import it.integry.integrywmsnative.core.data_store.db.view_model.ArticoloDTO;
|
||||
import it.integry.integrywmsnative.core.data_store.db.view_model.GrigliaDTO;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.DtbOrdt;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityThread;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dto.ArtDTO;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dto.OrdineDTO;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dto.SaveDTO;
|
||||
@ -29,8 +27,6 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
import static br.com.zbra.androidlinq.Linq.stream;
|
||||
|
||||
public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
@ -43,25 +39,27 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
public void onResponse(Call<ServiceRESTResponse<GrigliaDTO>> call, Response<ServiceRESTResponse<GrigliaDTO>> response) {
|
||||
analyzeAnswer(response, "getArticoliListino", griglia -> {
|
||||
|
||||
List<ArticoloDTO> listaArticoli = new ArrayList<>();
|
||||
Stream.of(griglia.getGrigliaAcquistiChild())
|
||||
.map(ArticoloDTO::getCodMart)
|
||||
.distinct()
|
||||
.withoutNulls()
|
||||
.forEach(art -> {
|
||||
List<ArticoloDTO> inList = Stream.of(griglia.getGrigliaAcquistiChild()).filter(x -> x.getCodMart().equalsIgnoreCase(art)).toList();
|
||||
if (inList.size() > 1) {
|
||||
for (ArticoloDTO articolo : inList) {
|
||||
if (!articolo.getBarCode().endsWith(articolo.getCodMart())) {
|
||||
listaArticoli.add(articolo);
|
||||
UtilityThread.executeParallel(() -> {
|
||||
List<ArticoloDTO> listaArticoli = new ArrayList<>();
|
||||
Stream.of(griglia.getGrigliaAcquistiChild())
|
||||
.map(ArticoloDTO::getCodMart)
|
||||
.distinct()
|
||||
.withoutNulls()
|
||||
.forEach(art -> {
|
||||
List<ArticoloDTO> inList = Stream.of(griglia.getGrigliaAcquistiChild()).filter(x -> x.getCodMart().equalsIgnoreCase(art)).toList();
|
||||
if (inList.size() > 1) {
|
||||
for (ArticoloDTO articolo : inList) {
|
||||
if (!articolo.getBarCode().endsWith(articolo.getCodMart())) {
|
||||
listaArticoli.add(articolo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
listaArticoli.add(inList.get(0));
|
||||
}
|
||||
} else {
|
||||
listaArticoli.add(inList.get(0));
|
||||
}
|
||||
});
|
||||
griglia.setGrigliaAcquistiChild(listaArticoli);
|
||||
onSuccess.run(griglia);
|
||||
});
|
||||
griglia.setGrigliaAcquistiChild(listaArticoli);
|
||||
onSuccess.run(griglia);
|
||||
});
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@ -108,8 +106,7 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
ordine.setDataOrdS(dto.getDataOrd());
|
||||
ordine.setCodMdep(dto.getCodMdep());
|
||||
ordine.setNumOrd(dto.getNumOrd());
|
||||
OrdineRepository repository = new OrdineRepository();
|
||||
repository.updateOrder(ordine,onSuccess,onFailed);
|
||||
onSuccess.run(ordine);
|
||||
}else{
|
||||
onFailed.run(new Exception("Nessun ordine generato"));
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer{
|
||||
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {}.getType();
|
||||
SystemRESTConsumer.processSql(sql, typeOfObjectsList, new ISimpleOperationCallback<List<MtbColt>>() {
|
||||
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<List<MtbColt>>() {
|
||||
@Override
|
||||
public void onSuccess(List<MtbColt> value) {
|
||||
if(onComplete != null) onComplete.run(value);
|
||||
|
||||
@ -2,12 +2,16 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.exception.printer.PrinterNotFoundException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
@ -16,8 +20,7 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
import static br.com.zbra.androidlinq.Linq.stream;
|
||||
|
||||
@Singleton
|
||||
public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public enum Type {
|
||||
@ -26,7 +29,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public static void getAvailablePrinters(final ISimpleOperationCallback<List<String>> callback) {
|
||||
public static void getAvailablePrintersStatic(final ISimpleOperationCallback<List<String>> callback) {
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||
printerService.getAvailablePrinters().enqueue(new Callback<ServiceRESTResponse<List<String>>>() {
|
||||
@Override
|
||||
@ -41,8 +44,11 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void getAvailablePrinters(String codMdep, final RunnableArgs<List<String>> onComplete, final RunnableArgs<Exception> onFailed) {
|
||||
getAvailablePrintersStatic(codMdep, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void getAvailablePrinters(String codMdep, final ISimpleOperationCallback<List<String>> callback) {
|
||||
public static void getAvailablePrintersStatic(String codMdep, final RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||
printerService.getAvailablePrinters(codMdep).enqueue(new Callback<ServiceRESTResponse<List<String>>>() {
|
||||
@ -51,12 +57,12 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
analyzeAnswer(response, "GetAvailablePrinters", new ISimpleOperationCallback<List<String>>() {
|
||||
@Override
|
||||
public void onSuccess(List<String> value) {
|
||||
callback.onSuccess(value != null ? stream(value).where(x -> x != null).toList() : null);
|
||||
onComplete.run(value != null ? Stream.of(value).withoutNulls().toList() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
callback.onFailed(ex);
|
||||
onFailed.run(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -65,13 +71,17 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
public void onFailure(Call<ServiceRESTResponse<List<String>>> call, Throwable t) {
|
||||
Log.e("GetAvailablePrinters", t.toString());
|
||||
UtilityLogger.errorMe(new Exception(t));
|
||||
callback.onFailed(new Exception(t));
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static void getAvailablePrinters(String codMdep, Type printerType, RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void getAvailablePrinters(String codMdep, Type printerType, RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
PrinterRESTConsumer.getAvailablePrintersStatic(codMdep, printerType, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void getAvailablePrintersStatic(String codMdep, Type printerType, RunnableArgs<List<String>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
String printerTypeStr = printerType != null ? printerType.toString() : null;
|
||||
|
||||
@ -91,7 +101,11 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public static void printCollo(String printerName, MtbColt testataColloToPrint, int quantity, String reportName, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void printCollo(String printerName, MtbColt testataColloToPrint, int quantity, String reportName, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
printColloStatic(printerName, testataColloToPrint, quantity, reportName, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void printColloStatic(String printerName, MtbColt testataColloToPrint, int quantity, String reportName, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
if(BuildConfig.DEBUG) {
|
||||
onComplete.run();
|
||||
@ -124,7 +138,7 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
if(t.getMessage().contains("Printer not found")) {
|
||||
onFailed.run(new PrinterNotFoundException());
|
||||
onFailed.run(new NoPrintersFoundException());
|
||||
} else onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
@ -14,6 +14,8 @@ import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
@ -30,9 +32,10 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public static <T> void processSql(String nativeSql, final Type clazz, RunnableArgs<T> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static <T> void processSqlStatic(String nativeSql, final Type clazz, RunnableArgs<T> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
NativeSqlRequestDTO nativeSqlDTO = new NativeSqlRequestDTO();
|
||||
nativeSqlDTO.nativeSql = nativeSql;
|
||||
@ -69,9 +72,17 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
|
||||
}
|
||||
public static <T> void processSql(String nativeSql, final Type clazz, final ISimpleOperationCallback<T> callback) {
|
||||
public static <T> void processSqlStatic(String nativeSql, final Type clazz, final ISimpleOperationCallback<T> callback) {
|
||||
|
||||
processSql(nativeSql, clazz, data -> {
|
||||
processSqlStatic(nativeSql, clazz, data -> {
|
||||
callback.onSuccess((T) data);
|
||||
}, callback::onFailed);
|
||||
|
||||
}
|
||||
|
||||
public <T> void processSql(String nativeSql, final Type clazz, final ISimpleOperationCallback<T> callback) {
|
||||
|
||||
processSqlStatic(nativeSql, clazz, data -> {
|
||||
callback.onSuccess((T) data);
|
||||
}, callback::onFailed);
|
||||
|
||||
@ -180,7 +191,7 @@ public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
String sql = "SELECT TOP 1 * FROM azienda";
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<Azienda>>() {}.getType();
|
||||
SystemRESTConsumer.processSql(sql, typeOfObjectsList, new ISimpleOperationCallback<List<Azienda>>() {
|
||||
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<List<Azienda>>() {
|
||||
@Override
|
||||
public void onSuccess(List<Azienda> value) {
|
||||
if(onComplete != null) onComplete.run(value.get(0));
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
package it.integry.integrywmsnative.gest.vendita.dto;
|
||||
|
||||
import java.util.Date;
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
public class GetPickingListDTO {
|
||||
|
||||
@ -0,0 +1,199 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class SitArtOrdDTO {
|
||||
|
||||
|
||||
private String codJcom;
|
||||
private String codMart;
|
||||
private String codCol;
|
||||
private String codTagl;
|
||||
private String codAlis;
|
||||
private String codArtFor;
|
||||
private String partitaMag;
|
||||
private BigDecimal qtaOrd;
|
||||
private BigDecimal numCnfOrd;
|
||||
private BigDecimal qtaCnfOrd;
|
||||
private String idViaggio;
|
||||
private String codMdep;
|
||||
private boolean flagEnablePickManuale;
|
||||
private String codMgrp;
|
||||
private String descrizioneMgrp;
|
||||
private String codMsgr;
|
||||
private String descrizioneMsgr;
|
||||
private String codMsfa;
|
||||
private String descrizioneMsfa;
|
||||
|
||||
public String getCodJcom() {
|
||||
return codJcom;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setCodJcom(String codJcom) {
|
||||
this.codJcom = codJcom;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodCol() {
|
||||
return codCol;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setCodCol(String codCol) {
|
||||
this.codCol = codCol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodTagl() {
|
||||
return codTagl;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setCodTagl(String codTagl) {
|
||||
this.codTagl = codTagl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodAlis() {
|
||||
return codAlis;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setCodAlis(String codAlis) {
|
||||
this.codAlis = codAlis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodArtFor() {
|
||||
return codArtFor;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setCodArtFor(String codArtFor) {
|
||||
this.codArtFor = codArtFor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPartitaMag() {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setPartitaMag(String partitaMag) {
|
||||
this.partitaMag = partitaMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaOrd() {
|
||||
return qtaOrd;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setQtaOrd(BigDecimal qtaOrd) {
|
||||
this.qtaOrd = qtaOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getNumCnfOrd() {
|
||||
return numCnfOrd;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setNumCnfOrd(BigDecimal numCnfOrd) {
|
||||
this.numCnfOrd = numCnfOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnfOrd() {
|
||||
return qtaCnfOrd;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setQtaCnfOrd(BigDecimal qtaCnfOrd) {
|
||||
this.qtaCnfOrd = qtaCnfOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIdViaggio() {
|
||||
return idViaggio;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setIdViaggio(String idViaggio) {
|
||||
this.idViaggio = idViaggio;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagEnablePickManuale() {
|
||||
return flagEnablePickManuale;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setFlagEnablePickManuale(boolean flagEnablePickManuale) {
|
||||
this.flagEnablePickManuale = flagEnablePickManuale;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public String getCodMgrp() {
|
||||
return codMgrp;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setCodMgrp(String codMgrp) {
|
||||
this.codMgrp = codMgrp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizioneMgrp() {
|
||||
return descrizioneMgrp;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setDescrizioneMgrp(String descrizioneMgrp) {
|
||||
this.descrizioneMgrp = descrizioneMgrp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMsgr() {
|
||||
return codMsgr;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setCodMsgr(String codMsgr) {
|
||||
this.codMsgr = codMsgr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizioneMsgr() {
|
||||
return descrizioneMsgr;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setDescrizioneMsgr(String descrizioneMsgr) {
|
||||
this.descrizioneMsgr = descrizioneMsgr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMsfa() {
|
||||
return codMsfa;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setCodMsfa(String codMsfa) {
|
||||
this.codMsfa = codMsfa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizioneMsfa() {
|
||||
return descrizioneMsfa;
|
||||
}
|
||||
|
||||
public SitArtOrdDTO setDescrizioneMsfa(String descrizioneMsfa) {
|
||||
this.descrizioneMsfa = descrizioneMsfa;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -31,6 +31,18 @@ public class DBSettingsModel {
|
||||
private boolean flagAskPesoColloSpedizione;
|
||||
private boolean flagForceAllToColli;
|
||||
private boolean flagSpedizioneEnableManualPick;
|
||||
private String produzioneDefaultCodAnag;
|
||||
|
||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||
return flagSpedizioneEnableFakeGiacenza;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagSpedizioneEnableFakeGiacenza(boolean flagSpedizioneEnableFakeGiacenza) {
|
||||
this.flagSpedizioneEnableFakeGiacenza = flagSpedizioneEnableFakeGiacenza;
|
||||
return this;
|
||||
}
|
||||
|
||||
private boolean flagSpedizioneEnableFakeGiacenza;
|
||||
|
||||
public List<String> getAvailableProfiles() {
|
||||
return availableProfiles;
|
||||
@ -200,4 +212,13 @@ public class DBSettingsModel {
|
||||
this.flagSpedizioneEnableManualPick = flagSpedizioneEnableManualPick;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getProduzioneDefaultCodAnag() {
|
||||
return produzioneDefaultCodAnag;
|
||||
}
|
||||
|
||||
public DBSettingsModel setProduzioneDefaultCodAnag(String produzioneDefaultCodAnag) {
|
||||
this.produzioneDefaultCodAnag = produzioneDefaultCodAnag;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.firebase.perf.metrics.Trace;
|
||||
@ -11,13 +10,13 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.StbGestSetup;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityFirebase;
|
||||
|
||||
public class SettingsManager {
|
||||
@ -88,6 +87,7 @@ public class SettingsManager {
|
||||
RunnableArgs<Exception> tmpOnFailed = ex -> {
|
||||
perfTrace.putAttribute("failed", "true");
|
||||
if(!(ex instanceof SocketTimeoutException)) onFailed.run(ex);
|
||||
else onFailed.run(new Exception("Errore durante il caricamento dei dati. Riavviare l'applicazione!"));
|
||||
};
|
||||
|
||||
loadDatiAzienda(() ->
|
||||
@ -234,28 +234,38 @@ public class SettingsManager {
|
||||
.setGestName("PICKING")
|
||||
.setSection("PRODUZIONE")
|
||||
.setKeySection("FLAG_VERSAMENTO_DIRETTO"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("PRODUZIONE")
|
||||
.setKeySection("DEFAULT_COD_ANAG"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("ENABLE_MANUAL_PICK"));
|
||||
stbGestSetupList.add(new StbGestSetup()
|
||||
.setGestName("PICKING")
|
||||
.setSection("SPEDIZIONE")
|
||||
.setKeySection("ENABLE_FAKE_GIACENZA"));
|
||||
|
||||
|
||||
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
|
||||
dbSettingsModelIstance.setDefaultCausaleRettificaGiacenze(getValueFromList(list, "DEFAULT_CAUSALE_RETTIFICA_GIACENZE", String.class));
|
||||
dbSettingsModelIstance.setEnableCheckPartitaMagCheckPickingV(getValueFromList(list, "ENABLE_CHECK_PARTITA_MAG_PICKING_V", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagMultiClienteOrdV(getValueFromList(list, "FLAG_MULTI_CLIENTE_ORD_VENDITA", Boolean.class));
|
||||
dbSettingsModelIstance.setDefaultCodAnag(getValueFromList(list, "COD_ANAG_DEFAULT", String.class));
|
||||
dbSettingsModelIstance.setDefaultCriterioDistribuzione(getValueFromList(list, "DEFAULT_CRITERIO_DISTRIBUZIONE", String.class));
|
||||
dbSettingsModelIstance.setFlagAskClienteInPickingLibero(getValueFromList(list, "FLAG_ASK_CLIENTE", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagCanAddExtraItemSpedizione(getValueFromList(list, "FLAG_CAN_ADD_EXTRA_ITEMS", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagCanAutoOpenNewULAccettazione(getValueFromList(list, "FLAG_AUTO_OPEN_NEW_UL", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagCanAddExtraQuantitySpedizione(getValueFromList(list, "FLAG_CAN_ADD_EXTRA_QUANTITY", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagEnableCheckDepositoSpedizione(getValueFromList(list, "ENABLE_CHECK_DEPOSITO", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagForceAllToColli(getValueFromList(list, "FLAG_FORCE_ALL_TO_COLLI", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagAskPesoColloSpedizione(getValueFromList(list, "FLAG_ASK_PESO_COLLO", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagUseNewPickingListSpedizione(getValueFromList(list, "FLAG_USE_NEW_PICKING_LIST", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagVersamentoDirettoProduzione(getValueFromList(list, "FLAG_VERSAMENTO_DIRETTO", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagSpedizioneEnableManualPick(getValueFromList(list, "ENABLE_MANUAL_PICK", Boolean.class));
|
||||
dbSettingsModelIstance.setDefaultCausaleRettificaGiacenze(getValueFromList(list, "SETUP", "DEFAULT_CAUSALE_RETTIFICA_GIACENZE", String.class));
|
||||
dbSettingsModelIstance.setEnableCheckPartitaMagCheckPickingV(getValueFromList(list, "SETUP","ENABLE_CHECK_PARTITA_MAG_PICKING_V", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagMultiClienteOrdV(getValueFromList(list, "SETUP","FLAG_MULTI_CLIENTE_ORD_VENDITA", Boolean.class));
|
||||
dbSettingsModelIstance.setDefaultCodAnag(getValueFromList(list, "SETUP","COD_ANAG_DEFAULT", String.class));
|
||||
dbSettingsModelIstance.setDefaultCriterioDistribuzione(getValueFromList(list, "SETUP","DEFAULT_CRITERIO_DISTRIBUZIONE", String.class));
|
||||
dbSettingsModelIstance.setFlagAskClienteInPickingLibero(getValueFromList(list, "PICKING_LIBERO", "FLAG_ASK_CLIENTE", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagCanAddExtraItemSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_ITEMS", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagCanAutoOpenNewULAccettazione(getValueFromList(list, "ACCETTAZIONE", "FLAG_AUTO_OPEN_NEW_UL", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagCanAddExtraQuantitySpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_QUANTITY", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagEnableCheckDepositoSpedizione(getValueFromList(list,"SPEDIZIONE", "ENABLE_CHECK_DEPOSITO", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagForceAllToColli(getValueFromList(list, "SETUP", "FLAG_FORCE_ALL_TO_COLLI", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagAskPesoColloSpedizione(getValueFromList(list, "SETUP", "FLAG_ASK_PESO_COLLO", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagUseNewPickingListSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_NEW_PICKING_LIST", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagVersamentoDirettoProduzione(getValueFromList(list, "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO", Boolean.class));
|
||||
dbSettingsModelIstance.setProduzioneDefaultCodAnag(getValueFromList(list, "PRODUZIONE", "DEFAULT_COD_ANAG", String.class));
|
||||
dbSettingsModelIstance.setFlagSpedizioneEnableManualPick(getValueFromList(list, "SPEDIZIONE", "ENABLE_MANUAL_PICK", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagSpedizioneEnableFakeGiacenza(getValueFromList(list, "SPEDIZIONE", "ENABLE_FAKE_GIACENZA", Boolean.class));
|
||||
|
||||
if(onComplete != null) onComplete.run();
|
||||
}, onFailed);
|
||||
@ -263,10 +273,10 @@ public class SettingsManager {
|
||||
}
|
||||
|
||||
|
||||
public static <T>T getValueFromList(List<StbGestSetup> stbGestSetupList, String keySectionName, Class<T> clazz) {
|
||||
public static <T>T getValueFromList(List<StbGestSetup> stbGestSetupList, String section, String keySectionName, Class<T> clazz) {
|
||||
|
||||
StbGestSetup value = Stream.of(stbGestSetupList)
|
||||
.filter(x -> x.getKeySection().equalsIgnoreCase(keySectionName))
|
||||
.filter(x -> x.getSection().equalsIgnoreCase(section) && x.getKeySection().equalsIgnoreCase(keySectionName))
|
||||
.findFirst().get();
|
||||
|
||||
if(clazz == String.class) {
|
||||
|
||||
@ -23,6 +23,7 @@ public class PermissionsHelper {
|
||||
List<String> permissionsToAsk = new ArrayList<>();
|
||||
permissionsToAsk.add(Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
permissionsToAsk.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
permissionsToAsk.add(Manifest.permission.CAMERA);
|
||||
//permissionsToAsk.add(Manifest.permission.INTERNET);
|
||||
//permissionsToAsk.add(Manifest.permission.ACCESS_WIFI_STATE);
|
||||
|
||||
@ -49,12 +50,9 @@ public class PermissionsHelper {
|
||||
onPermissionsConfirmed.run();
|
||||
|
||||
} else {
|
||||
|
||||
boolean anyPermDeny = shouldShowRequestPermissionRationale( activity, permissions );
|
||||
|
||||
onPermissionsDenied.run(anyPermDeny);
|
||||
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -49,14 +49,28 @@ public class UtilityBarcode {
|
||||
return isPosizione;
|
||||
}
|
||||
|
||||
public static boolean isEtichettaArt(BarcodeScanDTO barcodeScanDTO) {
|
||||
return isEan8(barcodeScanDTO) || isEan13(barcodeScanDTO) || isUPCA(barcodeScanDTO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static boolean isEanPeso(BarcodeScanDTO barcodeScanDTO) {
|
||||
return (isEtichetta128(barcodeScanDTO) || isEan13(barcodeScanDTO)) && barcodeScanDTO.getStringValue().startsWith("2");
|
||||
}
|
||||
|
||||
public static boolean isEan8(BarcodeScanDTO barcodeScanDTO) {
|
||||
return barcodeScanDTO != null && barcodeScanDTO.getType() == BarcodeType.EAN8;
|
||||
}
|
||||
|
||||
public static boolean isEan13(BarcodeScanDTO barcodeScanDTO) {
|
||||
return barcodeScanDTO != null && barcodeScanDTO.getType() == BarcodeType.EAN13;
|
||||
}
|
||||
|
||||
public static boolean isUPCA(BarcodeScanDTO barcodeScanDTO) {
|
||||
return barcodeScanDTO != null && barcodeScanDTO.getType() == BarcodeType.UPCA;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Integer getNumColloFromULAnonima(String barcode) {
|
||||
|
||||
@ -12,6 +12,7 @@ public class UtilityBigDecimal {
|
||||
}
|
||||
|
||||
public static boolean equalsTo(BigDecimal input, BigDecimal toCompareWith) {
|
||||
if(input == null && toCompareWith == null) return true;
|
||||
if(input == null) return false;
|
||||
if(toCompareWith == null) return false;
|
||||
|
||||
@ -25,4 +26,43 @@ public class UtilityBigDecimal {
|
||||
return input.compareTo(toCompareWith) < 0;
|
||||
}
|
||||
|
||||
public static BigDecimal getLowerBetween(BigDecimal input1, BigDecimal input2) {
|
||||
if(input1 == null) return input2;
|
||||
if(input2 == null) return input1;
|
||||
|
||||
return lowerThan(input1, input2) ? input1 : input2;
|
||||
}
|
||||
|
||||
public static BigDecimal getGreaterBetween(BigDecimal input1, BigDecimal input2) {
|
||||
if(input1 == null) return input2;
|
||||
if(input2 == null) return input1;
|
||||
|
||||
return greaterThan(input1, input2) ? input1 : input2;
|
||||
}
|
||||
|
||||
|
||||
public static BigDecimal divide(BigDecimal input1, BigDecimal divisor) {
|
||||
if(divisor == null || equalsTo(divisor, BigDecimal.ZERO)) return null;
|
||||
|
||||
return input1.divide(divisor, 3, BigDecimal.ROUND_HALF_EVEN);
|
||||
}
|
||||
|
||||
|
||||
public static BigDecimal divideToInteger(BigDecimal input1, BigDecimal divisor) {
|
||||
if(divisor == null || equalsTo(divisor, BigDecimal.ZERO)) return null;
|
||||
|
||||
return new BigDecimal(input1.divide(divisor,3, BigDecimal.ROUND_HALF_EVEN).intValue());
|
||||
}
|
||||
|
||||
|
||||
public static BigDecimal divideAndRoundToInteger(BigDecimal input1, BigDecimal divisor) {
|
||||
if(divisor == null || equalsTo(divisor, BigDecimal.ZERO)) return null;
|
||||
|
||||
return new BigDecimal(input1.divide(divisor,0, BigDecimal.ROUND_HALF_EVEN).intValue());
|
||||
}
|
||||
|
||||
public static BigDecimal multiply(BigDecimal input1, BigDecimal multiplier) {
|
||||
return input1.multiply(multiplier);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class UtilityContext {
|
||||
|
||||
private static Context mApplicationContext;
|
||||
|
||||
public static void initApplicationContext(Context context) {
|
||||
mApplicationContext = context;
|
||||
}
|
||||
|
||||
|
||||
public static Context getApplicationContext() {
|
||||
return mApplicationContext;
|
||||
}
|
||||
|
||||
}
|
||||
@ -4,13 +4,32 @@ import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
public class UtilityDialog {
|
||||
|
||||
public static void setTo90PercentSize(Context context, Dialog dialog) {
|
||||
public static void setTo90PercentWidth(Context context, Dialog dialog) {
|
||||
int width = (int)(context.getResources().getDisplayMetrics().widthPixels*0.90);
|
||||
//int height = (int)(context.getResources().getDisplayMetrics().heightPixels*0.90);
|
||||
|
||||
dialog.getWindow().setLayout(width, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
public static void setTo90PercentWidth(Context context, DialogFragment dialog) {
|
||||
int width = (int)(context.getResources().getDisplayMetrics().widthPixels*0.90);
|
||||
|
||||
dialog.getDialog().getWindow().setLayout(width, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
public static void setTo95PercentWidth(Context context, DialogFragment dialog) {
|
||||
int width = (int)(context.getResources().getDisplayMetrics().widthPixels*0.95);
|
||||
|
||||
dialog.getDialog().getWindow().setLayout(width, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
// public static void setTo90PercentHeight(Context context, Dialog dialog) {
|
||||
// int height = (int)(context.getResources().getDisplayMetrics().heightPixels*0.90);
|
||||
//
|
||||
// dialog.getWindow().setLayout(width, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.text.SpannableString;
|
||||
|
||||
import com.crashlytics.android.Crashlytics;
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
@ -16,13 +15,13 @@ public class UtilityExceptions {
|
||||
|
||||
|
||||
public static void defaultException(Context context, Exception ex, Dialog progressDialog){
|
||||
if(progressDialog != null) progressDialog.dismiss();
|
||||
defaultException(context, ex);
|
||||
if(progressDialog != null) progressDialog.dismiss();
|
||||
}
|
||||
|
||||
public static void defaultException(Context context, Exception ex, Dialog progressDialog, boolean sendMail){
|
||||
if(progressDialog != null) progressDialog.dismiss();
|
||||
defaultException(context, ex, sendMail);
|
||||
if(progressDialog != null) progressDialog.dismiss();
|
||||
}
|
||||
public static void defaultException(Context context, Exception ex){
|
||||
defaultException(context, ex, false);
|
||||
@ -38,16 +37,19 @@ public class UtilityExceptions {
|
||||
|
||||
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
||||
|
||||
if(errorMessage == null) errorMessage = ex.getMessage();
|
||||
if(errorMessage == null) {
|
||||
errorMessage = ex.getMessage();
|
||||
|
||||
if(ex.getCause() != null) errorMessage += "<br />" + ex.getCause().getMessage();
|
||||
}
|
||||
|
||||
if(context != null) {
|
||||
DialogSimpleMessageHelper.makeErrorDialog(context, new SpannableString(errorMessage), null, null).show();
|
||||
}
|
||||
|
||||
if(!BuildConfig.DEBUG) {
|
||||
if(sendEmail) UtilityLogger.errorMe(ex);
|
||||
|
||||
Crashlytics.logException(ex.getCause());
|
||||
// if(sendEmail) UtilityLogger.errorMe(ex);
|
||||
FirebaseCrashlytics.getInstance().recordException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -8,6 +9,7 @@ import java.io.StringWriter;
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
@ -40,37 +42,44 @@ public class UtilityLogger {
|
||||
}
|
||||
|
||||
public static void errorMe(Exception ex, String additionalText, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
if ((!(ex instanceof SocketTimeoutException) && !(ex.getCause() instanceof SocketTimeoutException)) ||
|
||||
(!(ex instanceof SocketException) && !(ex.getCause() instanceof SocketException)) ||
|
||||
(!(ex instanceof IOException) && !(ex.getCause() instanceof IOException))) {
|
||||
if(!BuildConfig.DEBUG) FirebaseCrashlytics.getInstance().recordException(ex);
|
||||
|
||||
String message = UtilityResources.readRawTextFile(R.raw.error_mail);
|
||||
logMe(ex.getMessage());
|
||||
|
||||
message = message.replace("__APP_NAME__", UtilityResources.getString(R.string.app_name));
|
||||
message = message.replace("__APP_PACKAGE__", UtilityResources.getPackageName());
|
||||
|
||||
String appVersion = UtilityResources.getAppVersion();
|
||||
message = message.replace("__APP_VERSION__", appVersion == null ? "" : appVersion);
|
||||
message = message.replace("__APP_VERSION_CODE__", "" + UtilityResources.getAppVersionCode());
|
||||
|
||||
|
||||
message = message.replaceAll("__ERROR_TITLE__", ex.getMessage());
|
||||
|
||||
message = message.replaceAll("__ERROR_DETAIL__", additionalText == null ? "" : additionalText);
|
||||
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
ex.printStackTrace(new PrintWriter(sw));
|
||||
|
||||
message = message.replace("__ERROR_STACKTRACE__", sw.toString());
|
||||
|
||||
String currentAzienda = UtilityString.isNullOrEmpty(SettingsManager.i().userSession.profileDB) ? "" : SettingsManager.i().userSession.profileDB;
|
||||
message = message.replace("__CUSTOMER_NAME__", currentAzienda);
|
||||
|
||||
message = message.replace("__ERROR_DATE__", UtilityDate.formatDate(UtilityDate.getDateInstance(), UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH));
|
||||
|
||||
SystemRESTConsumer.sendErrorLogMail(message, onComplete, onFailed);
|
||||
}
|
||||
// if ((!(ex instanceof SocketTimeoutException) && !(ex.getCause() instanceof SocketTimeoutException)) ||
|
||||
// (!(ex instanceof SocketException) && !(ex.getCause() instanceof SocketException)) ||
|
||||
// (!(ex instanceof IOException) && !(ex.getCause() instanceof IOException))) {
|
||||
//
|
||||
// if(ex.getMessage().contains("SocketTimeoutException")) return;
|
||||
//
|
||||
//
|
||||
// String message = UtilityResources.readRawTextFile(R.raw.error_mail);
|
||||
//
|
||||
// message = message.replace("__APP_NAME__", UtilityResources.getString(R.string.app_name));
|
||||
// message = message.replace("__APP_PACKAGE__", UtilityResources.getPackageName());
|
||||
//
|
||||
// String appVersion = UtilityResources.getAppVersion();
|
||||
// message = message.replace("__APP_VERSION__", appVersion == null ? "" : appVersion);
|
||||
// message = message.replace("__APP_VERSION_CODE__", "" + UtilityResources.getAppVersionCode());
|
||||
//
|
||||
//
|
||||
// message = message.replaceAll("__ERROR_TITLE__", ex.getMessage());
|
||||
//
|
||||
// message = message.replaceAll("__ERROR_DETAIL__", additionalText == null ? "" : additionalText);
|
||||
//
|
||||
//
|
||||
// StringWriter sw = new StringWriter();
|
||||
// ex.printStackTrace(new PrintWriter(sw));
|
||||
//
|
||||
// message = message.replace("__ERROR_STACKTRACE__", sw.toString());
|
||||
//
|
||||
// String currentAzienda = UtilityString.isNullOrEmpty(SettingsManager.i().userSession.profileDB) ? "" : SettingsManager.i().userSession.profileDB;
|
||||
// message = message.replace("__CUSTOMER_NAME__", currentAzienda);
|
||||
//
|
||||
// message = message.replace("__ERROR_DATE__", UtilityDate.formatDate(UtilityDate.getDateInstance(), UtilityDate.COMMONS_DATE_FORMATS.DMY_TIME_SLASH));
|
||||
//
|
||||
// SystemRESTConsumer.sendErrorLogMail(message, onComplete, onFailed);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import androidx.databinding.Observable;
|
||||
import androidx.databinding.ObservableField;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
|
||||
public class UtilityObservable {
|
||||
|
||||
public static <T> void addPropertyChanged(ObservableField<T> observableField, RunnableArgs<T> onValueChanged) {
|
||||
observableField.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||
@Override
|
||||
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||
onValueChanged.run(observableField.get());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,16 +1,15 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsModel;
|
||||
|
||||
public class UtilitySettings {
|
||||
|
||||
|
||||
public static void logout(){
|
||||
public static void logout(AppDatabase appDatabase){
|
||||
SettingsManager.i().user = null;
|
||||
SettingsManager.i().userSession = null;
|
||||
MainApplication.clearDB();
|
||||
UtilityThread.executeParallel(appDatabase::clearAllTables);
|
||||
SettingsManager.update();
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
public class UtilityThread {
|
||||
|
||||
public static void executeParallel(Runnable runnable) {
|
||||
new Thread(runnable).start();
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,7 +2,7 @@ package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso;
|
||||
|
||||
import android.content.Intent;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@ -113,7 +113,7 @@ public class AccettazioneOrdineInevasoActivity extends BaseActivity {
|
||||
|
||||
|
||||
public void startListaBancaliRegistratiActivity(ArrayList<MtbColt> mtbColts){
|
||||
Intent myIntent = ListaBancaliActivity.createIntent(this, mtbColts, false, PrinterRESTConsumer.Type.SECONDARIA, ReportManager.getRightReportNameByGestione(GestioneEnum.ACQUISTO));
|
||||
Intent myIntent = ListaBancaliActivity.createIntent(this, mtbColts, false, PrinterRESTConsumer.Type.SECONDARIA, ReportManager.getReportNameLUFromGestione(GestioneEnum.ACQUISTO));
|
||||
this.startActivityForResult(myIntent, PICK_UL_REQUEST);
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ public class OrdineAccettazioneInevasoRESTConsumerService {
|
||||
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbColt>>() {}.getType();
|
||||
SystemRESTConsumer.processSql(sql, typeOfObjectsList, new ISimpleOperationCallback<List<MtbColt>>() {
|
||||
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<List<MtbColt>>() {
|
||||
@Override
|
||||
public void onSuccess(List<MtbColt> value) {
|
||||
if(onComplete != null) onComplete.run(value);
|
||||
|
||||
@ -258,7 +258,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
|
||||
|
||||
private void executeEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
||||
ColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), false, false, mtbColt -> {
|
||||
ColliMagazzinoRESTConsumer.getBySSCCStatic(barcodeScanDTO.getStringValue(), false, false, mtbColt -> {
|
||||
|
||||
if (mtbColt == null) {
|
||||
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
||||
@ -284,7 +284,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
||||
BarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
String barcodeProd = null;
|
||||
|
||||
@ -328,7 +328,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
barcodeProd = UtilityBarcode.convertITF14toEAN13(barcodeProd);
|
||||
}
|
||||
|
||||
ArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
|
||||
ArticoloRESTConsumer.getByBarcodeProdStatic(barcodeProd, mtbAartList -> {
|
||||
|
||||
if (mtbAartList != null && mtbAartList.size() > 0) {
|
||||
|
||||
@ -498,7 +498,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
}
|
||||
|
||||
|
||||
ColliMagazzinoRESTConsumer.saveCollo(mtbColt, new ISimpleOperationCallback<MtbColt>() {
|
||||
ColliMagazzinoRESTConsumer.saveColloStatic(mtbColt, new ISimpleOperationCallback<MtbColt>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
|
||||
@ -566,7 +566,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
progress.show();
|
||||
|
||||
if (thereIsAnyRowInUL()) {
|
||||
ColliMagazzinoRESTConsumer.updateDataFine(mActivity, progress, getColloRef(), () -> {
|
||||
ColliMagazzinoRESTConsumer.updateDataFineStatic(getColloRef(), () -> {
|
||||
if (shouldPrint) printCollo(progress, onComplete);
|
||||
else {
|
||||
postCloseOperations(onComplete);
|
||||
@ -592,15 +592,15 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
return;
|
||||
}
|
||||
|
||||
PrinterRESTConsumer.getAvailablePrinters(SettingsManager.i().userSession.depo.getCodMdep(), PrinterRESTConsumer.Type.SECONDARIA, value -> {
|
||||
PrinterRESTConsumer.getAvailablePrintersStatic(SettingsManager.i().userSession.depo.getCodMdep(), PrinterRESTConsumer.Type.SECONDARIA, value -> {
|
||||
|
||||
if (value.size() > 0) {
|
||||
try {
|
||||
|
||||
|
||||
ReportManager.getRightReportNameByGestione(GestioneEnum.ACQUISTO, reportName -> {
|
||||
ReportManager.getReportNameLUFromGestione(GestioneEnum.ACQUISTO, reportName -> {
|
||||
|
||||
PrinterRESTConsumer.printCollo(
|
||||
PrinterRESTConsumer.printColloStatic(
|
||||
value.get(0),
|
||||
currentMtbColt,
|
||||
1, reportName, () -> {
|
||||
@ -642,7 +642,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
|
||||
private void deleteCollo(Dialog progress, Runnable onComplete) {
|
||||
|
||||
ColliMagazzinoRESTConsumer.deleteCollo(getColloRef(), () -> {
|
||||
ColliMagazzinoRESTConsumer.deleteColloStatic(getColloRef(), () -> {
|
||||
mArticoliInColloBottomSheetViewModel.mtbColt.set(null);
|
||||
|
||||
isFabVisible.set(true);
|
||||
@ -783,7 +783,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
//if(!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
dto.setQtaTot(new BigDecimal(ean128Model.Count));
|
||||
|
||||
if (!item.getMtbAart().isFlagQtaCnfFissa()) {
|
||||
if (!item.getMtbAart().isFlagQtaCnfFissaBoolean()) {
|
||||
dto.setQtaCnf(new BigDecimal(ean128Model.Count));
|
||||
}
|
||||
//} else {
|
||||
@ -826,7 +826,7 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
.setCodJcom(item.getCodJcom())
|
||||
.setRigaOrd(item.getRigaOrd());
|
||||
|
||||
if (!item.getMtbAart().isFlagQtaCnfFissa()) {
|
||||
if (!item.getMtbAart().isFlagQtaCnfFissaBoolean()) {
|
||||
mtbColr.setQtaCnf(quantityDTO.qtaCnf.getBigDecimal());
|
||||
}
|
||||
|
||||
@ -835,10 +835,10 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
||||
MtbColt cloneMtbColt = (MtbColt) getColloRef().clone();
|
||||
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
|
||||
|
||||
cloneMtbColt.setMtbColr(new ObservableArrayList());
|
||||
cloneMtbColt.setMtbColr(new ObservableArrayList<>());
|
||||
cloneMtbColt.getMtbColr().add(mtbColr);
|
||||
|
||||
ColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, new ISimpleOperationCallback<MtbColt>() {
|
||||
ColliMagazzinoRESTConsumer.saveColloStatic(cloneMtbColt, new ISimpleOperationCallback<MtbColt>() {
|
||||
@Override
|
||||
public void onSuccess(MtbColt value) {
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ public class ContenutoBancaleListAdapter extends RecyclerView.Adapter<ContenutoB
|
||||
|
||||
|
||||
//Setting qty with unt_mis
|
||||
if(!SettingsManager.iDB().isFlagForceAllToColli() && (mtbColr.getMtbAart() == null || mtbColr.getMtbAart().isFlagQtaCnfFissa())){
|
||||
if(!SettingsManager.iDB().isFlagForceAllToColli() && (mtbColr.getMtbAart() == null || mtbColr.getMtbAart().isFlagQtaCnfFissaBoolean())){
|
||||
String text = UtilityNumber.decimalToString(mtbColr.getQtaCol());
|
||||
|
||||
if(mtbColr.getMtbAart() != null) {
|
||||
@ -78,7 +78,7 @@ public class ContenutoBancaleListAdapter extends RecyclerView.Adapter<ContenutoB
|
||||
holder.bind(mtbColr);
|
||||
|
||||
//Setting qty with unt_mis
|
||||
if(!SettingsManager.iDB().isFlagForceAllToColli() && (mtbColr.getMtbAart() == null || mtbColr.getMtbAart().isFlagQtaCnfFissa())){
|
||||
if(!SettingsManager.iDB().isFlagForceAllToColli() && (mtbColr.getMtbAart() == null || mtbColr.getMtbAart().isFlagQtaCnfFissaBoolean())){
|
||||
String text = UtilityNumber.decimalToString(mtbColr.getQtaCol());
|
||||
|
||||
if(mtbColr.getMtbAart() != null) {
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
package it.integry.integrywmsnative.gest.contenuto_bancale.ui;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.andrefrsousa.superbottomsheet.SuperBottomSheetFragment;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
|
||||
public class ContenutoBancaleBottomPanel extends SuperBottomSheetFragment {
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
return inflater.inflate(R.layout.fragment_contenuto_bancale, container, false);
|
||||
}
|
||||
|
||||
public float getCornerRadius() {
|
||||
if(getContext() != null) return getContext().getResources().getDimension(R.dimen.bottom_sheet_round16);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColor() {
|
||||
return Color.RED;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
package it.integry.integrywmsnative.gest.contenuto_bancale.viewmodel;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import androidx.databinding.ObservableField;
|
||||
@ -101,16 +100,16 @@ public class ContenutoBancaleViewModel implements IRecyclerItemClicked<MtbColr>
|
||||
mContext.bindings.contenutoBancaleFab.close(true);
|
||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
|
||||
PrinterRESTConsumer.getAvailablePrinters(SettingsManager.i().userSession.depo.getCodMdep(), mPrinterType, value -> {
|
||||
PrinterRESTConsumer.getAvailablePrintersStatic(SettingsManager.i().userSession.depo.getCodMdep(), mPrinterType, value -> {
|
||||
|
||||
if(value.size() > 0) {
|
||||
|
||||
try {
|
||||
ReportManager.getRightReportNameByGestione(mtbColt.get().getGestioneEnum(), reportName -> {
|
||||
ReportManager.getReportNameLUFromGestione(mtbColt.get().getGestioneEnum(), reportName -> {
|
||||
|
||||
reportName = mReportName != null ? mReportName : reportName;
|
||||
|
||||
PrinterRESTConsumer.printCollo(value.get(0),
|
||||
PrinterRESTConsumer.printColloStatic(value.get(0),
|
||||
mtbColt.get(),
|
||||
1,
|
||||
reportName,
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package it.integry.integrywmsnative.gest.lista_bancali.viewmodel;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.core.content.ContextCompat;
|
||||
@ -37,7 +36,6 @@ public class ListaBancaliViewModel implements IRecyclerItemClicked<MtbColt> {
|
||||
|
||||
public void initRecyclerView() {
|
||||
mContext.bindings.listaColliMainList.setHasFixedSize(true);
|
||||
|
||||
mContext.bindings.listaColliMainList.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
|
||||
DividerItemDecoration itemDecorator = new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL);
|
||||
@ -58,7 +56,7 @@ public class ListaBancaliViewModel implements IRecyclerItemClicked<MtbColt> {
|
||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
|
||||
try {
|
||||
ColliMagazzinoRESTConsumer.getByTestata(item, true, false, mtbColt -> {
|
||||
ColliMagazzinoRESTConsumer.getByTestataStatic(item, true, false, mtbColt -> {
|
||||
|
||||
ObservableArrayList<MtbColr> mtbColrObservableArrayList = new ObservableArrayList<>();
|
||||
mtbColrObservableArrayList.addAll(mtbColt.getMtbColr());
|
||||
|
||||
@ -3,36 +3,36 @@ package it.integry.integrywmsnative.gest.main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.MainActivity;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.class_router.interfaces.IOrdiniVendita;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.class_router.BaseCustomConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||
import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.interfaces.IOrdiniVendita;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecover;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
@ -89,19 +89,16 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if(mOnPreDestroy != null) mOnPreDestroy.run();
|
||||
if (mOnPreDestroy != null) mOnPreDestroy.run();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
private void init(){
|
||||
private void init() {
|
||||
ServerStatusChecker.getInstance().addCallback(value -> {
|
||||
if(value && mBindings.noConnectionTopLayout.isExpanded()){
|
||||
|
||||
if (value && mBindings.noConnectionTopLayout.isExpanded()) {
|
||||
collapseNoConnectionLayout();
|
||||
|
||||
|
||||
} else if(!value && !mBindings.noConnectionTopLayout.isExpanded()){
|
||||
} else if (!value && !mBindings.noConnectionTopLayout.isExpanded()) {
|
||||
expandNoConnectionLayout();
|
||||
}
|
||||
});
|
||||
@ -118,13 +115,13 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
mBindings.currentUserName.setText(SettingsManager.i().user.fullname);
|
||||
mBindings.currentDeposito.setText(String.format("Deposito: %s • %s", SettingsManager.i().userSession.depo.getCodMdep(), SettingsManager.i().userSession.depo.getDescrizione()));
|
||||
|
||||
if(SettingsManager.iDB().getDatiAzienda() != null && SettingsManager.iDB().getDatiAzienda().isLogoAvailable()) {
|
||||
if (SettingsManager.iDB().getDatiAzienda() != null && SettingsManager.iDB().getDatiAzienda().isLogoAvailable()) {
|
||||
// currentLogoAzienda.setImageBitmap(SettingsManager.iDB().getDatiAzienda().getLogo());
|
||||
}
|
||||
}
|
||||
|
||||
private void initRecuperoCollo() {
|
||||
if(ColliDataRecover.thereIsAnExistantSession()){
|
||||
if (ColliDataRecover.thereIsAnExistantSession()) {
|
||||
startRecoverMode();
|
||||
|
||||
List<Exception> generatedErrors = new ArrayList<>();
|
||||
@ -144,42 +141,39 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
}
|
||||
|
||||
private void cyclicRecover(Iterator<Integer> sessionsIterator, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
if(sessionsIterator.hasNext()) {
|
||||
|
||||
RunnableArgss<Exception, Integer> tmpOnFailed = (ex, recoveredMtbColtID) -> {
|
||||
if (ex.getMessage().contains("Dati entity mtb_colt non trovati") || ex.getMessage().contains("Dati collo non corretti") || (ex.getMessage().contains("Il collo numero") && ex.getMessage().contains("non esiste"))) {
|
||||
ColliDataRecover.closeSession(recoveredMtbColtID);
|
||||
onFailed.run(ex);
|
||||
} else {
|
||||
onFailed.run(ex);
|
||||
}
|
||||
|
||||
cyclicRecover(sessionsIterator, onComplete, onFailed);
|
||||
};
|
||||
|
||||
if (sessionsIterator.hasNext()) {
|
||||
Integer recoveredMtbColtID = sessionsIterator.next();
|
||||
ColliDataRecover.RecoverDTO recoveredMtbColtDto = ColliDataRecover.getSession(recoveredMtbColtID);
|
||||
MtbColt recoveredMtbColt = recoveredMtbColtDto.getMtbColt();
|
||||
|
||||
if(recoveredMtbColt != null && (recoveredMtbColt.getGestioneEnum() == GestioneEnum.VENDITA || recoveredMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && !UtilityString.isNullOrEmpty(recoveredMtbColt.getFiltroOrdini())) {
|
||||
if (recoveredMtbColt != null && (recoveredMtbColt.getGestioneEnum() == GestioneEnum.VENDITA || recoveredMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && !UtilityString.isNullOrEmpty(recoveredMtbColt.getFiltroOrdini())) {
|
||||
|
||||
IOrdiniVendita ordiniVendita = ClassRouter.getInstance(ClassRouter.PATH.ORDINI_VENDITA);
|
||||
|
||||
ColliMagazzinoRESTConsumer.updateDataFine(getActivity(), null, recoveredMtbColt, () -> {
|
||||
ordiniVendita.distribuisciCollo(null, recoveredMtbColt, recoveredMtbColtDto.getTestateOrdini(),
|
||||
mtbColts -> {
|
||||
ColliDataRecover.closeSession(recoveredMtbColtID);
|
||||
|
||||
cyclicRecover(sessionsIterator, onComplete, onFailed);
|
||||
}, ex -> {
|
||||
|
||||
if(ex.getMessage().contains("Dati entity mtb_colt non trovati") || ex.getMessage().contains("Dati collo non corretti") || (ex.getMessage().contains("Il collo numero") && ex.getMessage().contains("non esiste"))) {
|
||||
ColliMagazzinoRESTConsumer.updateDataFineStatic(recoveredMtbColt, () -> {
|
||||
ordiniVendita.distribuisciCollo(recoveredMtbColt, recoveredMtbColtDto.getTestateOrdini(),
|
||||
mtbColts -> {
|
||||
ColliDataRecover.closeSession(recoveredMtbColtID);
|
||||
onFailed.run(ex);
|
||||
} else {
|
||||
onFailed.run(ex);
|
||||
|
||||
cyclicRecover(sessionsIterator, onComplete, onFailed);
|
||||
}, ex -> {
|
||||
tmpOnFailed.run(ex, recoveredMtbColtID);
|
||||
}
|
||||
|
||||
cyclicRecover(sessionsIterator, onComplete, onFailed);
|
||||
});
|
||||
}, ex -> {
|
||||
|
||||
if(ex.getMessage().contains("Dati entity mtb_colt non trovati") || ex.getMessage().contains("Dati collo non corretti") || (ex.getMessage().contains("Il collo numero") && ex.getMessage().contains("non esiste"))) {
|
||||
ColliDataRecover.closeSession(recoveredMtbColtID);
|
||||
onFailed.run(ex);
|
||||
} else {
|
||||
onFailed.run(ex);
|
||||
}
|
||||
|
||||
cyclicRecover(sessionsIterator, onComplete, onFailed);
|
||||
);
|
||||
}, ex -> {
|
||||
tmpOnFailed.run(ex, recoveredMtbColtID);
|
||||
});
|
||||
} else {
|
||||
ColliDataRecover.closeSession(recoveredMtbColtID);
|
||||
@ -191,12 +185,14 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
}
|
||||
}
|
||||
|
||||
private void collapseNoConnectionLayout(){
|
||||
if(getActivity() != null) getActivity().runOnUiThread(() -> mBindings.noConnectionTopLayout.collapse(true));
|
||||
private void collapseNoConnectionLayout() {
|
||||
if (getActivity() != null)
|
||||
getActivity().runOnUiThread(() -> mBindings.noConnectionTopLayout.collapse(true));
|
||||
}
|
||||
|
||||
private void expandNoConnectionLayout(){
|
||||
if(getActivity() != null) getActivity().runOnUiThread(() -> mBindings.noConnectionTopLayout.expand(true));
|
||||
private void expandNoConnectionLayout() {
|
||||
if (getActivity() != null)
|
||||
getActivity().runOnUiThread(() -> mBindings.noConnectionTopLayout.expand(true));
|
||||
}
|
||||
|
||||
private void startRecoverMode() {
|
||||
@ -223,22 +219,16 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void initGestMenu() {
|
||||
ICustomConfiguration customConfiguration = ClassRouter.getInstance(ClassRouter.PATH.CUSTOM_CONFIGURATION);
|
||||
if (customConfiguration == null) {
|
||||
// MainApplication.exit();
|
||||
}
|
||||
|
||||
BaseMenuConfiguration menuConfiguration = customConfiguration.getConfig(BaseCustomConfiguration.Keys.MENU_CONFIGURATION);
|
||||
List<MenuConfiguration.MenuGroup> menuGroups = menuConfiguration.getGroups();
|
||||
|
||||
for(MenuConfiguration.MenuGroup menuGroup : menuGroups) {
|
||||
|
||||
for (MenuConfiguration.MenuGroup menuGroup : menuGroups) {
|
||||
FragmentMainMenuGroupLayoutBinding groupBinding = DataBindingUtil.inflate(mLayoutInflater, R.layout.fragment_main_menu_group_layout, null, false);
|
||||
|
||||
String title = this.getResources().getString(menuGroup.getGroupText());
|
||||
@ -256,6 +246,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
|
||||
mBindings.menuContainer.addView(groupBinding.getRoot());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void onMenuClick(MenuConfiguration.MenuItem menuItem) {
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.gest.picking_libero;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface PickingLiberoComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
|
||||
PickingLiberoComponent create();
|
||||
}
|
||||
|
||||
void inject(PickingLiberoFragment pickingLiberoFragment);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user