Compare commits
53 Commits
v1.41.09(4
...
v1.43.02(4
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b536eb0b0 | |||
| f390548d66 | |||
| c6a2b8c6ea | |||
| 6d48182d90 | |||
| e3d8defa5b | |||
| dc24b43311 | |||
| 75f55ebd44 | |||
| 9dc0935cc1 | |||
| 5bfd695f2d | |||
| 8e0b05b6af | |||
| ddc441e76e | |||
| 20602cadb5 | |||
| 416ac0a2a5 | |||
| 49933c8493 | |||
| b1bc72a1a5 | |||
| c498a373f5 | |||
| bd04d6263e | |||
| 6e52a3c0c7 | |||
| 9f92274720 | |||
| 6d431bb251 | |||
| 5265b949af | |||
| db875491d0 | |||
| 778fdff69a | |||
| 4b54aa3c02 | |||
| 019688a5cc | |||
| 00fc3a59eb | |||
| e5244e75a3 | |||
| cb77c21656 | |||
| e23446654d | |||
| b3641534c9 | |||
| a3a5f65e53 | |||
| ac6f64d494 | |||
| 9d001f8896 | |||
| 24e9cffeea | |||
| b0f2763a85 | |||
| cc343c296f | |||
| bc9b60b0ac | |||
| 856592e1fe | |||
| cd28d01354 | |||
| 653cd3fd75 | |||
| 73b1a77a12 | |||
| 777d6a3c5b | |||
| 98f520427e | |||
| 403f2ec57c | |||
| e69d99fdf1 | |||
| b48b2fbac9 | |||
| 00515aaf9b | |||
| e70d5697c3 | |||
| fb6d206203 | |||
| d3a9c87d14 | |||
| 39841f6b0d | |||
| 7ed3b421a1 | |||
| 3b5eb32190 |
14
.idea/appInsightsSettings.xml
generated
14
.idea/appInsightsSettings.xml
generated
@@ -4,6 +4,20 @@
|
||||
<option name="selectedTabId" value="Android Vitals" />
|
||||
<option name="tabSettings">
|
||||
<map>
|
||||
<entry key="Android Vitals">
|
||||
<value>
|
||||
<InsightsFilterSettings>
|
||||
<option name="connection">
|
||||
<ConnectionSetting>
|
||||
<option name="appId" value="it.integry.ordify.dulciar" />
|
||||
</ConnectionSetting>
|
||||
</option>
|
||||
<option name="signal" value="SIGNAL_UNSPECIFIED" />
|
||||
<option name="timeIntervalDays" value="SEVEN_DAYS" />
|
||||
<option name="visibilityType" value="ALL" />
|
||||
</InsightsFilterSettings>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="Firebase Crashlytics">
|
||||
<value>
|
||||
<InsightsFilterSettings>
|
||||
|
||||
4
.idea/deploymentTargetSelector.xml
generated
4
.idea/deploymentTargetSelector.xml
generated
@@ -4,10 +4,10 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2024-09-13T09:26:42.884931500Z">
|
||||
<DropdownSelection timestamp="2025-01-17T09:18:08.345092200Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=R52T60AZ93A" />
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=21088B8EFD" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
|
||||
2
.idea/kotlinc.xml
generated
2
.idea/kotlinc.xml
generated
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.9.20" />
|
||||
<option name="version" value="1.9.25" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -5,13 +5,13 @@ if (!project.hasProperty("disable-performance-plugin")) {
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.firebase.crashlytics'
|
||||
apply plugin: 'kotlin-android'
|
||||
//apply plugin: 'kotlin-android'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 457
|
||||
def appVersionName = '1.41.09'
|
||||
def appVersionCode = 467
|
||||
def appVersionName = '1.43.02'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
@@ -34,10 +34,10 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "it.integry.integrywmsnative"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 34
|
||||
targetSdkVersion 35
|
||||
versionCode appVersionCode
|
||||
versionName appVersionName
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
signingConfig signingConfigs.release
|
||||
|
||||
javaCompileOptions {
|
||||
@@ -75,47 +75,54 @@ android {
|
||||
build {
|
||||
doLast {
|
||||
delete "$projectDir/build/outputs/apk/release/version.txt"
|
||||
file("$projectDir/build/outputs/apk/release/version.txt").text = appVersionCode + '\n' + appVersionName
|
||||
file("$projectDir/build/outputs/apk/release/version.txt").text = appVersionCode + '\n' + appVersionName + '\n' + 'forced=true'
|
||||
}
|
||||
}
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
tasks.withType(JavaCompile.class) {
|
||||
tasks.withType(JavaCompile.class).tap {
|
||||
configureEach {
|
||||
options.compilerArgs << "-Xmaxerrs" << "10000"
|
||||
}
|
||||
}
|
||||
}
|
||||
lint {
|
||||
abortOnError false
|
||||
}
|
||||
namespace 'it.integry.integrywmsnative'
|
||||
compileSdk 34
|
||||
compileSdk 35
|
||||
}
|
||||
|
||||
configurations {
|
||||
all*.exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk7'
|
||||
all*.exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4'
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
// androidTestImplementation('androidx.test.espresso:espresso-core:3.6.1', {
|
||||
// exclude group: 'com.android.support', module: 'support-annotations'
|
||||
// })
|
||||
// implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation 'com.github.lupaulus:logger:2.3.2'
|
||||
|
||||
//Firebase
|
||||
|
||||
// Import the Firebase BoM
|
||||
implementation platform('com.google.firebase:firebase-bom:32.8.1')
|
||||
implementation platform('com.google.firebase:firebase-bom:33.8.0')
|
||||
implementation 'com.google.firebase:firebase-analytics'
|
||||
implementation 'com.google.firebase:firebase-crashlytics'
|
||||
implementation 'com.google.firebase:firebase-perf'
|
||||
implementation 'com.google.android.gms:play-services-basement:18.3.0'
|
||||
implementation 'com.google.android.gms:play-services-basement:18.5.0'
|
||||
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.11.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'com.google.android.material:material:1.12.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.3.2'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.4.0'
|
||||
|
||||
implementation('androidx.preference:preference-ktx:1.2.1') {
|
||||
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel'
|
||||
@@ -127,12 +134,12 @@ dependencies {
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
implementation 'com.annimon:stream:1.2.2'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7'
|
||||
// implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||
implementation 'org.apache.commons:commons-text:1.9'
|
||||
|
||||
//MVVM
|
||||
def dagger2_version = '2.46.1'
|
||||
def dagger2_version = '2.55'
|
||||
api "com.google.dagger:dagger:$dagger2_version"
|
||||
annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
|
||||
api "com.google.dagger:dagger-android:$dagger2_version"
|
||||
@@ -182,6 +189,9 @@ dependencies {
|
||||
// RxJava is also required.
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
|
||||
|
||||
//Barcode generator
|
||||
implementation group: 'com.google.zxing', name: 'core', version: '3.5.3'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
android:allowBackup="true"
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
|
||||
BIN
app/src/main/ic_launcher-playstore.png
Normal file
BIN
app/src/main/ic_launcher-playstore.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
@@ -126,6 +126,8 @@ import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.Di
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdComponent;
|
||||
@@ -142,6 +144,8 @@ import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArtComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArtModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.switch_user_depo.DialogSwitchUserDepoComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.switch_user_depo.DialogSwitchUserDepoModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracciamentoImballiComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracciamentoImballiModule;
|
||||
|
||||
@@ -218,7 +222,9 @@ import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracc
|
||||
DialogInfoGiacenzaModule.class,
|
||||
ArticoliInGiacenzaModule.class,
|
||||
DialogTracciamentoImballiModule.class,
|
||||
DialogAskVettoreModule.class
|
||||
DialogAskVettoreModule.class,
|
||||
DialogCreateNewArtModule.class,
|
||||
DialogSwitchUserDepoModule.class
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
@@ -365,6 +371,10 @@ public interface MainApplicationComponent {
|
||||
|
||||
DialogAskVettoreComponent.Factory dialogAskVettoreComponent();
|
||||
|
||||
DialogCreateNewArtComponent.Factory dialogCreateNewArtComponent();
|
||||
|
||||
DialogSwitchUserDepoComponent.Factory dialogSwitchUserDepoComponent();
|
||||
|
||||
void inject(MainApplication mainApplication);
|
||||
|
||||
void inject(AppContext mainApplication);
|
||||
|
||||
@@ -82,8 +82,8 @@ public class MainApplicationModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public SettingsManager provideSettingsManager(SystemRESTConsumer systemRESTConsumer, AziendaRESTConsumer aziendaRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer, GestSetupRESTConsumer gestSetupRESTConsumer) {
|
||||
return new SettingsManager(mApplication, systemRESTConsumer, aziendaRESTConsumer, gestSetupRESTConsumer, posizioniRESTConsumer);
|
||||
public SettingsManager provideSettingsManager(SystemRESTConsumer systemRESTConsumer, ImballiRESTConsumer imballiRESTConsumer, AziendaRESTConsumer aziendaRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer, GestSetupRESTConsumer gestSetupRESTConsumer) {
|
||||
return new SettingsManager(mApplication, systemRESTConsumer, imballiRESTConsumer, aziendaRESTConsumer, gestSetupRESTConsumer, posizioniRESTConsumer);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@@ -103,12 +103,12 @@ public class SplashActivity extends BaseActivity implements MainContext.Listener
|
||||
|
||||
@Override
|
||||
public void onDBDataLoading(String item) {
|
||||
mBinding.loadingInfoTextview.setText("Caricamento " + item);
|
||||
runOnUiThread(() -> mBinding.loadingInfoTextview.setText("Caricamento " + item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMenuLoading() {
|
||||
mBinding.loadingInfoTextview.setText("Caricamento menù");
|
||||
runOnUiThread(() -> mBinding.loadingInfoTextview.setText("Caricamento menù"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -105,6 +105,28 @@ public class Converters {
|
||||
view.setTag(R.id.bound_observable, new Pair<>(observableField, watcher));
|
||||
view.addTextChangedListener(watcher);
|
||||
}
|
||||
String newValue = observableField != null ? observableField.get() : "";
|
||||
if (!view.getText().toString().equals(newValue)) {
|
||||
view.setText(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("binding")
|
||||
public static void bindEditText(AppCompatTextView view, final ValidatableObservableField<String> observableField) {
|
||||
Pair<ValidatableObservableField<String>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||
if (pair == null || pair.first != observableField) {
|
||||
if (pair != null) {
|
||||
view.removeTextChangedListener(pair.second);
|
||||
}
|
||||
TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if (observableField != null) observableField.set(s.toString());
|
||||
}
|
||||
};
|
||||
view.setTag(R.id.bound_observable, new Pair<>(observableField, watcher));
|
||||
view.addTextChangedListener(watcher);
|
||||
}
|
||||
String newValue = observableField.get();
|
||||
if (!view.getText().toString().equals(newValue)) {
|
||||
view.setText(newValue);
|
||||
@@ -156,6 +178,28 @@ public class Converters {
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("binding")
|
||||
public static void bindEditText(EditText view, final ValidatableObservableField<String> observableString) {
|
||||
Pair<ValidatableObservableField<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();
|
||||
if (!view.getText().toString().equals(newValue)) {
|
||||
view.setText(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("binding")
|
||||
public static void bindEditText(AutoCompleteTextView view, final ObservableField<String> observableString) {
|
||||
Pair<ObservableField<String>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||
@@ -260,6 +304,36 @@ public class Converters {
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("binding")
|
||||
public static void bindTextInputEditTextBigDecimal(EditText view, final ValidatableObservableField<BigDecimal> observableBigDecimal) {
|
||||
Pair<ValidatableObservableField<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;
|
||||
String newValueString = s.toString().trim();
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(newValueString))
|
||||
value = new BigDecimal(newValueString);
|
||||
|
||||
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().isEmpty() ? new BigDecimal(view.getText().toString()) : null;
|
||||
|
||||
if (!UtilityBigDecimal.equalsTo(viewValue, newValue)) {
|
||||
view.setText(UtilityNumber.decimalToString(newValue));
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("binding")
|
||||
public static void bindTextInputEditTextBigDecimal(TextInputEditText view, final BindableBigDecimal bindableBigDecimal) {
|
||||
Pair<BindableBigDecimal, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||
@@ -657,6 +731,30 @@ public class Converters {
|
||||
view.setChecked(newValue);
|
||||
}
|
||||
|
||||
@BindingAdapter("checked")
|
||||
public static void bindCheckbox(AppCompatCheckBox view, final ObservableField<Boolean> bindableBoolean) {
|
||||
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
||||
view.setTag(R.id.bound_observable, bindableBoolean);
|
||||
view.setOnCheckedChangeListener((compoundButton, b) -> {
|
||||
bindableBoolean.set(b);
|
||||
});
|
||||
}
|
||||
Boolean newValue = bindableBoolean.get();
|
||||
view.setChecked(newValue);
|
||||
}
|
||||
|
||||
@BindingAdapter("checked")
|
||||
public static void bindCheckbox(AppCompatCheckBox view, final ValidatableObservableField<Boolean> bindableBoolean) {
|
||||
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
||||
view.setTag(R.id.bound_observable, bindableBoolean);
|
||||
view.setOnCheckedChangeListener((compoundButton, b) -> {
|
||||
bindableBoolean.set(b);
|
||||
});
|
||||
}
|
||||
Boolean newValue = bindableBoolean.get();
|
||||
view.setChecked(newValue);
|
||||
}
|
||||
|
||||
@BindingAdapter("checked")
|
||||
public static void bindCheckbox(CheckBox view, final BindableBoolean bindableBoolean) {
|
||||
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
||||
@@ -721,10 +819,49 @@ public class Converters {
|
||||
}
|
||||
|
||||
|
||||
@BindingAdapter("visibilityWhenNotNull")
|
||||
public static void bindViewVisibilityWhenNotNull(View view, ObservableField<?> bindableObject) {
|
||||
if(bindableObject == null) return;
|
||||
|
||||
if (view.getTag(R.id.bound_observable) != bindableObject) {
|
||||
view.setTag(R.id.bound_observable, bindableObject);
|
||||
}
|
||||
|
||||
bindableObject.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||
@Override
|
||||
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||
view.setVisibility(bindableObject.get() == null ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
view.setVisibility(bindableObject.get() == null ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
@BindingAdapter("visibilityWhenNull")
|
||||
public static void bindViewVisibilityWhenNull(View view, ObservableField<?> bindableObject) {
|
||||
|
||||
if (view.getTag(R.id.bound_observable_visibility) != bindableObject) {
|
||||
view.setTag(R.id.bound_observable_visibility, bindableObject);
|
||||
}
|
||||
|
||||
view.setVisibility(bindableObject == null || bindableObject.get() == null ? View.VISIBLE : View.GONE);
|
||||
|
||||
if(bindableObject == null) return;
|
||||
|
||||
bindableObject.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||
@Override
|
||||
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||
view.setVisibility(bindableObject.get() == null ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@BindingAdapter({"reverse_visibility"})
|
||||
public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) {
|
||||
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
||||
view.setTag(R.id.bound_observable, bindableBoolean);
|
||||
if (view.getTag(R.id.bound_reverse_visibility) != bindableBoolean) {
|
||||
view.setTag(R.id.bound_reverse_visibility, bindableBoolean);
|
||||
}
|
||||
bindableBoolean.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package it.integry.integrywmsnative.core.di;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.BaseObservable;
|
||||
import androidx.databinding.Bindable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.BR;
|
||||
import it.integry.integrywmsnative.core.di.validators.Validator;
|
||||
|
||||
public class ValidatableObservableField<T> extends BaseObservable {
|
||||
private T mValue;
|
||||
private final List<Validator<T>> validators = new ArrayList<>();
|
||||
public String errorMessage;
|
||||
|
||||
public ValidatableObservableField() {
|
||||
}
|
||||
|
||||
public ValidatableObservableField(T value) {
|
||||
mValue = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the stored value.
|
||||
*/
|
||||
@Nullable
|
||||
public T get() {
|
||||
return mValue;
|
||||
}
|
||||
|
||||
public void set(T value) {
|
||||
if (value != mValue) {
|
||||
mValue = value;
|
||||
notifyChange();
|
||||
validate();
|
||||
}
|
||||
}
|
||||
|
||||
public void addValidator(Validator<T> validator) {
|
||||
validators.add(validator);
|
||||
}
|
||||
|
||||
public boolean validate() {
|
||||
for (Validator<T> validator : validators) {
|
||||
if (!validator.isValid(mValue)) {
|
||||
setErrorMessage(validator.getErrorMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
setErrorMessage(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Bindable
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
private void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
notifyPropertyChanged(BR.errorMessage); // Notifica il cambiamento di errorMessage
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,25 @@ package it.integry.integrywmsnative.core.di.binders;
|
||||
|
||||
public class AutoCompleteTextViewBinders {
|
||||
|
||||
|
||||
// @BindingAdapter("binding")
|
||||
// public static void bindUntMisText(AppCompatAutoCompleteTextView view, ObservableField<MtbUntMis> untMisField) {
|
||||
// Pair<ObservableField<MtbUntMis>, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
|
||||
// if (pair == null || pair.first != untMisField) {
|
||||
// if (pair != null) {
|
||||
// view.removeTextChangedListener(pair.second);
|
||||
// }
|
||||
// TextWatcherAdapter watcher = new TextWatcherAdapter() {
|
||||
// @Override
|
||||
// public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
// if (untMisField != null) untMisField.set(s.toString());
|
||||
// }
|
||||
// };
|
||||
// view.setTag(R.id.bound_observable, new Pair<>(untMisField, watcher));
|
||||
// view.addTextChangedListener(watcher);
|
||||
// }
|
||||
// String newValue = untMisField != null && untMisField.get() != null ? Objects.requireNonNull(untMisField.get()).getUntMis() : "";
|
||||
// if (!view.getText().toString().equals(newValue)) {
|
||||
// view.setText(newValue);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.di.binders;
|
||||
|
||||
import androidx.databinding.BindingAdapter;
|
||||
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
public class TextInputLayoutBinders {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package it.integry.integrywmsnative.core.di.validators;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class GreaterThenValidator implements Validator<BigDecimal> {
|
||||
private final String errorMessage;
|
||||
private final BigDecimal greaterThanValue;
|
||||
|
||||
public GreaterThenValidator(BigDecimal greaterThanValue, String errorMessage) {
|
||||
this.greaterThanValue = greaterThanValue;
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(BigDecimal value) {
|
||||
return value != null && value.compareTo(greaterThanValue) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package it.integry.integrywmsnative.core.di.validators;
|
||||
|
||||
public class MinLengthValidator implements Validator<String> {
|
||||
private final int minLength;
|
||||
private final String errorMessage;
|
||||
|
||||
public MinLengthValidator(int minLength, String errorMessage) {
|
||||
this.minLength = minLength;
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value) {
|
||||
return value != null && value.length() >= minLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.integrywmsnative.core.di.validators;
|
||||
|
||||
public class NotEmptyValidator implements Validator<String> {
|
||||
private final String errorMessage;
|
||||
|
||||
public NotEmptyValidator(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value) {
|
||||
return value != null && !value.trim().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.integrywmsnative.core.di.validators;
|
||||
|
||||
public class NotNullValidator<T> implements Validator<T>{
|
||||
private final String errorMessage;
|
||||
|
||||
public NotNullValidator(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(T value) {
|
||||
return value != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.di.validators;
|
||||
|
||||
public interface Validator<T> {
|
||||
boolean isValid(T value);
|
||||
|
||||
String getErrorMessage();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package it.integry.integrywmsnative.core.helper;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
|
||||
public final class GestioneToTextConverter {
|
||||
|
||||
public static String convert(GestioneEnum gestioneEnum) {
|
||||
return switch (gestioneEnum) {
|
||||
case ACQUISTO -> "Acquisto";
|
||||
case PRODUZIONE -> "Produzione";
|
||||
case LAVORAZIONE -> "Lavorazione";
|
||||
case VENDITA -> "Vendita";
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.mapper;
|
||||
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRowRoomDTO;
|
||||
import it.integry.integrywmsnative.core.model.MtbInvenr;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
|
||||
public class InventarioRowMapper extends BaseMapper<MtbInvenr, InventarioRowRoomDTO> {
|
||||
|
||||
@@ -32,6 +33,7 @@ public class InventarioRowMapper extends BaseMapper<MtbInvenr, InventarioRowRoom
|
||||
data.setDataOraInv(inputData.getDataOraInv());
|
||||
data.setScanCodBarre(inputData.getScanCodBarre());
|
||||
data.setZona(inputData.getZona());
|
||||
data.setIdDisp(SettingsManager.i().getUserSession().getDeviceId());
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.model;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableField;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
@@ -16,6 +17,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||
@@ -64,7 +66,7 @@ public class MtbColt extends EntityBase {
|
||||
private BigDecimal altezzaCm;
|
||||
private String codJcom;
|
||||
|
||||
private MtbTCol mtbTCol;
|
||||
private final ObservableField<ObservableMtbTcol> mtbTCol = new ObservableField<>();
|
||||
|
||||
private Boolean disablePrint;
|
||||
private String ragSocCliente;
|
||||
@@ -258,6 +260,16 @@ public class MtbColt extends EntityBase {
|
||||
|
||||
public MtbColt setCodTcol(String codTcol) {
|
||||
this.codTcol = codTcol;
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(codTcol)) {
|
||||
var fountMtbTcolObservable = SettingsManager.iDB().getInternalImballi().stream()
|
||||
.filter(x -> x.getCodTcol().equalsIgnoreCase(codTcol))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
this.setMtbTCol(fountMtbTcolObservable);
|
||||
} else
|
||||
this.setMtbTCol(null);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -532,15 +544,19 @@ public class MtbColt extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbTCol getMtbTCol() {
|
||||
return mtbTCol;
|
||||
public ObservableMtbTcol getMtbTCol() {
|
||||
return mtbTCol.get();
|
||||
}
|
||||
|
||||
public MtbColt setMtbTCol(MtbTCol mtbTCol) {
|
||||
this.mtbTCol = mtbTCol;
|
||||
public MtbColt setMtbTCol(ObservableMtbTcol mtbTCol) {
|
||||
this.mtbTCol.set(mtbTCol);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ObservableField<ObservableMtbTcol> mtbTcolProperty() {
|
||||
return mtbTCol;
|
||||
}
|
||||
|
||||
public void generaFiltroOrdineFromDTO(List<FiltroOrdineDTO> filtroOrdineDtos) {
|
||||
|
||||
String xmlPrefix = "{\"whereCond\": \"";
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MtbGrup extends EntityBase {
|
||||
|
||||
private String codMgrp;
|
||||
@@ -8,6 +11,7 @@ public class MtbGrup extends EntityBase {
|
||||
private String logoWeb;
|
||||
private String criterioVal;
|
||||
private String tipoMgrp;
|
||||
private List<MtbSgrp> mtbSgrp = new ArrayList<>();
|
||||
|
||||
public MtbGrup() {
|
||||
this.type = "mtb_grup";
|
||||
@@ -66,4 +70,13 @@ public class MtbGrup extends EntityBase {
|
||||
this.tipoMgrp = tipoMgrp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbSgrp> getMtbSgrp() {
|
||||
return mtbSgrp;
|
||||
}
|
||||
|
||||
public MtbGrup setMtbSgrp(List<MtbSgrp> mtbSgrp) {
|
||||
this.mtbSgrp = mtbSgrp;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
public class MtbSfam extends EntityBase {
|
||||
|
||||
private String codMgrp;
|
||||
private String codMsgr;
|
||||
private String codMsfa;
|
||||
private String descrizione;
|
||||
|
||||
public MtbSfam() {
|
||||
this.type = "mtb_sfam";
|
||||
}
|
||||
|
||||
public String getCodMgrp() {
|
||||
return codMgrp;
|
||||
}
|
||||
|
||||
public MtbSfam setCodMgrp(String codMgrp) {
|
||||
this.codMgrp = codMgrp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMsgr() {
|
||||
return codMsgr;
|
||||
}
|
||||
|
||||
public MtbSfam setCodMsgr(String codMsgr) {
|
||||
this.codMsgr = codMsgr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMsfa() {
|
||||
return codMsfa;
|
||||
}
|
||||
|
||||
public MtbSfam setCodMsfa(String codMsfa) {
|
||||
this.codMsfa = codMsfa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public MtbSfam setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MtbSgrp extends EntityBase {
|
||||
|
||||
private String codMgrp;
|
||||
private String codMsgr;
|
||||
private String descrizione;
|
||||
private String inclInStat;
|
||||
private String contoRimFin;
|
||||
private Integer ordinamento;
|
||||
private Boolean chkGiacenzaNeg;
|
||||
private Boolean flagReso;
|
||||
private String codCconWip;
|
||||
private List<MtbSfam> mtbSfam = new ArrayList<>();
|
||||
|
||||
public MtbSgrp() {
|
||||
this.type = "mtb_sgrp";
|
||||
}
|
||||
|
||||
public String getCodMgrp() {
|
||||
return codMgrp;
|
||||
}
|
||||
|
||||
public MtbSgrp setCodMgrp(String codMgrp) {
|
||||
this.codMgrp = codMgrp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMsgr() {
|
||||
return codMsgr;
|
||||
}
|
||||
|
||||
public MtbSgrp setCodMsgr(String codMsgr) {
|
||||
this.codMsgr = codMsgr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public MtbSgrp setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getInclInStat() {
|
||||
return inclInStat;
|
||||
}
|
||||
|
||||
public MtbSgrp setInclInStat(String inclInStat) {
|
||||
this.inclInStat = inclInStat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getContoRimFin() {
|
||||
return contoRimFin;
|
||||
}
|
||||
|
||||
public MtbSgrp setContoRimFin(String contoRimFin) {
|
||||
this.contoRimFin = contoRimFin;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getOrdinamento() {
|
||||
return ordinamento;
|
||||
}
|
||||
|
||||
public MtbSgrp setOrdinamento(Integer ordinamento) {
|
||||
this.ordinamento = ordinamento;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getChkGiacenzaNeg() {
|
||||
return chkGiacenzaNeg;
|
||||
}
|
||||
|
||||
public MtbSgrp setChkGiacenzaNeg(Boolean chkGiacenzaNeg) {
|
||||
this.chkGiacenzaNeg = chkGiacenzaNeg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getFlagReso() {
|
||||
return flagReso;
|
||||
}
|
||||
|
||||
public MtbSgrp setFlagReso(Boolean flagReso) {
|
||||
this.flagReso = flagReso;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodCconWip() {
|
||||
return codCconWip;
|
||||
}
|
||||
|
||||
public MtbSgrp setCodCconWip(String codCconWip) {
|
||||
this.codCconWip = codCconWip;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbSfam> getMtbSfam() {
|
||||
return mtbSfam;
|
||||
}
|
||||
|
||||
public MtbSgrp setMtbSfam(List<MtbSfam> mtbSfam) {
|
||||
this.mtbSfam = mtbSfam;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public class MtbTCol {
|
||||
private BigDecimal taraKg;
|
||||
private String descrizione;
|
||||
private String codMart;
|
||||
private FlagUiUlEnum flagUIUL;
|
||||
private FlagUiUlEnum flagUiUl;
|
||||
private String circuito;
|
||||
|
||||
public String getCodTcol() {
|
||||
@@ -90,12 +90,12 @@ public class MtbTCol {
|
||||
return this;
|
||||
}
|
||||
|
||||
public FlagUiUlEnum getFlagUIUL() {
|
||||
return flagUIUL;
|
||||
public FlagUiUlEnum getFlagUiUl() {
|
||||
return flagUiUl;
|
||||
}
|
||||
|
||||
public void setFlagUIUL(FlagUiUlEnum flagUIUL) {
|
||||
this.flagUIUL = flagUIUL;
|
||||
public void setFlagUiUl(FlagUiUlEnum flagUiUl) {
|
||||
this.flagUiUl = flagUiUl;
|
||||
}
|
||||
|
||||
public String getCircuito() {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package it.integry.integrywmsnative.core.model.mapper;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableList;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
|
||||
public class MtbTcolMapper {
|
||||
|
||||
public static ObservableMtbTcol fromDTO(MtbTCol dto) {
|
||||
ObservableMtbTcol mtbTcol = new ObservableMtbTcol();
|
||||
mtbTcol.updateFromDTO(dto);
|
||||
return mtbTcol;
|
||||
}
|
||||
|
||||
public static ObservableList<ObservableMtbTcol> fromDTOList(List<MtbTCol> dto) {
|
||||
ObservableList<ObservableMtbTcol> mtbTCols = new ObservableArrayList<>();
|
||||
|
||||
mtbTCols.addAll(dto.stream().map(MtbTcolMapper::fromDTO)
|
||||
.collect(Collectors.toUnmodifiableList()));
|
||||
|
||||
return mtbTCols;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package it.integry.integrywmsnative.core.model.observable;
|
||||
|
||||
import androidx.databinding.BaseObservable;
|
||||
import androidx.databinding.Bindable;
|
||||
import androidx.databinding.ObservableField;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
|
||||
public class ObservableMtbTcol extends BaseObservable {
|
||||
|
||||
private final ObservableField<String> codTcol = new ObservableField<>();
|
||||
private final ObservableField<BigDecimal> pesoKg = new ObservableField<>();
|
||||
private final ObservableField<BigDecimal> lunghezzaCm = new ObservableField<>();
|
||||
private final ObservableField<BigDecimal> larghezzaCm = new ObservableField<>();
|
||||
private final ObservableField<BigDecimal> altezzaCm = new ObservableField<>();
|
||||
private final ObservableField<BigDecimal> taraKg = new ObservableField<>();
|
||||
private final ObservableField<String> descrizione = new ObservableField<>();
|
||||
private final ObservableField<String> codMart = new ObservableField<>();
|
||||
private final ObservableField<MtbTCol.FlagUiUlEnum> flagUIUL = new ObservableField<>();
|
||||
private final ObservableField<String> circuito = new ObservableField<>();
|
||||
|
||||
@Bindable
|
||||
public String getCodTcol() {
|
||||
return codTcol.get();
|
||||
}
|
||||
|
||||
@Bindable
|
||||
public BigDecimal getPesoKg() {
|
||||
return pesoKg.get();
|
||||
}
|
||||
|
||||
@Bindable
|
||||
public BigDecimal getLunghezzaCm() {
|
||||
return lunghezzaCm.get();
|
||||
}
|
||||
|
||||
@Bindable
|
||||
public BigDecimal getLarghezzaCm() {
|
||||
return larghezzaCm.get();
|
||||
}
|
||||
|
||||
@Bindable
|
||||
public BigDecimal getAltezzaCm() {
|
||||
return altezzaCm.get();
|
||||
}
|
||||
|
||||
@Bindable
|
||||
public BigDecimal getTaraKg() {
|
||||
return taraKg.get();
|
||||
}
|
||||
|
||||
@Bindable
|
||||
public String getDescrizione() {
|
||||
return descrizione.get();
|
||||
}
|
||||
|
||||
@Bindable
|
||||
public String getCodMart() {
|
||||
return codMart.get();
|
||||
}
|
||||
|
||||
@Bindable
|
||||
public MtbTCol.FlagUiUlEnum getFlagUIUL() {
|
||||
return flagUIUL.get();
|
||||
}
|
||||
|
||||
@Bindable
|
||||
public String getCircuito() {
|
||||
return circuito.get();
|
||||
}
|
||||
|
||||
|
||||
public ObservableField<String> codTcolProperty() {
|
||||
return codTcol;
|
||||
}
|
||||
|
||||
public ObservableField<BigDecimal> pesoKgProperty() {
|
||||
return pesoKg;
|
||||
}
|
||||
|
||||
public ObservableField<BigDecimal> lunghezzaCmProperty() {
|
||||
return lunghezzaCm;
|
||||
}
|
||||
|
||||
public ObservableField<BigDecimal> larghezzaCmProperty() {
|
||||
return larghezzaCm;
|
||||
}
|
||||
|
||||
public ObservableField<BigDecimal> altezzaCmProperty() {
|
||||
return altezzaCm;
|
||||
}
|
||||
|
||||
public ObservableField<BigDecimal> taraKgProperty() {
|
||||
return taraKg;
|
||||
}
|
||||
|
||||
public ObservableField<String> descrizioneProperty() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public ObservableField<String> codMartProperty() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public ObservableField<MtbTCol.FlagUiUlEnum> flagUIULProperty() {
|
||||
return flagUIUL;
|
||||
}
|
||||
|
||||
public ObservableField<String> circuitoProperty() {
|
||||
return circuito;
|
||||
}
|
||||
|
||||
public void updateFromDTO(MtbTCol mtbTCol) {
|
||||
codTcol.set(mtbTCol.getCodTcol());
|
||||
pesoKg.set(mtbTCol.getPesoKg());
|
||||
lunghezzaCm.set(mtbTCol.getLunghezzaCm());
|
||||
larghezzaCm.set(mtbTCol.getLarghezzaCm());
|
||||
altezzaCm.set(mtbTCol.getAltezzaCm());
|
||||
taraKg.set(mtbTCol.getTaraKg());
|
||||
descrizione.set(mtbTCol.getDescrizione());
|
||||
codMart.set(mtbTCol.getCodMart());
|
||||
flagUIUL.set(mtbTCol.getFlagUiUl());
|
||||
circuito.set(mtbTCol.getCircuito());
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
@@ -18,7 +20,10 @@ import it.integry.integrywmsnative.core.model.MtbUntMis;
|
||||
import it.integry.integrywmsnative.core.model.dto.StatoArticoloDTO;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.articolo.ArticoloDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.articolo.RetrieveArticoloByCodMartRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.articolo.UpdateBarcodeImballoRequestDTO;
|
||||
@@ -36,6 +41,41 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
this.systemRESTConsumer = systemRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
public void retrieveAvailableUntMis(RunnableArgs<List<MtbUntMis>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
articoloRESTConsumerService
|
||||
.retrieveAvailableUntMis()
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<MtbUntMis>> call, Response<ServiceRESTResponse<MtbUntMis>> response) {
|
||||
analyzeAnswerList(response, "retrieveAvailableUntMis", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<MtbUntMis>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void retrieveAvailableGruppiMerceologici(RunnableArgs<List<MtbGrup>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
articoloRESTConsumerService
|
||||
.retrieveAvailableGruppiMerceologici()
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<MtbGrup>> call, Response<ServiceRESTResponse<MtbGrup>> response) {
|
||||
analyzeAnswerList(response, "retrieveAvailableGruppiMerceologici", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<MtbGrup>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void searchByBarcode(String barcodeProd, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
|
||||
@@ -60,6 +100,25 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void findIfIsKit(MtbAart mtbAart, RunnableArgs<MtbAart> onComplete, RunnableArgs<Exception> onFailed){
|
||||
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
|
||||
articoloRESTConsumerService
|
||||
.findIfIsKit(mtbAart)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ServiceRESTResponse<MtbAart>> call, @NonNull Response<ServiceRESTResponse<MtbAart>> response) {
|
||||
analyzeAnswer(response, "findIfIsKit", (m) -> {
|
||||
onComplete.run(response.body().getDto());
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ServiceRESTResponse<MtbAart>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getByCodMarts(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
getByCodMartsStatic(codMartToFind, onComplete, onFailed);
|
||||
@@ -205,4 +264,28 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void saveArticolo(ArticoloDTO articoloToSave, RunnableArgs<String> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class);
|
||||
|
||||
var request = new SaveArticoloRequestDTO()
|
||||
.setArtToSave(articoloToSave);
|
||||
|
||||
articoloRESTConsumerService
|
||||
.saveArticolo(request)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<SaveArticoloResponseDTO>> call, Response<ServiceRESTResponse<SaveArticoloResponseDTO>> response) {
|
||||
analyzeAnswer(response, "saveArticolo", data -> {
|
||||
onComplete.run(data.getCodMart());
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<SaveArticoloResponseDTO>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,13 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
||||
import it.integry.integrywmsnative.core.model.dto.StatoArticoloDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.articolo.RetrieveArticoloByCodMartRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.articolo.SaveArticoloResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.articolo.SearchArticoloByBarcodeResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.articolo.UpdateBarcodeImballoRequestDTO;
|
||||
@@ -17,9 +21,19 @@ import retrofit2.http.Query;
|
||||
|
||||
public interface ArticoloRESTConsumerService {
|
||||
|
||||
|
||||
@GET("wms/articolo/availableUntMis")
|
||||
Call<ServiceRESTResponse<MtbUntMis>> retrieveAvailableUntMis();
|
||||
|
||||
@GET("wms/articolo/availableGruppiMerceologici")
|
||||
Call<ServiceRESTResponse<MtbGrup>> retrieveAvailableGruppiMerceologici();
|
||||
|
||||
@POST("wms/articolo/searchByBarcode")
|
||||
Call<ServiceRESTResponse<SearchArticoloByBarcodeResponseDTO>> searchByBarcode(@Body() SearchArticoloByBarcodeRequestDTO searchArticoloByBarcodeRequest);
|
||||
|
||||
@POST("wms/articolo/findIfIsKit")
|
||||
Call<ServiceRESTResponse<MtbAart>> findIfIsKit(@Body MtbAart mtbAart);
|
||||
|
||||
@POST("wms/articolo/retrieveByCodMart")
|
||||
Call<ServiceRESTResponse<List<MtbAart>>> getByCodMart(@Body RetrieveArticoloByCodMartRequestDTO retrieveArticoloByCodMartRequest);
|
||||
|
||||
@@ -29,4 +43,7 @@ public interface ArticoloRESTConsumerService {
|
||||
@GET("getProductLotStatus")
|
||||
Call<ServiceRESTResponse<List<StatoArticoloDTO>>> getStatoPartita(@Query("codMart") String codMart, @Query("partitaMag") String partitaMag);
|
||||
|
||||
@POST("wms/articolo/saveArticolo")
|
||||
Call<ServiceRESTResponse<SaveArticoloResponseDTO>> saveArticolo(@Body SaveArticoloRequestDTO saveArticoloRequest);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -31,6 +32,8 @@ import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteULRequestDTO;
|
||||
@@ -286,7 +289,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
public void onResponse(Call<ServiceRESTResponse<MtbColt>> call, Response<ServiceRESTResponse<MtbColt>> response) {
|
||||
analyzeAnswer(response, "GetBySSCC", mtbColt -> {
|
||||
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
|
||||
if (mtbColt != null && mtbColt.getMtbColr() != null && !mtbColt.getMtbColr().isEmpty()) {
|
||||
List<MtbColt> mtbColtList = new ArrayList<>();
|
||||
mtbColtList.add(mtbColt);
|
||||
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
|
||||
@@ -404,11 +407,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void changePosizione(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
String codMdep = posizione.getCodMdep();
|
||||
String posizioneString = posizione.getPosizione();
|
||||
|
||||
public void spostaUL(MtbColt mtbColtToMove, String codMdep, String posizione, boolean createDocAutomatically, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
|
||||
|
||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||
@@ -417,26 +416,66 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
.setMtbPartitaMag(null);
|
||||
}
|
||||
|
||||
SpostaULRequestDTO spostaUlRequestDTO = new SpostaULRequestDTO()
|
||||
.setCodMdep(codMdep)
|
||||
.setPosizione(posizione)
|
||||
.setMtbColtsToMove(Collections.singletonList(mtbColtToMoveClone))
|
||||
.setCreateDocAutomatically(createDocAutomatically);
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService
|
||||
.spostaULInPosizione(codMdep,
|
||||
posizioneString,
|
||||
mtbColtToMoveClone)
|
||||
.enqueue(new Callback<ServiceRESTResponse<Object>>() {
|
||||
.spostaUL(spostaUlRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "changePosizione", mtbColts -> {
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "spostaUL", mtbColts -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
if (onFailed != null) onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void spostaUL(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
String codMdep = posizione.getCodMdep();
|
||||
String posizioneString = posizione.getPosizione();
|
||||
|
||||
spostaUL(mtbColtToMove, codMdep, posizioneString, true, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void updateTipoUL(MtbColt mtbColt, String codTcol, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
MtbColt mtbColtClone = (MtbColt) mtbColt.clone();
|
||||
mtbColtClone.setMtbColr(new ObservableArrayList<>());
|
||||
|
||||
UpdateTipoULRequestDTO updateTipoULRequest = new UpdateTipoULRequestDTO()
|
||||
.setMtbColt(mtbColtClone)
|
||||
.setCodTcol(codTcol);
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService
|
||||
.updateTipoUL(updateTipoULRequest)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "updateTipoUL", mtbColts -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
if (onFailed != null) onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
MtbColt cloneMtbColt = (MtbColt) mtbColt.clone();
|
||||
@@ -517,14 +556,14 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.spostaArtsTraUL(spostaArtsTraULRequestDTO).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "spostaArtsTraUL", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
if (onFailed != null) onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -7,6 +7,8 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.UpdateTipoULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CanULBeDeletedRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteULRequestDTO;
|
||||
@@ -31,11 +33,14 @@ public interface ColliMagazzinoRESTConsumerService {
|
||||
@POST("creaRettificaCollo")
|
||||
Call<ServiceRESTResponse<MtbColr>> creaRettificaCollo(@Query("codMdep") String codMdep, @Body RettificaULDTO rettificaULDTO);
|
||||
|
||||
@POST("wms/spostaULInPosizione")
|
||||
Call<ServiceRESTResponse<Object>> spostaULInPosizione(@Query("codMdep") String codMdep, @Query("posizione") String posizione, @Body MtbColt mtbColtToMove);
|
||||
@POST("wms/updateTipoUL")
|
||||
Call<ServiceRESTResponse<Void>> updateTipoUL(@Body UpdateTipoULRequestDTO requestDto);
|
||||
|
||||
@POST("wms/spostaUL")
|
||||
Call<ServiceRESTResponse<Void>> spostaUL(@Body SpostaULRequestDTO requestDto);
|
||||
|
||||
@POST("wms/spostaArtsTraUL")
|
||||
Call<ServiceRESTResponse<Object>> spostaArtsTraUL(@Body SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO);
|
||||
Call<ServiceRESTResponse<Void>> spostaArtsTraUL(@Body SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO);
|
||||
|
||||
@POST("wms/assegnaLottoSuColloScarico")
|
||||
Call<ServiceRESTResponse<MtbColt>> assegnaLottoSuColloScarico(@Body MtbColt mtbColt);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
@@ -7,6 +8,8 @@ import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.mapper.MtbTcolMapper;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.imballi.ImballoQuantityDTO;
|
||||
@@ -24,18 +27,20 @@ public class ImballiRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public List<MtbTCol> retrieveTipiColloSyncronized(MtbTCol.FlagUiUlEnum tipoImballo) throws Exception {
|
||||
public List<ObservableMtbTcol> retrieveImballiSyncronized(MtbTCol.FlagUiUlEnum tipoImballo) throws Exception {
|
||||
ImballiRESTConsumerService service = RESTBuilder.getService(ImballiRESTConsumerService.class);
|
||||
Response<ServiceRESTResponse<List<MtbTCol>>> response = service.retrieveTipiCollo(tipoImballo)
|
||||
Response<ServiceRESTResponse<List<MtbTCol>>> response = service.retrieveImballi(tipoImballo)
|
||||
.execute();
|
||||
|
||||
return analyzeAnswer(response, "retrieveTipiCollo");
|
||||
List<MtbTCol> retrieveTipiCollo = analyzeAnswer(response, "retrieveTipiCollo");
|
||||
retrieveTipiCollo = retrieveTipiCollo == null ? new ArrayList<>() : retrieveTipiCollo;
|
||||
return MtbTcolMapper.fromDTOList(retrieveTipiCollo);
|
||||
}
|
||||
|
||||
public void retrieveTipiCollo(MtbTCol.FlagUiUlEnum tipoImballo, RunnableArgs<List<MtbTCol>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void retrieveImballi(MtbTCol.FlagUiUlEnum tipoImballo, RunnableArgs<List<ObservableMtbTcol>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
var response = retrieveTipiColloSyncronized(tipoImballo);
|
||||
var response = retrieveImballiSyncronized(tipoImballo);
|
||||
if (onComplete != null) onComplete.run(response);
|
||||
} catch (Exception ex) {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
|
||||
@@ -16,7 +16,7 @@ public interface ImballiRESTConsumerService {
|
||||
|
||||
|
||||
@GET("wms/imballi/retrieve/{tipo}")
|
||||
Call<ServiceRESTResponse<List<MtbTCol>>> retrieveTipiCollo(@Path("tipo") MtbTCol.FlagUiUlEnum tipo);
|
||||
Call<ServiceRESTResponse<List<MtbTCol>>> retrieveImballi(@Path("tipo") MtbTCol.FlagUiUlEnum tipo);
|
||||
|
||||
@POST("wms/imballi/registraCarico")
|
||||
Call<ServiceRESTResponse<Void>> registraCarico(@Body RegistraCaricoImballiRequestDTO registraCaricoImballiRequest);
|
||||
|
||||
@@ -4,9 +4,6 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -15,7 +12,6 @@ import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.ConnectException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
@@ -29,9 +25,9 @@ import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.system.RegisterDeviceRequestDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityGson;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import retrofit2.Call;
|
||||
@@ -42,6 +38,23 @@ import retrofit2.Response;
|
||||
public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void retrieveUpdatesInfo(final RunnableArgs<LatestAppVersionInfoDTO> onSuccess, final RunnableArgs<Exception> onFailed) {
|
||||
SystemRESTConsumerService systemRESTConsumerService = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||
systemRESTConsumerService.retrieveUpdatesInfo()
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<LatestAppVersionInfoDTO> call, Response<LatestAppVersionInfoDTO> response) {
|
||||
analyzeAnswerGeneric(response, "updates", onSuccess, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<LatestAppVersionInfoDTO> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void registerDevice(final Runnable onSuccess, final RunnableArgs<Exception> onFailed) {
|
||||
RegisterDeviceRequestDTO registerDeviceRequestDTO = new RegisterDeviceRequestDTO()
|
||||
.setApp("WMS");
|
||||
|
||||
@@ -6,6 +6,7 @@ import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.system.LatestAppVersionInfoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.system.RegisterDeviceRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
@@ -15,6 +16,9 @@ import retrofit2.http.Query;
|
||||
|
||||
public interface SystemRESTConsumerService {
|
||||
|
||||
@GET("wms/currentVersion")
|
||||
Call<LatestAppVersionInfoDTO> retrieveUpdatesInfo();
|
||||
|
||||
@POST("device/register")
|
||||
Call<ServiceRESTResponse<Void>> registerDevice(@Body RegisterDeviceRequestDTO registerDeviceRequestDTO);
|
||||
|
||||
|
||||
@@ -15,6 +15,32 @@ import retrofit2.Response;
|
||||
|
||||
public abstract class _BaseRESTConsumer {
|
||||
|
||||
|
||||
public static <T> void analyzeAnswerGeneric(Response<T> response, String logTitle, RunnableArgs<T> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
try {
|
||||
var data = analyzeAnswerGeneric(response, logTitle);
|
||||
onComplete.run(data);
|
||||
} catch (Exception e) {
|
||||
onFailed.run(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T analyzeAnswerGeneric(Response<T> response, String logTitle) throws Exception {
|
||||
if (response.isSuccessful()) {
|
||||
return response.body();
|
||||
} else {
|
||||
if (response.code() == 404) {
|
||||
Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata (" + response.raw().request().url() + ")");
|
||||
throw new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")");
|
||||
} else if (response.code() == 550)
|
||||
throw new InvalidLicenseException();
|
||||
else {
|
||||
Log.e(logTitle, "Status " + response.code() + ": " + response.message());
|
||||
throw new Exception("Status " + response.code() + ": " + response.message());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T analyzeAnswer(Response<ServiceRESTResponse<T>> response, String logTitle) throws Exception {
|
||||
if (response.isSuccessful()) {
|
||||
if (response.body() != null) {
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class SpostaULRequestDTO {
|
||||
|
||||
private String codMdep;
|
||||
private String posizione;
|
||||
private String annotazioni;
|
||||
private boolean createDocAutomatically = true;
|
||||
private List<MtbColt> mtbColtsToMove = new ArrayList<>();
|
||||
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public SpostaULRequestDTO setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPosizione() {
|
||||
return posizione;
|
||||
}
|
||||
|
||||
public SpostaULRequestDTO setPosizione(String posizione) {
|
||||
this.posizione = posizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAnnotazioni() {
|
||||
return annotazioni;
|
||||
}
|
||||
|
||||
public SpostaULRequestDTO setAnnotazioni(String annotazioni) {
|
||||
this.annotazioni = annotazioni;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isCreateDocAutomatically() {
|
||||
return createDocAutomatically;
|
||||
}
|
||||
|
||||
public SpostaULRequestDTO setCreateDocAutomatically(boolean createDocAutomatically) {
|
||||
this.createDocAutomatically = createDocAutomatically;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbColt> getMtbColtsToMove() {
|
||||
return mtbColtsToMove;
|
||||
}
|
||||
|
||||
public SpostaULRequestDTO setMtbColtsToMove(List<MtbColt> mtbColtsToMove) {
|
||||
this.mtbColtsToMove = mtbColtsToMove;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class UpdateTipoULRequestDTO {
|
||||
|
||||
private MtbColt mtbColt;
|
||||
private String codTcol;
|
||||
|
||||
public MtbColt getMtbColt() {
|
||||
return mtbColt;
|
||||
}
|
||||
|
||||
public UpdateTipoULRequestDTO setMtbColt(MtbColt mtbColt) {
|
||||
this.mtbColt = mtbColt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodTcol() {
|
||||
return codTcol;
|
||||
}
|
||||
|
||||
public UpdateTipoULRequestDTO setCodTcol(String codTcol) {
|
||||
this.codTcol = codTcol;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.articolo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class ArticoloDTO {
|
||||
|
||||
private String codMart;
|
||||
private String descrizione;
|
||||
private String untMis;
|
||||
private String barcode;
|
||||
private BigDecimal qtaCnf;
|
||||
private String codAliq;
|
||||
private String articoloComposto;
|
||||
private String descrizioneEstesa;
|
||||
private String note;
|
||||
private String posizione;
|
||||
private String codMgrp;
|
||||
private String codMsfa;
|
||||
private String codMsgr;
|
||||
private String codMstp;
|
||||
private String codMtip;
|
||||
private boolean flagStato;
|
||||
private String barcodeImballo;
|
||||
private String diacod;
|
||||
private boolean flagQtaCnfFissa;
|
||||
private String idArtEqui;
|
||||
private boolean flagKit;
|
||||
private String precode;
|
||||
private String gruppo;
|
||||
private String sottoGruppo;
|
||||
private String sottoFamiglia;
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public ArticoloDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public ArticoloDTO setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public ArticoloDTO setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBarcode() {
|
||||
return barcode;
|
||||
}
|
||||
|
||||
public ArticoloDTO setBarcode(String barcode) {
|
||||
this.barcode = barcode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public ArticoloDTO setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodAliq() {
|
||||
return codAliq;
|
||||
}
|
||||
|
||||
public ArticoloDTO setCodAliq(String codAliq) {
|
||||
this.codAliq = codAliq;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getArticoloComposto() {
|
||||
return articoloComposto;
|
||||
}
|
||||
|
||||
public ArticoloDTO setArticoloComposto(String articoloComposto) {
|
||||
this.articoloComposto = articoloComposto;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizioneEstesa() {
|
||||
return descrizioneEstesa;
|
||||
}
|
||||
|
||||
public ArticoloDTO setDescrizioneEstesa(String descrizioneEstesa) {
|
||||
this.descrizioneEstesa = descrizioneEstesa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public ArticoloDTO setNote(String note) {
|
||||
this.note = note;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPosizione() {
|
||||
return posizione;
|
||||
}
|
||||
|
||||
public ArticoloDTO setPosizione(String posizione) {
|
||||
this.posizione = posizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMgrp() {
|
||||
return codMgrp;
|
||||
}
|
||||
|
||||
public ArticoloDTO setCodMgrp(String codMgrp) {
|
||||
this.codMgrp = codMgrp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMsfa() {
|
||||
return codMsfa;
|
||||
}
|
||||
|
||||
public ArticoloDTO setCodMsfa(String codMsfa) {
|
||||
this.codMsfa = codMsfa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMsgr() {
|
||||
return codMsgr;
|
||||
}
|
||||
|
||||
public ArticoloDTO setCodMsgr(String codMsgr) {
|
||||
this.codMsgr = codMsgr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMstp() {
|
||||
return codMstp;
|
||||
}
|
||||
|
||||
public ArticoloDTO setCodMstp(String codMstp) {
|
||||
this.codMstp = codMstp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMtip() {
|
||||
return codMtip;
|
||||
}
|
||||
|
||||
public ArticoloDTO setCodMtip(String codMtip) {
|
||||
this.codMtip = codMtip;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagStato() {
|
||||
return flagStato;
|
||||
}
|
||||
|
||||
public ArticoloDTO setFlagStato(boolean flagStato) {
|
||||
this.flagStato = flagStato;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBarcodeImballo() {
|
||||
return barcodeImballo;
|
||||
}
|
||||
|
||||
public ArticoloDTO setBarcodeImballo(String barcodeImballo) {
|
||||
this.barcodeImballo = barcodeImballo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDiacod() {
|
||||
return diacod;
|
||||
}
|
||||
|
||||
public ArticoloDTO setDiacod(String diacod) {
|
||||
this.diacod = diacod;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagQtaCnfFissa() {
|
||||
return flagQtaCnfFissa;
|
||||
}
|
||||
|
||||
public ArticoloDTO setFlagQtaCnfFissa(boolean flagQtaCnfFissa) {
|
||||
this.flagQtaCnfFissa = flagQtaCnfFissa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIdArtEqui() {
|
||||
return idArtEqui;
|
||||
}
|
||||
|
||||
public ArticoloDTO setIdArtEqui(String idArtEqui) {
|
||||
this.idArtEqui = idArtEqui;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagKit() {
|
||||
return flagKit;
|
||||
}
|
||||
|
||||
public ArticoloDTO setFlagKit(boolean flagKit) {
|
||||
this.flagKit = flagKit;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPrecode() {
|
||||
return precode;
|
||||
}
|
||||
|
||||
public ArticoloDTO setPrecode(String precode) {
|
||||
this.precode = precode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGruppo() {
|
||||
return gruppo;
|
||||
}
|
||||
|
||||
public ArticoloDTO setGruppo(String gruppo) {
|
||||
this.gruppo = gruppo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSottoGruppo() {
|
||||
return sottoGruppo;
|
||||
}
|
||||
|
||||
public ArticoloDTO setSottoGruppo(String sottoGruppo) {
|
||||
this.sottoGruppo = sottoGruppo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSottoFamiglia() {
|
||||
return sottoFamiglia;
|
||||
}
|
||||
|
||||
public ArticoloDTO setSottoFamiglia(String sottoFamiglia) {
|
||||
this.sottoFamiglia = sottoFamiglia;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.articolo;
|
||||
|
||||
public class SaveArticoloRequestDTO {
|
||||
private ArticoloDTO artToSave;
|
||||
|
||||
public ArticoloDTO getArtToSave() {
|
||||
return artToSave;
|
||||
}
|
||||
|
||||
public SaveArticoloRequestDTO setArtToSave(ArticoloDTO artToSave) {
|
||||
this.artToSave = artToSave;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.articolo;
|
||||
|
||||
public class SaveArticoloResponseDTO {
|
||||
private String codMart;
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.system;
|
||||
|
||||
public class LatestAppVersionInfoDTO {
|
||||
private String latestVersion;
|
||||
private int latestVersionCode;
|
||||
private String url;
|
||||
private boolean forced;
|
||||
|
||||
public String getLatestVersion() {
|
||||
return latestVersion;
|
||||
}
|
||||
|
||||
public LatestAppVersionInfoDTO setLatestVersion(String latestVersion) {
|
||||
this.latestVersion = latestVersion;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getLatestVersionCode() {
|
||||
return latestVersionCode;
|
||||
}
|
||||
|
||||
public LatestAppVersionInfoDTO setLatestVersionCode(int latestVersionCode) {
|
||||
this.latestVersionCode = latestVersionCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public LatestAppVersionInfoDTO setUrl(String url) {
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isForced() {
|
||||
return forced;
|
||||
}
|
||||
|
||||
public LatestAppVersionInfoDTO setForced(boolean forced) {
|
||||
this.forced = forced;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
package it.integry.integrywmsnative.core.settings;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.Azienda;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
|
||||
public class DBSettingsModel {
|
||||
@@ -16,6 +20,7 @@ public class DBSettingsModel {
|
||||
|
||||
private Azienda datiAzienda = null;
|
||||
private List<InternalCodAnagsDTO> internalCodAnags = null;
|
||||
private ObservableList<ObservableMtbTcol> internalImballi = new ObservableArrayList<>();
|
||||
|
||||
private boolean enableCheckPartitaMagCheckPickingV;
|
||||
private boolean flagMultiClienteOrdV;
|
||||
@@ -83,6 +88,9 @@ public class DBSettingsModel {
|
||||
private boolean suggestDataScad = false;
|
||||
private boolean flagPositionChangeRequest = false;
|
||||
private String docInterniRequestNumDoc;
|
||||
private boolean flagEnableArtCreation;
|
||||
private List<String> allowedCodMgrpForArtCreation;
|
||||
private boolean flagAccettazioneGroupListForn = false;
|
||||
|
||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||
return flagSpedizioneEnableFakeGiacenza;
|
||||
@@ -129,6 +137,15 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ObservableList<ObservableMtbTcol> getInternalImballi() {
|
||||
return internalImballi;
|
||||
}
|
||||
|
||||
public DBSettingsModel setInternalImballi(ObservableList<ObservableMtbTcol> internalImballi) {
|
||||
this.internalImballi = internalImballi;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<AvailableCodMdepsDTO> getAvailableCodMdep() {
|
||||
return availableCodMdep;
|
||||
}
|
||||
@@ -705,6 +722,24 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getAllowedCodMgrpForArtCreation() {
|
||||
return allowedCodMgrpForArtCreation;
|
||||
}
|
||||
|
||||
public DBSettingsModel setAllowedCodMgrpForArtCreation(List<String> allowedCodMgrpForArtCreation) {
|
||||
this.allowedCodMgrpForArtCreation = allowedCodMgrpForArtCreation;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagEnableArtCreation() {
|
||||
return flagEnableArtCreation;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagEnableArtCreation(boolean flagEnableArtCreation) {
|
||||
this.flagEnableArtCreation = flagEnableArtCreation;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagPositionChangeRequest() {
|
||||
return flagPositionChangeRequest;
|
||||
}
|
||||
@@ -713,4 +748,12 @@ public class DBSettingsModel {
|
||||
this.flagPositionChangeRequest = flagPositionChangeRequest;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagAccettazioneGroupListForn() {
|
||||
return flagAccettazioneGroupListForn;
|
||||
}
|
||||
|
||||
public void setFlagAccettazioneGroupListForn(boolean flagAccettazioneGroupListForn) {
|
||||
this.flagAccettazioneGroupListForn = flagAccettazioneGroupListForn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.settings;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
|
||||
import com.google.firebase.perf.metrics.Trace;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
@@ -16,9 +18,12 @@ import javax.inject.Singleton;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.CommonConst;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.AziendaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
@@ -38,17 +43,20 @@ public class SettingsManager {
|
||||
|
||||
private static Context mContext;
|
||||
private static SystemRESTConsumer mSystemRESTConsumer;
|
||||
private static ImballiRESTConsumer mImballiRESTConsumer;
|
||||
private static AziendaRESTConsumer mAziendaRESTConsumer;
|
||||
private static GestSetupRESTConsumer mGestSetupRESTConsumer;
|
||||
private static PosizioniRESTConsumer mPosizioniRESTConsumer;
|
||||
|
||||
public SettingsManager(Context context,
|
||||
SystemRESTConsumer systemRESTConsumer,
|
||||
ImballiRESTConsumer imballiRESTConsumer,
|
||||
AziendaRESTConsumer aziendaRESTConsumer,
|
||||
GestSetupRESTConsumer gestSetupRESTConsumer,
|
||||
PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||
mContext = context;
|
||||
mSystemRESTConsumer = systemRESTConsumer;
|
||||
mImballiRESTConsumer = imballiRESTConsumer;
|
||||
mAziendaRESTConsumer = aziendaRESTConsumer;
|
||||
mGestSetupRESTConsumer = gestSetupRESTConsumer;
|
||||
mPosizioniRESTConsumer = posizioniRESTConsumer;
|
||||
@@ -124,10 +132,29 @@ public class SettingsManager {
|
||||
loadGestSetupValues(() -> {
|
||||
|
||||
onProgress.run("dati azienda");
|
||||
loadDatiAzienda(tmpOnComplete, tmpOnFailed);
|
||||
loadDatiAzienda(() -> {
|
||||
|
||||
loadTipiCollo(tmpOnComplete, tmpOnFailed);
|
||||
|
||||
}, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
}, tmpOnFailed);
|
||||
}
|
||||
|
||||
private static void loadTipiCollo(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
mImballiRESTConsumer.retrieveImballi(MtbTCol.FlagUiUlEnum.UL, tipiColloUl -> {
|
||||
mImballiRESTConsumer.retrieveImballi(MtbTCol.FlagUiUlEnum.UI, tipiColloUi -> {
|
||||
|
||||
var imballiList = new ObservableArrayList<ObservableMtbTcol>();
|
||||
imballiList.addAll(tipiColloUi);
|
||||
imballiList.addAll(tipiColloUl);
|
||||
|
||||
SettingsManager.iDB().setInternalImballi(imballiList);
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}, onFailed);
|
||||
|
||||
}
|
||||
|
||||
private static void loadDatiAzienda(Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
@@ -243,6 +270,11 @@ public class SettingsManager {
|
||||
.setSection("ACCETTAZIONE")
|
||||
.setKeySection("FLAG_AUTO_OPEN_NEW_UL")
|
||||
.setSetter(dbSettingsModelIstance::setFlagCanAutoOpenNewULAccettazione));
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("ACCETTAZIONE")
|
||||
.setKeySection("FLAG_GROUP_LIST_FORN")
|
||||
.setSetter(dbSettingsModelIstance::setFlagAccettazioneGroupListForn));
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("ACCETTAZIONE")
|
||||
@@ -569,6 +601,21 @@ public class SettingsManager {
|
||||
.setKeySection("REQUEST_NUM_DOC")
|
||||
.setSetter(dbSettingsModelIstance::setDocInterniRequestNumDoc));
|
||||
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SETUP")
|
||||
.setKeySection("ENABLE_ART_CREATION")
|
||||
.setSetter(dbSettingsModelIstance::setFlagEnableArtCreation));
|
||||
|
||||
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
|
||||
.setGestName("PICKING")
|
||||
.setSection("SETUP")
|
||||
.setKeySection("ENABLE_ART_CREATION_GRP_MERC")
|
||||
.setSetter(data -> {
|
||||
if (data != null)
|
||||
dbSettingsModelIstance.setAllowedCodMgrpForArtCreation(Arrays.asList(data.split("\\|")));
|
||||
}));
|
||||
|
||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||
|
||||
|
||||
|
||||
@@ -15,16 +15,19 @@ import java.io.File;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.FileDownloader;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
|
||||
@Singleton
|
||||
public class UpdatesManager {
|
||||
|
||||
|
||||
private AppCompatActivity mContext;
|
||||
|
||||
public void init(AppCompatActivity activityContext) {
|
||||
public void init(AppCompatActivity activityContext, SystemRESTConsumer systemRESTConsumer) {
|
||||
this.mContext = activityContext;
|
||||
|
||||
final String baseEndpoint = SettingsManager.i().getServer().getProtocol() + "://" + SettingsManager.i().getServer().getHost() +
|
||||
@@ -34,6 +37,8 @@ public class UpdatesManager {
|
||||
final String currentDownloadUrl = baseEndpoint + "/ems-api/wms/android-release.apk";
|
||||
|
||||
|
||||
systemRESTConsumer.retrieveUpdatesInfo(latestData -> {
|
||||
|
||||
AppUpdater appUpdater = new AppUpdater(mContext)
|
||||
.setDisplay(Display.DIALOG)
|
||||
.setUpdateFrom(UpdateFrom.JSON)
|
||||
@@ -42,7 +47,12 @@ public class UpdatesManager {
|
||||
.setButtonUpdateClickListener((dialog, which) -> {
|
||||
installAPK(currentDownloadUrl);
|
||||
});
|
||||
|
||||
if(latestData.isForced())
|
||||
appUpdater.setButtonDismiss(null);
|
||||
|
||||
appUpdater.start();
|
||||
}, ex -> UtilityExceptions.defaultException(mContext, ex));
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +77,11 @@ public class UpdatesManager {
|
||||
mContext.runOnUiThread(() -> {
|
||||
progressDialogBuilder.dismiss();
|
||||
|
||||
if (!destination.exists()) {
|
||||
UtilityExceptions.defaultException(mContext, new Exception("Errore durante il download dell'aggiornamento"));
|
||||
return;
|
||||
}
|
||||
|
||||
Uri fileLoc;
|
||||
Intent intent;
|
||||
|
||||
@@ -93,7 +108,8 @@ public class UpdatesManager {
|
||||
try {
|
||||
fileDownloader.download();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
progressDialogBuilder.dismissAllowingStateLoss();
|
||||
UtilityExceptions.defaultException(mContext, e);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@@ -61,6 +61,8 @@ public class FileDownloader {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
if(downloadFile != null && downloadFile.exists())
|
||||
downloadFile.delete();
|
||||
throw e;
|
||||
|
||||
} finally {
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.MultiFormatWriter;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
@@ -109,12 +115,12 @@ public class UtilityBarcode {
|
||||
}
|
||||
|
||||
|
||||
public static String convertITF14toEAN13(String barcodeITF14) {
|
||||
public static String convertITF14toEAN13(String barcodeITF14) throws Exception {
|
||||
String barcodeEAN13 = null;
|
||||
|
||||
if (barcodeITF14.length() == 14) {
|
||||
barcodeEAN13 = barcodeITF14.substring(1, barcodeITF14.length() - 1).trim();
|
||||
barcodeEAN13 += getEAN13CheckDigit(barcodeEAN13);
|
||||
barcodeEAN13 += calculateEAN13CheckDigit(barcodeEAN13);
|
||||
}
|
||||
|
||||
return barcodeEAN13;
|
||||
@@ -131,18 +137,69 @@ public class UtilityBarcode {
|
||||
}
|
||||
|
||||
|
||||
private static String getEAN13CheckDigit(String ean) {
|
||||
|
||||
if (ean.length() != 12) {
|
||||
UtilityLogger.error(new Exception("Please provide an input string of 12 chars. Current lenght: " + ean.length()));
|
||||
return null;
|
||||
}
|
||||
long tot = 0;
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
tot = tot + (Long.parseLong(String.valueOf(ean.charAt(i))) * (i % 2 == 0 ? 1 : 3));
|
||||
}
|
||||
return tot % 10 == 0 ? "0" : "" + (10 - (tot % 10));
|
||||
public static boolean isValidEan13(String ean13) {
|
||||
// Verifica che il codice sia lungo esattamente 13 cifre
|
||||
if (ean13.length() != 13 || !ean13.matches("\\d+")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Calcola il check digit dalle prime 12 cifre
|
||||
int calculatedCheckDigit = calculateEAN13CheckDigit(ean13.substring(0, 12));
|
||||
int providedCheckDigit = Character.getNumericValue(ean13.charAt(12));
|
||||
|
||||
// Confronta il check digit calcolato con quello fornito
|
||||
return calculatedCheckDigit == providedCheckDigit;
|
||||
}
|
||||
|
||||
private static int calculateEAN13CheckDigit(String ean12) {
|
||||
int sum = 0;
|
||||
for (int i = 0; i < ean12.length(); i++) {
|
||||
int digit = Character.getNumericValue(ean12.charAt(i));
|
||||
sum += (i % 2 == 0) ? digit : digit * 3;
|
||||
}
|
||||
return (10 - (sum % 10)) % 10;
|
||||
}
|
||||
|
||||
public static Bitmap generateBarcodeImage(String barcode, int width, int height) throws Exception {
|
||||
if(barcode == null) return null;
|
||||
|
||||
BarcodeType barcodeType;
|
||||
|
||||
if(barcode.length() == 8)
|
||||
barcodeType = BarcodeType.EAN8;
|
||||
else if(barcode.length() == 13)
|
||||
barcodeType = BarcodeType.EAN13;
|
||||
else if(barcode.length() == 14)
|
||||
barcodeType = BarcodeType.INTERLEAVED_2OF5;
|
||||
else throw new Exception("Barcode " + barcode + " non valido");
|
||||
|
||||
return generateBarcodeImage(barcode, barcodeType, width, height);
|
||||
}
|
||||
|
||||
public static Bitmap generateBarcodeImage(String barcode, BarcodeType type, int width, int height) throws Exception {
|
||||
// Genera la matrice del codice a barre
|
||||
MultiFormatWriter writer = new MultiFormatWriter();
|
||||
|
||||
BarcodeFormat barcodeFormat = switch (type) {
|
||||
case EAN8 -> BarcodeFormat.EAN_8;
|
||||
case EAN13 -> BarcodeFormat.EAN_13;
|
||||
case INTERLEAVED_2OF5 -> BarcodeFormat.ITF;
|
||||
case CODE128 -> BarcodeFormat.CODE_128;
|
||||
default -> throw new Exception("Barcode " + barcode + " non valido (tipo: " + type + ")");
|
||||
};
|
||||
|
||||
BitMatrix bitMatrix = writer.encode(barcode, barcodeFormat, width, height);
|
||||
|
||||
// Crea un bitmap a partire dalla matrice
|
||||
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
bitmap.setPixel(x, y, bitMatrix.get(x, y) ? Color.BLACK : Color.WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
package it.integry.integrywmsnative.core.utility;
|
||||
|
||||
import androidx.databinding.Observable;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.databinding.ObservableList;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.OnGeneralChangedCallback;
|
||||
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgsWithReturn;
|
||||
|
||||
public class UtilityObservable {
|
||||
|
||||
@@ -16,4 +23,36 @@ public class UtilityObservable {
|
||||
});
|
||||
}
|
||||
|
||||
public static <T, R> ObservableField<R> convertObservable(ObservableField<T> observableField, RunnableArgsWithReturn<T, R> dataConverter) {
|
||||
ObservableField<R> returnObservable = new ObservableField<>();
|
||||
|
||||
observableField.addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||
@Override
|
||||
public void run() {
|
||||
returnObservable.set(dataConverter.run(observableField.get()));
|
||||
}
|
||||
});
|
||||
|
||||
returnObservable.set(dataConverter.run(observableField.get()));
|
||||
|
||||
return returnObservable;
|
||||
}
|
||||
|
||||
public static <T, R> ObservableArrayList<R> convertObservableArrayList(ObservableArrayList<T> observableField, RunnableArgsWithReturn<T, R> dataConverter) {
|
||||
ObservableArrayList<R> returnObservable = new ObservableArrayList<>();
|
||||
|
||||
observableField.addOnListChangedCallback(new OnListGeneralChangedCallback<T>() {
|
||||
@Override
|
||||
public void onChanged(ObservableList<T> sender) {
|
||||
|
||||
returnObservable.clear();
|
||||
returnObservable.addAll(sender.stream().map(dataConverter::run).collect(Collectors.toUnmodifiableList()));
|
||||
}
|
||||
});
|
||||
|
||||
returnObservable.addAll(observableField.stream().map(dataConverter::run).collect(Collectors.toUnmodifiableList()));
|
||||
|
||||
return returnObservable;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainAccettazioneBollaBinding;
|
||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.rest.dto.SitBollaAccettazioneDTO;
|
||||
@@ -182,33 +183,44 @@ public class MainAccettazioneBollaElencoFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private List<MainAccettazioneBolleElencoListModel> convertDataModelToListModel(List<TestataBollaAccettazioneDTO> dataList) {
|
||||
if(dataList == null)
|
||||
return null;
|
||||
boolean group = !SettingsManager.iDB().isFlagAccettazioneGroupListForn();
|
||||
if (dataList == null) return null;
|
||||
|
||||
Stream<TestataBollaAccettazioneDTO> stream = Stream.of(dataList);
|
||||
|
||||
if (group) {
|
||||
final Comparator<TestataBollaAccettazioneDTO> comparer = Comparator.comparing(TestataBollaAccettazioneDTO::getListino)
|
||||
.thenComparing(TestataBollaAccettazioneDTO::getRagSoc)
|
||||
.thenComparing(TestataBollaAccettazioneDTO::getNumDoc);
|
||||
stream = stream.sorted(comparer);
|
||||
} else {
|
||||
stream = stream.sortBy(x -> x.getRagSoc() + UtilityDate.formatDate(x.getDataDoc(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH));
|
||||
}
|
||||
|
||||
return Stream.of(dataList)
|
||||
.sorted(comparer)
|
||||
.map(x -> {
|
||||
return stream.map(x -> {
|
||||
MainAccettazioneBolleElencoListModel listModel = new MainAccettazioneBolleElencoListModel();
|
||||
|
||||
listModel.setOriginalModel(x);
|
||||
listModel.setGroupTitle(x.getListino() + " - " + x.getRagSoc());
|
||||
listModel.setDescription(String.format(getString(R.string.ord_acq_testata), x.getNumDoc(), UtilityDate.formatDate(x.getDataDoc(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)));
|
||||
|
||||
if (group)
|
||||
listModel.setGroupTitle(x.getListino() + " - " + x.getRagSoc());
|
||||
else
|
||||
listModel.setGroupTitle(x.getRagSoc());
|
||||
|
||||
listModel.setDescription(String.format(getString(R.string.ord_acq_testata),
|
||||
x.getNumDoc(),
|
||||
UtilityDate.formatDate(x.getDataDoc(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)));
|
||||
|
||||
if (group)
|
||||
listModel.setSubDescription(x.getDescrizioneListino());
|
||||
else
|
||||
listModel.setSubDescription(x.getListino() + " - " + x.getDescrizioneListino());
|
||||
|
||||
listModel.setRightDescription(x.getCodAnag());
|
||||
listModel.setRightSubDescription(x.getCodJcom());
|
||||
|
||||
return listModel;
|
||||
})
|
||||
.toList();
|
||||
}).toList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ public class SitBollaAccettazioneDTO {
|
||||
private BigDecimal qtaDaAccettare;
|
||||
private BigDecimal numCnfDaAccettare;
|
||||
|
||||
private boolean kit;
|
||||
private boolean componente;
|
||||
|
||||
public int getNumDoc() {
|
||||
return numDoc;
|
||||
}
|
||||
@@ -126,4 +129,20 @@ public class SitBollaAccettazioneDTO {
|
||||
this.numCnfDaAccettare = numCnfDaAccettare;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKit() {
|
||||
return kit;
|
||||
}
|
||||
|
||||
public void setKit(boolean kit) {
|
||||
this.kit = kit;
|
||||
}
|
||||
|
||||
public boolean isComponente() {
|
||||
return componente;
|
||||
}
|
||||
|
||||
public void setComponente(boolean componente) {
|
||||
this.componente = componente;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
@@ -464,6 +464,8 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
.findFirstOrElse(null)
|
||||
.isCanBeRecovered(),
|
||||
|
||||
false,
|
||||
|
||||
ReportManager.getReportNameLUFromGestione(GestioneEnum.ACQUISTO));
|
||||
|
||||
this.startActivityForResult(myIntent, PICK_UL_REQUEST);
|
||||
@@ -544,6 +546,16 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
this.mViewModel.deleteRow(mtbColr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestChangeMtbTcol(MtbColt mtbColt) {
|
||||
DialogInfoAggiuntiveLUView.newInstance(mtbColt, false, true, (note, mtbTcol) -> {
|
||||
onLoadingStarted();
|
||||
mViewModel.updateTipoUl(mtbTcol, this::onLoadingEnded);
|
||||
}, () -> {
|
||||
})
|
||||
.show(getSupportFragmentManager(), "dialog-note-aggiuntive");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBottomSheetLUClose() {
|
||||
this.mViewModel.closeLU();
|
||||
@@ -558,7 +570,7 @@ public class AccettazioneBollaPickingActivity extends BaseActivity implements Ac
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete) {
|
||||
public void onInfoAggiuntiveRequest(RunnableArgss<String, ObservableMtbTcol> onComplete) {
|
||||
DialogInfoAggiuntiveLUView.newInstance(onComplete, this::onLoadingEnded)
|
||||
.show(getSupportFragmentManager(), DialogInfoAggiuntiveLUView.class.getName());
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingL
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
@@ -338,8 +338,14 @@ public class AccettazioneBollaPickingViewModel {
|
||||
}
|
||||
|
||||
private void loadMatchedRows(List<PickingObjectDTO> matchedRows, MtbAart mtbAart, PickDataDTO pickDataDTO) {
|
||||
if (matchedRows == null || matchedRows.size() == 0) {
|
||||
if (matchedRows == null || matchedRows.isEmpty()) {
|
||||
this.mArticoloRESTConsumer.findIfIsKit(mtbAart, mtbAartFind -> {
|
||||
if (mtbAartFind == null){
|
||||
manageNoArtFound(mtbAart, pickDataDTO);
|
||||
} else {
|
||||
searchArtFromAnag(mtbAartFind, pickDataDTO, () -> {});
|
||||
}
|
||||
}, this::sendError);
|
||||
} else if (matchedRows.size() == 1) {
|
||||
this.manageDispatchBollaRow(matchedRows.get(0));
|
||||
} else {
|
||||
@@ -409,7 +415,7 @@ public class AccettazioneBollaPickingViewModel {
|
||||
});
|
||||
}
|
||||
|
||||
private void manageInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete) {
|
||||
private void manageInfoAggiuntiveRequest(RunnableArgss<String, ObservableMtbTcol> onComplete) {
|
||||
if (!SettingsManager.iDB().isFlagAccettazioneBollaAskTipoCollo()) {
|
||||
onComplete.run(null, null);
|
||||
return;
|
||||
@@ -544,10 +550,6 @@ public class AccettazioneBollaPickingViewModel {
|
||||
initialQtaCnf = qtaCnfDaPrelevare;
|
||||
initialQtaTot = qtaColDaPrelevare;
|
||||
|
||||
} else if (totalQtaDoc != null) {
|
||||
initialNumCnf = totalNumCnfDoc;
|
||||
initialQtaCnf = qtaCnfDoc;
|
||||
initialQtaTot = totalQtaDoc;
|
||||
} else {
|
||||
initialNumCnf = BigDecimal.ONE;
|
||||
initialQtaCnf = mtbAart.getQtaCnf();
|
||||
@@ -666,8 +668,8 @@ public class AccettazioneBollaPickingViewModel {
|
||||
.setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
|
||||
.setMtbAart(pickingObjectDTO.getMtbAart());
|
||||
|
||||
pickingObjectDTO.getWithdrawMtbColrs().add(insertedMtbColr);
|
||||
mCurrentMtbColt.getMtbColr().add(insertedMtbColr);
|
||||
pickingObjectDTO.getWithdrawMtbColrs().add(0, insertedMtbColr);
|
||||
mCurrentMtbColt.getMtbColr().add(0, insertedMtbColr);
|
||||
|
||||
//Chiamato removeListFilter perché cosi mi cancella tutti i dati di pick temporanei
|
||||
resetMatchedRows();
|
||||
@@ -892,6 +894,13 @@ public class AccettazioneBollaPickingViewModel {
|
||||
this.mPickingList.postValue(this.mPickingList.getValue());
|
||||
}
|
||||
|
||||
public void updateTipoUl(ObservableMtbTcol newTipoUL, Runnable onComplete) {
|
||||
mColliMagazzinoRESTConsumer.updateTipoUL(mCurrentMtbColt, newTipoUL.getCodTcol(), () -> {
|
||||
mCurrentMtbColt.setCodTcol(newTipoUL.getCodTcol());
|
||||
onComplete.run();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void addHistoryItem(@NonNull MtbColr mtbColr) {
|
||||
Optional<HistoryMtbAartDTO> optional = Stream.of(this.mHistoryUsedAarts)
|
||||
.filter(x -> (x.getCodMart() != null && x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart())) ||
|
||||
@@ -939,7 +948,7 @@ public class AccettazioneBollaPickingViewModel {
|
||||
if (this.mListener != null) this.mListener.onVersamentoAutomaticoULRequest(onComplete);
|
||||
}
|
||||
|
||||
private void sendOnInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete) {
|
||||
private void sendOnInfoAggiuntiveRequest(RunnableArgss<String, ObservableMtbTcol> onComplete) {
|
||||
if (this.mListener != null) this.mListener.onInfoAggiuntiveRequest(onComplete);
|
||||
}
|
||||
|
||||
@@ -1041,7 +1050,7 @@ public class AccettazioneBollaPickingViewModel {
|
||||
|
||||
void onVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete);
|
||||
|
||||
void onInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete);
|
||||
void onInfoAggiuntiveRequest(RunnableArgss<String, ObservableMtbTcol> onComplete);
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
|
||||
@@ -2,10 +2,12 @@ package it.integry.integrywmsnative.gest.accettazione_bolla_picking.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
@@ -15,7 +17,11 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.zhukic.sectionedrecyclerview.SectionedRecyclerViewAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||
@@ -62,10 +68,29 @@ public class AccettazioneBollaPickingListAdapter extends SectionedRecyclerViewAd
|
||||
this.mShowSecondaryUntMis = showSecondaryUntMis;
|
||||
|
||||
mutableDataSet.addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
||||
@RequiresApi(api = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
|
||||
@Override
|
||||
public void onChanged(ObservableList sender) {
|
||||
List<AccettazioneBollaPickingListModel> listaOrdinata = new ArrayList<>();
|
||||
if (!sender.isEmpty()) {
|
||||
listaOrdinata = new ArrayList<>(sender);
|
||||
|
||||
Collections.sort(listaOrdinata, (a, b) -> {
|
||||
|
||||
boolean condA = a.getQtaEvasa().floatValue() > 0;
|
||||
boolean condB = b.getQtaEvasa().floatValue() > 0;
|
||||
|
||||
if (condA && !condB) {
|
||||
return -1;
|
||||
} else if (!condA && condB) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
mDataset.clear();
|
||||
mDataset.addAll(sender);
|
||||
mDataset.addAll(listaOrdinata);
|
||||
notifyDataSetChanged();
|
||||
notifyDataChanged();
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||
import it.integry.integrywmsnative.core.rest.model.VersamentoAutomaticoULResponseDTO;
|
||||
@@ -714,6 +714,16 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
this.mViewModel.deleteRow(mtbColr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestChangeMtbTcol(MtbColt mtbColt) {
|
||||
DialogInfoAggiuntiveLUView.newInstance(mtbColt, false, true, (note, mtbTcol) -> {
|
||||
onLoadingStarted();
|
||||
mViewModel.updateTipoUl(mtbTcol, this::onLoadingEnded);
|
||||
}, () -> {
|
||||
})
|
||||
.show(getSupportFragmentManager(), "dialog-note-aggiuntive");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBottomSheetLUClose() {
|
||||
this.mViewModel.closeLU();
|
||||
@@ -725,7 +735,7 @@ public class AccettazioneOrdiniPickingActivity extends BaseActivity implements A
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete) {
|
||||
public void onInfoAggiuntiveRequest(RunnableArgss<String, ObservableMtbTcol> onComplete) {
|
||||
DialogInfoAggiuntiveLUView.newInstance(onComplete, this::onLoadingEnded).show(getSupportFragmentManager(), DialogInfoAggiuntiveLUView.class.getName());
|
||||
}
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@ import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingL
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.dto.AlreadyRegisteredUDCDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
@@ -878,6 +878,13 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
this.mPickingList.postValue(this.mPickingList.getValue());
|
||||
}
|
||||
|
||||
public void updateTipoUl(ObservableMtbTcol newTipoUL, Runnable onComplete) {
|
||||
mColliMagazzinoRESTConsumer.updateTipoUL(mCurrentMtbColt, newTipoUL.getCodTcol(), () -> {
|
||||
mCurrentMtbColt.setCodTcol(newTipoUL.getCodTcol());
|
||||
onComplete.run();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void addHistoryItem(@NonNull MtbColr mtbColr) {
|
||||
Optional<HistoryMtbAartDTO> optional = Stream.of(this.mHistoryUsedAarts)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(mtbColr.getCodMart()))
|
||||
@@ -931,7 +938,7 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
if (this.mListener != null) this.mListener.onVersamentoAutomaticoULRequest(onComplete);
|
||||
}
|
||||
|
||||
private void sendOnInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete) {
|
||||
private void sendOnInfoAggiuntiveRequest(RunnableArgss<String, ObservableMtbTcol> onComplete) {
|
||||
if (this.mListener != null) this.mListener.onInfoAggiuntiveRequest(onComplete);
|
||||
}
|
||||
|
||||
@@ -1031,7 +1038,7 @@ public class AccettazioneOrdiniPickingViewModel {
|
||||
|
||||
void onVersamentoAutomaticoULRequest(RunnableArgs<Boolean> onComplete);
|
||||
|
||||
void onInfoAggiuntiveRequest(RunnableArgss<String, MtbTCol> onComplete);
|
||||
void onInfoAggiuntiveRequest(RunnableArgss<String, ObservableMtbTcol> onComplete);
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.gest.contab_doc_interni.dialog;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -36,7 +37,8 @@ public class DialogSelectDocInfoViewModel extends ViewModel {
|
||||
private final MutableLiveData<Boolean> noteRequired = new MutableLiveData<>(false);
|
||||
|
||||
public DialogSelectDocInfoViewModel() {
|
||||
List<String> requestNumDocList = Arrays.asList(SettingsManager.iDB().getDocInterniRequestNumDoc().split("\\|"));
|
||||
String docInterniRequestNumDoc = SettingsManager.iDB().getDocInterniRequestNumDoc();
|
||||
List<String> requestNumDocList = docInterniRequestNumDoc != null ? Arrays.asList(docInterniRequestNumDoc.split("\\|")) : new ArrayList<>();
|
||||
|
||||
tipoDoc.observeForever(val -> fornitoreRequired.postValue(val != null && (val.getGestioneDoc().equals("T") || val.getGestioneDoc().equals("A") || (val.getGestioneDoc().equals("P") && !val.getGestione().equals("L")))));
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ public class ListaBancaliActivity extends BaseActivity implements ListaBancaliVi
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
mViewModel.setListener(this);
|
||||
|
||||
mCanRecoverUl = DataCache.retrieveItem(getIntent().getStringExtra(Key.CanRecoverUL));
|
||||
mReportName = DataCache.retrieveItem(getIntent().getStringExtra(Key.ReportName));
|
||||
|
||||
@@ -41,6 +41,7 @@ import it.integry.integrywmsnative.core.interfaces.ISearchableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.update.UpdatesManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityContext;
|
||||
@@ -69,6 +70,9 @@ public class MainActivity extends BaseActivity
|
||||
@Inject
|
||||
UpdatesManager updatesManager;
|
||||
|
||||
@Inject
|
||||
SystemRESTConsumer systemRESTConsumer;
|
||||
|
||||
@Inject
|
||||
DialogProgressView mDialogProgressView;
|
||||
|
||||
@@ -85,7 +89,7 @@ public class MainActivity extends BaseActivity
|
||||
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_main, null, false);
|
||||
setContentView(mBinding.getRoot());
|
||||
|
||||
updatesManager.init(this);
|
||||
updatesManager.init(this, systemRESTConsumer);
|
||||
UtilityContext.initMainActivity(this);
|
||||
|
||||
setSupportActionBar(mBinding.appBarMain.toolbar);
|
||||
|
||||
@@ -41,6 +41,7 @@ import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
@@ -51,6 +52,7 @@ import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainBinding;
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainMenuGroupLayoutBinding;
|
||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
import it.integry.integrywmsnative.view.dialogs.switch_user_depo.DialogSwitchUserDepoView;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
@@ -153,6 +155,8 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
initSessionData();
|
||||
|
||||
initRecuperoCollo();
|
||||
|
||||
mBindings.switchDepoButton.setVisibility(SettingsManager.iDB().getAvailableCodMdep().size() > 1 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void initSessionData() {
|
||||
@@ -278,8 +282,8 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
|
||||
private void initGestMenu() {
|
||||
int menuSpanCount = 2;
|
||||
if (UtilityDimension.getDisplayInchs(this.getActivity()) > 8) menuSpanCount = 4;
|
||||
else if (UtilityDimension.getDisplayInchs(this.getActivity()) > 6.5) menuSpanCount = 3;
|
||||
if (UtilityDimension.getDisplayInchs(this.requireActivity()) > 8) menuSpanCount = 4;
|
||||
else if (UtilityDimension.getDisplayInchs(this.requireActivity()) > 6.5) menuSpanCount = 3;
|
||||
|
||||
MenuConfiguration baseMenuConfiguration = new MenuConfiguration();
|
||||
List<MenuConfiguration.MenuGroup> menuGroups = baseMenuConfiguration.getGroups();
|
||||
@@ -319,7 +323,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
|
||||
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
UtilityExceptions.defaultException(requireActivity(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,4 +425,14 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
colorFadeTitleTextColor.setDuration(animationTimeMillis);
|
||||
colorFadeTitleTextColor.start();
|
||||
}
|
||||
|
||||
public void changeUserDepo() {
|
||||
DialogSwitchUserDepoView.newInstance(SettingsManager.iDB().getAvailableCodMdep(), this::onUserDepoChanged)
|
||||
.show(getParentFragmentManager(), "switch-user-depo");
|
||||
}
|
||||
|
||||
private void onUserDepoChanged(AvailableCodMdepsDTO newDepo) {
|
||||
SettingsManager.i().getUserSession().setDepo(newDepo);
|
||||
initSessionData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import android.view.ViewGroup;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
@@ -60,7 +59,6 @@ import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterAutom
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterClienteLayoutView;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterDepositoLayoutView;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterGruppoMercLayoutView;
|
||||
import it.integry.integrywmsnative.ui.filter_chips.filters.FilterNumeroOrdineLayoutView;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterPaeseLayoutView;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterTermConsLayoutView;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterVettoreLayoutView;
|
||||
@@ -74,6 +72,7 @@ import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.BaseDialogRo
|
||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
||||
import it.integry.integrywmsnative.ui.filter_chips.FilterChipView;
|
||||
import it.integry.integrywmsnative.ui.filter_chips.filters.FilterNumeroOrdineLayoutView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
|
||||
public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledFragment, IScrollableFragment, ISelectAllFragment, OrdiniUscitaElencoViewModel.Listener {
|
||||
@@ -150,7 +149,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_main_ordini_uscita, container, false);
|
||||
mBindings = FragmentMainOrdiniUscitaBinding.inflate(inflater, container, false);
|
||||
|
||||
MainApplication.appComponent
|
||||
.prodOrdineLavorazioneElencoComponent()
|
||||
|
||||
@@ -33,7 +33,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
@@ -50,11 +50,12 @@ import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGExcep
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentView;
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_should_print.DialogAskShouldPrint;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLUView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
import it.integry.integrywmsnative.view.dialogs.yes_no.DialogYesNoView;
|
||||
|
||||
public class PickingResiActivity extends BaseActivity implements BottomSheetFragmentLUContentView.Listener, BottomSheetFragmentLUContentViewModel.Listener, PickingResiViewModel.Listener {
|
||||
|
||||
@@ -269,13 +270,23 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
this.mViewmodel.deleteRow(mtbColr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestChangeMtbTcol(MtbColt mtbColt) {
|
||||
DialogInfoAggiuntiveLUView.newInstance(mtbColt, false, true, (note, mtbTcol) -> {
|
||||
onLoadingStarted();
|
||||
mViewmodel.updateTipoUl(mtbTcol, this::onLoadingEnded);
|
||||
}, () -> {
|
||||
})
|
||||
.show(getSupportFragmentManager(), "dialog-note-aggiuntive");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBottomSheetLUClose() {
|
||||
this.mViewmodel.closeLU(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInfoAggiuntiveRequired(RunnableArgss<String, MtbTCol> onComplete) {
|
||||
public void onInfoAggiuntiveRequired(RunnableArgss<String, ObservableMtbTcol> onComplete) {
|
||||
DialogInfoAggiuntiveLUView.newInstance(onComplete, this::onLoadingEnded)
|
||||
.show(getSupportFragmentManager(), DialogInfoAggiuntiveLUView.class.getName());
|
||||
}
|
||||
@@ -392,14 +403,18 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
@Override
|
||||
public void onLUPrintRequest(RunnableArgs<Boolean> onComplete) {
|
||||
DialogAskShouldPrint.make(this, "Packing List", onComplete).show();
|
||||
DialogYesNoView.newInstance(getString(R.string.action_print),
|
||||
String.format(getString(R.string.message_print_packing_list), "Packing List"),
|
||||
result -> {
|
||||
onComplete.run(result == DialogConsts.Results.YES);
|
||||
})
|
||||
.show(getSupportFragmentManager(), "dialog-print");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||
this.onLoadingEnded();
|
||||
DialogSimpleMessageView.makeErrorDialog(
|
||||
new SpannableString(ex.getMessage()),
|
||||
DialogSimpleMessageView.makeErrorDialog(new SpannableString(ex.getMessage()),
|
||||
null,
|
||||
null,
|
||||
R.string.button_ignore_print,
|
||||
|
||||
@@ -28,8 +28,8 @@ import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
@@ -716,6 +716,13 @@ public class PickingResiViewModel {
|
||||
});
|
||||
}
|
||||
|
||||
public void updateTipoUl(ObservableMtbTcol newTipoUL, Runnable onComplete) {
|
||||
mColliMagazzinoRESTConsumer.updateTipoUL(mCurrentMtbColt, newTipoUL.getCodTcol(), () -> {
|
||||
mCurrentMtbColt.setCodTcol(newTipoUL.getCodTcol());
|
||||
onComplete.run();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
public void resetMatchedRows() {
|
||||
for (WithdrawableDtbDocr pickingObjectDTO : this.mPickingList.getValue()) {
|
||||
pickingObjectDTO
|
||||
@@ -732,7 +739,7 @@ public class PickingResiViewModel {
|
||||
return mPickingList;
|
||||
}
|
||||
|
||||
private void sendOnInfoAggiuntiveRequired(RunnableArgss<String, MtbTCol> onComplete) {
|
||||
private void sendOnInfoAggiuntiveRequired(RunnableArgss<String, ObservableMtbTcol> onComplete) {
|
||||
if (this.mListener != null) this.mListener.onInfoAggiuntiveRequired(onComplete);
|
||||
}
|
||||
|
||||
@@ -808,9 +815,10 @@ public class PickingResiViewModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public interface Listener extends ILUPrintListener, ILoadingListener, ILUBaseOperationsListener {
|
||||
|
||||
void onInfoAggiuntiveRequired(RunnableArgss<String, MtbTCol> onComplete);
|
||||
void onInfoAggiuntiveRequired(RunnableArgss<String, ObservableMtbTcol> onComplete);
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
|
||||
@@ -195,6 +195,9 @@ public class ProdRecuperoMaterialeViewModel {
|
||||
mtbColtScarico.getMtbColr().add(mtbColrScarico);
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
|
||||
BigDecimal qtaColToSave;
|
||||
BigDecimal numCnfToSave;
|
||||
if (SettingsManager.iDB().isFlagForceAllToColli() || (item.getMtbAart() != null && !item.getMtbAart().isFlagQtaCnfFissaBoolean())) {
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ProdRecuperMaterialeRESTConsumer extends _BaseRESTConsumer {
|
||||
" dtb_ord_steps.hr_num as hr, " +
|
||||
" mtb_colr.riga_ord, " +
|
||||
" CONVERT(INTEGER, ROUND((CAST(dtb_ord_steps.hr_num AS DECIMAL(20, 5)) / " +
|
||||
" SUM(dtb_ord_steps.hr_num) OVER (PARTITION BY mtb_colr.num_collo)) * 100, " +
|
||||
" SUM(CASE WHEN dtb_ord_steps.hr_num > 0 then dtb_ord_steps.hr_num else 1 end) OVER (PARTITION BY mtb_colr.num_collo)) * 100, " +
|
||||
" 0)) as percentage_hr " +
|
||||
" FROM mtb_colr " +
|
||||
" INNER JOIN mtb_colt ON mtb_colr.num_collo = mtb_colt.num_collo " +
|
||||
|
||||
@@ -3,7 +3,7 @@ package it.integry.integrywmsnative.gest.prod_rientro_merce.order_detail;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.JtbFasi;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
|
||||
public class ProdRientroMerceOrderDetailPickedQuantityDTO {
|
||||
|
||||
@@ -14,7 +14,7 @@ public class ProdRientroMerceOrderDetailPickedQuantityDTO {
|
||||
private BigDecimal taraCol;
|
||||
private BigDecimal pesoLordo;
|
||||
|
||||
private MtbTCol mtbTCol;
|
||||
private ObservableMtbTcol mtbTCol;
|
||||
private JtbFasi jtbFasi;
|
||||
|
||||
public BigDecimal getNumCnf() {
|
||||
@@ -71,11 +71,11 @@ public class ProdRientroMerceOrderDetailPickedQuantityDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbTCol getMtbTCol() {
|
||||
public ObservableMtbTcol getMtbTCol() {
|
||||
return mtbTCol;
|
||||
}
|
||||
|
||||
public ProdRientroMerceOrderDetailPickedQuantityDTO setMtbTCol(MtbTCol mtbTCol) {
|
||||
public ProdRientroMerceOrderDetailPickedQuantityDTO setMtbTCol(ObservableMtbTcol mtbTCol) {
|
||||
this.mtbTCol = mtbTCol;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ public class ProdRiposizionamentoDaProdViewModel {
|
||||
this.sendError(new ScannedPositionNotExistException());
|
||||
} else {
|
||||
if (mtbColt != null) {
|
||||
mColliMagazzinoRESTConsumer.changePosizione(mtbColt, mtbDepoPosizione, () -> {
|
||||
mColliMagazzinoRESTConsumer.spostaUL(mtbColt, mtbDepoPosizione, () -> {
|
||||
List<MvwSitArtUdcDetInventario> mvwSitArtUdcDetInventarioList = mMvwSitArtUdcDetInventarioLiveData.getValue();
|
||||
|
||||
if (mvwSitArtUdcDetInventarioList != null) {
|
||||
|
||||
@@ -97,7 +97,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
||||
}
|
||||
String testataOrdString = String.format(this.getString(R.string.ord_acq_testata), ordine.getOrdineId(), UtilityDate.formatDate(ordine.getDataIns(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN));
|
||||
mBinding.orderIdentifier.setText(Html.fromHtml(testataOrdString));
|
||||
FabMenuCustomAnimations.changeIconOnFocus(mBinding.closeActivityFab, R.drawable.ic_check_white_24dp, R.drawable.ic_close_24dp);
|
||||
FabMenuCustomAnimations.changeIconOnFocus(mBinding.closeActivityFab, R.drawable.ic_round_check_24, R.drawable.ic_close_24dp);
|
||||
|
||||
|
||||
initBarcodeReader();
|
||||
|
||||
@@ -15,8 +15,6 @@ import android.view.inputmethod.EditorInfo;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
@@ -63,6 +61,7 @@ import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLUView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArtsView;
|
||||
import it.integry.integrywmsnative.view.dialogs.create_new_art.DialogCreateNewArtView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUView;
|
||||
@@ -142,7 +141,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
setRetainInstance(true);
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_main_rettifica_giacenze, container, false);
|
||||
mBinding = FragmentMainRettificaGiacenzeBinding.inflate(inflater, container, false);
|
||||
|
||||
|
||||
mBinding.setLifecycleOwner(this);
|
||||
@@ -205,14 +204,17 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
|
||||
private void init() {
|
||||
mBinding.autoCompleteFornitori.setOnFocusChangeListener((v, hasFocus) -> {
|
||||
if (hasFocus)
|
||||
setUIToForn();
|
||||
});
|
||||
|
||||
mBinding.inputCodArtDescrForn.setOnFocusChangeListener((v, hasFocus) -> {
|
||||
if (hasFocus)
|
||||
setUIToForn();
|
||||
});
|
||||
|
||||
mBinding.inputCodArtDescrInt.setOnFocusChangeListener((v, hasFocus) -> {
|
||||
if (hasFocus)
|
||||
setUIToIntArt();
|
||||
});
|
||||
|
||||
@@ -238,23 +240,30 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
|
||||
public void setUIToForn() {
|
||||
mBinding.rettificaGiacenzeFornCheckBox.setChecked(true);
|
||||
mBinding.rettificaGiacenzeFornLayout.setBackground(ResourcesCompat.getDrawable(getActivity().getResources(), R.drawable.circular_background_left, null));
|
||||
mBinding.rettificaGiacenzeFornLayout.setBackgroundTintList(ColorStateList.valueOf(getActivity().getResources().getColor(R.color.alpha_blue_500)));
|
||||
|
||||
mBinding.rettificaGiacenzeArtIntCheckBox.setChecked(false);
|
||||
mBinding.rettificaGiacenzeArtIntLayout.setBackground(null);
|
||||
mBinding.rettificaGiacenzeArtIntLayout.setBackgroundTintList(null);
|
||||
|
||||
mBinding.inputCodArtDescrInt.clearFocus();
|
||||
|
||||
if (!mBinding.inputCodArtDescrForn.hasFocus() && !mBinding.autoCompleteFornitori.hasFocus()) {
|
||||
mBinding.inputCodArtDescrForn.clearFocus();
|
||||
mBinding.autoCompleteFornitori.requestFocusFromTouch();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setUIToIntArt() {
|
||||
mBinding.rettificaGiacenzeArtIntCheckBox.setChecked(true);
|
||||
mBinding.rettificaGiacenzeArtIntLayout.setBackground(ResourcesCompat.getDrawable(getActivity().getResources(), R.drawable.circular_background_left, null));
|
||||
mBinding.rettificaGiacenzeArtIntLayout.setBackgroundTintList(ColorStateList.valueOf(getActivity().getResources().getColor(R.color.alpha_blue_500)));
|
||||
|
||||
mBinding.rettificaGiacenzeFornCheckBox.setChecked(false);
|
||||
mBinding.rettificaGiacenzeFornLayout.setBackground(null);
|
||||
mBinding.rettificaGiacenzeFornLayout.setBackgroundTintList(null);
|
||||
|
||||
mBinding.inputCodArtDescrForn.clearFocus();
|
||||
mBinding.autoCompleteFornitori.clearFocus();
|
||||
mBinding.inputCodArtDescrInt.requestFocusFromTouch();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -295,13 +304,22 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
return true;
|
||||
}
|
||||
|
||||
mViewModel.searchArtInt(mBinding.inputCodArtDescrInt.getText().toString(), null);
|
||||
mViewModel.searchArtInt(mBinding.inputCodArtDescrInt.getText().toString(), null, null);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestNewArtCreation(String description, BarcodeScanDTO barcode) {
|
||||
DialogCreateNewArtView.newInstance(description, barcode, currentMtbColtObs.get().getPosizione(),
|
||||
createdCodMart -> {
|
||||
mViewModel.searchArtInt(createdCodMart, null, null);
|
||||
})
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArtListLoaded(ArrayList<MtbAart> artList, RunnableArgs<MtbAart> onArtChoosed) {
|
||||
new DialogChooseArtFromListaArtsView(true, artList, onArtChoosed)
|
||||
@@ -418,7 +436,8 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
})
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}, () -> {});
|
||||
}, () -> {
|
||||
});
|
||||
}
|
||||
|
||||
private void checkIfItemIsActive(String flagStato, String codMart, Runnable onContinue, Runnable onNegativeClick) {
|
||||
|
||||
@@ -111,7 +111,10 @@ public class RettificaGiacenzeViewModel {
|
||||
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
if(UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
||||
//Not implemented now
|
||||
onComplete.run();
|
||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
//Cerco tramite etichetta ean 128 (che può indicarmi un articolo o una UL)
|
||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||
|
||||
@@ -120,7 +123,7 @@ public class RettificaGiacenzeViewModel {
|
||||
this.executeEtichettaEanPeso(barcodeScanDTO, onComplete);
|
||||
|
||||
} else if (UtilityBarcode.isEtichettaArt(barcodeScanDTO)) {
|
||||
this.searchArtInt(barcodeScanDTO.getStringValue(), onComplete);
|
||||
this.searchArtInt(null, barcodeScanDTO, onComplete);
|
||||
|
||||
} else {
|
||||
onComplete.run();
|
||||
@@ -145,9 +148,9 @@ public class RettificaGiacenzeViewModel {
|
||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
|
||||
PickDataDTO pickDataDTO = PickDataDTO.fromEan128(ean128Model);
|
||||
this.loadArticolo(barcodeProd, pickDataDTO, onComplete);
|
||||
this.loadArticolo(barcodeProd, pickDataDTO, barcodeScanDTO, onComplete);
|
||||
} else if (!UtilityString.isNullOrEmpty(codMart)) {
|
||||
this.searchArtInt(codMart, onComplete);
|
||||
this.searchArtInt(codMart, barcodeScanDTO, onComplete);
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
onComplete.run();
|
||||
@@ -158,18 +161,18 @@ public class RettificaGiacenzeViewModel {
|
||||
private void executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
try {
|
||||
Ean13PesoModel ean13PesoModel = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
|
||||
this.loadArticolo(ean13PesoModel.getPrecode(), PickDataDTO.fromEan128(ean13PesoModel.toEan128()), onComplete);
|
||||
this.loadArticolo(ean13PesoModel.getPrecode(), PickDataDTO.fromEan128(ean13PesoModel.toEan128()), barcodeScanDTO, onComplete);
|
||||
} catch (Exception ex) {
|
||||
this.sendError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) {
|
||||
private void loadArticolo(String barcodeProd, PickDataDTO pickData, BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
this.mArticoloRESTConsumer.searchByBarcode(barcodeProd, mtbAartList -> {
|
||||
if (onComplete != null) onComplete.run();
|
||||
|
||||
if (mtbAartList != null && !mtbAartList.isEmpty()) {
|
||||
this.dispatchArts(mtbAartList, pickData);
|
||||
this.dispatchArts(mtbAartList, pickData, null, barcodeScanDTO);
|
||||
} else {
|
||||
this.sendError(new NoResultFromBarcodeException(barcodeProd));
|
||||
}
|
||||
@@ -190,24 +193,28 @@ public class RettificaGiacenzeViewModel {
|
||||
.map(x -> (MtbAart) x.getMtbAart())
|
||||
.toList();
|
||||
|
||||
dispatchArts(mtbAarts, null);
|
||||
dispatchArts(mtbAarts, null, queryText, null);
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
public void searchArtInt(String queryText, Runnable onComplete) {
|
||||
public void searchArtInt(String queryText, BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
mRettificaGiacenzeRESTConsumer.searchArtInt(queryText, listaArts -> {
|
||||
String barcode = barcodeScanDTO != null ? barcodeScanDTO.getStringValue() : null;
|
||||
mRettificaGiacenzeRESTConsumer.searchArtInt(UtilityString.isNull(queryText, barcode), listaArts -> {
|
||||
this.sendOnLoadingEnded();
|
||||
|
||||
dispatchArts(listaArts, null);
|
||||
dispatchArts(listaArts, null, queryText, barcodeScanDTO);
|
||||
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void dispatchArts(List<MtbAart> artsList, PickDataDTO pickData) {
|
||||
if (artsList == null || artsList.size() == 0) {
|
||||
private void dispatchArts(List<MtbAart> artsList, PickDataDTO pickData, String description, BarcodeScanDTO barcodeProd) {
|
||||
if (artsList == null || artsList.isEmpty()) {
|
||||
if(SettingsManager.iDB().isFlagEnableArtCreation())
|
||||
this.sendRequestNewArtCreation(description, barcodeProd);
|
||||
else
|
||||
this.sendError(new NoArtsFoundException());
|
||||
return;
|
||||
}
|
||||
@@ -556,8 +563,6 @@ public class RettificaGiacenzeViewModel {
|
||||
private void saveEditedRow(MtbColr mtbColrToUpdate, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
// if(!mIsCreatedLU && mCurrentMtbColt.isDocumentPresent()) {
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.creaRettificaCollo(
|
||||
mtbColrToUpdate,
|
||||
numCnf,
|
||||
@@ -579,47 +584,6 @@ public class RettificaGiacenzeViewModel {
|
||||
},
|
||||
this::sendError
|
||||
);
|
||||
|
||||
// } else {
|
||||
//
|
||||
// MtbColt mtbColt = new MtbColt()
|
||||
// .setNumCollo(mtbColrToUpdate.getNumCollo())
|
||||
// .setDataCollo(mtbColrToUpdate.getDataColloS())
|
||||
// .setSerCollo(mtbColrToUpdate.getSerCollo())
|
||||
// .setGestione(mtbColrToUpdate.getGestione())
|
||||
// .setMtbColr(new ObservableArrayList<>());
|
||||
// mtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
|
||||
//
|
||||
// final MtbColr mtbColr = (MtbColr) mtbColrToUpdate.clone();
|
||||
// mtbColr
|
||||
// .setNumCnf(numCnf.subtract(mtbColr.getNumCnf()))
|
||||
// .setQtaCnf(qtaCnf)
|
||||
// .setQtaCol(qtaTot.subtract(mtbColr.getQtaCol()))
|
||||
// .setPartitaMag(partitaMag)
|
||||
// .setDataScadPartita(dataScad)
|
||||
// .setUtente(SettingsManager.i().getUser().getFullname())
|
||||
// .setCausale(MtbColr.Causale.RETTIFICA)
|
||||
// .setDatetimeRow(UtilityDate.getDateInstance())
|
||||
// .setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||
//
|
||||
// mtbColt.getMtbColr().add(mtbColr);
|
||||
//
|
||||
// this.mColliMagazzinoRESTConsumer.saveCollo(mtbColt, (value) -> {
|
||||
//
|
||||
// mtbColr.setNumCnf(numCnf)
|
||||
// .setQtaCnf(qtaCnf)
|
||||
// .setQtaCol(qtaTot);
|
||||
//
|
||||
// this.mCurrentMtbColt.getMtbColr().remove(mtbColrToUpdate);
|
||||
// this.mCurrentMtbColt.getMtbColr().add(mtbColr);
|
||||
//
|
||||
// this.mAnyEditDone = true;
|
||||
//
|
||||
// this.sendOnRowSaved();
|
||||
// this.sendOnLoadingEnded();
|
||||
//
|
||||
// }, this::sendError);
|
||||
// }
|
||||
}
|
||||
|
||||
public void deleteRow(MtbColr mtbColrToDelete) {
|
||||
@@ -627,7 +591,6 @@ public class RettificaGiacenzeViewModel {
|
||||
if (shouldDelete) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
// if(!mIsCreatedLU && mCurrentMtbColt.isDocumentPresent()) {
|
||||
this.mColliMagazzinoRESTConsumer.creaRettificaCollo(
|
||||
mtbColrToDelete,
|
||||
BigDecimal.ZERO,
|
||||
@@ -639,37 +602,6 @@ public class RettificaGiacenzeViewModel {
|
||||
},
|
||||
this::sendError
|
||||
);
|
||||
// } else {
|
||||
// MtbColt mtbColt = new MtbColt()
|
||||
// .setNumCollo(mtbColrToDelete.getNumCollo())
|
||||
// .setDataCollo(mtbColrToDelete.getDataColloS())
|
||||
// .setSerCollo(mtbColrToDelete.getSerCollo())
|
||||
// .setGestione(mtbColrToDelete.getGestione())
|
||||
// .setMtbColr(new ObservableArrayList<>());
|
||||
// mtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
|
||||
//
|
||||
// MtbColr mtbColr = (MtbColr) mtbColrToDelete.clone();
|
||||
// mtbColr
|
||||
// .setNumCnf(mtbColr.getNumCnf().multiply(new BigDecimal(-1)))
|
||||
// .setQtaCnf(mtbColr.getQtaCnf())
|
||||
// .setQtaCol(mtbColr.getQtaCol().multiply(new BigDecimal(-1)))
|
||||
// .setPartitaMag(mtbColr.getPartitaMag())
|
||||
// .setDataScadPartita(mtbColr.getDataScadPartitaD())
|
||||
// .setUtente(SettingsManager.i().getUser().getFullname())
|
||||
// .setCausale(MtbColr.Causale.RETTIFICA)
|
||||
// .setDatetimeRow(UtilityDate.getDateInstance())
|
||||
// .setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||
//
|
||||
// mtbColt.getMtbColr().add(mtbColr);
|
||||
//
|
||||
// this.mColliMagazzinoRESTConsumer.saveCollo(mtbColt, (value) -> {
|
||||
// this.mCurrentMtbColt.getMtbColr().remove(mtbColrToDelete);
|
||||
//
|
||||
// this.sendOnRowSaved();
|
||||
// this.sendOnLoadingEnded();
|
||||
//
|
||||
// }, this::sendError);
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -686,6 +618,10 @@ public class RettificaGiacenzeViewModel {
|
||||
if (this.mListener != null) mListener.onFornitoriLoaded(fornitoriList);
|
||||
}
|
||||
|
||||
private void sendRequestNewArtCreation(String description, BarcodeScanDTO barcode) {
|
||||
if(this.mListener != null) mListener.onRequestNewArtCreation(description, barcode);
|
||||
}
|
||||
|
||||
|
||||
private void sendOnArtListLoaded(ArrayList<MtbAart> artList, RunnableArgs<MtbAart> onArtChoosed) {
|
||||
if (this.mListener != null) mListener.onArtListLoaded(artList, onArtChoosed);
|
||||
@@ -777,6 +713,8 @@ public class RettificaGiacenzeViewModel {
|
||||
|
||||
void onFornitoriLoaded(ArrayList<FornitoreDTO> fornitoriList);
|
||||
|
||||
void onRequestNewArtCreation(String description, BarcodeScanDTO barcode);
|
||||
|
||||
void onArtListLoaded(ArrayList<MtbAart> artList, RunnableArgs<MtbAart> onArtChoosed);
|
||||
|
||||
void onLUOpenRequest(boolean enableCreation, boolean checkIfDocumentExists, boolean warnOnOpeningVendita, RunnableArgss<MtbColt, Boolean> onComplete);
|
||||
|
||||
@@ -44,7 +44,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||
@@ -70,7 +70,6 @@ import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFrag
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLUView;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_should_print.DialogAskShouldPrint;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_vettore.DialogAskVettoreView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
@@ -81,7 +80,6 @@ import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAgg
|
||||
import it.integry.integrywmsnative.view.dialogs.input_peso_lu.DialogInputPesoLUView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.exception.OverflowQtaTotOrderedQuantityException;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArtView;
|
||||
import it.integry.integrywmsnative.view.dialogs.tracciamento_imballi.DialogTracciamentoImballiView;
|
||||
import it.integry.integrywmsnative.view.dialogs.yes_no.DialogYesNoView;
|
||||
@@ -818,7 +816,12 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
|
||||
@Override
|
||||
public void onLUPrintRequest(RunnableArgs<Boolean> onComplete) {
|
||||
DialogAskShouldPrint.make(this, "Packing List", onComplete).show();
|
||||
DialogYesNoView.newInstance(getString(R.string.action_print),
|
||||
String.format(getString(R.string.message_print_packing_list), "Packing List"),
|
||||
result -> {
|
||||
onComplete.run(result == DialogConsts.Results.YES);
|
||||
})
|
||||
.show(getSupportFragmentManager(), "dialog-print");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1046,6 +1049,16 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestChangeMtbTcol(MtbColt mtbColt) {
|
||||
DialogInfoAggiuntiveLUView.newInstance(mtbColt, false, true, (note, mtbTcol) -> {
|
||||
onLoadingStarted();
|
||||
mViewmodel.updateTipoUl(mtbTcol, this::onLoadingEnded);
|
||||
}, () -> {
|
||||
})
|
||||
.show(getSupportFragmentManager(), "dialog-note-aggiuntive");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBottomSheetLUClose() {
|
||||
this.mViewmodel.requestCloseLU(true);
|
||||
@@ -1078,8 +1091,8 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInfoAggiuntiveRequired(MtbColt mtbColt, RunnableArgss<String, MtbTCol> onComplete) {
|
||||
DialogInfoAggiuntiveLUView.newInstance(mtbColt, onComplete, this::onLoadingEnded)
|
||||
public void onInfoAggiuntiveRequired(MtbColt mtbColt, RunnableArgss<String, ObservableMtbTcol> onComplete) {
|
||||
DialogInfoAggiuntiveLUView.newInstance(mtbColt, true, true, onComplete, this::onLoadingEnded)
|
||||
.show(getSupportFragmentManager(), DialogInfoAggiuntiveLUView.class.getName());
|
||||
}
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MtbPartitaMag;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.VtbVett;
|
||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||
import it.integry.integrywmsnative.core.model.dto.StatoArticoloDTO;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
@@ -855,7 +855,7 @@ public class SpedizioneViewModel {
|
||||
|
||||
|
||||
private void loadMatchedRows(List<PickingObjectDTO> matchedRows) {
|
||||
if (matchedRows == null || matchedRows.size() == 0) {
|
||||
if (matchedRows == null || matchedRows.isEmpty()) {
|
||||
this.sendError(new NoArtsFoundException());
|
||||
} else if (matchedRows.size() == 1) {
|
||||
PickingObjectDTO matchedItem = matchedRows.get(0);
|
||||
@@ -898,9 +898,6 @@ public class SpedizioneViewModel {
|
||||
|
||||
public void dispatchOrdineRow(final PickingObjectDTO pickingObjectDTO, MtbColt refMtbColt, MtbColr refMtbColr, boolean canPartitaMagBeChanged) {
|
||||
|
||||
//TODO: Al posto di prelevare la prima riga bisognerebbe controllare se c'è ne una che corrisponde con la partita richiesta
|
||||
// MtbColr refMtbColr = refMtbColt != null ? refMtbColt.getMtbColr().get(0) : null;
|
||||
|
||||
|
||||
if (pickingObjectDTO.getTempPickData() != null && pickingObjectDTO.getTempPickData().getSourceMtbColt() != null && pickingObjectDTO.getTempPickData().getSourceMtbColt().getMtbColr() != null) {
|
||||
|
||||
@@ -942,7 +939,7 @@ public class SpedizioneViewModel {
|
||||
if (availableBatchLots.stream().anyMatch(x -> x.getDataScad() == null)) {
|
||||
tmp.addAll(availableBatchLots.stream()
|
||||
.filter(x -> x.getDataScad() == null)
|
||||
.sorted(Comparator.comparing(MtbPartitaMag::getPartitaMag))
|
||||
.sorted(Comparator.comparing(x -> UtilityString.isNull(x.getPartitaMag(), "")))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@@ -1100,8 +1097,12 @@ public class SpedizioneViewModel {
|
||||
BigDecimal initialQtaTot = mUseColliPedana ? initialNumCnf.multiply(initialQtaCnf) : mUseQtaOrd ? qtaColDaPrelevare : null;
|
||||
|
||||
MtbColt finalRefMtbColt = refMtbColt;
|
||||
|
||||
this.onItemDispatched(pickingObjectDTO, pickingObjectDTO.getMtbAart(), initialNumCnf, initialQtaCnf, initialQtaTot, qtaDaEvadere, numCnfDaEvadere, qtaCnfDaEvadere, qtaColDaPrelevare, numCnfDaPrelevare, qtaCnfDaPrelevare, totalQtaAvailable, totalNumCnfAvailable, qtaCnfAvailable, partitaMag, dataScad, mCanOverflowOrderQuantity, canPartitaMagBeChanged, (pickedQuantityDTO, shouldCloseLU) -> {
|
||||
|
||||
this.saveNewRow(pickingObjectDTO, finalRefMtbColt, pickedQuantityDTO.getNumCnf(), pickedQuantityDTO.getQtaCnf(), pickedQuantityDTO.getQtaTot(), pickedQuantityDTO.getPartitaMag(), pickedQuantityDTO.getDataScad(), shouldCloseLU);
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1430,7 +1431,9 @@ public class SpedizioneViewModel {
|
||||
insertUDSRowRequestDto
|
||||
.setDataScad(dataScad);
|
||||
|
||||
this.mColliScaricoRESTConsumer.insertUDSRow(insertUDSRowRequestDto, createdMtbColr -> {
|
||||
executeDepositChangeIfNeeded(refMtbColt,
|
||||
() -> executeTipoUlChangeIfNeeded(refMtbColt,
|
||||
() -> this.mColliScaricoRESTConsumer.insertUDSRow(insertUDSRowRequestDto, createdMtbColr -> {
|
||||
pickingObjectDTO.getWithdrawMtbColrs().add(createdMtbColr);
|
||||
this.mCurrentMtbColt.getMtbColr().add(createdMtbColr);
|
||||
|
||||
@@ -1448,7 +1451,7 @@ public class SpedizioneViewModel {
|
||||
|
||||
if (refMtbColt != null) {
|
||||
|
||||
MtbColr originalRefMtbColr = refMtbColt.getMtbColr() != null && refMtbColt.getMtbColr().size() > 0 ? refMtbColt.getMtbColr().get(0) : null;
|
||||
MtbColr originalRefMtbColr = refMtbColt.getMtbColr() != null && !refMtbColt.getMtbColr().isEmpty() ? refMtbColt.getMtbColr().get(0) : null;
|
||||
|
||||
if (originalRefMtbColr != null) {
|
||||
refMtbColr.setId(originalRefMtbColr.getId());
|
||||
@@ -1470,10 +1473,52 @@ public class SpedizioneViewModel {
|
||||
|
||||
if (shouldCloseLU) requestCloseLU(shouldPrint);
|
||||
|
||||
}, this::sendError);
|
||||
}, this::sendError)));
|
||||
|
||||
}
|
||||
|
||||
private void executeDepositChangeIfNeeded(MtbColt refMtbColt, Runnable onComplete) {
|
||||
//Considero solo la prima UDC scansionata
|
||||
boolean shouldChangeCodMdep = refMtbColt != null && !refMtbColt.getCodMdep().equalsIgnoreCase(mCurrentMtbColt.getCodMdep()) &&
|
||||
mCurrentMtbColt.getMtbColr().isEmpty();
|
||||
String newCodMdep = shouldChangeCodMdep ? refMtbColt.getCodMdep() : null;
|
||||
|
||||
if (shouldChangeCodMdep) {
|
||||
mColliMagazzinoRESTConsumer.spostaUL(mCurrentMtbColt, newCodMdep, null, false, () -> {
|
||||
mCurrentMtbColt.setCodMdep(newCodMdep);
|
||||
onComplete.run();
|
||||
}, this::sendError);
|
||||
} else onComplete.run();
|
||||
}
|
||||
|
||||
private void executeTipoUlChangeIfNeeded(MtbColt refMtbColt, Runnable onComplete) {
|
||||
boolean shouldChangeCodTcol = refMtbColt != null && refMtbColt.getCodTcol() != null &&
|
||||
!refMtbColt.getCodTcol().equalsIgnoreCase(mCurrentMtbColt.getCodTcol()) &&
|
||||
mCurrentMtbColt.getMtbColr().isEmpty();
|
||||
String newTipoUL = shouldChangeCodTcol ? refMtbColt.getCodTcol() : null;
|
||||
|
||||
ObservableMtbTcol newMtbTcol = SettingsManager.iDB().getInternalImballi().stream().filter(x -> x.getCodTcol().equalsIgnoreCase(newTipoUL))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(newTipoUL) && newMtbTcol == null) {
|
||||
this.sendError(new Exception("Impossibile riconoscere il tipo UL " + newTipoUL));
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
|
||||
if (shouldChangeCodTcol && newMtbTcol != null) {
|
||||
updateTipoUl(newMtbTcol, onComplete);
|
||||
} else onComplete.run();
|
||||
}
|
||||
|
||||
public void updateTipoUl(ObservableMtbTcol newTipoUL, Runnable onComplete) {
|
||||
mColliMagazzinoRESTConsumer.updateTipoUL(mCurrentMtbColt, newTipoUL.getCodTcol(), () -> {
|
||||
mCurrentMtbColt.setCodTcol(newTipoUL.getCodTcol());
|
||||
onComplete.run();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void saveEditedRow(MtbColr mtbColrToUpdate, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, LocalDate dataScad, boolean shouldCloseLU) {
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
@@ -2062,7 +2107,7 @@ public class SpedizioneViewModel {
|
||||
|
||||
void onFullItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaOrd, BigDecimal totalNumCnfOrd, BigDecimal qtaCnfOrd, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, String partitaMag, LocalDate dataScad, boolean canOverflowOrderQuantity, boolean canBatchLotBeChanged, RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
|
||||
|
||||
void onInfoAggiuntiveRequired(MtbColt currentMtbColt, RunnableArgss<String, MtbTCol> onComplete);
|
||||
void onInfoAggiuntiveRequired(MtbColt currentMtbColt, RunnableArgss<String, ObservableMtbTcol> onComplete);
|
||||
|
||||
void onLUPositionChangeRequest(RunnableArgss<Boolean, MtbDepoPosizione> onComplete);
|
||||
|
||||
|
||||
@@ -104,7 +104,8 @@ public class DialogUltimeConsegneFiltroAvanzato {
|
||||
|
||||
private void initView(DialogUltimeConsegneFiltroAvanzatoBinding bindings, DialogUltimeConsegneFiltroAvanzatoViewModel viewModel) {
|
||||
|
||||
arrayAdapterRagSoc = new SimpleAutoCompleteDropdownAdapter(mContext, R.layout.dialog_vendita_filtro_avanzato__single_item, getAvailableRagSocs(false));
|
||||
arrayAdapterRagSoc = new SimpleAutoCompleteDropdownAdapter<>(mContext, R.layout.dialog_vendita_filtro_avanzato__single_item, getAvailableRagSocs(false));
|
||||
arrayAdapterRagSoc.addAll();
|
||||
bindings.filledExposedDropdownRagSoc.setAdapter(arrayAdapterRagSoc);
|
||||
|
||||
bindings.filledExposedDropdownDataDoc.setOnClickListener(view -> {
|
||||
|
||||
@@ -302,7 +302,7 @@ public class VersamentoMerceViewModel {
|
||||
|
||||
public void updatePosizione(MtbDepoPosizione mtbDepoPosizione) {
|
||||
this.sendOnLoadingStarted();
|
||||
mColliMagazzinoRESTConsumer.changePosizione(mCurrentMtbColt.getValue(), mtbDepoPosizione, () -> {
|
||||
mColliMagazzinoRESTConsumer.spostaUL(mCurrentMtbColt.getValue(), mtbDepoPosizione, () -> {
|
||||
this.sendOnLoadingEnded();
|
||||
this.sendOnDataSaved();
|
||||
}, this::sendError);
|
||||
|
||||
@@ -1,105 +1,116 @@
|
||||
package it.integry.integrywmsnative.ui.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Filter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class SimpleAutoCompleteDropdownAdapter extends ArrayAdapter {
|
||||
public class SimpleAutoCompleteDropdownAdapter<T> extends ArrayAdapter<T> {
|
||||
|
||||
private List<Object> mObjects;
|
||||
private final ObservableArrayList<T> objects;
|
||||
private final LayoutInflater mInflater;
|
||||
private int mDropDownResource;
|
||||
|
||||
public SimpleAutoCompleteDropdownAdapter(@NonNull Context context, int resource) {
|
||||
super(context, resource);
|
||||
public SimpleAutoCompleteDropdownAdapter(@NonNull Context context, int resource, @NonNull List<T> objects) {
|
||||
this(context, resource, new ObservableArrayList<>());
|
||||
this.objects.addAll(objects);
|
||||
}
|
||||
|
||||
public SimpleAutoCompleteDropdownAdapter(@NonNull Context context, int resource, int textViewResourceId) {
|
||||
super(context, resource, textViewResourceId);
|
||||
public SimpleAutoCompleteDropdownAdapter(@NonNull Context context, int resource, @NonNull ObservableArrayList<T> objects) {
|
||||
super(context, resource, new ArrayList<>(objects));
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mDropDownResource = resource;
|
||||
this.objects = objects;
|
||||
|
||||
// Listener per aggiornare l'adapter quando la lista cambia
|
||||
this.objects.addOnListChangedCallback(new ObservableList.OnListChangedCallback<ObservableList<T>>() {
|
||||
@Override
|
||||
public void onChanged(ObservableList<T> sender) {
|
||||
updateAdapter();
|
||||
}
|
||||
|
||||
public SimpleAutoCompleteDropdownAdapter(@NonNull Context context, int resource, @NonNull Object[] objects) {
|
||||
super(context, resource, objects);
|
||||
mObjects = Arrays.asList(objects);
|
||||
@Override
|
||||
public void onItemRangeChanged(ObservableList<T> sender, int positionStart, int itemCount) {
|
||||
updateAdapter();
|
||||
}
|
||||
|
||||
public SimpleAutoCompleteDropdownAdapter(@NonNull Context context, int resource, int textViewResourceId, @NonNull Object[] objects) {
|
||||
super(context, resource, textViewResourceId, objects);
|
||||
mObjects = Arrays.asList(objects);
|
||||
@Override
|
||||
public void onItemRangeInserted(ObservableList<T> sender, int positionStart, int itemCount) {
|
||||
updateAdapter();
|
||||
}
|
||||
|
||||
public SimpleAutoCompleteDropdownAdapter(@NonNull Context context, int resource, @NonNull List objects) {
|
||||
super(context, resource, objects);
|
||||
mObjects = objects;
|
||||
@Override
|
||||
public void onItemRangeMoved(ObservableList<T> sender, int fromPosition, int toPosition, int itemCount) {
|
||||
updateAdapter();
|
||||
}
|
||||
|
||||
public SimpleAutoCompleteDropdownAdapter(@NonNull Context context, int resource, int textViewResourceId, @NonNull List objects) {
|
||||
super(context, resource, textViewResourceId, objects);
|
||||
mObjects = objects;
|
||||
@Override
|
||||
public void onItemRangeRemoved(ObservableList<T> sender, int positionStart, int itemCount) {
|
||||
updateAdapter();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateAdapter() {
|
||||
clear();
|
||||
addAll(objects);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Filter getFilter() {
|
||||
return new StringFilter(mObjects);
|
||||
return new StringFilter(objects);
|
||||
}
|
||||
|
||||
private class StringFilter extends Filter {
|
||||
|
||||
|
||||
|
||||
private class StringFilter<T> extends Filter {
|
||||
|
||||
private ArrayList<T> sourceObjects;
|
||||
private final List<T> sourceObjects;
|
||||
|
||||
public StringFilter(List<T> objects) {
|
||||
if(objects == null) return;
|
||||
sourceObjects = new ArrayList<T>();
|
||||
synchronized (this) {
|
||||
sourceObjects.addAll(objects);
|
||||
}
|
||||
this.sourceObjects = objects;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FilterResults performFiltering(CharSequence chars) {
|
||||
String filterSeq = chars.toString().toLowerCase();
|
||||
String filterSeq = chars == null ? "" : chars.toString().toLowerCase();
|
||||
FilterResults result = new FilterResults();
|
||||
if (filterSeq != null && filterSeq.length() > 0) {
|
||||
ArrayList<T> filter = new ArrayList<T>();
|
||||
|
||||
for (T object : sourceObjects) {
|
||||
// the filtering itself:
|
||||
if (object.toString().toLowerCase().contains(filterSeq))
|
||||
filter.add(object);
|
||||
}
|
||||
result.count = filter.size();
|
||||
result.values = filter;
|
||||
} else {
|
||||
// add all objects
|
||||
synchronized (this) {
|
||||
result.values = sourceObjects;
|
||||
if (filterSeq.isEmpty()) {
|
||||
result.values = new ArrayList<>(sourceObjects);
|
||||
result.count = sourceObjects.size();
|
||||
} else {
|
||||
ArrayList<T> filtered = new ArrayList<>();
|
||||
for (T object : sourceObjects) {
|
||||
String stringObject = object.toString();
|
||||
|
||||
if (stringObject.toLowerCase().contains(filterSeq)) {
|
||||
filtered.add(object);
|
||||
}
|
||||
}
|
||||
result.values = filtered;
|
||||
result.count = filtered.size();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void publishResults(CharSequence constraint,
|
||||
FilterResults results) {
|
||||
// NOTE: this function is *always* called from the UI thread.
|
||||
if(constraint != null && constraint.length() > 2) {
|
||||
ArrayList<T> filtered = (ArrayList<T>) results.values;
|
||||
notifyDataSetChanged();
|
||||
protected void publishResults(CharSequence constraint, FilterResults results) {
|
||||
List<T> filtered = (List<T>) results.values;
|
||||
if (filtered != null) {
|
||||
synchronized (this) {
|
||||
clear();
|
||||
for (int i = 0, l = filtered.size(); i < l; i++)
|
||||
add(filtered.get(i));
|
||||
notifyDataSetInvalidated();
|
||||
addAll(filtered);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableList;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -24,8 +23,8 @@ import it.integry.integrywmsnative.databinding.BottomSheetFragmentLuContentListI
|
||||
|
||||
public class BottomSheetFragmentLUContentListAdapter extends RecyclerView.Adapter<BottomSheetFragmentLUContentListAdapter.ViewHolder> {
|
||||
|
||||
private Context mContext;
|
||||
private ArrayList<MtbColr> mDataset;
|
||||
private final Context mContext;
|
||||
private final ArrayList<MtbColr> mDataset;
|
||||
private OnItemClickListener mOnItemClickListener;
|
||||
|
||||
|
||||
@@ -60,7 +59,7 @@ public class BottomSheetFragmentLUContentListAdapter extends RecyclerView.Adapte
|
||||
@Override
|
||||
public BottomSheetFragmentLUContentListAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
// create a new view
|
||||
BottomSheetFragmentLuContentListItemBinding viewDataBinding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.bottom_sheet_fragment__lu_content__list_item, parent, false);
|
||||
BottomSheetFragmentLuContentListItemBinding viewDataBinding = BottomSheetFragmentLuContentListItemBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||
|
||||
return new BottomSheetFragmentLUContentListAdapter.ViewHolder(viewDataBinding);
|
||||
}
|
||||
|
||||
@@ -8,10 +8,12 @@ import java.math.RoundingMode;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
|
||||
public class BottomSheetFragmentLUContentViewModel {
|
||||
|
||||
|
||||
|
||||
public ObservableField<MtbColt> mtbColt = new ObservableField<>();
|
||||
public ObservableField<String> pesoKg = new ObservableField<>();
|
||||
public ObservableField<String> pesoNettoKg = new ObservableField<>();
|
||||
@@ -22,6 +24,10 @@ public class BottomSheetFragmentLUContentViewModel {
|
||||
if (this.mListener != null) this.mListener.onBottomSheetLUClose();
|
||||
}
|
||||
|
||||
public void requestChangeMtbTcol() {
|
||||
if (this.mListener != null) this.mListener.onRequestChangeMtbTcol(mtbColt.get());
|
||||
}
|
||||
|
||||
public BottomSheetFragmentLUContentViewModel setMtbColt(MtbColt mtbColt) {
|
||||
this.mtbColt.set(mtbColt);
|
||||
return this;
|
||||
@@ -45,7 +51,7 @@ public class BottomSheetFragmentLUContentViewModel {
|
||||
MtbColt collo = this.mtbColt.get();
|
||||
if (collo == null) return;
|
||||
|
||||
MtbTCol tipoPedana = collo.getMtbTCol();
|
||||
ObservableMtbTcol tipoPedana = collo.getMtbTCol();
|
||||
BigDecimal taraPedana = tipoPedana != null ? tipoPedana.getTaraKg() : BigDecimal.ZERO;
|
||||
BigDecimal pesoNetto = BigDecimal.ZERO;
|
||||
|
||||
@@ -67,6 +73,8 @@ public class BottomSheetFragmentLUContentViewModel {
|
||||
}
|
||||
|
||||
public interface Listener {
|
||||
void onRequestChangeMtbTcol(MtbColt mtbColt);
|
||||
|
||||
void onBottomSheetLUClose();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.ask_should_print;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.databinding.DialogAskShouldPrintBinding;
|
||||
|
||||
public class DialogAskShouldPrint {
|
||||
|
||||
private Dialog currentDialog;
|
||||
|
||||
public static Dialog make(final Context context, final String nomeEtichettaEN, RunnableArgs<Boolean> onDialogDismiss) {
|
||||
return new DialogAskShouldPrint(context, nomeEtichettaEN, onDialogDismiss).currentDialog;
|
||||
}
|
||||
|
||||
private DialogAskShouldPrint(Context context, String nomeEtichettaEN, RunnableArgs<Boolean> onDialogDismiss) {
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||
DialogAskShouldPrintBinding bindings = DataBindingUtil.inflate(inflater, R.layout.dialog_ask_should_print, null, false);
|
||||
|
||||
currentDialog = new Dialog(context);
|
||||
currentDialog.setContentView(bindings.getRoot());
|
||||
|
||||
currentDialog.setCanceledOnTouchOutside(false);
|
||||
currentDialog.setCancelable(false);
|
||||
currentDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
bindings.descriptionText.setText(String.format(context.getResources().getString(R.string.message_print_packing_list), nomeEtichettaEN));
|
||||
|
||||
bindings.buttonConfirm.setOnClickListener(v -> {
|
||||
currentDialog.dismiss();
|
||||
onDialogDismiss.run(true);
|
||||
});
|
||||
|
||||
bindings.buttonAbort.setOnClickListener(v -> {
|
||||
currentDialog.dismiss();
|
||||
onDialogDismiss.run(false);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -136,31 +136,26 @@ public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||
|
||||
private void initContent() {
|
||||
int colorBackgroundTitle = -1;
|
||||
Drawable titleIconRes = null;
|
||||
|
||||
switch (mType) {
|
||||
case INFO:
|
||||
Drawable titleIconRes = switch (mType) {
|
||||
case INFO -> {
|
||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.colorPrimary);
|
||||
titleIconRes = ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_info_78dp, null);
|
||||
break;
|
||||
|
||||
case SUCCESS:
|
||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.green_300);
|
||||
titleIconRes = ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_done_white_24dp, null);
|
||||
break;
|
||||
|
||||
case WARNING:
|
||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.yellow_600);
|
||||
titleIconRes = ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_warning_white_24dp, null);
|
||||
break;
|
||||
|
||||
case ERROR:
|
||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.red_300);
|
||||
titleIconRes = ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_mood_bad_24dp, null);
|
||||
break;
|
||||
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_info_78dp, null);
|
||||
}
|
||||
case SUCCESS -> {
|
||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.green_300);
|
||||
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_done_white_24dp, null);
|
||||
}
|
||||
case WARNING -> {
|
||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.yellow_600);
|
||||
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_warning_white_24dp, null);
|
||||
}
|
||||
case ERROR -> {
|
||||
colorBackgroundTitle = ContextCompat.getColor(requireContext(), R.color.red_300);
|
||||
yield ResourcesCompat.getDrawable(requireContext().getResources(), R.drawable.ic_mood_bad_24dp, null);
|
||||
}
|
||||
};
|
||||
|
||||
this.positiveButtonText = requireContext().getText(R.string.ok).toString();
|
||||
this.positiveButtonText = requireContext().getText(mOnNegativeClick != null ? R.string.yes : R.string.ok).toString();
|
||||
this.negativeButtonText = requireContext().getText(R.string.no).toString();
|
||||
|
||||
//Title VIEW
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.create_new_art;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogCreateNewArtComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogCreateNewArtComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogCreateNewArtView dialogCreateNewArtView);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.create_new_art;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
|
||||
@Module(subcomponents = DialogCreateNewArtComponent.class)
|
||||
public class DialogCreateNewArtModule {
|
||||
|
||||
@Provides
|
||||
DialogCreateNewArtViewModel providesDialogCreateNewArtViewModel(ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
return new DialogCreateNewArtViewModel(articoloRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.create_new_art;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputFilter;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.databinding.ObservableList;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.OnGeneralChangedCallback;
|
||||
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||
import it.integry.integrywmsnative.core.model.MtbSfam;
|
||||
import it.integry.integrywmsnative.core.model.MtbSgrp;
|
||||
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogCreateNewArtBinding;
|
||||
import it.integry.integrywmsnative.ui.adapter.SimpleAutoCompleteDropdownAdapter;
|
||||
|
||||
public class DialogCreateNewArtView extends BaseDialogFragment implements DialogCreateNewArtViewModel.Listener {
|
||||
|
||||
public final ObservableField<String> selectedUntMisText = new ObservableField<>();
|
||||
public final ObservableField<String> selectedMtbGrupText = new ObservableField<>();
|
||||
public final ObservableField<String> selectedMtbSubGrupText = new ObservableField<>();
|
||||
public final ObservableField<String> selectedMtbSubSubGrupText = new ObservableField<>();
|
||||
public final ObservableField<String> selectedPosizioneText = new ObservableField<>();
|
||||
public final BindableBoolean editingBarcode = new BindableBoolean(false);
|
||||
|
||||
@Inject
|
||||
DialogCreateNewArtViewModel mViewModel;
|
||||
|
||||
private DialogCreateNewArtBinding mBindings;
|
||||
private Context mContext;
|
||||
|
||||
public final BarcodeScanDTO mScannedBarcode;
|
||||
private int mBarcodeScannerIstanceID;
|
||||
|
||||
private final String initialPosizione;
|
||||
private final RunnableArgs<String> onArticleCreated;
|
||||
|
||||
//Pass here all external parameters
|
||||
public static DialogCreateNewArtView newInstance() {
|
||||
return newInstance(null, null, null);
|
||||
}
|
||||
|
||||
//Pass here all external parameters
|
||||
public static DialogCreateNewArtView newInstance(String description, BarcodeScanDTO barcode, String posizione) {
|
||||
return new DialogCreateNewArtView(description, barcode, posizione, null);
|
||||
}
|
||||
|
||||
public static DialogCreateNewArtView newInstance(String description, BarcodeScanDTO barcode, String posizione, RunnableArgs<String> onArticleCreated) {
|
||||
return new DialogCreateNewArtView(description, barcode, posizione, onArticleCreated);
|
||||
}
|
||||
|
||||
private DialogCreateNewArtView(String description, BarcodeScanDTO barcode, String posizione, RunnableArgs<String> onArticleCreated) {
|
||||
super();
|
||||
this.mScannedBarcode = barcode;
|
||||
this.onArticleCreated = onArticleCreated;
|
||||
this.initialPosizione = posizione;
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogCreateNewArtComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
mViewModel.setListener(this);
|
||||
if (description != null) mViewModel.descrizione.set(description.toUpperCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTheme() {
|
||||
return R.style.AppTheme_NewMaterial_Dialog_FullscreenDialog;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
this.mContext = requireContext();
|
||||
|
||||
mBindings = DialogCreateNewArtBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
mBindings.setViewmodel(mViewModel);
|
||||
mBindings.setView(this);
|
||||
mBindings.toolbar.setTitle("Nuovo articolo");
|
||||
|
||||
this.initBarcodeReader();
|
||||
this.initObservable();
|
||||
this.initBarcodes();
|
||||
|
||||
mBindings.inputDescrizioneText.setFilters(new InputFilter.AllCaps[]{
|
||||
new InputFilter.AllCaps()
|
||||
});
|
||||
|
||||
SimpleAutoCompleteDropdownAdapter<String> arrayAdapterPosizioni = new SimpleAutoCompleteDropdownAdapter<>(mContext,
|
||||
android.R.layout.simple_dropdown_item_1line,
|
||||
UtilityObservable.convertObservableArrayList(mViewModel.retrieveAvailablePosizioni(), MtbDepoPosizione::getPosizione));
|
||||
mBindings.inputDefaultPosText.setAdapter(arrayAdapterPosizioni);
|
||||
mViewModel.retrieveAvailablePosizioni().addOnListChangedCallback(new OnListGeneralChangedCallback<MtbDepoPosizione>() {
|
||||
@Override
|
||||
public void onChanged(ObservableList<MtbDepoPosizione> sender) {
|
||||
if(!UtilityString.isNullOrEmpty(initialPosizione)) {
|
||||
selectedPosizioneText.set(initialPosizione);
|
||||
} else if(sender.size() == 1) {
|
||||
selectedPosizioneText.set(sender.get(0).getPosizione());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SimpleAutoCompleteDropdownAdapter<String> arrayAdapterUntMis = new SimpleAutoCompleteDropdownAdapter<>(mContext,
|
||||
android.R.layout.simple_dropdown_item_1line,
|
||||
UtilityObservable.convertObservableArrayList(mViewModel.retrieveAvailableUntMis(), MtbUntMis::getUntMis));
|
||||
mBindings.filledUntMisText.setAdapter(arrayAdapterUntMis);
|
||||
mViewModel.retrieveAvailableUntMis().addOnListChangedCallback(new OnListGeneralChangedCallback<MtbUntMis>() {
|
||||
@Override
|
||||
public void onChanged(ObservableList<MtbUntMis> sender) {
|
||||
if(sender.size() == 1) {
|
||||
selectedUntMisText.set(sender.get(0).getUntMis());
|
||||
} else if(sender.stream().anyMatch(x -> x.getUntMis().equalsIgnoreCase("PZ"))) {
|
||||
MtbUntMis pzUntMis = sender.stream().filter(x -> x.getUntMis().equalsIgnoreCase("PZ")).findFirst().get();
|
||||
selectedUntMisText.set(pzUntMis.getUntMis());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SimpleAutoCompleteDropdownAdapter<String> arrayAdapterGruppoArt = new SimpleAutoCompleteDropdownAdapter<>(mContext,
|
||||
android.R.layout.simple_dropdown_item_1line,
|
||||
UtilityObservable.convertObservableArrayList(mViewModel.retrieveAvailableArtGroups(), x -> String.format("%s - %s", x.getCodMgrp(), x.getDescrizione())));
|
||||
mBindings.filledGruppoText.setAdapter(arrayAdapterGruppoArt);
|
||||
mViewModel.retrieveAvailableArtGroups().addOnListChangedCallback(new OnListGeneralChangedCallback<MtbGrup>() {
|
||||
@Override
|
||||
public void onChanged(ObservableList<MtbGrup> sender) {
|
||||
if(sender.size() == 1) {
|
||||
selectedMtbGrupText.set(String.format("%s - %s", sender.get(0).getCodMgrp(), sender.get(0).getDescrizione()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SimpleAutoCompleteDropdownAdapter<String> arrayAdapterSottoGruppoArt = new SimpleAutoCompleteDropdownAdapter<>(mContext,
|
||||
android.R.layout.simple_dropdown_item_1line,
|
||||
UtilityObservable.convertObservableArrayList(mViewModel.retrieveAvailableArtSubGroups(), x -> String.format("%s - %s", x.getCodMsgr(), x.getDescrizione())));
|
||||
mBindings.filledSottoGruppoText.setAdapter(arrayAdapterSottoGruppoArt);
|
||||
mViewModel.retrieveAvailableArtSubGroups().addOnListChangedCallback(new OnListGeneralChangedCallback<MtbSgrp>() {
|
||||
@Override
|
||||
public void onChanged(ObservableList<MtbSgrp> sender) {
|
||||
if(sender.size() == 1) {
|
||||
selectedMtbSubGrupText.set(String.format("%s - %s", sender.get(0).getCodMsgr(), sender.get(0).getDescrizione()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SimpleAutoCompleteDropdownAdapter<String> arrayAdapterSottoSottoGruppoArt = new SimpleAutoCompleteDropdownAdapter<>(mContext,
|
||||
android.R.layout.simple_dropdown_item_1line,
|
||||
UtilityObservable.convertObservableArrayList(mViewModel.retrieveAvailableArtSubSubGroups(), x -> String.format("%s - %s", x.getCodMsfa(), x.getDescrizione())));
|
||||
mBindings.filledSottoSottoGruppoText.setAdapter(arrayAdapterSottoSottoGruppoArt);
|
||||
mViewModel.retrieveAvailableArtSubSubGroups().addOnListChangedCallback(new OnListGeneralChangedCallback<MtbSfam>() {
|
||||
@Override
|
||||
public void onChanged(ObservableList<MtbSfam> sender) {
|
||||
if(sender.size() == 1) {
|
||||
selectedMtbSubSubGrupText.set(String.format("%s - %s", sender.get(0).getCodMsfa(), sender.get(0).getDescrizione()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mViewModel.init();
|
||||
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
private void initBarcodeReader() {
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(data -> {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
|
||||
if (UtilityBarcode.isEtichettaPosizione(data)) {
|
||||
selectedPosizioneText.set(data.getStringValue());
|
||||
} else if (editingBarcode.get()) {
|
||||
mViewModel.barcodeProdotto.set(data.getStringValue());
|
||||
saveBarcode();
|
||||
}
|
||||
});
|
||||
})
|
||||
.setOnScanFailed(this::onError));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||
}
|
||||
|
||||
private void initObservable() {
|
||||
this.selectedUntMisText.addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||
@Override
|
||||
public void run() {
|
||||
mViewModel.selectedUntMis.set(mViewModel.retrieveAvailableUntMis().stream()
|
||||
.filter(x -> x.getUntMis().equals(selectedUntMisText.get()))
|
||||
.findFirst().orElse(null));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.selectedMtbGrupText.addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||
@Override
|
||||
public void run() {
|
||||
mViewModel.selectedMtbGrup.set(mViewModel.retrieveAvailableArtGroups().stream()
|
||||
.filter(x -> String.format("%s - %s", x.getCodMgrp(), x.getDescrizione()).equals(selectedMtbGrupText.get()))
|
||||
.findFirst().orElse(null));
|
||||
|
||||
selectedMtbSubGrupText.set(null);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.selectedMtbSubGrupText.addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||
@Override
|
||||
public void run() {
|
||||
mViewModel.selectedMtbSubGrup.set(mViewModel.retrieveAvailableArtSubGroups().stream()
|
||||
.filter(x -> String.format("%s - %s", x.getCodMsgr(), x.getDescrizione()).equals(selectedMtbSubGrupText.get()))
|
||||
.findFirst().orElse(null));
|
||||
|
||||
selectedMtbSubSubGrupText.set(null);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.selectedMtbSubSubGrupText.addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||
@Override
|
||||
public void run() {
|
||||
mViewModel.selectedMtbSubSubGrup.set(mViewModel.retrieveAvailableArtSubSubGroups().stream()
|
||||
.filter(x -> String.format("%s - %s", x.getCodMsfa(), x.getDescrizione()).equals(selectedMtbSubSubGrupText.get()))
|
||||
.findFirst().orElse(null));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
this.selectedPosizioneText.addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||
@Override
|
||||
public void run() {
|
||||
mViewModel.selectedPosizioneDefault.set(mViewModel.retrieveAvailablePosizioni().stream()
|
||||
.filter(x -> x.getPosizione().equals(selectedPosizioneText.get()))
|
||||
.findFirst().orElse(null));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void initBarcodes() {
|
||||
if (mScannedBarcode != null) {
|
||||
mViewModel.barcodeProdotto.set(mScannedBarcode.getStringValue());
|
||||
try {
|
||||
generateBarcodeBitmap();
|
||||
} catch (Exception e) {
|
||||
onError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void saveBarcode() {
|
||||
try {
|
||||
generateBarcodeBitmap();
|
||||
editingBarcode.toggle();
|
||||
} catch (Exception e) {
|
||||
onError(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void generateBarcodeBitmap() throws Exception {
|
||||
Bitmap barcodeBitmap = UtilityBarcode.generateBarcodeImage(mViewModel.barcodeProdotto.get(), 500, 170);
|
||||
mBindings.barcodeProdottoImage.setImageBitmap(barcodeBitmap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaved(String codMart) {
|
||||
this.dismiss();
|
||||
|
||||
if (this.onArticleCreated != null) this.onArticleCreated.run(codMart);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.create_new_art;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import it.integry.integrywmsnative.core.di.ValidatableObservableField;
|
||||
import it.integry.integrywmsnative.core.di.validators.GreaterThenValidator;
|
||||
import it.integry.integrywmsnative.core.di.validators.NotEmptyValidator;
|
||||
import it.integry.integrywmsnative.core.di.validators.NotNullValidator;
|
||||
import it.integry.integrywmsnative.core.expansion.OnGeneralChangedCallback;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||
import it.integry.integrywmsnative.core.model.MtbSfam;
|
||||
import it.integry.integrywmsnative.core.model.MtbSgrp;
|
||||
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.articolo.ArticoloDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
|
||||
public class DialogCreateNewArtViewModel {
|
||||
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
private final ArticoloRESTConsumer articoloRESTConsumer;
|
||||
|
||||
private final ObservableArrayList<MtbUntMis> availableUntMis = new ObservableArrayList<>();
|
||||
private final ObservableArrayList<MtbGrup> availableMtbGroups = new ObservableArrayList<>();
|
||||
private final ObservableArrayList<MtbSgrp> availableMtbSubGroups = new ObservableArrayList<>();
|
||||
private final ObservableArrayList<MtbSfam> availableMtbSubSubGroups = new ObservableArrayList<>();
|
||||
|
||||
private final ObservableArrayList<MtbDepoPosizione> availablePosizioni = new ObservableArrayList<>();
|
||||
|
||||
public ValidatableObservableField<String> descrizione = new ValidatableObservableField<>() {{
|
||||
addValidator(new NotEmptyValidator("La descrizione non può essere vuota"));
|
||||
}};
|
||||
|
||||
public final ValidatableObservableField<String> noteAggiuntive = new ValidatableObservableField<>();
|
||||
public final ValidatableObservableField<BigDecimal> qtaCnf = new ValidatableObservableField<>(BigDecimal.ONE) {{
|
||||
addValidator(new NotNullValidator<>("La qta x cnf deve essere > 0"));
|
||||
addValidator(new GreaterThenValidator(BigDecimal.ZERO, "La qta x cnf deve essere > 0"));
|
||||
}};
|
||||
|
||||
public final ValidatableObservableField<String> barcodeProdotto = new ValidatableObservableField<>();
|
||||
public final ValidatableObservableField<Boolean> qtaCnfFissa = new ValidatableObservableField<>(true);
|
||||
|
||||
public ValidatableObservableField<MtbUntMis> selectedUntMis = new ValidatableObservableField<>(null) {{
|
||||
addValidator(new NotNullValidator<>("Seleziona un'unità di misura"));
|
||||
}};
|
||||
public ValidatableObservableField<MtbGrup> selectedMtbGrup = new ValidatableObservableField<>(null) {{
|
||||
addValidator(new NotNullValidator<>("Seleziona un gruppo"));
|
||||
}};
|
||||
public ValidatableObservableField<MtbSgrp> selectedMtbSubGrup = new ValidatableObservableField<>(null) {{
|
||||
addValidator(new NotNullValidator<>("Seleziona un sotto gruppo"));
|
||||
}};
|
||||
public ValidatableObservableField<MtbSfam> selectedMtbSubSubGrup = new ValidatableObservableField<>(null) {{
|
||||
addValidator(new NotNullValidator<>("Seleziona un sotto-sotto gruppo"));
|
||||
}};
|
||||
|
||||
public ValidatableObservableField<MtbDepoPosizione> selectedPosizioneDefault = new ValidatableObservableField<>(null) {{
|
||||
addValidator(new NotNullValidator<>("Seleziona una posizione"));
|
||||
}};
|
||||
|
||||
|
||||
public DialogCreateNewArtViewModel(ArticoloRESTConsumer articoloRESTConsumer) {
|
||||
this.articoloRESTConsumer = articoloRESTConsumer;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
this.availablePosizioni.addAll(SettingsManager.iDB().getAvailablePosizioni());
|
||||
|
||||
this.articoloRESTConsumer.retrieveAvailableUntMis(untMisList -> {
|
||||
this.availableUntMis.addAll(untMisList);
|
||||
|
||||
this.articoloRESTConsumer.retrieveAvailableGruppiMerceologici(mtbGrupList -> {
|
||||
|
||||
List<String> allowedCodMgrpForArtCreation = SettingsManager.iDB().getAllowedCodMgrpForArtCreation();
|
||||
|
||||
if(allowedCodMgrpForArtCreation != null && !allowedCodMgrpForArtCreation.isEmpty()) {
|
||||
mtbGrupList = mtbGrupList.stream()
|
||||
.filter(x -> allowedCodMgrpForArtCreation.contains(x.getCodMgrp()))
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
}
|
||||
|
||||
if(mtbGrupList.size() == 1)
|
||||
this.selectedMtbGrup.set(mtbGrupList.get(0));
|
||||
|
||||
this.availableMtbGroups.addAll(mtbGrupList);
|
||||
|
||||
this.sendOnLoadingEnded();
|
||||
}, this::sendError);
|
||||
}, this::sendError);
|
||||
|
||||
this.selectedMtbGrup.addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||
@Override
|
||||
public void run() {
|
||||
availableMtbSubGroups.clear();
|
||||
|
||||
if (selectedMtbGrup != null && selectedMtbGrup.get() != null)
|
||||
availableMtbSubGroups.addAll(Objects.requireNonNull(selectedMtbGrup.get()).getMtbSgrp());
|
||||
}
|
||||
});
|
||||
|
||||
this.selectedMtbSubGrup.addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||
@Override
|
||||
public void run() {
|
||||
availableMtbSubSubGroups.clear();
|
||||
|
||||
if (selectedMtbSubGrup != null && selectedMtbSubGrup.get() != null)
|
||||
availableMtbSubSubGroups.addAll(Objects.requireNonNull(selectedMtbSubGrup.get()).getMtbSfam());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public ObservableArrayList<MtbDepoPosizione> retrieveAvailablePosizioni() {
|
||||
return availablePosizioni;
|
||||
}
|
||||
|
||||
public ObservableArrayList<MtbUntMis> retrieveAvailableUntMis() {
|
||||
return availableUntMis;
|
||||
}
|
||||
|
||||
public ObservableArrayList<MtbGrup> retrieveAvailableArtGroups() {
|
||||
return availableMtbGroups;
|
||||
}
|
||||
|
||||
public ObservableArrayList<MtbSgrp> retrieveAvailableArtSubGroups() {
|
||||
return availableMtbSubGroups;
|
||||
}
|
||||
|
||||
public ObservableArrayList<MtbSfam> retrieveAvailableArtSubSubGroups() {
|
||||
return availableMtbSubSubGroups;
|
||||
}
|
||||
|
||||
|
||||
public void save() {
|
||||
if (descrizione.validate() &
|
||||
noteAggiuntive.validate() &
|
||||
selectedMtbGrup.validate() &
|
||||
selectedMtbSubGrup.validate() &
|
||||
selectedMtbSubSubGrup.validate() &
|
||||
selectedUntMis.validate() &
|
||||
qtaCnf.validate() &
|
||||
qtaCnfFissa.validate() &
|
||||
selectedPosizioneDefault.validate() &
|
||||
barcodeProdotto.validate()
|
||||
) {
|
||||
ArticoloDTO articoloToSave = new ArticoloDTO()
|
||||
.setDescrizione(descrizione.get() != null ? descrizione.get().substring(0, Math.min(40, descrizione.get().length())) : null)
|
||||
.setDescrizioneEstesa(descrizione.get())
|
||||
.setNote(UtilityString.empty2null(noteAggiuntive.get()))
|
||||
.setCodMgrp(selectedMtbGrup.get().getCodMgrp())
|
||||
.setCodMsgr(selectedMtbSubGrup.get().getCodMsgr())
|
||||
.setCodMsfa(selectedMtbSubSubGrup.get().getCodMsfa())
|
||||
.setUntMis(selectedUntMis.get().getUntMis())
|
||||
.setFlagQtaCnfFissa(qtaCnfFissa.get().booleanValue())
|
||||
.setQtaCnf(qtaCnf.get())
|
||||
.setPosizione(selectedPosizioneDefault.get().getPosizione())
|
||||
.setBarcode(UtilityString.empty2null(barcodeProdotto.get()))
|
||||
.setFlagStato(true);
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
articoloRESTConsumer.saveArticolo(articoloToSave, codMart -> {
|
||||
this.sendOnLoadingEnded();
|
||||
this.sendOnSaved(codMart);
|
||||
}, this::sendError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.mListener != null) mListener.onLoadingStarted();
|
||||
}
|
||||
|
||||
private void sendOnLoadingEnded() {
|
||||
if (this.mListener != null) mListener.onLoadingEnded();
|
||||
}
|
||||
|
||||
private void sendError(Exception ex) {
|
||||
if (this.mListener != null) mListener.onError(ex);
|
||||
}
|
||||
|
||||
private void sendOnSaved(String codMart) {
|
||||
if (this.mListener != null) mListener.onSaved(codMart);
|
||||
}
|
||||
|
||||
public void setListener(Listener listener) {
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
|
||||
interface Listener extends ILoadingListener {
|
||||
|
||||
void onSaved(String codMart);
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,14 +2,13 @@ package it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
||||
|
||||
@Module(subcomponents = DialogInfoAggiuntiveLUComponent.class)
|
||||
public class DialogInfoAggiuntiveLUModule {
|
||||
|
||||
@Provides
|
||||
DialogInfoAggiuntiveLUViewModel providesDialogInfoAggiuntiveLUViewModel(ImballiRESTConsumer imballiRESTConsumer) {
|
||||
return new DialogInfoAggiuntiveLUViewModel(imballiRESTConsumer);
|
||||
DialogInfoAggiuntiveLUViewModel providesDialogInfoAggiuntiveLUViewModel() {
|
||||
return new DialogInfoAggiuntiveLUViewModel();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogInfoAggiuntiveLuBinding;
|
||||
@@ -46,26 +46,38 @@ public class DialogInfoAggiuntiveLUView extends BaseDialogFragment implements Di
|
||||
private Context mContext;
|
||||
|
||||
|
||||
private final RunnableArgss<String, MtbTCol> mOnComplete;
|
||||
private final boolean askNotes;
|
||||
private final boolean askTipoUl;
|
||||
private final RunnableArgss<String, ObservableMtbTcol> mOnComplete;
|
||||
private final Runnable mOnAbort;
|
||||
private final MtbColt currentMtbColt;
|
||||
|
||||
|
||||
public static DialogInfoAggiuntiveLUView newInstance(@NotNull RunnableArgss<String, MtbTCol> onComplete, @NotNull Runnable onAbort) {
|
||||
return new DialogInfoAggiuntiveLUView(null, onComplete, onAbort);
|
||||
public static DialogInfoAggiuntiveLUView newInstance(@NotNull RunnableArgss<String, ObservableMtbTcol> onComplete, @NotNull Runnable onAbort) {
|
||||
return new DialogInfoAggiuntiveLUView(null, true, true, onComplete, onAbort);
|
||||
}
|
||||
|
||||
public static DialogInfoAggiuntiveLUView newInstance(MtbColt mtbColt, @NotNull RunnableArgss<String, MtbTCol> onComplete, @NotNull Runnable onAbort) {
|
||||
return new DialogInfoAggiuntiveLUView(mtbColt, onComplete, onAbort);
|
||||
public static DialogInfoAggiuntiveLUView newInstance(MtbColt mtbColt, boolean askNotes, boolean askTipoUl, @NotNull RunnableArgss<String, ObservableMtbTcol> onComplete, @NotNull Runnable onAbort) {
|
||||
return new DialogInfoAggiuntiveLUView(mtbColt, askNotes, askTipoUl, onComplete, onAbort);
|
||||
}
|
||||
|
||||
private DialogInfoAggiuntiveLUView(MtbColt mtbColt, @NotNull RunnableArgss<String, MtbTCol> onComplete, @NotNull Runnable onAbort) {
|
||||
private DialogInfoAggiuntiveLUView(MtbColt mtbColt, boolean askNotes, boolean askTipoUl, @NotNull RunnableArgss<String, ObservableMtbTcol> onComplete, @NotNull Runnable onAbort) {
|
||||
super();
|
||||
this.mOnComplete = onComplete;
|
||||
this.mOnAbort = onAbort;
|
||||
this.currentMtbColt = mtbColt;
|
||||
|
||||
this.askNotes = askNotes;
|
||||
this.askTipoUl = askTipoUl;
|
||||
}
|
||||
|
||||
public boolean isAskNotes() {
|
||||
return askNotes;
|
||||
}
|
||||
|
||||
public boolean isAskTipoUl() {
|
||||
return askTipoUl;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
@@ -109,8 +121,8 @@ public class DialogInfoAggiuntiveLUView extends BaseDialogFragment implements Di
|
||||
public void onInit(DialogInterface dialogInterface) {
|
||||
super.onInit(dialogInterface);
|
||||
|
||||
this.init();
|
||||
this.mViewModel.init();
|
||||
this.init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
@@ -123,15 +135,12 @@ public class DialogInfoAggiuntiveLUView extends BaseDialogFragment implements Di
|
||||
|
||||
mBindings.filledExposedDropdownCodTcol.setAdapter(codTcolArrayAdapter);
|
||||
|
||||
this.mViewModel.getTipiCollo().observe(this, tipiCollo -> {
|
||||
|
||||
if (currentMtbColt != null && !UtilityString.isNullOrEmpty(currentMtbColt.getCodTcol()) && UtilityString.isNullOrEmpty(this.selectedMtbTcol.get())) {
|
||||
tipiCollo.stream()
|
||||
mViewModel.getTipiCollo().getValue().stream()
|
||||
.filter(x -> x.getCodTcol().equalsIgnoreCase(currentMtbColt.getCodTcol()))
|
||||
.findFirst()
|
||||
.ifPresent(tipoPedana -> this.selectedMtbTcol.set(tipoPedana.getCodTcol() + " - " + tipoPedana.getDescrizione()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
UtilityObservable.addPropertyChanged(this.selectedMtbTcol, (value) -> {
|
||||
@@ -160,6 +169,5 @@ public class DialogInfoAggiuntiveLUView extends BaseDialogFragment implements Di
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,38 +2,35 @@ package it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
|
||||
public class DialogInfoAggiuntiveLUViewModel {
|
||||
|
||||
private final MutableLiveData<List<MtbTCol>> tipiCollo = new MutableLiveData<>();
|
||||
private final MutableLiveData<List<ObservableMtbTcol>> tipiCollo = new MutableLiveData<>();
|
||||
|
||||
private Listener mListener;
|
||||
private final ImballiRESTConsumer imballiRESTConsumer;
|
||||
|
||||
@Inject
|
||||
public DialogInfoAggiuntiveLUViewModel(ImballiRESTConsumer imballiRESTConsumer) {
|
||||
this.imballiRESTConsumer = imballiRESTConsumer;
|
||||
public DialogInfoAggiuntiveLUViewModel() {
|
||||
}
|
||||
|
||||
|
||||
public void init() {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
imballiRESTConsumer.retrieveTipiCollo(MtbTCol.FlagUiUlEnum.UL, tipiCollo -> {
|
||||
this.tipiCollo.postValue(tipiCollo == null ? new ArrayList<>() : tipiCollo);
|
||||
this.sendOnLoadingEnded();
|
||||
}, this::sendError);
|
||||
var imballiList = SettingsManager.iDB().getInternalImballi().stream()
|
||||
.filter(x -> x.getFlagUIUL() == MtbTCol.FlagUiUlEnum.UL)
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
this.tipiCollo.setValue(imballiList);
|
||||
}
|
||||
|
||||
public MutableLiveData<List<MtbTCol>> getTipiCollo() {
|
||||
public MutableLiveData<List<ObservableMtbTcol>> getTipiCollo() {
|
||||
return tipiCollo;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package it.integry.integrywmsnative.view.dialogs.input_lu_prod;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.JtbFasi;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
|
||||
public class DialogInputLUProdResultDTO {
|
||||
|
||||
@@ -14,7 +14,7 @@ public class DialogInputLUProdResultDTO {
|
||||
private BigDecimal taraCol;
|
||||
private BigDecimal pesoLordo;
|
||||
|
||||
private MtbTCol mtbTCol;
|
||||
private ObservableMtbTcol mtbTCol;
|
||||
private JtbFasi jtbFasi;
|
||||
|
||||
|
||||
@@ -72,11 +72,11 @@ public class DialogInputLUProdResultDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbTCol getMtbTCol() {
|
||||
public ObservableMtbTcol getMtbTCol() {
|
||||
return mtbTCol;
|
||||
}
|
||||
|
||||
public DialogInputLUProdResultDTO setMtbTCol(MtbTCol mtbTCol) {
|
||||
public DialogInputLUProdResultDTO setMtbTCol(ObservableMtbTcol mtbTCol) {
|
||||
this.mtbTCol = mtbTCol;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.JtbFasi;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
||||
import it.integry.integrywmsnative.databinding.DialogInputLuProdBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
@@ -335,7 +335,7 @@ public class DialogInputLUProdView extends BaseDialogFragment implements DialogI
|
||||
|
||||
|
||||
if (mDialogInputLUProdDTO.getCodTcol() != null) {
|
||||
Optional<MtbTCol> optTCol = Stream.of(tipiCollo)
|
||||
java.util.Optional<ObservableMtbTcol> optTCol = tipiCollo.stream()
|
||||
.filter(x -> x.getCodTcol().equalsIgnoreCase(mDialogInputLUProdDTO.getCodTcol()))
|
||||
.findFirst();
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingL
|
||||
import it.integry.integrywmsnative.core.model.JtbFasi;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
@@ -30,7 +31,7 @@ public class DialogInputLUProdViewModel {
|
||||
public ObservableField<Boolean> blockedTaraCol = new ObservableField<>(false);
|
||||
public ObservableField<Boolean> blockedPesoLordo = new ObservableField<>(false);
|
||||
|
||||
private final MutableLiveData<List<MtbTCol>> mTipiColloLiveData = new MutableLiveData<>();
|
||||
private final MutableLiveData<List<ObservableMtbTcol>> mTipiColloLiveData = new MutableLiveData<>();
|
||||
private final MutableLiveData<List<JtbFasi>> mLineeProdLiveData = new MutableLiveData<>();
|
||||
|
||||
private BigDecimal initialNumCnf;
|
||||
@@ -43,7 +44,7 @@ public class DialogInputLUProdViewModel {
|
||||
private BigDecimal internalTaraCol;
|
||||
private BigDecimal internalPesoLordo;
|
||||
|
||||
private MtbTCol internalTipoPed;
|
||||
private ObservableMtbTcol internalTipoPed;
|
||||
private JtbFasi internalLineaProd;
|
||||
|
||||
private boolean isLineeProdRequired;
|
||||
@@ -62,7 +63,7 @@ public class DialogInputLUProdViewModel {
|
||||
public void init(String codJfasParent) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
imballiRESTConsumer.retrieveTipiCollo(MtbTCol.FlagUiUlEnum.UL, tipiCollo -> {
|
||||
imballiRESTConsumer.retrieveImballi(MtbTCol.FlagUiUlEnum.UL, tipiCollo -> {
|
||||
this.mTipiColloLiveData.postValue(tipiCollo);
|
||||
|
||||
mMesRESTConsumer.getLineeProduzione(codJfasParent, jtbFasi -> {
|
||||
@@ -76,7 +77,7 @@ public class DialogInputLUProdViewModel {
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
public MutableLiveData<List<MtbTCol>> getTipiCollo() {
|
||||
public MutableLiveData<List<ObservableMtbTcol>> getTipiCollo() {
|
||||
return this.mTipiColloLiveData;
|
||||
}
|
||||
|
||||
@@ -200,7 +201,7 @@ public class DialogInputLUProdViewModel {
|
||||
this.mListener.onDataChanged();
|
||||
}
|
||||
|
||||
public DialogInputLUProdViewModel setInternalTipoPed(MtbTCol internalTipoPed) {
|
||||
public DialogInputLUProdViewModel setInternalTipoPed(ObservableMtbTcol internalTipoPed) {
|
||||
this.internalTipoPed = internalTipoPed;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -6,35 +6,40 @@ import android.widget.ArrayAdapter;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
|
||||
public class DialogInputLUProdTipoColloAdapter extends ArrayAdapter<DialogInputLUProdTipoColloListModel> {
|
||||
|
||||
private List<DialogInputLUProdTipoColloListModel> mDataset;
|
||||
|
||||
public DialogInputLUProdTipoColloAdapter(@NonNull Context context, int resource, @NonNull MutableLiveData<List<MtbTCol>> inputData) {
|
||||
public DialogInputLUProdTipoColloAdapter(@NonNull Context context, int resource, @NonNull MutableLiveData<List<ObservableMtbTcol>> inputData) {
|
||||
super(context, resource);
|
||||
|
||||
inputData.observeForever(data -> {
|
||||
mDataset = Stream.of(data)
|
||||
mDataset = data.stream()
|
||||
.map(x -> new DialogInputLUProdTipoColloListModel()
|
||||
.setOriginalModel(x))
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
|
||||
clear();
|
||||
addAll(mDataset);
|
||||
});
|
||||
|
||||
if (inputData.getValue() != null)
|
||||
mDataset = inputData.getValue().stream()
|
||||
.map(x -> new DialogInputLUProdTipoColloListModel()
|
||||
.setOriginalModel(x))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<DialogInputLUProdTipoColloListModel> getDataset() {
|
||||
return this.mDataset;
|
||||
}
|
||||
|
||||
public MtbTCol getOriginalModelItem(int position) {
|
||||
public ObservableMtbTcol getOriginalModelItem(int position) {
|
||||
return mDataset.get(position).getOriginalModel();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,17 +2,17 @@ package it.integry.integrywmsnative.view.dialogs.input_lu_prod.adapter;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
|
||||
public class DialogInputLUProdTipoColloListModel {
|
||||
|
||||
private MtbTCol originalModel;
|
||||
private ObservableMtbTcol originalModel;
|
||||
|
||||
public MtbTCol getOriginalModel() {
|
||||
public ObservableMtbTcol getOriginalModel() {
|
||||
return originalModel;
|
||||
}
|
||||
|
||||
public DialogInputLUProdTipoColloListModel setOriginalModel(MtbTCol originalModel) {
|
||||
public DialogInputLUProdTipoColloListModel setOriginalModel(ObservableMtbTcol originalModel) {
|
||||
this.originalModel = originalModel;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -9,12 +9,13 @@ import android.widget.ArrayAdapter;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -24,7 +25,9 @@ import it.integry.integrywmsnative.core.di.BindableString;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||
import it.integry.integrywmsnative.databinding.DialogInputPesoLuBinding;
|
||||
@@ -47,7 +50,7 @@ public class DialogInputPesoLUView extends BaseDialogFragment {
|
||||
public BindableString grossWeight = new BindableString();
|
||||
|
||||
|
||||
private List<MtbTCol> codTcolList = null;
|
||||
private List<ObservableMtbTcol> codTcolList = null;
|
||||
private ArrayAdapter<String> codTcolArrayAdapter = null;
|
||||
|
||||
|
||||
@@ -95,34 +98,31 @@ public class DialogInputPesoLUView extends BaseDialogFragment {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void init() {
|
||||
|
||||
imballiRESTConsumer.retrieveTipiCollo(MtbTCol.FlagUiUlEnum.UL, codTcols -> {
|
||||
this.codTcolList = codTcols;
|
||||
this.codTcolList = SettingsManager.iDB().getInternalImballi().stream()
|
||||
.filter(x -> x.getFlagUIUL() == MtbTCol.FlagUiUlEnum.UL)
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
|
||||
List<String> codTcolDescriptions = Stream.of(codTcols)
|
||||
List<String> codTcolDescriptions = codTcolList.stream()
|
||||
.map(codTcol -> codTcol.getCodTcol() + " - " + codTcol.getDescrizione())
|
||||
.toList();
|
||||
|
||||
if (codTcol.get() != null) {
|
||||
Optional<String> newCodTcol = Stream.of(codTcols)
|
||||
Optional<String> newCodTcol = this.codTcolList.stream()
|
||||
.filter(x -> x.getCodTcol().equalsIgnoreCase(codTcol.get()))
|
||||
.map(codTcol -> codTcol.getCodTcol() + " - " + codTcol.getDescrizione())
|
||||
.findSingle();
|
||||
.findFirst();
|
||||
|
||||
if (newCodTcol.isPresent()) codTcol.set(newCodTcol.get());
|
||||
}
|
||||
|
||||
codTcolArrayAdapter = new ArrayAdapter(requireContext(), R.layout.array_adapter_single_item);
|
||||
codTcolArrayAdapter = new ArrayAdapter<>(requireContext(), R.layout.array_adapter_single_item);
|
||||
codTcolArrayAdapter.addAll(codTcolDescriptions);
|
||||
mBindings.filledExposedDropdownCodTcol.setAdapter(codTcolArrayAdapter);
|
||||
|
||||
// progressDialog.dismiss();
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(requireContext(), ex);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
||||
this.initProductLotStatusNotification();
|
||||
}
|
||||
|
||||
MtbUntMis mtbUntMis = mDialogInputQuantityV2DTO.getMtbAart().getMtbUntMis() != null && mDialogInputQuantityV2DTO.getMtbAart().getMtbUntMis().size() > 0 ? mDialogInputQuantityV2DTO.getMtbAart().getMtbUntMis().get(0) : null;
|
||||
MtbUntMis mtbUntMis = mDialogInputQuantityV2DTO.getMtbAart().getMtbUntMis() != null && !mDialogInputQuantityV2DTO.getMtbAart().getMtbUntMis().isEmpty() ? mDialogInputQuantityV2DTO.getMtbAart().getMtbUntMis().get(0) : null;
|
||||
if (!(mtbUntMis != null && mtbUntMis.isFlagDig())) {
|
||||
mBindings.inputQtaTotText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
||||
}
|
||||
@@ -231,7 +231,7 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
||||
this.mBindings.inputDataScadLayout.setEndIconTintList(ColorStateList.valueOf(ContextCompat.getColor(requireContext(), com.tfb.fbtoast.R.color.error_color)));
|
||||
}
|
||||
case NON_IN_SCADENZA -> {
|
||||
this.mBindings.inputDataScadLayout.setEndIconDrawable(R.drawable.ic_check_white_24dp);
|
||||
this.mBindings.inputDataScadLayout.setEndIconDrawable(R.drawable.ic_round_check_24);
|
||||
this.mBindings.inputDataScadLayout.setEndIconTintList(ColorStateList.valueOf(ContextCompat.getColor(requireContext(), com.tfb.fbtoast.R.color.success_color)));
|
||||
}
|
||||
}
|
||||
@@ -295,6 +295,8 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
||||
int onNumCnfInputChanged = SettingsManager.iDB().getOnNumCnfInputChanged();
|
||||
int onQtaTotInputChanged = SettingsManager.iDB().getOnQtaTotInputChanged();
|
||||
|
||||
onNumCnfInputChanged = onNumCnfInputChanged == 0 && mViewModel.getMtbAart().isFlagQtaCnfFissaBoolean() ? 2 : onNumCnfInputChanged;
|
||||
|
||||
this.mViewModel.setListener(this);
|
||||
this.mViewModel.init(onNumCnfInputChanged, onQtaTotInputChanged);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.switch_user_depo;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogSwitchUserDepoComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogSwitchUserDepoComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogSwitchUserDepoView dialogSwitchUserDepoView);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.switch_user_depo;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
@Module(subcomponents = DialogSwitchUserDepoComponent.class)
|
||||
public class DialogSwitchUserDepoModule {
|
||||
|
||||
@Provides
|
||||
DialogSwitchUserDepoViewModel providesDialogSwitchUserDepoViewModel() {
|
||||
return new DialogSwitchUserDepoViewModel();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.switch_user_depo;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.BR;
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.di.binders.recyclerview.BindingRecyclerViewAdapter;
|
||||
import it.integry.integrywmsnative.core.di.binders.recyclerview.ItemBinder;
|
||||
import it.integry.integrywmsnative.core.di.binders.recyclerview.ItemBinderBase;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||
import it.integry.integrywmsnative.databinding.DialogSwitchUserDepoBinding;
|
||||
|
||||
public class DialogSwitchUserDepoView extends BaseDialogFragment {
|
||||
|
||||
@Inject
|
||||
DialogSwitchUserDepoViewModel mViewModel;
|
||||
|
||||
private DialogSwitchUserDepoBinding mBindings;
|
||||
private Context mContext;
|
||||
|
||||
private final List<AvailableCodMdepsDTO> availableCodMdeps;
|
||||
private final RunnableArgs<AvailableCodMdepsDTO> onComplete;
|
||||
|
||||
//Pass here all external parameters
|
||||
public static DialogSwitchUserDepoView newInstance(List<AvailableCodMdepsDTO> availableCodMdeps, RunnableArgs<AvailableCodMdepsDTO> onComplete) {
|
||||
return new DialogSwitchUserDepoView(availableCodMdeps, onComplete);
|
||||
}
|
||||
|
||||
private DialogSwitchUserDepoView(List<AvailableCodMdepsDTO> availableCodMdeps, RunnableArgs<AvailableCodMdepsDTO> onComplete) {
|
||||
super();
|
||||
|
||||
this.availableCodMdeps = availableCodMdeps;
|
||||
this.onComplete = onComplete;
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogSwitchUserDepoComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
this.mContext = requireContext();
|
||||
|
||||
mBindings = DialogSwitchUserDepoBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
|
||||
setCancelable(true);
|
||||
|
||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(isCancelable())
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||
alertDialog.setOnShowListener(this);
|
||||
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInit(DialogInterface dialogInterface) {
|
||||
super.onInit(dialogInterface);
|
||||
|
||||
ItemBinder<AvailableCodMdepsDTO> itemBinder = new ItemBinderBase<>(BR.item, R.layout.dialog_switch_user_depo__list_item);
|
||||
|
||||
BindingRecyclerViewAdapter<AvailableCodMdepsDTO> adapter = new BindingRecyclerViewAdapter<>(itemBinder, availableCodMdeps);
|
||||
adapter.setClickHandler(data -> {
|
||||
onComplete.run(data);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
mBindings.availableDepoList.setAdapter(adapter);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.switch_user_depo;
|
||||
|
||||
public class DialogSwitchUserDepoViewModel {
|
||||
|
||||
}
|
||||
@@ -2,14 +2,13 @@ package it.integry.integrywmsnative.view.dialogs.tracciamento_imballi;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
||||
|
||||
@Module(subcomponents = DialogTracciamentoImballiComponent.class)
|
||||
public class DialogTracciamentoImballiModule {
|
||||
|
||||
@Provides
|
||||
DialogTracciamentoImballiViewModel providesDialogTracciamentoImballiViewModel(ImballiRESTConsumer imballiRESTConsumer) {
|
||||
return new DialogTracciamentoImballiViewModel(imballiRESTConsumer);
|
||||
DialogTracciamentoImballiViewModel providesDialogTracciamentoImballiViewModel() {
|
||||
return new DialogTracciamentoImballiViewModel();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,33 +7,29 @@ import androidx.lifecycle.MutableLiveData;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ImballiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
|
||||
public class DialogTracciamentoImballiViewModel {
|
||||
|
||||
private final ImballiRESTConsumer imballiRESTConsumer;
|
||||
|
||||
private final MutableLiveData<List<TracciamentoImballoDTO>> imballiRegistrati = new MutableLiveData<>(new ArrayList<>());
|
||||
private final ObservableArrayList<MtbTCol> imballiDisponibili = new ObservableArrayList<>();
|
||||
private final ObservableArrayList<ObservableMtbTcol> imballiDisponibili = new ObservableArrayList<>();
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
public DialogTracciamentoImballiViewModel(ImballiRESTConsumer imballiRESTConsumer) {
|
||||
this.imballiRESTConsumer = imballiRESTConsumer;
|
||||
public DialogTracciamentoImballiViewModel() {
|
||||
}
|
||||
|
||||
|
||||
public void init() {
|
||||
this.imballiRESTConsumer.retrieveTipiCollo(MtbTCol.FlagUiUlEnum.UI, tipiCollo -> {
|
||||
imballiDisponibili.addAll(SettingsManager.iDB().getInternalImballi().stream()
|
||||
.filter(x -> x.getFlagUIUL() == MtbTCol.FlagUiUlEnum.UI)
|
||||
.collect(Collectors.toUnmodifiableList()));
|
||||
|
||||
if (tipiCollo == null || tipiCollo.isEmpty())
|
||||
return;
|
||||
|
||||
imballiDisponibili.addAll(tipiCollo);
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +37,7 @@ public class DialogTracciamentoImballiViewModel {
|
||||
return imballiRegistrati;
|
||||
}
|
||||
|
||||
public ObservableArrayList<MtbTCol> getImballiDisponibili() {
|
||||
public ObservableArrayList<ObservableMtbTcol> getImballiDisponibili() {
|
||||
return imballiDisponibili;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
import it.integry.integrywmsnative.core.model.observable.ObservableMtbTcol;
|
||||
|
||||
public class DialogTracciamentoImballi_TipoColloAdapter extends ArrayAdapter<DialogTracciamentoImballi_TipoColloAdapter.ListModel> {
|
||||
|
||||
public DialogTracciamentoImballi_TipoColloAdapter(@NonNull Context context, int resource, List<MtbTCol> inputData) {
|
||||
public DialogTracciamentoImballi_TipoColloAdapter(@NonNull Context context, int resource, List<ObservableMtbTcol> inputData) {
|
||||
super(context, resource);
|
||||
|
||||
if(inputData == null) return;
|
||||
@@ -28,12 +28,12 @@ public class DialogTracciamentoImballi_TipoColloAdapter extends ArrayAdapter<Dia
|
||||
|
||||
public static class ListModel {
|
||||
|
||||
private MtbTCol originalModel;
|
||||
private ObservableMtbTcol originalModel;
|
||||
|
||||
public MtbTCol getOriginalModel() {
|
||||
public ObservableMtbTcol getOriginalModel() {
|
||||
return originalModel;
|
||||
}
|
||||
public ListModel setOriginalModel(MtbTCol originalModel) {
|
||||
public ListModel setOriginalModel(ObservableMtbTcol originalModel) {
|
||||
this.originalModel = originalModel;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogYesNoBinding;
|
||||
@@ -56,10 +57,10 @@ public class DialogYesNoView extends DialogFragment {
|
||||
var alertDialog = new MaterialAlertDialogBuilder(requireContext())
|
||||
.setView(binding.getRoot())
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Ok", (dialog, which) -> {
|
||||
.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||
if (onDialogDismiss != null) onDialogDismiss.run(DialogConsts.Results.YES);
|
||||
})
|
||||
.setNegativeButton("Annulla", (dialog, which) -> {
|
||||
.setNegativeButton(R.string.no, (dialog, which) -> {
|
||||
if (onDialogDismiss != null) onDialogDismiss.run(DialogConsts.Results.NO);
|
||||
})
|
||||
.create();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user