Compare commits
55 Commits
v1.16.15(1
...
v1.16.26(2
| Author | SHA1 | Date | |
|---|---|---|---|
| eb94944928 | |||
| 28698ba306 | |||
| c713bbebbc | |||
| 38e2a02766 | |||
| dd8bf264a4 | |||
| 9488c1994d | |||
| 16099cdaf6 | |||
| f061f2bfc9 | |||
| f7253fd44c | |||
| e12d371567 | |||
| 5596f71c03 | |||
| 8669b812f5 | |||
| 3243484dd0 | |||
| 37114dc4d1 | |||
| d5af79abba | |||
| b50aa7a9d2 | |||
| cc333c3147 | |||
| fc5044134c | |||
| 93a3e39332 | |||
| 3eaf187136 | |||
| 36f9fa1e36 | |||
| 0f89913609 | |||
| 4cda247ddc | |||
| e88ea0a45c | |||
| 726cf80dc0 | |||
| a779d8b94d | |||
| f41e1f3a02 | |||
| aa75a77913 | |||
| 639be21ab5 | |||
| dfc241e7f6 | |||
| 7948c7fa97 | |||
| 2ae311c28a | |||
| 56ba43183c | |||
| b93b309ea8 | |||
| f5a2d012e5 | |||
| bf07e3d0f0 | |||
| 91f075976d | |||
| ee70faefa9 | |||
| 13cca99b09 | |||
| e55b6f4934 | |||
| 62d4b6f724 | |||
| 19b0465569 | |||
| d4f44c1ab7 | |||
| 6bf183d73c | |||
| a939f0ba08 | |||
| 08b44cb45b | |||
| fef57622cf | |||
| cbf36ec962 | |||
| adc7343352 | |||
| 94b2959d29 | |||
| 11903d1a34 | |||
| ff448b36b9 | |||
| aa8a54547c | |||
| e1d1878131 | |||
| 00c90021b5 |
@@ -6,8 +6,8 @@ apply plugin: 'com.google.gms.google-services'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
def appVersionCode = 197
|
def appVersionCode = 208
|
||||||
def appVersionName = '1.16.15'
|
def appVersionName = '1.16.26'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
@@ -101,7 +101,7 @@ dependencies {
|
|||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'com.google.android.material:material:1.3.0-rc01'
|
implementation 'com.google.android.material:material:1.3.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||||
implementation 'androidx.cardview:cardview:1.0.0'
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
|||||||
import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration;
|
import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration;
|
||||||
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
|
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
|
||||||
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
|
import it.integry.integrywmsnative.core.class_router.interfaces.ICustomConfiguration;
|
||||||
|
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||||
import it.integry.integrywmsnative.core.expansion.OnSingleClickListener;
|
import it.integry.integrywmsnative.core.expansion.OnSingleClickListener;
|
||||||
@@ -42,6 +43,7 @@ import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
|||||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||||
import it.integry.integrywmsnative.core.update.UpdatesManager;
|
import it.integry.integrywmsnative.core.update.UpdatesManager;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityContext;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilitySettings;
|
import it.integry.integrywmsnative.core.utility.UtilitySettings;
|
||||||
import it.integry.integrywmsnative.databinding.ActivityMainBinding;
|
import it.integry.integrywmsnative.databinding.ActivityMainBinding;
|
||||||
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
||||||
@@ -59,6 +61,9 @@ public class MainActivity extends BaseActivity
|
|||||||
@Inject
|
@Inject
|
||||||
AppDatabase mAppDatabase;
|
AppDatabase mAppDatabase;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ColliDataRecoverService mColliDataRecoverService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -68,10 +73,13 @@ public class MainActivity extends BaseActivity
|
|||||||
.create()
|
.create()
|
||||||
.inject(this);
|
.inject(this);
|
||||||
|
|
||||||
|
mColliDataRecoverService.init(this);
|
||||||
|
|
||||||
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_main, null, false);
|
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_main, null, false);
|
||||||
setContentView(mBinding.getRoot());
|
setContentView(mBinding.getRoot());
|
||||||
|
|
||||||
UpdatesManager.init(this);
|
UpdatesManager.init(this);
|
||||||
|
UtilityContext.initMainActivity(this);
|
||||||
|
|
||||||
setSupportActionBar(mBinding.appBarMain.toolbar);
|
setSupportActionBar(mBinding.appBarMain.toolbar);
|
||||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||||
|
|||||||
@@ -27,10 +27,18 @@ import it.integry.integrywmsnative.gest.spedizione.SpedizioneComponent;
|
|||||||
import it.integry.integrywmsnative.gest.spedizione.SpedizioneModule;
|
import it.integry.integrywmsnative.gest.spedizione.SpedizioneModule;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.prod_fabbisogno_linee_prod.DialogRowInfoProdFabbisognoLineeProdComponent;
|
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.prod_fabbisogno_linee_prod.DialogRowInfoProdFabbisognoLineeProdComponent;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.prod_fabbisogno_linee_prod.DialogRowInfoProdFabbisognoLineeProdModule;
|
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.prod_fabbisogno_linee_prod.DialogRowInfoProdFabbisognoLineeProdModule;
|
||||||
|
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteModule;
|
||||||
|
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreModule;
|
||||||
|
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceModule;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Component;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Component;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Module;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Module;
|
||||||
import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArtComponent;
|
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_art.DialogScanArtModule;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUComponent;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUModule;
|
||||||
|
|
||||||
// Definition of the Application graph
|
// Definition of the Application graph
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -44,11 +52,15 @@ import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArtModule;
|
|||||||
RettificaGiacenzeModule.class,
|
RettificaGiacenzeModule.class,
|
||||||
SpedizioneModule.class,
|
SpedizioneModule.class,
|
||||||
AccettazionePickingModule.class,
|
AccettazionePickingModule.class,
|
||||||
|
UltimeConsegneClienteModule.class,
|
||||||
|
UltimiArriviFornitoreModule.class,
|
||||||
PickingResiModule.class,
|
PickingResiModule.class,
|
||||||
OrdiniUscitaElencoModule.class,
|
OrdiniUscitaElencoModule.class,
|
||||||
DialogInputQuantityV2Module.class,
|
DialogInputQuantityV2Module.class,
|
||||||
DialogScanArtModule.class,
|
DialogScanArtModule.class,
|
||||||
|
DialogScanOrCreateLUModule.class,
|
||||||
ProdFabbisognoLineeProdModule.class,
|
ProdFabbisognoLineeProdModule.class,
|
||||||
|
VersamentoMerceModule.class,
|
||||||
DialogAskMagazzinoProssimitaModule.class,
|
DialogAskMagazzinoProssimitaModule.class,
|
||||||
DialogRowInfoProdFabbisognoLineeProdModule.class})
|
DialogRowInfoProdFabbisognoLineeProdModule.class})
|
||||||
public interface MainApplicationComponent {
|
public interface MainApplicationComponent {
|
||||||
@@ -60,11 +72,15 @@ public interface MainApplicationComponent {
|
|||||||
RettificaGiacenzeComponent.Factory rettificaGiacenzeComponent();
|
RettificaGiacenzeComponent.Factory rettificaGiacenzeComponent();
|
||||||
SpedizioneComponent.Factory spedizioneComponent();
|
SpedizioneComponent.Factory spedizioneComponent();
|
||||||
AccettazionePickingComponent.Factory accettazionePickingComponent();
|
AccettazionePickingComponent.Factory accettazionePickingComponent();
|
||||||
|
UltimeConsegneClienteComponent.Factory ultimeConsegneClienteComponent();
|
||||||
|
UltimiArriviFornitoreComponent.Factory ultimiArriviFornitoreComponent();
|
||||||
PickingResiComponent.Factory pickingResiComponent();
|
PickingResiComponent.Factory pickingResiComponent();
|
||||||
OrdiniUscitaElencoComponent.Factory prodOrdineLavorazioneElencoComponent();
|
OrdiniUscitaElencoComponent.Factory prodOrdineLavorazioneElencoComponent();
|
||||||
DialogInputQuantityV2Component.Factory dialogInputQuantityV2Component();
|
DialogInputQuantityV2Component.Factory dialogInputQuantityV2Component();
|
||||||
DialogScanArtComponent.Factory dialogScanArtComponent();
|
DialogScanArtComponent.Factory dialogScanArtComponent();
|
||||||
|
DialogScanOrCreateLUComponent.Factory dialogScanOrCreateLUComponent();
|
||||||
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
|
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
|
||||||
|
VersamentoMerceComponent.Factory versamentoMerceComponent();
|
||||||
DialogAskMagazzinoProssimitaComponent.Factory dialogAskMagazzinoProssimitaComponent();
|
DialogAskMagazzinoProssimitaComponent.Factory dialogAskMagazzinoProssimitaComponent();
|
||||||
DialogRowInfoProdFabbisognoLineeProdComponent.Factory dialogRowInfoProdFabbisognoLineeProdComponent();
|
DialogRowInfoProdFabbisognoLineeProdComponent.Factory dialogRowInfoProdFabbisognoLineeProdComponent();
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class MainApplicationModule {
|
|||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
ColliDataRecoverService provideColliDataRecoverService() {
|
ColliDataRecoverService provideColliDataRecoverService() {
|
||||||
return new ColliDataRecoverService(mContext);
|
return new ColliDataRecoverService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|||||||
@@ -6,22 +6,21 @@ import android.content.pm.PackageManager;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.widget.TextView;
|
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.context.MainContext;
|
import it.integry.integrywmsnative.core.context.MainContext;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.PermissionsHelper;
|
import it.integry.integrywmsnative.core.utility.PermissionsHelper;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityContext;
|
||||||
import it.integry.integrywmsnative.databinding.ActivitySplashBinding;
|
import it.integry.integrywmsnative.databinding.ActivitySplashBinding;
|
||||||
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class SplashActivity extends BaseActivity {
|
public class SplashActivity extends BaseActivity {
|
||||||
|
|
||||||
@@ -39,6 +38,8 @@ public class SplashActivity extends BaseActivity {
|
|||||||
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_splash, null, false);
|
mBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.activity_splash, null, false);
|
||||||
setContentView(mBinding.getRoot());
|
setContentView(mBinding.getRoot());
|
||||||
|
|
||||||
|
UtilityContext.initMainActivity(this);
|
||||||
|
|
||||||
initAppVersion();
|
initAppVersion();
|
||||||
|
|
||||||
initPermissions(this::init);
|
initPermissions(this::init);
|
||||||
@@ -49,10 +50,10 @@ public class SplashActivity extends BaseActivity {
|
|||||||
onComplete.run();
|
onComplete.run();
|
||||||
}, permanentlyDenied -> {
|
}, permanentlyDenied -> {
|
||||||
if(permanentlyDenied) {
|
if(permanentlyDenied) {
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(this,
|
DialogSimpleMessageView.makeErrorDialog(new SpannableString(getText(R.string.permissions_permanently_denied)), null, () -> {
|
||||||
new SpannableString(getText(R.string.permissions_permanently_denied)), null, () -> {
|
|
||||||
this.finish();
|
this.finish();
|
||||||
}).show();
|
})
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
} else {
|
} else {
|
||||||
initPermissions(onComplete);
|
initPermissions(onComplete);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import com.orhanobut.logger.Logger;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.BuildConfig;
|
import it.integry.integrywmsnative.BuildConfig;
|
||||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecover;
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.settings.Stash;
|
import it.integry.integrywmsnative.core.settings.Stash;
|
||||||
@@ -41,8 +40,6 @@ public class AppContext {
|
|||||||
this.initCrashlytics();
|
this.initCrashlytics();
|
||||||
|
|
||||||
this.initLogger();
|
this.initLogger();
|
||||||
|
|
||||||
this.initRecoverColli();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -77,9 +74,5 @@ public class AppContext {
|
|||||||
Logger.addLogAdapter(new AndroidLogAdapter());
|
Logger.addLogAdapter(new AndroidLogAdapter());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initRecoverColli() {
|
|
||||||
ColliDataRecover.init(mContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,25 @@
|
|||||||
package it.integry.integrywmsnative.core.context;
|
package it.integry.integrywmsnative.core.context;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.text.Html;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
|
import android.text.Spanned;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.net.ConnectException;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.MainApplication;
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||||
|
import it.integry.integrywmsnative.core.data_recover.ColliDataRecover;
|
||||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilitySettings;
|
import it.integry.integrywmsnative.core.utility.UtilitySettings;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class MainContext {
|
public class MainContext {
|
||||||
|
|
||||||
@@ -37,6 +41,8 @@ public class MainContext {
|
|||||||
this.initReflections();
|
this.initReflections();
|
||||||
|
|
||||||
this.initServerStatusChecker();
|
this.initServerStatusChecker();
|
||||||
|
|
||||||
|
ColliDataRecover.init(mContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -46,11 +52,23 @@ public class MainContext {
|
|||||||
|
|
||||||
private void initDBData(Runnable onComplete) {
|
private void initDBData(Runnable onComplete) {
|
||||||
SettingsManager.loadDBVariables(onComplete, ex -> {
|
SettingsManager.loadDBVariables(onComplete, ex -> {
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(mContext,
|
|
||||||
new SpannableString(ex.getMessage()), null, mContext::finish, R.string.logout, () -> {
|
Spanned message = null;
|
||||||
|
|
||||||
|
if (ex.getCause() != null && ex.getCause() instanceof ConnectException) {
|
||||||
|
message = Html.fromHtml("Impossibile collegarsi all'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
|
||||||
|
} else if (ex.getMessage().startsWith("Status 404:")) {
|
||||||
|
message = Html.fromHtml("Errore 404. Non è stato possibile soddisfare la richiesta sull'host <b>" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "</b>. Riprovare più tardi.");
|
||||||
|
} else {
|
||||||
|
message = new SpannableString(ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogSimpleMessageView.makeErrorDialog(
|
||||||
|
message, null, mContext::finish, R.string.logout, () -> {
|
||||||
UtilitySettings.logout();
|
UtilitySettings.logout();
|
||||||
MainApplication.exit();
|
MainApplication.exit();
|
||||||
}).show();
|
})
|
||||||
|
.show(mContext.getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package it.integry.integrywmsnative.core.data_recover;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.annimon.stream.Optional;
|
import com.annimon.stream.Optional;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.google.android.gms.common.util.IOUtils;
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
@@ -107,11 +108,11 @@ public class ColliDataRecover {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Context mContext;
|
private static AppCompatActivity mContext;
|
||||||
|
|
||||||
private static List<RecoverDTO> mtbColtsSessions = new ArrayList<>();
|
private static List<RecoverDTO> mtbColtsSessions = new ArrayList<>();
|
||||||
|
|
||||||
public static void init(Context context) {
|
public static void init(AppCompatActivity context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
|
||||||
if(isFilePresent(CommonConst.Files.RECOVER_COLLO_FILE)) {
|
if(isFilePresent(CommonConst.Files.RECOVER_COLLO_FILE)) {
|
||||||
@@ -120,7 +121,7 @@ public class ColliDataRecover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean thereIsAnExistantSession() {
|
public static boolean thereIsAnExistantSession() {
|
||||||
return mtbColtsSessions.size() > 0;
|
return mtbColtsSessions != null && mtbColtsSessions.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Integer> getAllSessionIDs() {
|
public static List<Integer> getAllSessionIDs() {
|
||||||
@@ -191,13 +192,16 @@ public class ColliDataRecover {
|
|||||||
try {
|
try {
|
||||||
inputStream = mContext.openFileInput(CommonConst.Files.RECOVER_COLLO_FILE);
|
inputStream = mContext.openFileInput(CommonConst.Files.RECOVER_COLLO_FILE);
|
||||||
|
|
||||||
byte[] bytes = IOUtils.readInputStreamFully(inputStream);
|
byte[] bytes = new byte[inputStream.available()];
|
||||||
|
inputStream.read(bytes);
|
||||||
|
inputStream.close();
|
||||||
|
|
||||||
String jsonString = new String(bytes);
|
String jsonString = new String(bytes);
|
||||||
|
|
||||||
Type listType = new TypeToken<ArrayList<RecoverDTO>>(){}.getType();
|
Type listType = new TypeToken<ArrayList<RecoverDTO>>(){}.getType();
|
||||||
mtbColtsSessions = gson.fromJson(jsonString, listType);
|
mtbColtsSessions = gson.fromJson(jsonString, listType);
|
||||||
|
|
||||||
inputStream.close();
|
if(mtbColtsSessions == null) mtbColtsSessions = new ArrayList<>();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
UtilityExceptions.defaultException(mContext, e);
|
UtilityExceptions.defaultException(mContext, e);
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.data_recover;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.annimon.stream.Optional;
|
import com.annimon.stream.Optional;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.google.android.gms.common.util.IOUtils;
|
import com.google.android.gms.common.util.IOUtils;
|
||||||
@@ -28,20 +30,21 @@ import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
|||||||
public class ColliDataRecoverService {
|
public class ColliDataRecoverService {
|
||||||
|
|
||||||
|
|
||||||
private final Context mContext;
|
private AppCompatActivity mContext;
|
||||||
private List<ColliDataRecoverDTO> mtbColtsSessions = new ArrayList<>();
|
private List<ColliDataRecoverDTO> mtbColtsSessions = new ArrayList<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ColliDataRecoverService(Context context) {
|
public ColliDataRecoverService() {
|
||||||
this.mContext = context;
|
}
|
||||||
|
|
||||||
|
public void init(AppCompatActivity appCompatActivity) {
|
||||||
|
this.mContext = appCompatActivity;
|
||||||
|
|
||||||
if(isFilePresent(CommonConst.Files.RECOVER_COLLO_FILE)) {
|
if(isFilePresent(CommonConst.Files.RECOVER_COLLO_FILE)) {
|
||||||
loadLocalFile();
|
loadLocalFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean thereIsAnExistantSession() {
|
public boolean thereIsAnExistantSession() {
|
||||||
return mtbColtsSessions.size() > 0;
|
return mtbColtsSessions.size() > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package it.integry.integrywmsnative.core.exception;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
|
public class AlreadyAttachedDocumentToLUException extends Exception {
|
||||||
|
|
||||||
|
public AlreadyAttachedDocumentToLUException() {
|
||||||
|
super(UtilityResources.getString(R.string.lu_already_attache_to_doc));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.exception;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
|
|
||||||
public class MyExceptionHandler implements
|
|
||||||
java.lang.Thread.UncaughtExceptionHandler {
|
|
||||||
private final Context myContext;
|
|
||||||
private final Class<?> myActivityClass;
|
|
||||||
|
|
||||||
public MyExceptionHandler(Context context, Class<?> c) {
|
|
||||||
|
|
||||||
myContext = context;
|
|
||||||
myActivityClass = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void uncaughtException(Thread thread, Throwable exception) {
|
|
||||||
|
|
||||||
StringWriter stackTrace = new StringWriter();
|
|
||||||
exception.printStackTrace(new PrintWriter(stackTrace));
|
|
||||||
System.err.println(stackTrace);// You can use LogCat too
|
|
||||||
// Intent intent = new Intent(myContext, myActivityClass);
|
|
||||||
// String s = stackTrace.toString();
|
|
||||||
// //you can use this String to know what caused the exception and in which Activity
|
|
||||||
// intent.putExtra("uncaughtException",
|
|
||||||
// "Exception is: " + stackTrace.toString());
|
|
||||||
// intent.putExtra("stacktrace", s);
|
|
||||||
// myContext.startActivity(intent);
|
|
||||||
//for restarting the Activity
|
|
||||||
// Process.killProcess(Process.myPid());
|
|
||||||
// System.exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package it.integry.integrywmsnative.core.exception;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
|
public class NoArtsInLUException extends Exception {
|
||||||
|
|
||||||
|
public NoArtsInLUException() {
|
||||||
|
super(UtilityResources.getString(R.string.no_items_found_message));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package it.integry.integrywmsnative.core.exception;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
|
public class TooManyLUFoundInMonoLUPositionException extends Exception {
|
||||||
|
|
||||||
|
public TooManyLUFoundInMonoLUPositionException() {
|
||||||
|
super(UtilityResources.getString(R.string.too_much_lu_found_message_in_mono_lu));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,19 +12,24 @@ public class BaseFragment extends Fragment {
|
|||||||
|
|
||||||
|
|
||||||
protected void openProgress() {
|
protected void openProgress() {
|
||||||
if (this.mCurrentProgress == null) {
|
|
||||||
|
new Thread(() -> {
|
||||||
getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
if (this.mCurrentProgress == null) {
|
||||||
|
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void closeProgress() {
|
protected void closeProgress() {
|
||||||
if (mCurrentProgress != null) {
|
new Thread(() -> {
|
||||||
getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
mCurrentProgress.dismiss();
|
if (mCurrentProgress != null) {
|
||||||
mCurrentProgress = null;
|
mCurrentProgress.dismiss();
|
||||||
|
mCurrentProgress = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package it.integry.integrywmsnative.core.expansion.view;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
import androidx.databinding.ObservableList;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.zhukic.sectionedrecyclerview.SectionedRecyclerViewAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||||
|
|
||||||
|
public abstract class ExtendedSectionedRecyclerView<T, SH extends RecyclerView.ViewHolder, VH extends RecyclerView.ViewHolder>
|
||||||
|
extends SectionedRecyclerViewAdapter<SH, VH> {
|
||||||
|
|
||||||
|
protected ArrayList<T> mDataset = new ArrayList<>();
|
||||||
|
private View mEmptyView;
|
||||||
|
|
||||||
|
public ExtendedSectionedRecyclerView(ObservableArrayList<T> myDataset) {
|
||||||
|
mDataset.addAll(myDataset);
|
||||||
|
|
||||||
|
myDataset.addOnListChangedCallback(new OnListGeneralChangedCallback() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(ObservableList sender) {
|
||||||
|
mDataset.clear();
|
||||||
|
mDataset.addAll(sender);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
notifyDataChanged();
|
||||||
|
checkIfEmpty();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
checkIfEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExtendedSectionedRecyclerView<T, SH, VH> setEmptyView(View emptyView) {
|
||||||
|
this.mEmptyView = emptyView;
|
||||||
|
this.checkIfEmpty();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemSize() {
|
||||||
|
return this.mDataset.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkIfEmpty() {
|
||||||
|
if (mEmptyView != null) {
|
||||||
|
final boolean emptyViewVisible = getItemSize() == 0;
|
||||||
|
mEmptyView.setVisibility(emptyViewVisible ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import java.math.BigDecimal;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
|
|
||||||
public class MtbColr extends EntityBase {
|
public class MtbColr extends EntityBase {
|
||||||
@@ -56,6 +57,10 @@ public class MtbColr extends EntityBase {
|
|||||||
|
|
||||||
public MtbColr() {
|
public MtbColr() {
|
||||||
type = "mtb_colr";
|
type = "mtb_colr";
|
||||||
|
|
||||||
|
if(SettingsManager.i().isUserLoggedIn()) {
|
||||||
|
setUtente(SettingsManager.i().getUser().getFullname());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,10 @@ public class MtbColt extends EntityBase {
|
|||||||
type = "mtb_colt";
|
type = "mtb_colt";
|
||||||
setDataCollo(UtilityDate.getDateInstance());
|
setDataCollo(UtilityDate.getDateInstance());
|
||||||
setSerCollo("/");
|
setSerCollo("/");
|
||||||
|
|
||||||
|
if(SettingsManager.i().isUserLoggedIn()) {
|
||||||
|
setPreparatoDa(SettingsManager.i().getUser().getFullname());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbColt initDefaultFields() {
|
public MtbColt initDefaultFields() {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
@@ -125,7 +126,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createColloLavorazione(int segno, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
MtbColt mtbColtToCreate = new MtbColt()
|
MtbColt mtbColtToCreate = new MtbColt()
|
||||||
.setSegno(segno)
|
.setSegno(segno)
|
||||||
.setGestione(GestioneEnum.LAVORAZIONE);
|
.setGestione(GestioneEnum.LAVORAZIONE);
|
||||||
@@ -136,16 +137,10 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||||
|
|
||||||
|
|
||||||
saveColloStatic(mtbColtToCreate, new ISimpleOperationCallback<MtbColt>() {
|
saveCollo(mtbColtToCreate, value -> {
|
||||||
@Override
|
if (onComplete != null) onComplete.run(value);
|
||||||
public void onSuccess(MtbColt value) {
|
}, ex -> {
|
||||||
if (onComplete != null) onComplete.run(value);
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailed(Exception ex) {
|
|
||||||
if (onFailed != null) onFailed.run(ex);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +207,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createColliScaricoDaOrdineLavorazione(MtbColt sourceMtbColt,MtbColr sourceMtbColr, MtbDepoPosizione posizione, List<OrdineLavorazioneDTO> ordini, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public static void createColliScaricoDaOrdineLavorazione(MtbColt sourceMtbColt, MtbColr sourceMtbColr, MtbDepoPosizione posizione, List<OrdineLavorazioneDTO> ordini, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
MtbColt newMtbColt = new MtbColt()
|
MtbColt newMtbColt = new MtbColt()
|
||||||
.initDefaultFields()
|
.initDefaultFields()
|
||||||
@@ -262,7 +257,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.setPartitaMag(original.getPartitaMag())
|
.setPartitaMag(original.getPartitaMag())
|
||||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||||
for (OrdineLavorazioneDTO ordLav : ordini) {
|
for (OrdineLavorazioneDTO ordLav : ordini) {
|
||||||
if (ordLav.getQtaColVersamento().getBigDecimal().compareTo(BigDecimal.ZERO) > 0){
|
if (ordLav.getQtaColVersamento().getBigDecimal().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
MtbColr ordColr = (MtbColr) mtbColrClone.clone();
|
MtbColr ordColr = (MtbColr) mtbColrClone.clone();
|
||||||
ordColr.setQtaCol(ordLav.getQtaColVersamento().getBigDecimal());
|
ordColr.setQtaCol(ordLav.getQtaColVersamento().getBigDecimal());
|
||||||
ordColr.setNumCnf(ordLav.getNumCnfVersamento().getBigDecimal());
|
ordColr.setNumCnf(ordLav.getNumCnfVersamento().getBigDecimal());
|
||||||
@@ -290,12 +285,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void createColloFromEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
public void createColloFromEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
createColloFromEtichettaAnonima(barcodeScanDTO.getStringValue(), gestione, onComplete, onFailed);
|
createColloFromEtichettaAnonima(barcodeScanDTO.getStringValue(), gestione, onComplete, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void createColloFromEtichettaAnonima(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
public static void createColloFromEtichettaAnonima(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
|
||||||
|
|
||||||
MtbColt mtbColtToCreate = new MtbColt()
|
MtbColt mtbColtToCreate = new MtbColt()
|
||||||
.setGestione(gestione);
|
.setGestione(gestione);
|
||||||
@@ -321,39 +315,22 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
mtbColtToCreate
|
mtbColtToCreate
|
||||||
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
.setOperation(CommonModelConsts.OPERATION.INSERT);
|
||||||
|
|
||||||
saveColloStatic(mtbColtToCreate, new ISimpleOperationCallback<MtbColt>() {
|
saveCollo(mtbColtToCreate, value -> {
|
||||||
@Override
|
if (onComplete != null) onComplete.run(value);
|
||||||
public void onSuccess(MtbColt value) {
|
}, ex -> {
|
||||||
if (onComplete != null) onComplete.run(value);
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailed(Exception ex) {
|
|
||||||
if (onFailed != null) onFailed.run(ex);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteCollo(MtbColt mtbColtToDelete, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void deleteCollo(MtbColt mtbColtToDelete, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
ColliMagazzinoRESTConsumer.deleteColloStatic(mtbColtToDelete, onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void deleteColloStatic(MtbColt mtbColtToDelete, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
|
||||||
|
|
||||||
mtbColtToDelete.setOperation(CommonModelConsts.OPERATION.DELETE);
|
mtbColtToDelete.setOperation(CommonModelConsts.OPERATION.DELETE);
|
||||||
|
|
||||||
saveColloStatic(mtbColtToDelete, new ISimpleOperationCallback<MtbColt>() {
|
saveCollo(mtbColtToDelete, value -> {
|
||||||
@Override
|
if (onComplete != null) onComplete.run();
|
||||||
public void onSuccess(MtbColt value) {
|
}, ex -> {
|
||||||
if (onComplete != null) onComplete.run();
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailed(Exception ex) {
|
|
||||||
if (onFailed != null) onFailed.run(ex);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void distribuisciCollo(MtbColt mtbColtToDistribute, DistribuzioneColloDTO.CriterioDistribuzione criterioDistribuzione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public static void distribuisciCollo(MtbColt mtbColtToDistribute, DistribuzioneColloDTO.CriterioDistribuzione criterioDistribuzione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
@@ -411,7 +388,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
|
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
|
||||||
List<MtbColt> mtbColtList = new ArrayList<>();
|
List<MtbColt> mtbColtList = new ArrayList<>();
|
||||||
mtbColtList.add(mtbColt);
|
mtbColtList.add(mtbColt);
|
||||||
fillMtbAartsOfMtbColts(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
|
fillMtbAartsOfMtbColtsStatic(mtbColtList, mtbColts -> onComplete.run(mtbColts.get(0)), onFailed);
|
||||||
} else {
|
} else {
|
||||||
onComplete.run(mtbColt);
|
onComplete.run(mtbColt);
|
||||||
}
|
}
|
||||||
@@ -426,8 +403,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
fillMtbAartsOfMtbColtsStatic(mtbColts, onComplete, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
public static void fillMtbAartsOfMtbColts(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public static void fillMtbAartsOfMtbColtsStatic(List<MtbColt> mtbColts, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
List<String> codMarts = new ArrayList<>();
|
List<String> codMarts = new ArrayList<>();
|
||||||
|
|
||||||
for (MtbColt mtbColt : mtbColts) {
|
for (MtbColt mtbColt : mtbColts) {
|
||||||
@@ -542,44 +522,37 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void changePosizione(MtbColt mtbColtToSave, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void changePosizione(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
MtbColt mtbColtToSaveClone = (MtbColt) mtbColtToSave.clone();
|
|
||||||
|
|
||||||
mtbColtToSaveClone.setOperation(CommonModelConsts.OPERATION.UPDATE);
|
String codMdep = posizione.getCodMdep();
|
||||||
mtbColtToSaveClone.setMtbColr(new ObservableArrayList<>());
|
String posizioneString = posizione.getPosizione();
|
||||||
|
|
||||||
if (posizione == null) mtbColtToSaveClone.setPosizione(null);
|
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
|
||||||
else mtbColtToSaveClone.setPosizione(posizione.getPosizione());
|
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumer.saveColloStatic(mtbColtToSaveClone, mtbColt -> {
|
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||||
if (onComplete != null) onComplete.run();
|
mtbColtToMoveClone.getMtbColr().get(i)
|
||||||
}, ex -> {
|
.setMtbAart(null)
|
||||||
if (onFailed != null) onFailed.run(ex);
|
.setMtbPartitaMag(null);
|
||||||
});
|
}
|
||||||
|
|
||||||
}
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
|
colliMagazzinoRESTConsumerService
|
||||||
|
.spostaULInPosizione(codMdep,
|
||||||
public void updateRiga(MtbColr mtbColrToUpdate, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
posizioneString,
|
||||||
updateRigaStatic(mtbColrToUpdate, onComplete, onFailed);
|
mtbColtToMoveClone)
|
||||||
}
|
.enqueue(new Callback<ServiceRESTResponse<Object>>() {
|
||||||
|
@Override
|
||||||
public static void updateRigaStatic(MtbColr mtbColrToUpdate, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||||
MtbColt mtbColt = new MtbColt()
|
analyzeAnswer(response, "changePosizione", mtbColts -> {
|
||||||
.setGestione(mtbColrToUpdate.getGestioneEnum())
|
onComplete.run();
|
||||||
.setNumCollo(mtbColrToUpdate.getNumCollo())
|
}, onFailed);
|
||||||
.setSerCollo(mtbColrToUpdate.getSerCollo())
|
}
|
||||||
.setDataCollo(mtbColrToUpdate.getDataColloS());
|
|
||||||
|
|
||||||
mtbColt.getMtbColr().add(mtbColrToUpdate);
|
|
||||||
|
|
||||||
mtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
|
|
||||||
mtbColrToUpdate.setOperation(CommonModelConsts.OPERATION.UPDATE);
|
|
||||||
|
|
||||||
EntityRESTConsumer.processEntity(mtbColt, value -> {
|
|
||||||
if(onComplete != null) onComplete.run();
|
|
||||||
}, onFailed, MtbColt.class);
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||||
|
if (onFailed != null) onFailed.run(new Exception(t));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public void updateDataFine(MtbColt mtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
@@ -659,7 +632,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<List<MtbColt>>> call, Response<ServiceRESTResponse<List<MtbColt>>> response) {
|
public void onResponse(Call<ServiceRESTResponse<List<MtbColt>>> call, Response<ServiceRESTResponse<List<MtbColt>>> response) {
|
||||||
analyzeAnswer(response, "getColliInBasket", mtbColts -> {
|
analyzeAnswer(response, "getColliInBasket", mtbColts -> {
|
||||||
fillMtbAartsOfMtbColts(mtbColts, onComplete, onFailed);
|
fillMtbAartsOfMtbColtsStatic(mtbColts, onComplete, onFailed);
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -670,12 +643,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void creaRettificaCollo(MtbColr sourceMtbColrOriginal, BigDecimal newNumCnf, BigDecimal newQtaTot, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void creaRettificaColloStatic(MtbColr sourceMtbColrOriginal, BigDecimal newNumCnf, BigDecimal newQtaTot, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
|
||||||
MtbColr sourceMtbColr = (MtbColr) sourceMtbColrOriginal.clone();
|
MtbColr sourceMtbColr = (MtbColr) sourceMtbColrOriginal.clone();
|
||||||
sourceMtbColr.setMtbPartitaMag(null);
|
sourceMtbColr.setMtbPartitaMag(null);
|
||||||
sourceMtbColr.setMtbAart(null);
|
sourceMtbColr.setMtbAart(null);
|
||||||
@@ -692,22 +660,48 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
|||||||
).enqueue(new Callback<ServiceRESTResponse<MtbColr>>() {
|
).enqueue(new Callback<ServiceRESTResponse<MtbColr>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<MtbColr>> call, Response<ServiceRESTResponse<MtbColr>> response) {
|
public void onResponse(Call<ServiceRESTResponse<MtbColr>> call, Response<ServiceRESTResponse<MtbColr>> response) {
|
||||||
analyzeAnswer(response, "creaRettificaCollo", data -> {
|
analyzeAnswer(response, "creaRettificaCollo", onComplete, onFailed);
|
||||||
onComplete.run(data);
|
|
||||||
}, onFailed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<MtbColr>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<MtbColr>> call, Throwable t) {
|
||||||
if(onFailed != null) onFailed.run(new Exception(t));
|
if (onFailed != null) onFailed.run(new Exception(t));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
||||||
|
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
|
||||||
|
|
||||||
|
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||||
|
mtbColtToMoveClone.getMtbColr().get(i)
|
||||||
|
.setMtbAart(null)
|
||||||
|
.setMtbPartitaMag(null);
|
||||||
|
}
|
||||||
|
|
||||||
public void creaRettificaCollo(MtbColr sourceMtbColrOriginal, BigDecimal newNumCnf, BigDecimal newQtaTot, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
mtbColtDestClone.setMtbColr(null);
|
||||||
creaRettificaColloStatic(sourceMtbColrOriginal, newNumCnf, newQtaTot, onComplete, onFailed);
|
|
||||||
|
SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO()
|
||||||
|
.setSourceMtbColt(mtbColtToMoveClone)
|
||||||
|
.setDestinationMtbColt(mtbColtDestClone);
|
||||||
|
|
||||||
|
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||||
|
colliMagazzinoRESTConsumerService.spostaArtsTraUL(
|
||||||
|
spostaArtsTraULRequestDTO
|
||||||
|
).enqueue(new Callback<ServiceRESTResponse<Object>>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||||
|
analyzeAnswer(response, "spostaArtsTraUL", data -> {
|
||||||
|
onComplete.run();
|
||||||
|
}, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||||
|
if (onFailed != null) onFailed.run(new Exception(t));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
@@ -29,4 +30,10 @@ public interface ColliMagazzinoRESTConsumerService {
|
|||||||
@POST("creaRettificaCollo")
|
@POST("creaRettificaCollo")
|
||||||
Call<ServiceRESTResponse<MtbColr>> creaRettificaCollo(@Query("codMdep") String codMdep, @Body RettificaULDTO rettificaULDTO);
|
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/spostaArtsTraUL")
|
||||||
|
Call<ServiceRESTResponse<Object>> spostaArtsTraUL(@Body SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,11 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
@@ -28,8 +27,30 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer{
|
|||||||
this.mSystemRESTConsumer = systemRESTConsumer;
|
this.mSystemRESTConsumer = systemRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getPosizioneFromString(String posizione, RunnableArgs<MtbDepoPosizione> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
String sql = "SELECT TOP 1 mtb_depo_posizioni.*," +
|
||||||
|
" CASE WHEN jtb_fasi.cod_jfas IS NULL THEN 'N' ELSE 'S' END AS flag_linea_produzione " +
|
||||||
|
" FROM mtb_depo_posizioni " +
|
||||||
|
" LEFT OUTER JOIN jtb_fasi " +
|
||||||
|
" ON mtb_depo_posizioni.posizione = jtb_fasi.cod_jfas " +
|
||||||
|
" WHERE posizione = " + UtilityDB.valueToString(posizione);
|
||||||
|
|
||||||
|
SystemRESTConsumer.processSqlStatic(sql, MtbDepoPosizione.class, new ISimpleOperationCallback<MtbDepoPosizione>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(MtbDepoPosizione value) {
|
||||||
|
if(onComplete != null) onComplete.run(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailed(Exception ex) {
|
||||||
|
if(onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public static void getAvailablePosizioni(RunnableArgs<List<MtbDepoPosizione>> onComplete, RunnableArgs<Exception> onFailed) {
|
public static void getAvailablePosizioni(RunnableArgs<List<MtbDepoPosizione>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
// String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
|
String codMdep = null;
|
||||||
|
|
||||||
PosizioniRESTConsumerService posizioniRESTConsumerService = RESTBuilder.getService(PosizioniRESTConsumerService.class);
|
PosizioniRESTConsumerService posizioniRESTConsumerService = RESTBuilder.getService(PosizioniRESTConsumerService.class);
|
||||||
posizioniRESTConsumerService.getAvailablePosizioni(codMdep).enqueue(new Callback<ServiceRESTResponse<List<MtbDepoPosizione>>>() {
|
posizioniRESTConsumerService.getAvailablePosizioni(codMdep).enqueue(new Callback<ServiceRESTResponse<List<MtbDepoPosizione>>>() {
|
||||||
@@ -47,11 +68,8 @@ public class PosizioniRESTConsumer extends _BaseRESTConsumer{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getBancaliInPosizione(MtbDepoPosizione mtbDepoPosizione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
|
||||||
getBancaliInPosizioneStatic(mtbDepoPosizione, onComplete, onFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void getBancaliInPosizioneStatic(MtbDepoPosizione mtbDepoPosizione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getBancaliInPosizione(MtbDepoPosizione mtbDepoPosizione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
String sql = "SELECT * FROM mtb_colt WHERE segno > 0 AND cod_mdep = " + UtilityDB.valueToString(mtbDepoPosizione.getCodMdep()) + " AND posizione = " + UtilityDB.valueToString(mtbDepoPosizione.getPosizione());
|
String sql = "SELECT * FROM mtb_colt WHERE segno > 0 AND cod_mdep = " + UtilityDB.valueToString(mtbDepoPosizione.getCodMdep()) + " AND posizione = " + UtilityDB.valueToString(mtbDepoPosizione.getPosizione());
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.model;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
|
||||||
|
public class SpostaArtsTraULRequestDTO {
|
||||||
|
|
||||||
|
|
||||||
|
private MtbColt sourceMtbColt;
|
||||||
|
|
||||||
|
private MtbColt destinationMtbColt;
|
||||||
|
|
||||||
|
public MtbColt getSourceMtbColt() {
|
||||||
|
return sourceMtbColt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpostaArtsTraULRequestDTO setSourceMtbColt(MtbColt sourceMtbColt) {
|
||||||
|
this.sourceMtbColt = sourceMtbColt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbColt getDestinationMtbColt() {
|
||||||
|
return destinationMtbColt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpostaArtsTraULRequestDTO setDestinationMtbColt(MtbColt destinationMtbColt) {
|
||||||
|
this.destinationMtbColt = destinationMtbColt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -33,8 +33,10 @@ public class DBSettingsModel {
|
|||||||
private boolean flagForceAllToColli;
|
private boolean flagForceAllToColli;
|
||||||
private boolean flagSpedizioneEnableManualPick;
|
private boolean flagSpedizioneEnableManualPick;
|
||||||
private boolean flagSpedizioneCanSelectMultipleOrders;
|
private boolean flagSpedizioneCanSelectMultipleOrders;
|
||||||
|
private boolean flagSpedizioneUseQtaOrd;
|
||||||
private String produzioneDefaultCodAnag;
|
private String produzioneDefaultCodAnag;
|
||||||
private String reportNameSpedizionChiudiOrdine;
|
private String reportNameSpedizionChiudiOrdine;
|
||||||
|
private int onNumCnfInputChanged = 1;
|
||||||
|
|
||||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||||
return flagSpedizioneEnableFakeGiacenza;
|
return flagSpedizioneEnableFakeGiacenza;
|
||||||
@@ -234,6 +236,15 @@ public class DBSettingsModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFlagSpedizioneUseQtaOrd() {
|
||||||
|
return flagSpedizioneUseQtaOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagSpedizioneUseQtaOrd(boolean flagSpedizioneUseQtaOrd) {
|
||||||
|
this.flagSpedizioneUseQtaOrd = flagSpedizioneUseQtaOrd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public String getProduzioneDefaultCodAnag() {
|
public String getProduzioneDefaultCodAnag() {
|
||||||
return produzioneDefaultCodAnag;
|
return produzioneDefaultCodAnag;
|
||||||
}
|
}
|
||||||
@@ -251,4 +262,13 @@ public class DBSettingsModel {
|
|||||||
this.reportNameSpedizionChiudiOrdine = reportNameSpedizionChiudiOrdine;
|
this.reportNameSpedizionChiudiOrdine = reportNameSpedizionChiudiOrdine;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getOnNumCnfInputChanged() {
|
||||||
|
return onNumCnfInputChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setOnNumCnfInputChanged(int onNumCnfInputChanged) {
|
||||||
|
this.onNumCnfInputChanged = onNumCnfInputChanged;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -258,6 +258,14 @@ public class SettingsManager {
|
|||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("SPEDIZIONE")
|
.setSection("SPEDIZIONE")
|
||||||
.setKeySection("REPORT_PACKING_LIST"));
|
.setKeySection("REPORT_PACKING_LIST"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("SPEDIZIONE")
|
||||||
|
.setKeySection("FLAG_USE_QTA_ORD"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("SETUP")
|
||||||
|
.setKeySection("ON_NUM_CNF_INPUT_CHANGED"));
|
||||||
|
|
||||||
|
|
||||||
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
|
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
|
||||||
@@ -281,6 +289,12 @@ public class SettingsManager {
|
|||||||
dbSettingsModelIstance.setFlagSpedizioneEnableFakeGiacenza(getValueFromList(list, "SPEDIZIONE", "ENABLE_FAKE_GIACENZA", Boolean.class));
|
dbSettingsModelIstance.setFlagSpedizioneEnableFakeGiacenza(getValueFromList(list, "SPEDIZIONE", "ENABLE_FAKE_GIACENZA", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagSpedizioneCanSelectMultipleOrders(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_SELECT_MULTIPLE_ORDERS", Boolean.class));
|
dbSettingsModelIstance.setFlagSpedizioneCanSelectMultipleOrders(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_SELECT_MULTIPLE_ORDERS", Boolean.class));
|
||||||
dbSettingsModelIstance.setReportNameSpedizionChiudiOrdine(getValueFromList(list, "SPEDIZIONE", "REPORT_PACKING_LIST", String.class));
|
dbSettingsModelIstance.setReportNameSpedizionChiudiOrdine(getValueFromList(list, "SPEDIZIONE", "REPORT_PACKING_LIST", String.class));
|
||||||
|
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
||||||
|
|
||||||
|
Integer onNumCnfInputChanged = getValueFromList(list, "SETUP", "ON_NUM_CNF_INPUT_CHANGED", Integer.class);
|
||||||
|
if(onNumCnfInputChanged != null) {
|
||||||
|
dbSettingsModelIstance.setOnNumCnfInputChanged(onNumCnfInputChanged);
|
||||||
|
}
|
||||||
|
|
||||||
if(onComplete != null) onComplete.run();
|
if(onComplete != null) onComplete.run();
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
|
|||||||
@@ -33,19 +33,24 @@ public class UtilityBarcode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEtichettaPosizione(BarcodeScanDTO barcodeScanDTO) {
|
public static boolean isEtichettaPosizione(BarcodeScanDTO barcodeScanDTO) {
|
||||||
|
return isEtichettaPosizione(barcodeScanDTO, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, boolean enableCheckCodMdep) {
|
||||||
|
String currentCodMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
|
|
||||||
String barcode = barcodeScanDTO.getStringValue();
|
String barcode = barcodeScanDTO.getStringValue();
|
||||||
boolean isPosizione = false;
|
boolean isPosizione = false;
|
||||||
|
|
||||||
if(SettingsManager.iDB().getAvailablePosizioni() != null) {
|
if(SettingsManager.iDB().getAvailablePosizioni() != null) {
|
||||||
Stream<MtbDepoPosizione> tmpStream = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
Stream<MtbDepoPosizione> tmpStream = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcode));
|
.filter(x -> x.getPosizione().equalsIgnoreCase(barcode) && (!enableCheckCodMdep || currentCodMdep.equalsIgnoreCase(x.getCodMdep())));
|
||||||
|
|
||||||
if(tmpStream.count() > 0){
|
if(tmpStream.count() > 0){
|
||||||
isPosizione = true;
|
isPosizione = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return isPosizione;
|
return isPosizione;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,17 +2,28 @@ package it.integry.integrywmsnative.core.utility;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
public class UtilityContext {
|
public class UtilityContext {
|
||||||
|
|
||||||
private static Context mApplicationContext;
|
private static Context mApplicationContext;
|
||||||
|
private static AppCompatActivity mMainActivity;
|
||||||
|
|
||||||
public static void initApplicationContext(Context context) {
|
public static void initApplicationContext(Context context) {
|
||||||
mApplicationContext = context;
|
mApplicationContext = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void initMainActivity(AppCompatActivity mainActivity) {
|
||||||
|
mMainActivity = mainActivity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Context getApplicationContext() {
|
public static Context getApplicationContext() {
|
||||||
return mApplicationContext;
|
return mApplicationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AppCompatActivity getMainActivity() {
|
||||||
|
return mMainActivity;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,15 @@ import android.app.Dialog;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
|
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||||
import com.orhanobut.logger.Logger;
|
import com.orhanobut.logger.Logger;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.BuildConfig;
|
import it.integry.integrywmsnative.BuildConfig;
|
||||||
import it.integry.integrywmsnative.core.rest.CommonRESTException;
|
import it.integry.integrywmsnative.core.rest.CommonRESTException;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class UtilityExceptions {
|
public class UtilityExceptions {
|
||||||
|
|
||||||
@@ -43,8 +46,17 @@ public class UtilityExceptions {
|
|||||||
if(ex.getCause() != null) errorMessage += "<br />" + ex.getCause().getMessage();
|
if(ex.getCause() != null) errorMessage += "<br />" + ex.getCause().getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(context != null) {
|
FragmentManager fm = null;
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(context, new SpannableString(errorMessage), null, null).show();
|
|
||||||
|
if(context != null && context instanceof FragmentActivity) {
|
||||||
|
fm = ((FragmentActivity) context).getSupportFragmentManager();
|
||||||
|
} else if(UtilityContext.getMainActivity() != null) {
|
||||||
|
fm = UtilityContext.getMainActivity().getSupportFragmentManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(fm != null) {
|
||||||
|
DialogSimpleMessageView.makeErrorDialog(new SpannableString(errorMessage), null, null)
|
||||||
|
.show(fm, "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!BuildConfig.DEBUG) {
|
if(!BuildConfig.DEBUG) {
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
package it.integry.integrywmsnative.core.utility;
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.ProgressDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.widget.ProgressBar;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogProgress;
|
import it.integry.integrywmsnative.view.dialogs.DialogProgress;
|
||||||
|
|
||||||
public class UtilityProgress {
|
public class UtilityProgress {
|
||||||
@@ -26,27 +23,4 @@ public class UtilityProgress {
|
|||||||
return progress;
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Thread makeProgressBarIndeterminate(ProgressBar progressBar) {
|
|
||||||
progressBar.setMax(100);
|
|
||||||
|
|
||||||
Thread updateProgressThread = new Thread(() -> {
|
|
||||||
|
|
||||||
try {
|
|
||||||
while (true) {
|
|
||||||
for (int i = 0; i < 100; i++) {
|
|
||||||
progressBar.setProgress(i);
|
|
||||||
Thread.sleep(10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
// String message = ex.toString();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
updateProgressThread.start();
|
|
||||||
|
|
||||||
return updateProgressThread;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,11 +68,11 @@ public class UtilityString {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Spanned formatHtmlString(String format, String... params){
|
public static Spanned formatHtmlString(String format, String... params){
|
||||||
return Html.fromHtml(String.format(format,params));
|
return Html.fromHtml(String.format(format, (Object[]) params));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Spanned formatHtmlStringFromResId(@StringRes int stringId, String... params){
|
public static Spanned formatHtmlStringFromResId(@StringRes int stringId, String... params){
|
||||||
return Html.fromHtml(String.format(UtilityResources.getString(stringId),params));
|
return Html.fromHtml(String.format(UtilityResources.getString(stringId), (Object[]) params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
|
|||||||
import it.integry.integrywmsnative.gest.accettazione.rest.OrdiniAccettazioneRESTConsumer;
|
import it.integry.integrywmsnative.gest.accettazione.rest.OrdiniAccettazioneRESTConsumer;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingActivity;
|
import it.integry.integrywmsnative.gest.accettazione_picking.AccettazionePickingActivity;
|
||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class MainAccettazioneFragment extends Fragment implements ISearcableFragment, ITitledFragment, IScrollableFragment {
|
public class MainAccettazioneFragment extends Fragment implements ISearcableFragment, ITitledFragment, IScrollableFragment {
|
||||||
|
|
||||||
@@ -187,8 +187,7 @@ public class MainAccettazioneFragment extends Fragment implements ISearcableFrag
|
|||||||
.count();
|
.count();
|
||||||
|
|
||||||
|
|
||||||
DialogSimpleMessageHelper.makeInfoDialog(getActivity(),
|
DialogSimpleMessageView.makeInfoDialog(getText(R.string.orders).toString(),
|
||||||
getText(R.string.orders).toString(),
|
|
||||||
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, (int) ordsCounter), ordsCounter)
|
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, (int) ordsCounter), ordsCounter)
|
||||||
+ "<br /><br />" +
|
+ "<br /><br />" +
|
||||||
"<b>" + artsCounter + "</b> " + getActivity().getResources().getQuantityString(R.plurals.available_articles, (int) artsCounter)),
|
"<b>" + artsCounter + "</b> " + getActivity().getResources().getQuantityString(R.plurals.available_articles, (int) artsCounter)),
|
||||||
@@ -203,14 +202,17 @@ public class MainAccettazioneFragment extends Fragment implements ISearcableFrag
|
|||||||
myIntent.putExtra("keySitArts", cacheSitArtItemID);
|
myIntent.putExtra("keySitArts", cacheSitArtItemID);
|
||||||
getActivity().startActivity(myIntent);
|
getActivity().startActivity(myIntent);
|
||||||
|
|
||||||
}).show();
|
}).show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
|
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
|
|
||||||
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
||||||
if(errorMessage == null) errorMessage = ex.getMessage() + "\n" + ex.getCause().getCause().getMessage();
|
if(errorMessage == null) errorMessage = ex.getMessage() + "\n" + ex.getCause().getCause().getMessage();
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(getActivity(), new SpannableString(errorMessage), null, null).show();
|
|
||||||
|
DialogSimpleMessageView
|
||||||
|
.makeErrorDialog(new SpannableString(errorMessage), null, null)
|
||||||
|
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGExcep
|
|||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
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.BottomSheetFragmentLUContentView;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||||
import it.integry.integrywmsnative.view.dialogs.note_aggiuntive_lu.NoteAggiuntiveLUDialog;
|
import it.integry.integrywmsnative.view.dialogs.note_aggiuntive_lu.NoteAggiuntiveLUDialog;
|
||||||
@@ -245,7 +245,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
//Calc Num CNF
|
//Calc Num CNF
|
||||||
BigDecimal numCnfEvasa = BigDecimal.ZERO;
|
BigDecimal numCnfEvasa = BigDecimal.ZERO;
|
||||||
|
|
||||||
if(x.getWithdrawMtbColrs().size() > 0) {
|
if (x.getWithdrawMtbColrs().size() > 0) {
|
||||||
numCnfEvasa = Stream.of(x.getWithdrawMtbColrs())
|
numCnfEvasa = Stream.of(x.getWithdrawMtbColrs())
|
||||||
.map(MtbColr::getNumCnf)
|
.map(MtbColr::getNumCnf)
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
@@ -254,14 +254,13 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
//Calc qta col
|
//Calc qta col
|
||||||
BigDecimal qtaEvasa = BigDecimal.ZERO;
|
BigDecimal qtaEvasa = BigDecimal.ZERO;
|
||||||
|
|
||||||
if(x.getWithdrawMtbColrs().size() > 0) {
|
if (x.getWithdrawMtbColrs().size() > 0) {
|
||||||
qtaEvasa = Stream.of(x.getWithdrawMtbColrs())
|
qtaEvasa = Stream.of(x.getWithdrawMtbColrs())
|
||||||
.map(MtbColr::getQtaCol)
|
.map(MtbColr::getQtaCol)
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().isFlagQtaCnfFissaBoolean())) {
|
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().isFlagQtaCnfFissaBoolean())) {
|
||||||
accettazioneListModel.setQtaEvasa(numCnfEvasa);
|
accettazioneListModel.setQtaEvasa(numCnfEvasa);
|
||||||
accettazioneListModel.setQtaTot(x.getSitArtOrdDTO().getNumCnfDaEvadere());
|
accettazioneListModel.setQtaTot(x.getSitArtOrdDTO().getNumCnfDaEvadere());
|
||||||
@@ -308,7 +307,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
//Calc Num CNF
|
//Calc Num CNF
|
||||||
BigDecimal numCnfEvasa = BigDecimal.ZERO;
|
BigDecimal numCnfEvasa = BigDecimal.ZERO;
|
||||||
|
|
||||||
if(x.getWithdrawMtbColrs().size() > 0) {
|
if (x.getWithdrawMtbColrs().size() > 0) {
|
||||||
numCnfEvasa = Stream.of(x.getWithdrawMtbColrs())
|
numCnfEvasa = Stream.of(x.getWithdrawMtbColrs())
|
||||||
.map(MtbColr::getNumCnf)
|
.map(MtbColr::getNumCnf)
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
@@ -317,14 +316,13 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
//Calc qta col
|
//Calc qta col
|
||||||
BigDecimal qtaEvasa = BigDecimal.ZERO;
|
BigDecimal qtaEvasa = BigDecimal.ZERO;
|
||||||
|
|
||||||
if(x.getWithdrawMtbColrs().size() > 0) {
|
if (x.getWithdrawMtbColrs().size() > 0) {
|
||||||
qtaEvasa = Stream.of(x.getWithdrawMtbColrs())
|
qtaEvasa = Stream.of(x.getWithdrawMtbColrs())
|
||||||
.map(MtbColr::getQtaCol)
|
.map(MtbColr::getQtaCol)
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().isFlagQtaCnfFissaBoolean())) {
|
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().isFlagQtaCnfFissaBoolean())) {
|
||||||
accettazioneListModel.setQtaEvasa(numCnfEvasa);
|
accettazioneListModel.setQtaEvasa(numCnfEvasa);
|
||||||
accettazioneListModel.setQtaTot(x.getSitArtOrdDTO().getNumCnfDaEvadere());
|
accettazioneListModel.setQtaTot(x.getSitArtOrdDTO().getNumCnfDaEvadere());
|
||||||
@@ -371,7 +369,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
//Calc Num CNF
|
//Calc Num CNF
|
||||||
BigDecimal numCnfEvasa = BigDecimal.ZERO;
|
BigDecimal numCnfEvasa = BigDecimal.ZERO;
|
||||||
|
|
||||||
if(x.getWithdrawMtbColrs().size() > 0) {
|
if (x.getWithdrawMtbColrs().size() > 0) {
|
||||||
numCnfEvasa = Stream.of(x.getWithdrawMtbColrs())
|
numCnfEvasa = Stream.of(x.getWithdrawMtbColrs())
|
||||||
.map(MtbColr::getNumCnf)
|
.map(MtbColr::getNumCnf)
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
@@ -380,7 +378,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
//Calc qta col
|
//Calc qta col
|
||||||
BigDecimal qtaEvasa = BigDecimal.ZERO;
|
BigDecimal qtaEvasa = BigDecimal.ZERO;
|
||||||
|
|
||||||
if(x.getWithdrawMtbColrs().size() > 0) {
|
if (x.getWithdrawMtbColrs().size() > 0) {
|
||||||
qtaEvasa = Stream.of(x.getWithdrawMtbColrs())
|
qtaEvasa = Stream.of(x.getWithdrawMtbColrs())
|
||||||
.map(MtbColr::getQtaCol)
|
.map(MtbColr::getQtaCol)
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
@@ -431,7 +429,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
//Calc Num CNF
|
//Calc Num CNF
|
||||||
BigDecimal numCnfEvasa = BigDecimal.ZERO;
|
BigDecimal numCnfEvasa = BigDecimal.ZERO;
|
||||||
|
|
||||||
if(x.getWithdrawMtbColrs().size() > 0) {
|
if (x.getWithdrawMtbColrs().size() > 0) {
|
||||||
numCnfEvasa = Stream.of(x.getWithdrawMtbColrs())
|
numCnfEvasa = Stream.of(x.getWithdrawMtbColrs())
|
||||||
.map(MtbColr::getNumCnf)
|
.map(MtbColr::getNumCnf)
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
@@ -440,7 +438,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
//Calc qta col
|
//Calc qta col
|
||||||
BigDecimal qtaEvasa = BigDecimal.ZERO;
|
BigDecimal qtaEvasa = BigDecimal.ZERO;
|
||||||
|
|
||||||
if(x.getWithdrawMtbColrs().size() > 0) {
|
if (x.getWithdrawMtbColrs().size() > 0) {
|
||||||
qtaEvasa = Stream.of(x.getWithdrawMtbColrs())
|
qtaEvasa = Stream.of(x.getWithdrawMtbColrs())
|
||||||
.map(MtbColr::getQtaCol)
|
.map(MtbColr::getQtaCol)
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
@@ -535,7 +533,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
public void startListaBancaliRegistratiActivity(ArrayList<RecoverMtbColt> mtbColts) {
|
public void startListaBancaliRegistratiActivity(ArrayList<RecoverMtbColt> mtbColts) {
|
||||||
|
|
||||||
Intent myIntent = ListaBancaliActivity.createIntent(this,
|
Intent myIntent = ListaBancaliActivity.createIntent(this,
|
||||||
Stream.of(mtbColts).map(x -> (MtbColt)x).toList(),
|
Stream.of(mtbColts).map(x -> (MtbColt) x).toList(),
|
||||||
input -> ((RecoverMtbColt) input).isFlagCanBeRecovered(),
|
input -> ((RecoverMtbColt) input).isFlagCanBeRecovered(),
|
||||||
PrinterRESTConsumer.Type.SECONDARIA,
|
PrinterRESTConsumer.Type.SECONDARIA,
|
||||||
ReportManager.getReportNameLUFromGestione(GestioneEnum.ACQUISTO));
|
ReportManager.getReportNameLUFromGestione(GestioneEnum.ACQUISTO));
|
||||||
@@ -546,7 +544,9 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
public void onLUSuccessullyPrinted() {
|
public void onLUSuccessullyPrinted() {
|
||||||
Resources res = getResources();
|
Resources res = getResources();
|
||||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||||
DialogSimpleMessageHelper.makeSuccessDialog(this, res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null).show();
|
DialogSimpleMessageView
|
||||||
|
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -556,13 +556,13 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
@Override
|
@Override
|
||||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(
|
DialogSimpleMessageView.makeErrorDialog(
|
||||||
this,
|
|
||||||
new SpannableString(ex.getMessage()),
|
new SpannableString(ex.getMessage()),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
R.string.button_ignore_print,
|
R.string.button_ignore_print,
|
||||||
onComplete).show();
|
onComplete)
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -599,7 +599,7 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
public void onError(Exception ex) {
|
public void onError(Exception ex) {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
|
|
||||||
if(ex instanceof InvalidPesoKGException) {
|
if (ex instanceof InvalidPesoKGException) {
|
||||||
UtilityToast.showToast(ex.getMessage());
|
UtilityToast.showToast(ex.getMessage());
|
||||||
} else {
|
} else {
|
||||||
UtilityExceptions.defaultException(this, ex, mCurrentProgress);
|
UtilityExceptions.defaultException(this, ex, mCurrentProgress);
|
||||||
@@ -664,12 +664,11 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
|||||||
@Override
|
@Override
|
||||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(this,
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
|
||||||
new SpannableString(text),
|
|
||||||
null,
|
null,
|
||||||
() -> onComplete.run(true),
|
() -> onComplete.run(true),
|
||||||
() -> onComplete.run(false)
|
() -> onComplete.run(false)
|
||||||
).show();
|
).show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -98,10 +98,13 @@ public class AccettazionePickingViewModel {
|
|||||||
|
|
||||||
public void init(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts, String codMdep) {
|
public void init(List<OrdineAccettazioneInevasoDTO> orders, List<SitArtOrdDTO> sitArts, String codMdep) {
|
||||||
this.mOrders = orders;
|
this.mOrders = orders;
|
||||||
this.mSitArts = sitArts;
|
|
||||||
this.mDefaultCodMdep = codMdep;
|
this.mDefaultCodMdep = codMdep;
|
||||||
|
|
||||||
getEmptyPickingList(sitArts, pickingObjectList -> {
|
this.mSitArts = Stream.of(sitArts)
|
||||||
|
.filter(x -> UtilityBigDecimal.greaterThan(x.getNumCnfDaEvadere(), BigDecimal.ZERO) && UtilityBigDecimal.greaterThan(x.getQtaDaEvadere(), BigDecimal.ZERO))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
getEmptyPickingList(this.mSitArts, pickingObjectList -> {
|
||||||
this.mPickingList.postValue(pickingObjectList);
|
this.mPickingList.postValue(pickingObjectList);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -136,6 +139,7 @@ public class AccettazionePickingViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void getEmptyPickingList(List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<PickingObjectDTO>> onComplete) {
|
private void getEmptyPickingList(List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<PickingObjectDTO>> onComplete) {
|
||||||
|
|
||||||
List<String> codMarts = Stream.of(sitArtOrdList)
|
List<String> codMarts = Stream.of(sitArtOrdList)
|
||||||
.map(SitArtOrdDTO::getCodMart)
|
.map(SitArtOrdDTO::getCodMart)
|
||||||
.toList();
|
.toList();
|
||||||
@@ -169,7 +173,7 @@ public class AccettazionePickingViewModel {
|
|||||||
public void retrieveExistentLU(RunnableArgs<ArrayList<RecoverMtbColt>> onComplete) {
|
public void retrieveExistentLU(RunnableArgs<ArrayList<RecoverMtbColt>> onComplete) {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
this.mAccettazionePickingRESTConsumer.getBancaliGiaRegistrati(this.mSitArts, mtbColtList -> {
|
this.mAccettazionePickingRESTConsumer.getBancaliGiaRegistrati(this.mOrders, mtbColtList -> {
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
onComplete.run(mtbColtList);
|
onComplete.run(mtbColtList);
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.SitArtOrdDTO;
|
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class AccettazionePickingRESTConsumer {
|
public class AccettazionePickingRESTConsumer {
|
||||||
@@ -28,18 +28,18 @@ public class AccettazionePickingRESTConsumer {
|
|||||||
this.mSystemRestConsumer = systemRESTConsumer;
|
this.mSystemRestConsumer = systemRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getBancaliGiaRegistrati(List<SitArtOrdDTO> ordiniToShow, RunnableArgs<ArrayList<RecoverMtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getBancaliGiaRegistrati(List<OrdineAccettazioneInevasoDTO> ordiniToShow, RunnableArgs<ArrayList<RecoverMtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
List<HashMap<String, Object>> whereCondListMap = new ArrayList<>();
|
List<HashMap<String, Object>> whereCondListMap = new ArrayList<>();
|
||||||
|
|
||||||
Stream
|
Stream
|
||||||
.of(ordiniToShow)
|
.of(ordiniToShow)
|
||||||
.distinctBy(x -> x.getDataOrd() + " " + x.getGestione() + " " + x.getNumOrd())
|
.distinctBy(x -> x.getData() + " " + x.getGestione() + " " + x.getNumero())
|
||||||
.forEach(x -> {
|
.forEach(x -> {
|
||||||
try {
|
try {
|
||||||
HashMap<String, Object> whereCondMap = new HashMap<>();
|
HashMap<String, Object> whereCondMap = new HashMap<>();
|
||||||
whereCondMap.put("mtb_colr.data_ord", UtilityDate.recognizeDate(x.getDataOrd()));
|
whereCondMap.put("mtb_colr.data_ord", UtilityDate.recognizeDate(x.getData()));
|
||||||
whereCondMap.put("mtb_colr.gestione", x.getGestione().equalsIgnoreCase("P") ? "L" : x.getGestione());
|
whereCondMap.put("mtb_colr.gestione", x.getGestione().equalsIgnoreCase("P") ? "L" : x.getGestione());
|
||||||
whereCondMap.put("mtb_colr.num_ord", x.getNumOrd());
|
whereCondMap.put("mtb_colr.num_ord", x.getNumero());
|
||||||
|
|
||||||
whereCondListMap.add(whereCondMap);
|
whereCondListMap.add(whereCondMap);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||||
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleActivity;
|
import it.integry.integrywmsnative.gest.contenuto_bancale.ContenutoBancaleActivity;
|
||||||
import it.integry.integrywmsnative.gest.contenuto_bancale.core.ContenutoBancaleListAdapter;
|
import it.integry.integrywmsnative.gest.contenuto_bancale.core.ContenutoBancaleListAdapter;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
import static android.app.Activity.RESULT_OK;
|
import static android.app.Activity.RESULT_OK;
|
||||||
|
|
||||||
@@ -118,7 +118,9 @@ public class ContenutoBancaleViewModel implements IRecyclerItemClicked<MtbColr>
|
|||||||
|
|
||||||
Resources res = mContext.getResources();
|
Resources res = mContext.getResources();
|
||||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||||
DialogSimpleMessageHelper.makeSuccessDialog(mContext, res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null).show();
|
DialogSimpleMessageView
|
||||||
|
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||||
|
.show(mContext.getSupportFragmentManager(), "tag");
|
||||||
}, ex -> UtilityExceptions.defaultException(mContext, ex, progress));
|
}, ex -> UtilityExceptions.defaultException(mContext, ex, progress));
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
@@ -128,7 +130,9 @@ public class ContenutoBancaleViewModel implements IRecyclerItemClicked<MtbColr>
|
|||||||
} else {
|
} else {
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
String errorMessage = "Nessuna stampante configurata";
|
String errorMessage = "Nessuna stampante configurata";
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext, new SpannableString(errorMessage), null, null).show();
|
DialogSimpleMessageView
|
||||||
|
.makeWarningDialog(new SpannableString(errorMessage), null, null)
|
||||||
|
.show(mContext.getSupportFragmentManager(), "tag");;
|
||||||
}
|
}
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
UtilityExceptions.defaultException(mContext, ex, progress);
|
UtilityExceptions.defaultException(mContext, ex, progress);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class ListaBancaliViewModel implements IRecyclerItemClicked<MtbColt> {
|
|||||||
ColliMagazzinoRESTConsumer.getByTestataStatic(item, mLoadOnlyResiduo, false, mtbColt -> {
|
ColliMagazzinoRESTConsumer.getByTestataStatic(item, mLoadOnlyResiduo, false, mtbColt -> {
|
||||||
|
|
||||||
ObservableArrayList<MtbColr> mtbColrObservableArrayList = new ObservableArrayList<>();
|
ObservableArrayList<MtbColr> mtbColrObservableArrayList = new ObservableArrayList<>();
|
||||||
mtbColrObservableArrayList.addAll(mtbColt.getMtbColr());
|
if(mtbColt != null && mtbColt.getMtbColr() != null) mtbColrObservableArrayList.addAll(mtbColt.getMtbColr());
|
||||||
item.setMtbColr(mtbColrObservableArrayList);
|
item.setMtbColr(mtbColrObservableArrayList);
|
||||||
|
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import it.integry.integrywmsnative.gest.login.LoginActivity;
|
|||||||
import it.integry.integrywmsnative.gest.login.core.LoginHelper;
|
import it.integry.integrywmsnative.gest.login.core.LoginHelper;
|
||||||
import it.integry.integrywmsnative.gest.login.dto.LoginAziendaDTO;
|
import it.integry.integrywmsnative.gest.login.dto.LoginAziendaDTO;
|
||||||
import it.integry.integrywmsnative.gest.login.dto.LoginDTO;
|
import it.integry.integrywmsnative.gest.login.dto.LoginDTO;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class LoginViewModel {
|
public class LoginViewModel {
|
||||||
|
|
||||||
@@ -192,22 +192,22 @@ public class LoginViewModel {
|
|||||||
private void onLoginFailed(final Spanned message){
|
private void onLoginFailed(final Spanned message){
|
||||||
mProgress.dismiss();
|
mProgress.dismiss();
|
||||||
loginButtonEnabled.set(true);
|
loginButtonEnabled.set(true);
|
||||||
mActivity.runOnUiThread(() -> DialogSimpleMessageHelper.makeErrorDialog(
|
mActivity.runOnUiThread(() -> DialogSimpleMessageView.makeErrorDialog(
|
||||||
mActivity,
|
|
||||||
message,
|
message,
|
||||||
null,
|
null,
|
||||||
null).show());
|
null)
|
||||||
|
.show(mActivity.getSupportFragmentManager(), "tag"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void onLoginSuccess(final String title, final Spanned message, final String host, final int port, final List<String> availableProfiles){
|
private void onLoginSuccess(final String title, final Spanned message, final String host, final int port, final List<String> availableProfiles){
|
||||||
mProgress.dismiss();
|
mProgress.dismiss();
|
||||||
mActivity.runOnUiThread(() -> DialogSimpleMessageHelper.makeSuccessDialog(
|
mActivity.runOnUiThread(() -> DialogSimpleMessageView.makeSuccessDialog(
|
||||||
mActivity,
|
|
||||||
title,
|
title,
|
||||||
message,
|
message,
|
||||||
null,
|
null,
|
||||||
() -> showProfileDBSelectionDialog(host, port, availableProfiles)).show());
|
() -> showProfileDBSelectionDialog(host, port, availableProfiles))
|
||||||
|
.show(mActivity.getSupportFragmentManager(), "tag"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showProfileDBSelectionDialog(final String host, final int port, final List<String> availableProfiles){
|
private void showProfileDBSelectionDialog(final String host, final int port, final List<String> availableProfiles){
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.appcompat.widget.AppCompatTextView;
|
import androidx.appcompat.widget.AppCompatTextView;
|
||||||
import androidx.core.content.res.ResourcesCompat;
|
import androidx.core.content.res.ResourcesCompat;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
@@ -33,7 +31,6 @@ import it.integry.integrywmsnative.core.di.BindableBoolean;
|
|||||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IFilterableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IFilterableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ILifecycleFragment;
|
|
||||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||||
@@ -53,9 +50,9 @@ import it.integry.integrywmsnative.gest.ordini_uscita_elenco.list.OrdiniUscitaEl
|
|||||||
import it.integry.integrywmsnative.gest.spedizione.SpedizioneActivity;
|
import it.integry.integrywmsnative.gest.spedizione.SpedizioneActivity;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.BaseDialogRowInfoView;
|
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.BaseDialogRowInfoView;
|
||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledFragment, ILifecycleFragment, IScrollableFragment, ISelectAllFragment, IFilterableFragment, OrdiniUscitaElencoViewModel.Listener {
|
public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledFragment, IScrollableFragment, ISelectAllFragment, IFilterableFragment, OrdiniUscitaElencoViewModel.Listener {
|
||||||
|
|
||||||
public BindableBoolean fabVisible = new BindableBoolean(false);
|
public BindableBoolean fabVisible = new BindableBoolean(false);
|
||||||
|
|
||||||
@@ -128,19 +125,25 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
this.initRecyclerView();
|
this.initRecyclerView();
|
||||||
this.initBarcodeReader();
|
this.initBarcodeReader();
|
||||||
|
|
||||||
|
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
|
mViewModel.init(codMdep, mCurrentGestioneOrd, mCurrentGestioneCol, mCurrentSegnoCol);
|
||||||
|
|
||||||
return mBindings.getRoot();
|
return mBindings.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
public void onStart() {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onStart();
|
||||||
|
|
||||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
if(mAppliedFilterViewModel != null) {
|
||||||
mViewModel.init(codMdep, mCurrentGestioneOrd, mCurrentGestioneCol, mCurrentSegnoCol);
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||||
|
|
||||||
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
||||||
onPreDestroy.run();
|
onPreDestroy.run();
|
||||||
}
|
}
|
||||||
@@ -259,12 +262,6 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
.forEach(x -> x.getSelectedObservable().set(false));
|
.forEach(x -> x.getSelectedObservable().set(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPreDestroy(Runnable onComplete) {
|
|
||||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
|
||||||
onComplete.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
||||||
titleText.setText(context.getText(R.string.prod_ordine_lavorazione_title_fragment).toString());
|
titleText.setText(context.getText(R.string.prod_ordine_lavorazione_title_fragment).toString());
|
||||||
@@ -278,7 +275,6 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
this.mViewModel.loadPicking(selectedOrders);
|
this.mViewModel.loadPicking(selectedOrders);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -315,8 +311,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
|
|
||||||
int alreadyRegisteredUL = alreadyRegisteredMtbColts.size();
|
int alreadyRegisteredUL = alreadyRegisteredMtbColts.size();
|
||||||
|
|
||||||
DialogSimpleMessageHelper.makeInfoDialog(getActivity(),
|
DialogSimpleMessageView.makeInfoDialog(getText(R.string.orders).toString(),
|
||||||
getText(R.string.orders).toString(),
|
|
||||||
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, orders.size()), orders.size())
|
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, orders.size()), orders.size())
|
||||||
+ "<br />" +
|
+ "<br />" +
|
||||||
"<b>" + codMarts.size() + "</b> " + getActivity().getResources().getQuantityString(R.plurals.available_articles, codMarts.size())
|
"<b>" + codMarts.size() + "</b> " + getActivity().getResources().getQuantityString(R.plurals.available_articles, codMarts.size())
|
||||||
@@ -324,7 +319,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
"<b>" + alreadyRegisteredUL + "</b> " + getActivity().getResources().getQuantityString(R.plurals.already_registered_lu, alreadyRegisteredUL)),
|
"<b>" + alreadyRegisteredUL + "</b> " + getActivity().getResources().getQuantityString(R.plurals.already_registered_lu, alreadyRegisteredUL)),
|
||||||
null,
|
null,
|
||||||
() -> SpedizioneActivity.startActivity(getActivity(), sitArts, orders, alreadyRegisteredMtbColts, mCurrentGestioneCol, mCurrentSegnoCol, MtbColr.Causale.DEFAULT, mDialogRowInfo)
|
() -> SpedizioneActivity.startActivity(getActivity(), sitArts, orders, alreadyRegisteredMtbColts, mCurrentGestioneCol, mCurrentSegnoCol, MtbColr.Causale.DEFAULT, mDialogRowInfo)
|
||||||
).show();
|
).show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import it.integry.integrywmsnative.core.exception.InvalidLUMultiGestioneExceptio
|
|||||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoOrderFoundException;
|
import it.integry.integrywmsnative.core.exception.NoOrderFoundException;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
import it.integry.integrywmsnative.core.model.DtbOrdt;
|
import it.integry.integrywmsnative.core.model.DtbOrdt;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||||
@@ -282,10 +283,7 @@ public class OrdiniUscitaElencoViewModel {
|
|||||||
if (this.mListener != null) mListener.onOrdersDispatched(orders, sitArts, alreadyRegisteredMtbColts);
|
if (this.mListener != null) mListener.onOrdersDispatched(orders, sitArts, alreadyRegisteredMtbColts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Listener {
|
public interface Listener extends ILoadingListener {
|
||||||
void onLoadingStarted();
|
|
||||||
|
|
||||||
void onLoadingEnded();
|
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
|||||||
@@ -132,17 +132,25 @@ public class OrdiniUscitaElencoAdapter extends SectionedRecyclerViewAdapter<Ordi
|
|||||||
holder.mBinding.emptyView.setBackgroundColor(listModel.getEtichettaColor());
|
holder.mBinding.emptyView.setBackgroundColor(listModel.getEtichettaColor());
|
||||||
else holder.mBinding.emptyView.setBackgroundColor(ResourcesCompat.getColor(mContext.getResources(), android.R.color.transparent, null));
|
else holder.mBinding.emptyView.setBackgroundColor(ResourcesCompat.getColor(mContext.getResources(), android.R.color.transparent, null));
|
||||||
|
|
||||||
if(!UtilityString.isNullOrEmpty(listModel.getDescription()))
|
if(!UtilityString.isNullOrEmpty(listModel.getDescription())) {
|
||||||
holder.mBinding.descrizione.setText(Html.fromHtml(listModel.getDescription()));
|
holder.mBinding.descrizione.setText(Html.fromHtml(listModel.getDescription()));
|
||||||
|
holder.mBinding.descrizione.setVisibility(View.VISIBLE);
|
||||||
|
} else holder.mBinding.descrizione.setVisibility(View.GONE);
|
||||||
|
|
||||||
if(!UtilityString.isNullOrEmpty(listModel.getSubDescription()))
|
if(!UtilityString.isNullOrEmpty(listModel.getSubDescription())) {
|
||||||
holder.mBinding.subDescrizione.setText(Html.fromHtml(listModel.getSubDescription()));
|
holder.mBinding.subDescrizione.setText(Html.fromHtml(listModel.getSubDescription()));
|
||||||
|
holder.mBinding.subDescrizione.setVisibility(View.VISIBLE);
|
||||||
|
} else holder.mBinding.subDescrizione.setVisibility(View.GONE);
|
||||||
|
|
||||||
if(!UtilityString.isNullOrEmpty(listModel.getRightDescription()))
|
if(!UtilityString.isNullOrEmpty(listModel.getRightDescription())) {
|
||||||
holder.mBinding.rightDescrizione.setText(Html.fromHtml(listModel.getRightDescription()));
|
holder.mBinding.rightDescrizione.setText(Html.fromHtml(listModel.getRightDescription()));
|
||||||
|
holder.mBinding.rightDescrizione.setVisibility(View.VISIBLE);
|
||||||
|
} else holder.mBinding.rightDescrizione.setVisibility(View.GONE);
|
||||||
|
|
||||||
if(!UtilityString.isNullOrEmpty(listModel.getRightSubDescription()))
|
if(!UtilityString.isNullOrEmpty(listModel.getRightSubDescription())) {
|
||||||
holder.mBinding.rightSubDescrizione.setText(Html.fromHtml(listModel.getRightSubDescription()));
|
holder.mBinding.rightSubDescrizione.setText(Html.fromHtml(listModel.getRightSubDescription()));
|
||||||
|
holder.mBinding.rightSubDescrizione.setVisibility(View.VISIBLE);
|
||||||
|
} else holder.mBinding.rightSubDescrizione.setVisibility(View.GONE);
|
||||||
|
|
||||||
holder.mBinding.setSelected(listModel.getSelectedObservable());
|
holder.mBinding.setSelected(listModel.getSelectedObservable());
|
||||||
holder.mBinding.executePendingBindings();
|
holder.mBinding.executePendingBindings();
|
||||||
|
|||||||
@@ -53,9 +53,8 @@ import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
|||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskCliente;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArts;
|
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArts;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
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.DialogInputQuantityV2View;
|
||||||
@@ -268,12 +267,11 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
@Override
|
@Override
|
||||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(getActivity(),
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
|
||||||
new SpannableString(text),
|
|
||||||
null,
|
null,
|
||||||
() -> onComplete.run(true),
|
() -> onComplete.run(true),
|
||||||
() -> onComplete.run(false)
|
() -> onComplete.run(false)
|
||||||
).show();
|
).show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -291,13 +289,8 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort) {
|
public void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort) {
|
||||||
DialogAskCliente.makeBase(getActivity(), (status, result, codJcom) -> {
|
DialogAskClienteView.newInstance(onComplete, onAbort)
|
||||||
if (status == DialogConsts.Results.YES) {
|
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
onComplete.run(result, codJcom);
|
|
||||||
} else {
|
|
||||||
onAbort.run();
|
|
||||||
}
|
|
||||||
}).show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -306,7 +299,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
onAbort.run();
|
onAbort.run();
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -369,7 +362,6 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||||
this.mViewModel.dispatchRowEdit(mtbColr);
|
this.mViewModel.dispatchRowEdit(mtbColr);
|
||||||
@@ -383,7 +375,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
|||||||
@Override
|
@Override
|
||||||
public void onPreDestroy(Runnable onComplete) {
|
public void onPreDestroy(Runnable onComplete) {
|
||||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||||
if(thereIsAnOpenedUL.get()) mViewModel.closeLU(onComplete);
|
if (thereIsAnOpenedUL.get()) mViewModel.closeLU(onComplete);
|
||||||
else onComplete.run();
|
else onComplete.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -179,7 +179,9 @@ public class PickingLiberoViewModel {
|
|||||||
|
|
||||||
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
|
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
|
||||||
if (this.mFlagAskCliente) {
|
if (this.mFlagAskCliente) {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
this.sendLUClienteRequired((vtbDest, codJcom) -> {
|
this.sendLUClienteRequired((vtbDest, codJcom) -> {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, vtbDest, codJcom, onComplete);
|
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, vtbDest, codJcom, onComplete);
|
||||||
}, onComplete);
|
}, onComplete);
|
||||||
} else {
|
} else {
|
||||||
@@ -646,8 +648,6 @@ public class PickingLiberoViewModel {
|
|||||||
.setQtaCol(qtaTot)
|
.setQtaCol(qtaTot)
|
||||||
.setPartitaMag(partitaMag)
|
.setPartitaMag(partitaMag)
|
||||||
.setDataScadPartita(dataScad)
|
.setDataScadPartita(dataScad)
|
||||||
.setUtente(SettingsManager.i().getUser().getFullname())
|
|
||||||
.setCausale(MtbColr.Causale.RETTIFICA)
|
|
||||||
.setDatetimeRow(UtilityDate.getDateInstance());
|
.setDatetimeRow(UtilityDate.getDateInstance());
|
||||||
|
|
||||||
mtbColt.getMtbColr().add(mtbColr);
|
mtbColt.getMtbColr().add(mtbColr);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
@@ -49,9 +50,9 @@ 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.BottomSheetFragmentLUContentView;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel;
|
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.ask_should_print.DialogAskShouldPrint;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
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.note_aggiuntive_lu.NoteAggiuntiveLUDialog;
|
import it.integry.integrywmsnative.view.dialogs.note_aggiuntive_lu.NoteAggiuntiveLUDialog;
|
||||||
|
|
||||||
public class PickingResiActivity extends BaseActivity implements BottomSheetFragmentLUContentView.Listener, BottomSheetFragmentLUContentViewModel.Listener, PickingResiViewModel.Listener {
|
public class PickingResiActivity extends BaseActivity implements BottomSheetFragmentLUContentView.Listener, BottomSheetFragmentLUContentViewModel.Listener, PickingResiViewModel.Listener {
|
||||||
@@ -179,9 +180,9 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
|||||||
this.mBindings.mainList.setAdapter(pickingResiListAdapter);
|
this.mBindings.mainList.setAdapter(pickingResiListAdapter);
|
||||||
this.mBindings.mainList.setLayoutManager(new LinearLayoutManager(this));
|
this.mBindings.mainList.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
|
||||||
pickingResiListAdapter.setOnItemClicked(clickedItem -> {
|
pickingResiListAdapter.setOnItemClicked((clickedItem, refMtbColt) -> {
|
||||||
if (!noLUPresent.get()) {
|
if (!noLUPresent.get()) {
|
||||||
this.mViewmodel.dispatchOrdineRow(clickedItem);
|
this.mViewmodel.dispatchOrdineRow(clickedItem, refMtbColt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -190,7 +191,11 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
|||||||
private List<PickingResiListModel> convertDataModelToListModel(List<WithdrawableDtbDocr> dataList) {
|
private List<PickingResiListModel> convertDataModelToListModel(List<WithdrawableDtbDocr> dataList) {
|
||||||
List<PickingResiListModel> pickingResiListModels = new ArrayList<>();
|
List<PickingResiListModel> pickingResiListModels = new ArrayList<>();
|
||||||
|
|
||||||
Stream.of(dataList)
|
List<WithdrawableDtbDocr> tmpList = Stream.of(dataList)
|
||||||
|
.filter(x -> !x.isHidden() && UtilityBigDecimal.greaterThan(x.getQtaDoc(), BigDecimal.ZERO))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
Stream.of(tmpList)
|
||||||
.sortBy(x -> x.getNumDoc() + " " + x.getDataDocS() + " " + x.getCodDtip() + " " + x.getSerDoc() + " " + x.getCodAnag() + " " + x.getIdRiga())
|
.sortBy(x -> x.getNumDoc() + " " + x.getDataDocS() + " " + x.getCodDtip() + " " + x.getSerDoc() + " " + x.getCodAnag() + " " + x.getIdRiga())
|
||||||
.forEach(x -> {
|
.forEach(x -> {
|
||||||
|
|
||||||
@@ -251,6 +256,10 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeListFilter() {
|
||||||
|
this.mViewmodel.resetMatchedRows();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||||
this.mViewmodel.dispatchRowEdit(mtbColr);
|
this.mViewmodel.dispatchRowEdit(mtbColr);
|
||||||
@@ -321,11 +330,23 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
|||||||
this.openProgress();
|
this.openProgress();
|
||||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||||
}, () -> {
|
}, () -> {
|
||||||
// this.mViewmodel.resetMatchedRows();
|
this.mViewmodel.resetMatchedRows();
|
||||||
})
|
})
|
||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFilterApplied(String newValue) {
|
||||||
|
this.mBindings.filteredArtsInListExpandableLayout.expand(true);
|
||||||
|
this.mBindings.descriptionFilterText.setText(!UtilityString.isNullOrEmpty(newValue) ? newValue : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFilterRemoved() {
|
||||||
|
this.mBindings.filteredArtsInListExpandableLayout.collapse(true);
|
||||||
|
this.mBindings.descriptionFilterText.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRowSaved() {
|
public void onRowSaved() {
|
||||||
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
FBToast.successToast(this, getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||||
@@ -334,12 +355,11 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
|||||||
@Override
|
@Override
|
||||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(this,
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
|
||||||
new SpannableString(text),
|
|
||||||
null,
|
null,
|
||||||
() -> onComplete.run(true),
|
() -> onComplete.run(true),
|
||||||
() -> onComplete.run(false)
|
() -> onComplete.run(false)
|
||||||
).show();
|
).show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -362,7 +382,9 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
|||||||
public void onLUSuccessullyPrinted() {
|
public void onLUSuccessullyPrinted() {
|
||||||
Resources res = getResources();
|
Resources res = getResources();
|
||||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||||
DialogSimpleMessageHelper.makeSuccessDialog(this, res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null).show();
|
DialogSimpleMessageView
|
||||||
|
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -373,13 +395,13 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
|||||||
@Override
|
@Override
|
||||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(
|
DialogSimpleMessageView.makeErrorDialog(
|
||||||
this,
|
|
||||||
new SpannableString(ex.getMessage()),
|
new SpannableString(ex.getMessage()),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
R.string.button_ignore_print,
|
R.string.button_ignore_print,
|
||||||
onComplete).show();
|
onComplete)
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ import java.util.List;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
|
import it.integry.integrywmsnative.core.CommonConst;
|
||||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||||
|
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
import it.integry.integrywmsnative.core.exception.NoPrintersFoundException;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
@@ -25,6 +29,7 @@ import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
@@ -39,6 +44,7 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
|
|||||||
import it.integry.integrywmsnative.gest.picking_resi.exceptions.DocumentsLoadException;
|
import it.integry.integrywmsnative.gest.picking_resi.exceptions.DocumentsLoadException;
|
||||||
import it.integry.integrywmsnative.gest.picking_resi.rest.PickingResiRESTConsumer;
|
import it.integry.integrywmsnative.gest.picking_resi.rest.PickingResiRESTConsumer;
|
||||||
import it.integry.integrywmsnative.gest.picking_resi.rest.WithdrawableDtbDocr;
|
import it.integry.integrywmsnative.gest.picking_resi.rest.WithdrawableDtbDocr;
|
||||||
|
import it.integry.integrywmsnative.gest.spedizione.exceptions.NotCurrentYearLUException;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||||
|
|
||||||
public class PickingResiViewModel {
|
public class PickingResiViewModel {
|
||||||
@@ -229,23 +235,26 @@ public class PickingResiViewModel {
|
|||||||
private void postCloseOperations(MtbColt mtbColt, Runnable onComplete) {
|
private void postCloseOperations(MtbColt mtbColt, Runnable onComplete) {
|
||||||
this.mColliRegistrati.add(mtbColt);
|
this.mColliRegistrati.add(mtbColt);
|
||||||
|
|
||||||
Stream.of(this.mPickingList.getValue())
|
List<WithdrawableDtbDocr> tmpList = getPickingList().getValue();
|
||||||
.forEach(x -> {
|
|
||||||
List<MtbColr> withdraws = x.getWithdrawRows();
|
|
||||||
|
|
||||||
for (int k = 0; k < withdraws.size(); k++) {
|
for (int i = 0; i < tmpList.size(); i++) {
|
||||||
MtbColr withdrawRow = withdraws.get(k);
|
WithdrawableDtbDocr x = tmpList.get(i);
|
||||||
x.setQtaDoc(x.getQtaDoc().subtract(withdrawRow.getQtaCol()));
|
List<MtbColr> withdraws = x.getWithdrawRows();
|
||||||
}
|
|
||||||
|
|
||||||
x.getWithdrawRows().clear();
|
for (int k = 0; k < withdraws.size(); k++) {
|
||||||
|
MtbColr withdrawRow = withdraws.get(k);
|
||||||
|
x.setQtaDoc(x.getQtaDoc().subtract(withdrawRow.getQtaCol()));
|
||||||
|
}
|
||||||
|
|
||||||
if (UtilityBigDecimal.equalsOrLowerThan(x.getQtaDoc(), BigDecimal.ZERO)) {
|
x.getWithdrawRows().clear();
|
||||||
this.mPickingList.getValue().remove(x);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.mPickingList.postValue(this.mPickingList.getValue());
|
if (UtilityBigDecimal.equalsOrLowerThan(x.getQtaDoc(), BigDecimal.ZERO)) {
|
||||||
|
tmpList.remove(x);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mPickingList.postValue(tmpList);
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,41 +268,232 @@ public class PickingResiViewModel {
|
|||||||
//Se il collo non esiste allora lo creo associandolo a questa etichetta anonima
|
//Se il collo non esiste allora lo creo associandolo a questa etichetta anonima
|
||||||
//invece se esiste apro un collo nuovo e cerco gli articoli presenti nell'ul
|
//invece se esiste apro un collo nuovo e cerco gli articoli presenti nell'ul
|
||||||
//dell'etichetta anonima
|
//dell'etichetta anonima
|
||||||
// this.executeEtichettaAnonimaNotOpenedLU(barcodeScanDTO, onComplete);
|
this.executeEtichettaAnonimaNotOpenedLU(barcodeScanDTO, onComplete);
|
||||||
} else {
|
} else {
|
||||||
// this.processBarcodeNotOpenedLU(barcodeScanDTO, onComplete);
|
this.processBarcodeNotOpenedLU(barcodeScanDTO, onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||||
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
|
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
|
||||||
// this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onComplete);
|
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onComplete);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// this.processBarcodeAlreadyOpenedLU(barcodeScanDTO, onComplete);
|
this.processBarcodeAlreadyOpenedLU(barcodeScanDTO, onComplete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispatchOrdineRow(final WithdrawableDtbDocr withdrawableDtbDocr) {
|
private void processBarcodeNotOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
this.createNewLU(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
() -> processBarcodeAlreadyOpenedLU(barcodeScanDTO, onComplete));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void processBarcodeAlreadyOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
|
||||||
|
if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||||
|
//Cerco tramite etichetta ean 128 (che può indicarmi un articolo o una UL)
|
||||||
|
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||||
|
|
||||||
|
|
||||||
|
} else onComplete.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void executeEtichettaAnonimaNotOpenedLU(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), true, false, mtbColt -> {
|
||||||
|
|
||||||
|
if (mtbColt == null) {
|
||||||
|
|
||||||
|
if (!UtilityBarcode.isEtichettaAnonimaOfCurrentYear(barcodeScanDTO.getStringValue())) {
|
||||||
|
this.sendError(new NotCurrentYearLUException());
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this.createNewLU(
|
||||||
|
UtilityBarcode.getNumColloFromULAnonima(barcodeScanDTO.getStringValue()),
|
||||||
|
CommonConst.Config.DEFAULT_ANONYMOUS_UL_SERIE, onComplete);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this.createNewLU(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
() -> searchArtFromUL(mtbColt, onComplete)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeEtichettaLU(String SSCC, Runnable onComplete) {
|
||||||
|
mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
|
||||||
|
|
||||||
|
if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
|
||||||
|
if (mtbColt.getSegno() != -1) {
|
||||||
|
searchArtFromUL(mtbColt, onComplete);
|
||||||
|
} else this.sendError(new InvalidLUException());
|
||||||
|
} else {
|
||||||
|
this.sendError(new NoArtsFoundException());
|
||||||
|
}
|
||||||
|
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||||
|
|
||||||
|
String barcodeProd = null;
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||||
|
barcodeProd = ean128Model.Content;
|
||||||
|
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||||
|
this.executeEtichettaLU(ean128Model.Sscc, onComplete);
|
||||||
|
} else {
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||||
|
onComplete.run();
|
||||||
|
}
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void searchArtFromUL(MtbColt scannedUL, Runnable onComplete) {
|
||||||
|
|
||||||
|
final List<WithdrawableDtbDocr> pickingList = mPickingList.getValue();
|
||||||
|
final List<WithdrawableDtbDocr> matchPickingObject = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
//Controllo se nel collo ho degli articoli che corrispondono per codice / taglia / colore / lotto
|
||||||
|
Stream.of(scannedUL.getMtbColr())
|
||||||
|
.filter(x -> !UtilityString.isNullOrEmpty(x.getCodMart()))
|
||||||
|
.forEach(x -> {
|
||||||
|
|
||||||
|
for (WithdrawableDtbDocr pickingObject : pickingList) {
|
||||||
|
//Da verificare se il controllo per partita deve essere sempre effettuato
|
||||||
|
if (UtilityString.equalsIgnoreCase(x.getCodMart(), pickingObject.getCodMart()) &&
|
||||||
|
UtilityString.equalsIgnoreCase(x.getCodTagl(), pickingObject.getCodTagl()) &&
|
||||||
|
UtilityString.equalsIgnoreCase(x.getCodCol(), pickingObject.getCodCol())) {
|
||||||
|
|
||||||
|
if (!matchPickingObject.contains(pickingObject)) {
|
||||||
|
matchPickingObject.add(pickingObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (WithdrawableDtbDocr matchedObject : matchPickingObject) {
|
||||||
|
MtbColt cloneMtbColt = (MtbColt) scannedUL.clone();
|
||||||
|
ObservableArrayList<MtbColr> cloneMtbColrs = (ObservableArrayList<MtbColr>) cloneMtbColt.getMtbColr().clone();
|
||||||
|
|
||||||
|
|
||||||
|
Stream.of(cloneMtbColt.getMtbColr())
|
||||||
|
.filter(x -> !(UtilityString.equalsIgnoreCase(x.getCodMart(), matchedObject.getCodMart()) &&
|
||||||
|
UtilityString.equalsIgnoreCase(x.getCodTagl(), matchedObject.getCodTagl()) &&
|
||||||
|
UtilityString.equalsIgnoreCase(x.getCodCol(), matchedObject.getCodCol())))
|
||||||
|
.forEach(cloneMtbColrs::remove);
|
||||||
|
|
||||||
|
cloneMtbColt.setMtbColr(cloneMtbColrs);
|
||||||
|
|
||||||
|
PickDataDTO tempPickData = new PickDataDTO()
|
||||||
|
.setSourceMtbColt(cloneMtbColt);
|
||||||
|
|
||||||
|
matchedObject.setTempPickData(tempPickData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.loadMatchedRows(matchPickingObject);
|
||||||
|
onComplete.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void loadMatchedRows(List<WithdrawableDtbDocr> matchedRows) {
|
||||||
|
if (matchedRows == null || matchedRows.size() == 0) {
|
||||||
|
this.sendError(new NoArtsFoundException());
|
||||||
|
} else if (matchedRows.size() == 1) {
|
||||||
|
WithdrawableDtbDocr matchedItem = matchedRows.get(0);
|
||||||
|
|
||||||
|
if (matchedItem.getWithdrawRows() != null && matchedItem.getWithdrawRows().size() > 1) {
|
||||||
|
|
||||||
|
List<WithdrawableDtbDocr> pickingList = mPickingList.getValue();
|
||||||
|
|
||||||
|
Stream.of(pickingList)
|
||||||
|
.filter(x -> x != matchedItem)
|
||||||
|
.forEach(x -> x.setHidden(true));
|
||||||
|
|
||||||
|
this.sendFilterApplied(null);
|
||||||
|
this.getPickingList().postValue(pickingList);
|
||||||
|
} else {
|
||||||
|
this.dispatchOrdineRow(matchedItem, matchedItem.getRefMtbColt());
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
List<WithdrawableDtbDocr> pickingList = mPickingList.getValue();
|
||||||
|
|
||||||
|
for (int i = 0; i < pickingList.size(); i++) {
|
||||||
|
if (!matchedRows.contains(pickingList.get(i))) {
|
||||||
|
pickingList.get(i).setHidden(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sendFilterApplied(null);
|
||||||
|
this.getPickingList().postValue(pickingList);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void dispatchOrdineRow(final WithdrawableDtbDocr withdrawableDtbDocr, final MtbColt refMtbColt) {
|
||||||
BigDecimal totalQtaDoc = withdrawableDtbDocr.getQtaDoc();
|
BigDecimal totalQtaDoc = withdrawableDtbDocr.getQtaDoc();
|
||||||
BigDecimal totalNumCnfDoc = withdrawableDtbDocr.getNumCnf();
|
BigDecimal totalNumCnfDoc = withdrawableDtbDocr.getNumCnf();
|
||||||
BigDecimal qtaCnfDoc = withdrawableDtbDocr.getQtaCnf();
|
BigDecimal qtaCnfDoc = withdrawableDtbDocr.getQtaCnf();
|
||||||
|
|
||||||
|
//TODO: Al posto di prelevare la prima riga bisognerebbe controllare se c'è ne una che corrisponde con la partita richiesta
|
||||||
|
MtbColr mtbColrToDispatch = withdrawableDtbDocr.getTempPickData() != null &&
|
||||||
|
withdrawableDtbDocr.getTempPickData().getSourceMtbColt() != null &&
|
||||||
|
withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr() != null &&
|
||||||
|
withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr().size() > 0 ?
|
||||||
|
withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr().get(0) : null;
|
||||||
|
|
||||||
|
BigDecimal totalAvailableQtaCol;
|
||||||
|
BigDecimal totalAvailableQtaCnf;
|
||||||
|
BigDecimal totalAvailableNumCnf;
|
||||||
|
|
||||||
|
if (mtbColrToDispatch != null) {
|
||||||
|
totalAvailableQtaCol = mtbColrToDispatch.getQtaCol();
|
||||||
|
totalAvailableQtaCnf = mtbColrToDispatch.getQtaCnf();
|
||||||
|
totalAvailableNumCnf = mtbColrToDispatch.getNumCnf();
|
||||||
|
} else {
|
||||||
|
totalAvailableQtaCol = totalQtaDoc;
|
||||||
|
totalAvailableQtaCnf = qtaCnfDoc;
|
||||||
|
totalAvailableNumCnf = totalNumCnfDoc;
|
||||||
|
}
|
||||||
|
|
||||||
this.sendOnItemDispatched(
|
this.sendOnItemDispatched(
|
||||||
withdrawableDtbDocr.getMtbAart(),
|
withdrawableDtbDocr.getMtbAart(),
|
||||||
totalNumCnfDoc,
|
totalAvailableNumCnf,
|
||||||
qtaCnfDoc,
|
totalAvailableQtaCnf,
|
||||||
totalQtaDoc,
|
totalAvailableQtaCol,
|
||||||
totalQtaDoc,
|
totalAvailableQtaCol,
|
||||||
totalNumCnfDoc,
|
totalAvailableNumCnf,
|
||||||
qtaCnfDoc,
|
totalAvailableQtaCnf,
|
||||||
withdrawableDtbDocr.getPartitaMag(),
|
withdrawableDtbDocr.getPartitaMag(),
|
||||||
withdrawableDtbDocr.getDataScadPartitaMagD(),
|
withdrawableDtbDocr.getDataScadPartitaMagD(),
|
||||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
(pickedQuantityDTO, shouldCloseLU) -> {
|
||||||
|
|
||||||
this.saveNewRow(withdrawableDtbDocr,
|
this.saveNewRow(withdrawableDtbDocr,
|
||||||
|
refMtbColt,
|
||||||
pickedQuantityDTO.getNumCnf(),
|
pickedQuantityDTO.getNumCnf(),
|
||||||
pickedQuantityDTO.getQtaCnf(),
|
pickedQuantityDTO.getQtaCnf(),
|
||||||
pickedQuantityDTO.getQtaTot(),
|
pickedQuantityDTO.getQtaTot(),
|
||||||
@@ -328,7 +528,7 @@ public class PickingResiViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void saveNewRow(WithdrawableDtbDocr withdrawableDtbDocr, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, Date dataScad, boolean shouldCloseLU) {
|
public void saveNewRow(WithdrawableDtbDocr withdrawableDtbDocr, MtbColt refMtbColt, BigDecimal numCnf, BigDecimal qtaCnf, BigDecimal qtaTot, String partitaMag, Date dataScad, boolean shouldCloseLU) {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
final MtbColr mtbColr = new MtbColr()
|
final MtbColr mtbColr = new MtbColr()
|
||||||
@@ -348,6 +548,39 @@ public class PickingResiViewModel {
|
|||||||
.setDataDoc(withdrawableDtbDocr.getDataDocS())
|
.setDataDoc(withdrawableDtbDocr.getDataDocS())
|
||||||
.setIdRigaDoc(withdrawableDtbDocr.getIdRiga());
|
.setIdRigaDoc(withdrawableDtbDocr.getIdRiga());
|
||||||
|
|
||||||
|
//TODO: Al posto di prelevare la prima riga bisognerebbe controllare se c'è ne una che corrisponde con la partita richiesta
|
||||||
|
MtbColr mtbColrToDispatch = withdrawableDtbDocr.getTempPickData() != null &&
|
||||||
|
withdrawableDtbDocr.getTempPickData().getSourceMtbColt() != null &&
|
||||||
|
withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr() != null &&
|
||||||
|
withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr().size() > 0 ?
|
||||||
|
withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getMtbColr().get(0) : null;
|
||||||
|
|
||||||
|
if (mtbColrToDispatch != null) {
|
||||||
|
if (UtilityString.isNullOrEmpty(mCurrentMtbColt.getCodTcol()))
|
||||||
|
mCurrentMtbColt.setCodTcol(UtilityString.empty2null(withdrawableDtbDocr.getTempPickData().getSourceMtbColt().getCodTcol()));
|
||||||
|
|
||||||
|
mtbColr
|
||||||
|
.setCodJcom(UtilityString.empty2null(mtbColrToDispatch.getCodJcom()))
|
||||||
|
.setSerColloRif(UtilityString.empty2null(mtbColrToDispatch.getSerCollo()))
|
||||||
|
.setNumColloRif(mtbColrToDispatch.getNumCollo())
|
||||||
|
.setGestioneRif(UtilityString.empty2null(mtbColrToDispatch.getGestione()))
|
||||||
|
.setDataColloRif(UtilityString.empty2null(mtbColrToDispatch.getDataColloS()));
|
||||||
|
|
||||||
|
|
||||||
|
if (mtbColrToDispatch.getPesoNettoKg() != null) {
|
||||||
|
//Proporzione
|
||||||
|
BigDecimal pesoNettoKg = UtilityBigDecimal.divide(UtilityBigDecimal.multiply(qtaTot, mtbColrToDispatch.getPesoNettoKg()), mtbColrToDispatch.getQtaCol());
|
||||||
|
mtbColr.setPesoNettoKg(pesoNettoKg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mtbColrToDispatch.getPesoLordoKg() != null) {
|
||||||
|
//Proporzione
|
||||||
|
BigDecimal pesoLordoKg = UtilityBigDecimal.divide(UtilityBigDecimal.multiply(qtaTot, mtbColrToDispatch.getPesoLordoKg()), mtbColrToDispatch.getQtaCol());
|
||||||
|
mtbColr.setPesoLordoKg(pesoLordoKg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||||
|
|
||||||
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
|
MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
|
||||||
@@ -482,6 +715,17 @@ public class PickingResiViewModel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetMatchedRows() {
|
||||||
|
for (WithdrawableDtbDocr pickingObjectDTO : this.mPickingList.getValue()) {
|
||||||
|
pickingObjectDTO
|
||||||
|
.setTempPickData(null)
|
||||||
|
.setHidden(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mPickingList.postValue(this.mPickingList.getValue());
|
||||||
|
this.sendFilterRemoved();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public MutableLiveData<List<WithdrawableDtbDocr>> getPickingList() {
|
public MutableLiveData<List<WithdrawableDtbDocr>> getPickingList() {
|
||||||
return mPickingList;
|
return mPickingList;
|
||||||
@@ -549,6 +793,14 @@ public class PickingResiViewModel {
|
|||||||
if (this.mListener != null) mListener.onRowSaved();
|
if (this.mListener != null) mListener.onRowSaved();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendFilterApplied(String newValue) {
|
||||||
|
if (this.mListener != null) mListener.onFilterApplied(newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendFilterRemoved() {
|
||||||
|
if (this.mListener != null) mListener.onFilterRemoved();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public PickingResiViewModel setListener(Listener listener) {
|
public PickingResiViewModel setListener(Listener listener) {
|
||||||
this.mListener = listener;
|
this.mListener = listener;
|
||||||
@@ -572,5 +824,9 @@ public class PickingResiViewModel {
|
|||||||
Date dataScad,
|
Date dataScad,
|
||||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
|
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
|
||||||
|
|
||||||
|
void onFilterApplied(String newValue);
|
||||||
|
|
||||||
|
void onFilterRemoved();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ import java.util.List;
|
|||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.databinding.PickingResiMainListItemBinding;
|
import it.integry.integrywmsnative.databinding.PickingResiMainListItemBinding;
|
||||||
@@ -31,7 +32,7 @@ public class PickingResiListAdapter extends SectionedRecyclerViewAdapter<Picking
|
|||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private final List<PickingResiListModel> mDataset = new ArrayList<>();
|
private final List<PickingResiListModel> mDataset = new ArrayList<>();
|
||||||
private RunnableArgs<WithdrawableDtbDocr> mOnItemClicked;
|
private RunnableArgss<WithdrawableDtbDocr, MtbColt> mOnItemClicked;
|
||||||
|
|
||||||
static class SubheaderHolder extends RecyclerView.ViewHolder {
|
static class SubheaderHolder extends RecyclerView.ViewHolder {
|
||||||
PickingResiMainListItemHeaderBinding mBinding;
|
PickingResiMainListItemHeaderBinding mBinding;
|
||||||
@@ -65,7 +66,7 @@ public class PickingResiListAdapter extends SectionedRecyclerViewAdapter<Picking
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnItemClicked(RunnableArgs<WithdrawableDtbDocr> onItemClicked) {
|
public void setOnItemClicked(RunnableArgss<WithdrawableDtbDocr, MtbColt> onItemClicked) {
|
||||||
this.mOnItemClicked = onItemClicked;
|
this.mOnItemClicked = onItemClicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +124,7 @@ public class PickingResiListAdapter extends SectionedRecyclerViewAdapter<Picking
|
|||||||
|
|
||||||
holder.mBinding.getRoot().setOnClickListener(v -> {
|
holder.mBinding.getRoot().setOnClickListener(v -> {
|
||||||
if (this.mOnItemClicked != null)
|
if (this.mOnItemClicked != null)
|
||||||
this.mOnItemClicked.run(pickingResiListModel.getOriginalModel());
|
this.mOnItemClicked.run(pickingResiListModel.getOriginalModel(), pickingResiListModel.getSourceMtbColt());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package it.integry.integrywmsnative.gest.picking_resi.core;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.gest.picking_resi.rest.WithdrawableDtbDocr;
|
import it.integry.integrywmsnative.gest.picking_resi.rest.WithdrawableDtbDocr;
|
||||||
|
|
||||||
public class PickingResiListModel {
|
public class PickingResiListModel {
|
||||||
@@ -19,6 +20,7 @@ public class PickingResiListModel {
|
|||||||
private boolean active;
|
private boolean active;
|
||||||
|
|
||||||
private WithdrawableDtbDocr mOriginalModel;
|
private WithdrawableDtbDocr mOriginalModel;
|
||||||
|
private MtbColt mSourceMtbColt;
|
||||||
|
|
||||||
public String getGroupTitle() {
|
public String getGroupTitle() {
|
||||||
return groupTitle;
|
return groupTitle;
|
||||||
@@ -100,4 +102,13 @@ public class PickingResiListModel {
|
|||||||
this.mOriginalModel = originalModel;
|
this.mOriginalModel = originalModel;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbColt getSourceMtbColt() {
|
||||||
|
return mSourceMtbColt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PickingResiListModel setSourceMtbColt(MtbColt sourceMtbColt) {
|
||||||
|
this.mSourceMtbColt = sourceMtbColt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,18 @@ import java.util.List;
|
|||||||
|
|
||||||
import it.integry.integrywmsnative.core.model.DtbDocr;
|
import it.integry.integrywmsnative.core.model.DtbDocr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||||
|
|
||||||
public class WithdrawableDtbDocr extends DtbDocr {
|
public class WithdrawableDtbDocr extends DtbDocr {
|
||||||
|
|
||||||
private String gestione;
|
private String gestione;
|
||||||
|
|
||||||
private List<MtbColr> withdrawRows = new ArrayList<>();
|
private List<MtbColr> withdrawRows = new ArrayList<>();
|
||||||
|
|
||||||
|
private PickDataDTO tempPickData;
|
||||||
|
private MtbColt refMtbColt;
|
||||||
|
private boolean hidden = false;
|
||||||
|
|
||||||
public WithdrawableDtbDocr() {
|
public WithdrawableDtbDocr() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@@ -33,4 +38,31 @@ public class WithdrawableDtbDocr extends DtbDocr {
|
|||||||
this.gestione = gestione;
|
this.gestione = gestione;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbColt getRefMtbColt() {
|
||||||
|
return refMtbColt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WithdrawableDtbDocr setRefMtbColt(MtbColt refMtbColt) {
|
||||||
|
this.refMtbColt = refMtbColt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PickDataDTO getTempPickData() {
|
||||||
|
return tempPickData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WithdrawableDtbDocr setTempPickData(PickDataDTO tempPickData) {
|
||||||
|
this.tempPickData = tempPickData;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHidden() {
|
||||||
|
return hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WithdrawableDtbDocr setHidden(boolean hidden) {
|
||||||
|
this.hidden = hidden;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.core.Or
|
|||||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.core.OrdineProduzioneListAdapter;
|
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.core.OrdineProduzioneListAdapter;
|
||||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.dialog.DialogOrdineProduzioneFiltroAvanzato;
|
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.dialog.DialogOrdineProduzioneFiltroAvanzato;
|
||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
@@ -137,7 +137,9 @@ public class ProdOrdineProduzioneElencoFragment extends Fragment implements ITit
|
|||||||
|
|
||||||
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
||||||
if (errorMessage == null) errorMessage = ex.getMessage();
|
if (errorMessage == null) errorMessage = ex.getMessage();
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(getActivity(), new SpannableString(errorMessage), null, null).show();
|
DialogSimpleMessageView
|
||||||
|
.makeErrorDialog(new SpannableString(errorMessage), null, null)
|
||||||
|
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -197,8 +199,7 @@ public class ProdOrdineProduzioneElencoFragment extends Fragment implements ITit
|
|||||||
.distinctBy(x -> x.getDataOrd() + " " + x.getNumOrd() + " " + x.getGestione())
|
.distinctBy(x -> x.getDataOrd() + " " + x.getNumOrd() + " " + x.getGestione())
|
||||||
.count();
|
.count();
|
||||||
|
|
||||||
DialogSimpleMessageHelper.makeInfoDialog(getActivity(),
|
DialogSimpleMessageView.makeInfoDialog(getText(R.string.orders).toString(),
|
||||||
getText(R.string.orders).toString(),
|
|
||||||
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, (int) ordsCounter), ordsCounter)
|
Html.fromHtml(String.format(getActivity().getResources().getQuantityString(R.plurals.loaded_orders_message, (int) ordsCounter), ordsCounter)
|
||||||
+ "<br /><br />" +
|
+ "<br /><br />" +
|
||||||
"<b>" + artsCounter + "</b> " + getActivity().getResources().getQuantityString(R.plurals.available_articles, (int) artsCounter)),
|
"<b>" + artsCounter + "</b> " + getActivity().getResources().getQuantityString(R.plurals.available_articles, (int) artsCounter)),
|
||||||
@@ -213,7 +214,7 @@ public class ProdOrdineProduzioneElencoFragment extends Fragment implements ITit
|
|||||||
myIntent.putExtra("keySitArts", cacheSitArtItemID);
|
myIntent.putExtra("keySitArts", cacheSitArtItemID);
|
||||||
getActivity().startActivity(myIntent);
|
getActivity().startActivity(myIntent);
|
||||||
|
|
||||||
}).show();
|
}).show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -224,7 +225,9 @@ public class ProdOrdineProduzioneElencoFragment extends Fragment implements ITit
|
|||||||
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
||||||
if (errorMessage == null)
|
if (errorMessage == null)
|
||||||
errorMessage = ex.getMessage() + "\n" + ex.getCause().getCause().getMessage();
|
errorMessage = ex.getMessage() + "\n" + ex.getCause().getCause().getMessage();
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(getActivity(), new SpannableString(errorMessage), null, null).show();
|
DialogSimpleMessageView
|
||||||
|
.makeErrorDialog(new SpannableString(errorMessage), null, null)
|
||||||
|
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ import it.integry.integrywmsnative.gest.prod_recupero_materiale.core.ProdRecuper
|
|||||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULDTO;
|
import it.integry.integrywmsnative.gest.prod_recupero_materiale.dto.HistoryVersamentoProdULDTO;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
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.DialogInputQuantityV2View;
|
||||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLU;
|
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUView;
|
||||||
|
|
||||||
public class ProdRecuperoMaterialeViewModel {
|
public class ProdRecuperoMaterialeViewModel {
|
||||||
|
|
||||||
@@ -369,7 +369,8 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (sourceMtbColt != null) saveRunnable.run(sourceMtbColt, false);
|
if (sourceMtbColt != null) saveRunnable.run(sourceMtbColt, false);
|
||||||
else DialogScanOrCreateLU.make(mContext, true, false, saveRunnable).show();
|
else DialogScanOrCreateLUView.newInstance(true, false, saveRunnable)
|
||||||
|
.show(mContext.getSupportFragmentManager(), "tag");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,13 +387,13 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
}, ex -> {
|
}, ex -> {
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
String errorMessage = ex.getMessage();
|
String errorMessage = ex.getMessage();
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(
|
DialogSimpleMessageView.makeErrorDialog(
|
||||||
mContext,
|
|
||||||
new SpannableString(errorMessage),
|
new SpannableString(errorMessage),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
R.string.button_ignore_print,
|
R.string.button_ignore_print,
|
||||||
onComplete).show();
|
onComplete)
|
||||||
|
.show(mContext.getSupportFragmentManager(), "tag");
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
@@ -402,7 +403,9 @@ public class ProdRecuperoMaterialeViewModel {
|
|||||||
} else {
|
} else {
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
String errorMessage = "Nessuna stampante configurata";
|
String errorMessage = "Nessuna stampante configurata";
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext, new SpannableString(errorMessage), null, onComplete).show();
|
DialogSimpleMessageView
|
||||||
|
.makeWarningDialog(new SpannableString(errorMessage), null, onComplete)
|
||||||
|
.show(mContext.getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
}, ex -> {
|
}, ex -> {
|
||||||
UtilityExceptions.defaultException(mContext, ex, progress);
|
UtilityExceptions.defaultException(mContext, ex, progress);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.text.SpannableString;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.databinding.Observable;
|
import androidx.databinding.Observable;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
@@ -32,7 +33,7 @@ import it.integry.integrywmsnative.core.utility.UtilityResources;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentChooseOrdsLavFromListItemModelBinding;
|
import it.integry.integrywmsnative.databinding.FragmentChooseOrdsLavFromListItemModelBinding;
|
||||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavorazioneDTO;
|
import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavorazioneDTO;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class ChooseOrdsLavFromListAdapter extends RecyclerView.Adapter<ChooseOrdsLavFromListAdapter.ViewHolder> {
|
public class ChooseOrdsLavFromListAdapter extends RecyclerView.Adapter<ChooseOrdsLavFromListAdapter.ViewHolder> {
|
||||||
|
|
||||||
@@ -57,11 +58,12 @@ public class ChooseOrdsLavFromListAdapter extends RecyclerView.Adapter<ChooseOrd
|
|||||||
|
|
||||||
private void onItemChecked(CheckableOrdineLavoro itemModel) {
|
private void onItemChecked(CheckableOrdineLavoro itemModel) {
|
||||||
if (itemModel.isChecked() && itemModel.getItem().getOrdineLav().getHrNum() <= 0){
|
if (itemModel.isChecked() && itemModel.getItem().getOrdineLav().getHrNum() <= 0){
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
DialogSimpleMessageView.makeWarningDialog(
|
||||||
new SpannableString(Html.fromHtml("Nessuna risorsa umana registrata per l'ordine selezionato! <br> Per una corretta suddivisione delle quantità registra le risorse.")),
|
new SpannableString(Html.fromHtml("Nessuna risorsa umana registrata per l'ordine selezionato! <br> Per una corretta suddivisione delle quantità registra le risorse.")),
|
||||||
null, () -> {
|
null, () -> {
|
||||||
itemModel.getChecked().set(false);
|
itemModel.getChecked().set(false);
|
||||||
}).show();
|
})
|
||||||
|
.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!itemModel.isChecked()) {
|
if (!itemModel.isChecked()) {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package it.integry.integrywmsnative.gest.prod_versamento_materiale.viewmodel;
|
package it.integry.integrywmsnative.gest.prod_versamento_materiale.viewmodel;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.databinding.ObservableField;
|
import androidx.databinding.ObservableField;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -44,14 +44,14 @@ import it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.OrdineLavo
|
|||||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLU;
|
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLU;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLU;
|
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUView;
|
||||||
|
|
||||||
|
|
||||||
public class ProdVersamentoMaterialViewModel {
|
public class ProdVersamentoMaterialViewModel {
|
||||||
|
|
||||||
|
|
||||||
private Context mContext;
|
private FragmentActivity mContext;
|
||||||
|
|
||||||
private FragmentProdVersamentoMaterialeBinding mBinding;
|
private FragmentProdVersamentoMaterialeBinding mBinding;
|
||||||
private ProdVersamentoMaterialHelper mHelper;
|
private ProdVersamentoMaterialHelper mHelper;
|
||||||
@@ -62,7 +62,7 @@ public class ProdVersamentoMaterialViewModel {
|
|||||||
public MtbColr mMtbColr;
|
public MtbColr mMtbColr;
|
||||||
|
|
||||||
|
|
||||||
public void init(Activity context, FragmentProdVersamentoMaterialeBinding binding, ProdVersamentoMaterialHelper helper, Runnable onVersamentoCompleted) {
|
public void init(FragmentActivity context, FragmentProdVersamentoMaterialeBinding binding, ProdVersamentoMaterialHelper helper, Runnable onVersamentoCompleted) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mBinding = binding;
|
mBinding = binding;
|
||||||
mHelper = helper;
|
mHelper = helper;
|
||||||
@@ -75,7 +75,7 @@ public class ProdVersamentoMaterialViewModel {
|
|||||||
mMtbColr = mtbColr;
|
mMtbColr = mtbColr;
|
||||||
mBinding.descrArt.setText(mtbColr.getDescrizione());
|
mBinding.descrArt.setText(mtbColr.getDescrizione());
|
||||||
mBinding.codArt.setText(mtbColr.getCodMart());
|
mBinding.codArt.setText(mtbColr.getCodMart());
|
||||||
mBinding.batch.setText(mtbColr.getPartitaMag() + ((mtbColr.getMtbPartitaMag() != null) ? " - "+ mtbColr.getMtbPartitaMag().getDescrizione() : ""));
|
mBinding.batch.setText(mtbColr.getPartitaMag() + ((mtbColr.getMtbPartitaMag() != null) ? " - " + mtbColr.getMtbPartitaMag().getDescrizione() : ""));
|
||||||
if (!SettingsManager.iDB().isFlagForceAllToColli() && (mtbColr.getMtbAart() == null || mtbColr.getMtbAart().isFlagQtaCnfFissaBoolean())) {
|
if (!SettingsManager.iDB().isFlagForceAllToColli() && (mtbColr.getMtbAart() == null || mtbColr.getMtbAart().isFlagQtaCnfFissaBoolean())) {
|
||||||
String text = UtilityNumber.decimalToString(mtbColr.getQtaCol());
|
String text = UtilityNumber.decimalToString(mtbColr.getQtaCol());
|
||||||
|
|
||||||
@@ -90,26 +90,28 @@ public class ProdVersamentoMaterialViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void openLU() {
|
public void openLU() {
|
||||||
DialogScanOrCreateLU.make(mContext, false, false, true, false, (mtbColt, created) -> {
|
DialogScanOrCreateLUView.newInstance(false, false, true, false, (mtbColt, created) -> {
|
||||||
if (mtbColt == null) {
|
if (mtbColt == null) {
|
||||||
((IPoppableActivity) mContext).pop();
|
((IPoppableActivity) mContext).pop();
|
||||||
} else if ((mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE || mtbColt.getGestioneEnum() == GestioneEnum.VENDITA) && mtbColt.getSegno().equals(+1)) {
|
} else if ((mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE || mtbColt.getGestioneEnum() == GestioneEnum.VENDITA) && mtbColt.getSegno().equals(+1)) {
|
||||||
|
|
||||||
if (mtbColt.getMtbColr() == null || mtbColt.getMtbColr().size() == 0) {
|
if (mtbColt.getMtbColr() == null || mtbColt.getMtbColr().size() == 0) {
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
DialogSimpleMessageView.makeWarningDialog(
|
||||||
new SpannableString(Html.fromHtml("E' stata scansionata una UL già vuota")),
|
new SpannableString(Html.fromHtml("E' stata scansionata una UL già vuota")),
|
||||||
null, this::openLU).show();
|
null, this::openLU)
|
||||||
|
.show((mContext).getSupportFragmentManager(), "tag");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setMtbColt(mtbColt);
|
setMtbColt(mtbColt);
|
||||||
choosePosition();
|
choosePosition();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
DialogSimpleMessageView
|
||||||
new SpannableString(Html.fromHtml("Sono accettate solamente UL di <b>Acquisto</b> o <b>Lavorazione</b> di <b>CARICO</b>")),
|
.makeWarningDialog(new SpannableString(Html.fromHtml("Sono accettate solamente UL di <b>Acquisto</b> o <b>Lavorazione</b> di <b>CARICO</b>")),
|
||||||
null, this::openLU).show();
|
null, this::openLU)
|
||||||
|
.show((mContext).getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
}).show();
|
}).show(mContext.getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void choosePosition() {
|
private void choosePosition() {
|
||||||
@@ -123,28 +125,36 @@ public class ProdVersamentoMaterialViewModel {
|
|||||||
createColloScarico(mtbDepoPosizione);
|
createColloScarico(mtbDepoPosizione);
|
||||||
} else {
|
} else {
|
||||||
if (mtbColt == null || mtbColt.get() == null || mtbColt.get().getMtbColr() == null || mtbColt.get().getMtbColr().size() <= 0) {
|
if (mtbColt == null || mtbColt.get() == null || mtbColt.get().getMtbColr() == null || mtbColt.get().getMtbColr().size() <= 0) {
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
DialogSimpleMessageView
|
||||||
new SpannableString(Html.fromHtml("Il collo selezionato non presenta articoli versabili sulla linea.")),
|
.makeWarningDialog(new SpannableString(Html.fromHtml("Il collo selezionato non presenta articoli versabili sulla linea.")),
|
||||||
null, this::openLU).show();
|
null, this::openLU)
|
||||||
|
.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag");
|
||||||
return;
|
return;
|
||||||
} else if (mtbColt.get().getMtbColr().size() > 1) {
|
} else if (mtbColt.get().getMtbColr().size() > 1) {
|
||||||
|
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
DialogSimpleMessageView
|
||||||
new SpannableString(Html.fromHtml("Il collo selezionato contiene più articoli, solo il primo verrà versato in questa sessione. <br> Per versare i colli restanti ripetere l'operazione di versamento.")),
|
.makeWarningDialog(new SpannableString(Html.fromHtml("Il collo selezionato contiene più articoli, solo il primo verrà versato in questa sessione. <br> Per versare i colli restanti ripetere l'operazione di versamento.")),
|
||||||
null, () -> {
|
null, () -> {
|
||||||
cyclicGetOrdiniLavByCollo(mtbColt.get().getMtbColr().iterator(), mtbDepoPosizione);
|
cyclicGetOrdiniLavByCollo(mtbColt.get().getMtbColr().iterator(), mtbDepoPosizione);
|
||||||
}).show();
|
})
|
||||||
|
.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
MesRESTConsumer.getOrdiniLavorazioneMateriale(mtbDepoPosizione.getPosizione(), getIdMaterialeFromCollo(mtbColt.get()), ordini -> richiediOrdiniPerVersamento(ordini, mtbDepoPosizione), e -> DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
MesRESTConsumer.getOrdiniLavorazioneMateriale(
|
||||||
new SpannableString(Html.fromHtml(e.getMessage())),
|
mtbDepoPosizione.getPosizione(),
|
||||||
null, this::openLU).show());
|
getIdMaterialeFromCollo(mtbColt.get()),
|
||||||
|
ordini -> richiediOrdiniPerVersamento(ordini, mtbDepoPosizione),
|
||||||
|
e -> DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(e.getMessage())),
|
||||||
|
null,
|
||||||
|
this::openLU)
|
||||||
|
.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
DialogSimpleMessageView
|
||||||
new SpannableString(Html.fromHtml("Si è verificato un errore. Riprovare")),
|
.makeWarningDialog(new SpannableString(Html.fromHtml("Si è verificato un errore. Riprovare")),
|
||||||
null, this::openLU).show();
|
null, this::openLU)
|
||||||
|
.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,8 +253,8 @@ public class ProdVersamentoMaterialViewModel {
|
|||||||
richiediOrdiniPerVersamento(ordini, mtbDepoPosizione);
|
richiediOrdiniPerVersamento(ordini, mtbDepoPosizione);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, e -> DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
, e -> DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(e.getMessage())),
|
||||||
new SpannableString(Html.fromHtml(e.getMessage())),
|
null, this::openLU)
|
||||||
null, this::openLU).show());
|
.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "tag"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.helper.PVEditOrd
|
|||||||
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogAskAction;
|
import it.integry.integrywmsnative.view.dialogs.DialogAskAction;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
private void deleteArticolo(ArticoloOrdine articoloOrdine) {
|
private void deleteArticolo(ArticoloOrdine articoloOrdine) {
|
||||||
String text = "Stai per eliminare l'articolo <b> " + articoloOrdine.getDescrizione() + "</b> dall'ordine, <br> sei sicuro?";
|
String text = "Stai per eliminare l'articolo <b> " + articoloOrdine.getDescrizione() + "</b> dall'ordine, <br> sei sicuro?";
|
||||||
|
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(this, new SpannableString(Html.fromHtml(text)), null, () -> this.runOnUiThread(() -> {
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(text)), null, () -> this.runOnUiThread(() -> {
|
||||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(this);
|
final Dialog progress = UtilityProgress.createDefaultProgressDialog(this);
|
||||||
mhelper.removeArticoloFromOrdine(articoloOrdine, () -> {
|
mhelper.removeArticoloFromOrdine(articoloOrdine, () -> {
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
@@ -146,7 +146,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity {
|
|||||||
runOnUiThread(() -> UtilityExceptions.defaultException(this, e));
|
runOnUiThread(() -> UtilityExceptions.defaultException(this, e));
|
||||||
});
|
});
|
||||||
}), () -> {
|
}), () -> {
|
||||||
}).show();
|
}).show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleException(Exception ex) {
|
private void handleException(Exception ex) {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs.DialogScanLis
|
|||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.helper.OrdineAcquistoPvHelper;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.helper.OrdineAcquistoPvHelper;
|
||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogAskAction;
|
import it.integry.integrywmsnative.view.dialogs.DialogAskAction;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitledFragment, IScrollableFragment {
|
public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitledFragment, IScrollableFragment {
|
||||||
|
|
||||||
@@ -142,7 +142,9 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
|||||||
}), (e) -> {
|
}), (e) -> {
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
String errorMessage = e.getMessage();
|
String errorMessage = e.getMessage();
|
||||||
getActivity().runOnUiThread(() -> DialogSimpleMessageHelper.makeErrorDialog(getActivity(), new SpannableString(errorMessage), null, null).show());
|
getActivity().runOnUiThread(() -> DialogSimpleMessageView
|
||||||
|
.makeErrorDialog(new SpannableString(errorMessage), null, null)
|
||||||
|
.show(getActivity().getSupportFragmentManager(), "tag"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +200,7 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
|||||||
private void deleteOrdine(Ordine ordine) {
|
private void deleteOrdine(Ordine ordine) {
|
||||||
String text = "Stai per eliminare un ordine sei sicuro?";
|
String text = "Stai per eliminare un ordine sei sicuro?";
|
||||||
|
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(getActivity(), new SpannableString(Html.fromHtml(text)), null, () -> getActivity().runOnUiThread(() -> {
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(Html.fromHtml(text)), null, () -> getActivity().runOnUiThread(() -> {
|
||||||
final Dialog progress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
final Dialog progress = UtilityProgress.createDefaultProgressDialog(getActivity());
|
||||||
mHelper.deleteOrder(ordine, () -> {
|
mHelper.deleteOrder(ordine, () -> {
|
||||||
getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
@@ -211,7 +213,7 @@ public class PVOrdiniAcquistoGrigliaFragment extends Fragment implements ITitled
|
|||||||
getActivity().runOnUiThread(() -> UtilityExceptions.defaultException(getActivity(), e));
|
getActivity().runOnUiThread(() -> UtilityExceptions.defaultException(getActivity(), e));
|
||||||
});
|
});
|
||||||
}), () -> {
|
}), () -> {
|
||||||
}).show();
|
}).show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshRenderedOrdini(List<OrdineWrapper> ordini) {
|
private void refreshRenderedOrdini(List<OrdineWrapper> ordini) {
|
||||||
|
|||||||
@@ -60,11 +60,11 @@ import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
|||||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLU;
|
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLU;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArts;
|
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArts;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLU;
|
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.yes_no.DialogYesNo;
|
import it.integry.integrywmsnative.view.dialogs.yes_no.DialogYesNo;
|
||||||
|
|
||||||
public class RettificaGiacenzeFragment extends Fragment implements ITitledFragment, ILifecycleFragment, RettificaGiacenzeViewModel.Listener, BottomSheetMtbColrEditView.Listener {
|
public class RettificaGiacenzeFragment extends Fragment implements ITitledFragment, ILifecycleFragment, RettificaGiacenzeViewModel.Listener, BottomSheetMtbColrEditView.Listener {
|
||||||
@@ -329,13 +329,13 @@ public class RettificaGiacenzeFragment extends Fragment implements ITitledFragme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUOpenRequest(RunnableArgss<MtbColt, Boolean> onComplete) {
|
public void onLUOpenRequest(RunnableArgss<MtbColt, Boolean> onComplete) {
|
||||||
DialogScanOrCreateLU.make(getActivity(), true, false, (mtbColt, created) -> {
|
DialogScanOrCreateLUView.newInstance(true, false, (mtbColt, created) -> {
|
||||||
if (mtbColt == null) {
|
if (mtbColt == null) {
|
||||||
((IPoppableActivity) getActivity()).pop();
|
((IPoppableActivity) getActivity()).pop();
|
||||||
} else {
|
} else {
|
||||||
onComplete.run(mtbColt, created);
|
onComplete.run(mtbColt, created);
|
||||||
}
|
}
|
||||||
}).show();
|
}).show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -360,12 +360,12 @@ public class RettificaGiacenzeFragment extends Fragment implements ITitledFragme
|
|||||||
@Override
|
@Override
|
||||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(getActivity(),
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
|
||||||
new SpannableString(text),
|
|
||||||
null,
|
null,
|
||||||
() -> onComplete.run(true),
|
() -> onComplete.run(true),
|
||||||
() -> onComplete.run(false)
|
() -> onComplete.run(false)
|
||||||
).show();
|
)
|
||||||
|
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -471,29 +471,31 @@ public class RettificaGiacenzeFragment extends Fragment implements ITitledFragme
|
|||||||
public void onLUSuccessullyPrinted() {
|
public void onLUSuccessullyPrinted() {
|
||||||
Resources res = getResources();
|
Resources res = getResources();
|
||||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||||
DialogSimpleMessageHelper.makeSuccessDialog(getActivity(), res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null).show();
|
DialogSimpleMessageView
|
||||||
|
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||||
|
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUPrintRequest(RunnableArgs<Boolean> onComplete) {
|
public void onLUPrintRequest(RunnableArgs<Boolean> onComplete) {
|
||||||
DialogSimpleMessageHelper.makeInfoDialog(
|
DialogSimpleMessageView.makeInfoDialog(
|
||||||
getActivity(),
|
|
||||||
getActivity().getResources().getString(R.string.action_print_ul),
|
getActivity().getResources().getString(R.string.action_print_ul),
|
||||||
new SpannableString(getActivity().getResources().getString(R.string.ask_print_message)),
|
new SpannableString(getActivity().getResources().getString(R.string.ask_print_message)),
|
||||||
null,
|
null,
|
||||||
() -> onComplete.run(true),
|
() -> onComplete.run(true),
|
||||||
() -> onComplete.run(false)).show();
|
() -> onComplete.run(false))
|
||||||
|
.show(getActivity().getSupportFragmentManager(), "tag");;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(
|
DialogSimpleMessageView.makeErrorDialog(
|
||||||
getActivity(),
|
|
||||||
new SpannableString(ex.getMessage()),
|
new SpannableString(ex.getMessage()),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
R.string.button_ignore_print,
|
R.string.button_ignore_print,
|
||||||
onComplete).show();
|
onComplete)
|
||||||
|
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
|||||||
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLU;
|
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLU;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_should_print.DialogAskShouldPrint;
|
import it.integry.integrywmsnative.view.dialogs.ask_should_print.DialogAskShouldPrint;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.camera_barcode_reader.DialogCameraBarcodeReader;
|
import it.integry.integrywmsnative.view.dialogs.camera_barcode_reader.DialogCameraBarcodeReader;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_peso_lu.DialogInputPeso;
|
import it.integry.integrywmsnative.view.dialogs.input_peso_lu.DialogInputPeso;
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||||
@@ -198,6 +198,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
boolean enableCheckPartitaMag = SettingsManager.iDB().isEnableCheckPartitaMagCheckPickingV();
|
boolean enableCheckPartitaMag = SettingsManager.iDB().isEnableCheckPartitaMagCheckPickingV();
|
||||||
boolean canOverflowOrderQuantity = SettingsManager.iDB().isFlagCanAddExtraQuantitySpedizione();
|
boolean canOverflowOrderQuantity = SettingsManager.iDB().isFlagCanAddExtraQuantitySpedizione();
|
||||||
boolean shouldAskPesoLU = SettingsManager.iDB().isFlagAskPesoColloSpedizione();
|
boolean shouldAskPesoLU = SettingsManager.iDB().isFlagAskPesoColloSpedizione();
|
||||||
|
boolean useQtaOrd = SettingsManager.iDB().isFlagSpedizioneUseQtaOrd();
|
||||||
|
|
||||||
if (mEnableGiacenza) this.openProgress();
|
if (mEnableGiacenza) this.openProgress();
|
||||||
mViewmodel.init(
|
mViewmodel.init(
|
||||||
@@ -211,7 +212,8 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
mColliRegistrati,
|
mColliRegistrati,
|
||||||
reportNameSpedizioneChiudiOrdine,
|
reportNameSpedizioneChiudiOrdine,
|
||||||
mGestioneCol, mSegnoCol, mDefaultCausaleUL,
|
mGestioneCol, mSegnoCol, mDefaultCausaleUL,
|
||||||
mEnableQuantityReset);
|
mEnableQuantityReset,
|
||||||
|
useQtaOrd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -265,7 +267,8 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
((SettingsManager.iDB().isFlagSpedizioneEnableManualPick() &&
|
((SettingsManager.iDB().isFlagSpedizioneEnableManualPick() &&
|
||||||
clickedItem.getSitArtOrdDTO().isFlagEnablePickManuale()) ||
|
clickedItem.getSitArtOrdDTO().isFlagEnablePickManuale()) ||
|
||||||
clickedItem.getTempPickData() != null)) {
|
clickedItem.getTempPickData() != null)) {
|
||||||
this.mViewmodel.dispatchOrdineRow(clickedItem, refMtbColt);
|
this.mViewmodel.dispatchOrdineRow(clickedItem, refMtbColt,
|
||||||
|
SettingsManager.iDB().isFlagSpedizioneEnableManualPick() && clickedItem.getSitArtOrdDTO().isFlagEnablePickManuale());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -719,7 +722,9 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
public void onLUSuccessullyPrinted() {
|
public void onLUSuccessullyPrinted() {
|
||||||
Resources res = getResources();
|
Resources res = getResources();
|
||||||
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
String errorMessage = res.getText(R.string.alert_print_completed_message).toString();
|
||||||
DialogSimpleMessageHelper.makeSuccessDialog(this, res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null).show();
|
DialogSimpleMessageView
|
||||||
|
.makeSuccessDialog(res.getText(R.string.completed).toString(), new SpannableString(errorMessage), null, null)
|
||||||
|
.show(getSupportFragmentManager(), "tag");;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -730,13 +735,14 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
@Override
|
@Override
|
||||||
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
public void onLUPrintError(Exception ex, Runnable onComplete) {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(
|
DialogSimpleMessageView.makeErrorDialog(
|
||||||
this,
|
|
||||||
new SpannableString(ex.getMessage()),
|
new SpannableString(ex.getMessage()),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
R.string.button_ignore_print,
|
R.string.button_ignore_print,
|
||||||
onComplete).show();
|
onComplete)
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -754,12 +760,12 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
@Override
|
@Override
|
||||||
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
public void onMtbColrDeleteRequest(RunnableArgs<Boolean> onComplete) {
|
||||||
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
String text = getResources().getString(R.string.alert_delete_mtb_colr);
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(this,
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(text),
|
||||||
new SpannableString(text),
|
|
||||||
null,
|
null,
|
||||||
() -> onComplete.run(true),
|
() -> onComplete.run(true),
|
||||||
() -> onComplete.run(false)
|
() -> onComplete.run(false)
|
||||||
).show();
|
)
|
||||||
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -793,6 +799,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
String partitaMag,
|
String partitaMag,
|
||||||
Date dataScad,
|
Date dataScad,
|
||||||
boolean canOverflowOrderQuantity,
|
boolean canOverflowOrderQuantity,
|
||||||
|
boolean canPartitaMagBeChanged,
|
||||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
||||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||||
.setMtbAart(mtbAart)
|
.setMtbAart(mtbAart)
|
||||||
@@ -811,7 +818,8 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
.setPartitaMag(partitaMag)
|
.setPartitaMag(partitaMag)
|
||||||
.setDataScad(dataScad)
|
.setDataScad(dataScad)
|
||||||
.setCanOverflowOrderQuantity(canOverflowOrderQuantity)
|
.setCanOverflowOrderQuantity(canOverflowOrderQuantity)
|
||||||
.setCanLUBeClosed(true);
|
.setCanLUBeClosed(true)
|
||||||
|
.setCanPartitaMagBeChanged(canPartitaMagBeChanged);
|
||||||
|
|
||||||
DialogInputQuantityV2View
|
DialogInputQuantityV2View
|
||||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ public class SpedizioneViewModel {
|
|||||||
private String mReportNameSpedizioneChiudiOrdine;
|
private String mReportNameSpedizioneChiudiOrdine;
|
||||||
private boolean mIsNewLU;
|
private boolean mIsNewLU;
|
||||||
private boolean mEnableQuantityReset;
|
private boolean mEnableQuantityReset;
|
||||||
|
private boolean mUseQtaOrd;
|
||||||
|
|
||||||
private MtbColt mCurrentMtbColt = null;
|
private MtbColt mCurrentMtbColt = null;
|
||||||
|
|
||||||
@@ -137,7 +138,8 @@ public class SpedizioneViewModel {
|
|||||||
GestioneEnum gestioneCol,
|
GestioneEnum gestioneCol,
|
||||||
int segnoCol,
|
int segnoCol,
|
||||||
Integer defaultCausaleUL,
|
Integer defaultCausaleUL,
|
||||||
boolean enableQuantityReset) {
|
boolean enableQuantityReset,
|
||||||
|
boolean useQtaOrd) {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
this.mDefaultCodMdep = codMdep;
|
this.mDefaultCodMdep = codMdep;
|
||||||
@@ -150,6 +152,7 @@ public class SpedizioneViewModel {
|
|||||||
this.mReportNameSpedizioneChiudiOrdine = reportNameSpedizioneChiudiOrdine;
|
this.mReportNameSpedizioneChiudiOrdine = reportNameSpedizioneChiudiOrdine;
|
||||||
this.mDefaultCausaleOfUL = defaultCausaleUL;
|
this.mDefaultCausaleOfUL = defaultCausaleUL;
|
||||||
this.mEnableQuantityReset = enableQuantityReset;
|
this.mEnableQuantityReset = enableQuantityReset;
|
||||||
|
this.mUseQtaOrd = useQtaOrd;
|
||||||
|
|
||||||
if (enableGiacenza) {
|
if (enableGiacenza) {
|
||||||
mOrdiniRestConsumerService.getSuggestedPickingList(this.mDefaultCodMdep, pickingList, pickingObjectList -> {
|
mOrdiniRestConsumerService.getSuggestedPickingList(this.mDefaultCodMdep, pickingList, pickingObjectList -> {
|
||||||
@@ -361,6 +364,7 @@ public class SpedizioneViewModel {
|
|||||||
String partitaMag,
|
String partitaMag,
|
||||||
Date dataScad,
|
Date dataScad,
|
||||||
boolean canOverflowOrderQuantity,
|
boolean canOverflowOrderQuantity,
|
||||||
|
boolean canBatchLotBeChanged,
|
||||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
||||||
if (this.mListener != null) mListener.onItemDispatched(pickingObjectDTO,
|
if (this.mListener != null) mListener.onItemDispatched(pickingObjectDTO,
|
||||||
mtbAart,
|
mtbAart,
|
||||||
@@ -379,6 +383,7 @@ public class SpedizioneViewModel {
|
|||||||
partitaMag,
|
partitaMag,
|
||||||
dataScad,
|
dataScad,
|
||||||
canOverflowOrderQuantity,
|
canOverflowOrderQuantity,
|
||||||
|
canBatchLotBeChanged,
|
||||||
onComplete);
|
onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -732,7 +737,7 @@ public class SpedizioneViewModel {
|
|||||||
this.sendFilterApplied(null);
|
this.sendFilterApplied(null);
|
||||||
this.getPickingList().postValue(pickingList);
|
this.getPickingList().postValue(pickingList);
|
||||||
} else {
|
} else {
|
||||||
this.dispatchOrdineRow(matchedItem, matchedItem.getRefMtbColt());
|
this.dispatchOrdineRow(matchedItem, matchedItem.getRefMtbColt(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -751,7 +756,7 @@ public class SpedizioneViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void dispatchOrdineRow(final PickingObjectDTO pickingObjectDTO, MtbColt refMtbColt) {
|
public void dispatchOrdineRow(final PickingObjectDTO pickingObjectDTO, MtbColt refMtbColt, boolean canPartitaMagBeChanged) {
|
||||||
|
|
||||||
BigDecimal totalQtaOrd = pickingObjectDTO.getSitArtOrdDTO().getQtaOrd();
|
BigDecimal totalQtaOrd = pickingObjectDTO.getSitArtOrdDTO().getQtaOrd();
|
||||||
BigDecimal totalNumCnfOrd = pickingObjectDTO.getSitArtOrdDTO().getNumCnfOrd();
|
BigDecimal totalNumCnfOrd = pickingObjectDTO.getSitArtOrdDTO().getNumCnfOrd();
|
||||||
@@ -900,7 +905,9 @@ public class SpedizioneViewModel {
|
|||||||
this.sendOnItemDispatched(
|
this.sendOnItemDispatched(
|
||||||
pickingObjectDTO,
|
pickingObjectDTO,
|
||||||
pickingObjectDTO.getMtbAart(),
|
pickingObjectDTO.getMtbAart(),
|
||||||
null, null, null,
|
mUseQtaOrd ? numCnfDaPrelevare : null,
|
||||||
|
mUseQtaOrd ? qtaCnfDaPrelevare : null,
|
||||||
|
mUseQtaOrd ? qtaColDaPrelevare : null,
|
||||||
qtaDaEvadere,
|
qtaDaEvadere,
|
||||||
numCnfDaEvadere,
|
numCnfDaEvadere,
|
||||||
qtaCnfDaEvadere,
|
qtaCnfDaEvadere,
|
||||||
@@ -913,6 +920,7 @@ public class SpedizioneViewModel {
|
|||||||
partitaMag,
|
partitaMag,
|
||||||
dataScad,
|
dataScad,
|
||||||
mCanOverflowOrderQuantity,
|
mCanOverflowOrderQuantity,
|
||||||
|
canPartitaMagBeChanged,
|
||||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
(pickedQuantityDTO, shouldCloseLU) -> {
|
||||||
this.saveNewRow(pickingObjectDTO,
|
this.saveNewRow(pickingObjectDTO,
|
||||||
finalRefMtbColt,
|
finalRefMtbColt,
|
||||||
@@ -1052,6 +1060,7 @@ public class SpedizioneViewModel {
|
|||||||
partitaMag,
|
partitaMag,
|
||||||
dataScad,
|
dataScad,
|
||||||
mCanOverflowOrderQuantity,
|
mCanOverflowOrderQuantity,
|
||||||
|
true,
|
||||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
(pickedQuantityDTO, shouldCloseLU) -> {
|
||||||
this.saveNewRow(pickingObjectDTO,
|
this.saveNewRow(pickingObjectDTO,
|
||||||
finalRefMtbColt,
|
finalRefMtbColt,
|
||||||
@@ -1188,6 +1197,7 @@ public class SpedizioneViewModel {
|
|||||||
partitaMag,
|
partitaMag,
|
||||||
dataScad,
|
dataScad,
|
||||||
mCanOverflowOrderQuantity,
|
mCanOverflowOrderQuantity,
|
||||||
|
false,
|
||||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
(pickedQuantityDTO, shouldCloseLU) -> {
|
||||||
this.saveEditedRow(mtbColrToEdit,
|
this.saveEditedRow(mtbColrToEdit,
|
||||||
pickedQuantityDTO.getNumCnf(),
|
pickedQuantityDTO.getNumCnf(),
|
||||||
@@ -1584,7 +1594,8 @@ public class SpedizioneViewModel {
|
|||||||
|
|
||||||
IOrdiniVendita ordiniVendita = ClassRouter.getInstance(ClassRouter.PATH.ORDINI_VENDITA);
|
IOrdiniVendita ordiniVendita = ClassRouter.getInstance(ClassRouter.PATH.ORDINI_VENDITA);
|
||||||
ordiniVendita.distribuisciCollo(cloneMtbColt, mTestateOrdini, mtbColts -> {
|
ordiniVendita.distribuisciCollo(cloneMtbColt, mTestateOrdini, mtbColts -> {
|
||||||
mColliMagazzinoRESTConsumer.getMultipleByTestate(mtbColts, false, onComplete, this::sendError);
|
mColliMagazzinoRESTConsumer.fillMtbAartsOfMtbColts(mtbColts, onComplete, this::sendError);
|
||||||
|
// mColliMagazzinoRESTConsumer.getMultipleByTestate(mtbColts, false, onComplete, this::sendError);
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1848,6 +1859,7 @@ public class SpedizioneViewModel {
|
|||||||
String partitaMag,
|
String partitaMag,
|
||||||
Date dataScad,
|
Date dataScad,
|
||||||
boolean canOverflowOrderQuantity,
|
boolean canOverflowOrderQuantity,
|
||||||
|
boolean canBatchLotBeChanged,
|
||||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
|
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ultime_consegne_cliente;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface UltimeConsegneClienteComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory{
|
||||||
|
UltimeConsegneClienteComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(UltimeConsegneClienteFragment ultimeConsegneClienteFragment);
|
||||||
|
}
|
||||||
@@ -7,38 +7,62 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.AppCompatTextView;
|
import androidx.appcompat.widget.AppCompatTextView;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.annimon.stream.Optional;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
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.R;
|
||||||
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||||
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IFilterableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IFilterableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||||
|
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentMainUltimeConsegneClienteBinding;
|
import it.integry.integrywmsnative.databinding.FragmentMainUltimeConsegneClienteBinding;
|
||||||
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.viewmodel.UltimeConsegneClienteViewModel;
|
import it.integry.integrywmsnative.gest.picking_resi.PickingResiActivity;
|
||||||
|
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.dialog.DialogUltimeConsegneFiltroAvanzato;
|
||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
|
|
||||||
public class UltimeConsegneClienteFragment extends Fragment implements ITitledFragment, IScrollableFragment, IFilterableFragment {
|
public class UltimeConsegneClienteFragment extends BaseFragment implements UltimeConsegneClienteViewModel.Listener, ITitledFragment, IScrollableFragment, IFilterableFragment {
|
||||||
|
|
||||||
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||||
private ElevatedToolbar mToolbar;
|
private ElevatedToolbar mToolbar;
|
||||||
|
|
||||||
private UltimeConsegneClienteViewModel mViewModel;
|
private int barcodeScannerIstanceID = -1;
|
||||||
|
|
||||||
|
private final ObservableArrayList<DocumentoResoDTO> mDocumentiMutableData = new ObservableArrayList<>();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
UltimeConsegneClienteViewModel mViewModel;
|
||||||
|
|
||||||
|
private DialogUltimeConsegneFiltroAvanzato.DialogUltimeConsegneFiltroAvanzatoViewModel mAppliedFilterViewModel;
|
||||||
|
|
||||||
|
private FragmentMainUltimeConsegneClienteBinding mBindings;
|
||||||
|
|
||||||
public UltimeConsegneClienteFragment() {
|
public UltimeConsegneClienteFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UltimeConsegneClienteFragment newInstance() {
|
public static UltimeConsegneClienteFragment newInstance() {
|
||||||
UltimeConsegneClienteFragment fragment = new UltimeConsegneClienteFragment();
|
return new UltimeConsegneClienteFragment();
|
||||||
Bundle args = new Bundle();
|
|
||||||
|
|
||||||
fragment.setArguments(args);
|
|
||||||
return fragment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -46,21 +70,158 @@ public class UltimeConsegneClienteFragment extends Fragment implements ITitledFr
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
|
||||||
FragmentMainUltimeConsegneClienteBinding mBinding = DataBindingUtil.inflate(LayoutInflater.from(getActivity()), R.layout.fragment_main_ultime_consegne_cliente, container, false);
|
mBindings = DataBindingUtil.inflate(LayoutInflater.from(getActivity()), R.layout.fragment_main_ultime_consegne_cliente, container, false);
|
||||||
|
|
||||||
mViewModel = new UltimeConsegneClienteViewModel(getActivity(), mBinding);
|
MainApplication.appComponent
|
||||||
|
.ultimeConsegneClienteComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
mBinding.setViewmodel(mViewModel);
|
mViewModel.setListener(this);
|
||||||
|
|
||||||
mToolbar.setRecyclerView(mBinding.recyclerView);
|
mBindings.setLifecycleOwner(this);
|
||||||
|
mBindings.setView(this);
|
||||||
|
mBindings.setViewmodel(mViewModel);
|
||||||
|
|
||||||
|
|
||||||
|
this.initRecyclerView();
|
||||||
|
// this.initBarcodeReader();
|
||||||
|
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
return mBinding.getRoot();
|
return mBindings.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
|
mViewModel.init(codMdep);
|
||||||
|
|
||||||
|
this.mBindings.mainFab.hide();
|
||||||
|
this.mBindings.mainFab.setOnClickListener(v -> {
|
||||||
|
dispatchConsegne();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.mViewModel.getDocuments().observe(this, this::refreshList);
|
||||||
|
|
||||||
|
openFilterDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void openFilterDialog() {
|
||||||
|
this.mViewModel.loadCodAnagClienti(gtbAnags -> {
|
||||||
|
DialogUltimeConsegneFiltroAvanzato.make(getActivity(), gtbAnags, mAppliedFilterViewModel, (filter) -> {
|
||||||
|
mAppliedFilterViewModel = filter;
|
||||||
|
refreshItems();
|
||||||
|
}).show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initRecyclerView() {
|
||||||
|
UltimeConsegneMainListAdapter mAdapter =
|
||||||
|
new UltimeConsegneMainListAdapter(getActivity(), mDocumentiMutableData);
|
||||||
|
mAdapter.setOnSelectionChanged(this::onSingleSelectionChanged);
|
||||||
|
mAdapter.setEmptyView(mBindings.emptyView);
|
||||||
|
|
||||||
|
mBindings.recyclerView.setHasFixedSize(true);
|
||||||
|
mBindings.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
|
mBindings.recyclerView.setAdapter(mAdapter);
|
||||||
|
// mBindings.fastscroll.setRecyclerView(mBindings.recyclerView);
|
||||||
|
|
||||||
|
|
||||||
|
if(mToolbar != null)
|
||||||
|
mToolbar.setRecyclerView(mBindings.recyclerView);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initBarcodeReader() {
|
||||||
|
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||||
|
.setOnScanSuccessfull(onScanSuccessful)
|
||||||
|
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||||
|
|
||||||
|
BarcodeManager.enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||||
|
BarcodeManager.disable();
|
||||||
|
|
||||||
|
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||||
|
BarcodeManager.enable();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
private void refreshList(List<DocumentoResoDTO> documentList) {
|
||||||
|
this.mDocumentiMutableData.clear();
|
||||||
|
this.mDocumentiMutableData.addAll(sort(documentList));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshItems() {
|
||||||
|
this.openProgress();
|
||||||
|
|
||||||
|
String currentAnagFilter = mAppliedFilterViewModel != null ? mAppliedFilterViewModel.ragSoc.get() : null;
|
||||||
|
String currentCodAnagFilter = null;
|
||||||
|
|
||||||
|
Optional<GtbAnag> singleGtbAnag = Stream.of(this.mViewModel.getGtbAnagClienti().getValue())
|
||||||
|
.filter(x -> (x.getCodAnag() + " - " + x.getRagSoc()).equals(currentAnagFilter))
|
||||||
|
.findSingle();
|
||||||
|
|
||||||
|
if (singleGtbAnag.isPresent()) {
|
||||||
|
currentCodAnagFilter = singleGtbAnag.get().getCodAnag();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mViewModel.loadConsegneClienti(currentCodAnagFilter,
|
||||||
|
null,
|
||||||
|
-1,
|
||||||
|
548
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DocumentoResoDTO> sort(List<DocumentoResoDTO> dataset) {
|
||||||
|
List<DocumentoResoDTO> sortedDataset = Stream.of(dataset)
|
||||||
|
.sortBy(DocumentoResoDTO::getRagSoc)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return sortedDataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void onSingleSelectionChanged(DocumentoResoDTO dto) {
|
||||||
|
List<DocumentoResoDTO> selectedOrders = getSelectedItems();
|
||||||
|
|
||||||
|
if (dto.isSelected()) {
|
||||||
|
Stream.of(selectedOrders)
|
||||||
|
.filter(x -> !x.getRagSoc().equalsIgnoreCase(dto.getRagSoc()))
|
||||||
|
.forEach(x -> x.setSelected(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedOrders != null && selectedOrders.size() > 0) {
|
||||||
|
mBindings.mainFab.show();
|
||||||
|
} else {
|
||||||
|
mBindings.mainFab.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private List<DocumentoResoDTO> getSelectedItems() {
|
||||||
|
return Stream.of(this.mDocumentiMutableData)
|
||||||
|
.filter(DocumentoResoDTO::isSelected)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void dispatchConsegne() {
|
||||||
|
List<DocumentoResoDTO> selectedConsegne = getSelectedItems();
|
||||||
|
|
||||||
|
PickingResiActivity.startActivity(getActivity(), getActivity().getText(R.string.ultime_consegne_cliente_title).toString(), selectedConsegne, +1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
for(Runnable onPreDestroy : mOnPreDestroyList) {
|
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
||||||
onPreDestroy.run();
|
onPreDestroy.run();
|
||||||
}
|
}
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@@ -78,11 +239,30 @@ public class UltimeConsegneClienteFragment extends Fragment implements ITitledFr
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFilterClick() {
|
public void onFilterClick() {
|
||||||
mViewModel.openFilterDialog();
|
openFilterDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addOnPreDestroy(Runnable onPreDestroy) {
|
public void addOnPreDestroy(Runnable onPreDestroy) {
|
||||||
this.mOnPreDestroyList.add(onPreDestroy);
|
this.mOnPreDestroyList.add(onPreDestroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadingStarted() {
|
||||||
|
BarcodeManager.disable();
|
||||||
|
this.openProgress();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadingEnded() {
|
||||||
|
this.closeProgress();
|
||||||
|
BarcodeManager.enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Exception ex) {
|
||||||
|
this.closeProgress();
|
||||||
|
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
||||||
|
BarcodeManager.enable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ultime_consegne_cliente;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.rest.UltimeConsegneClienteRESTConsumer;
|
||||||
|
|
||||||
|
@Module(subcomponents = UltimeConsegneClienteComponent.class)
|
||||||
|
public class UltimeConsegneClienteModule {
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
UltimeConsegneClienteRESTConsumer providesUltimeConsegneClienteRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||||
|
return new UltimeConsegneClienteRESTConsumer(systemRESTConsumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
UltimeConsegneClienteViewModel providesUltimeConsegneClienteViewModel(
|
||||||
|
UltimeConsegneClienteRESTConsumer ultimeConsegneClienteRESTConsumer,
|
||||||
|
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||||
|
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer) {
|
||||||
|
return new UltimeConsegneClienteViewModel(ultimeConsegneClienteRESTConsumer, barcodeRESTConsumer, colliMagazzinoRESTConsumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ultime_consegne_cliente;
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
|
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
|
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.rest.UltimeConsegneClienteRESTConsumer;
|
||||||
|
|
||||||
|
public class UltimeConsegneClienteViewModel {
|
||||||
|
|
||||||
|
|
||||||
|
private final MutableLiveData<List<GtbAnag>> mGtbAnagClienti = new MutableLiveData<>();
|
||||||
|
private final MutableLiveData<List<DocumentoResoDTO>> mDocuments = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private final UltimeConsegneClienteRESTConsumer mUltimeConsegneClienteRESTConsumer;
|
||||||
|
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||||
|
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||||
|
|
||||||
|
private Listener mListener;
|
||||||
|
|
||||||
|
private String mCodMdep;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public UltimeConsegneClienteViewModel(
|
||||||
|
UltimeConsegneClienteRESTConsumer ultimeConsegneClienteRESTConsumer,
|
||||||
|
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||||
|
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer) {
|
||||||
|
this.mUltimeConsegneClienteRESTConsumer = ultimeConsegneClienteRESTConsumer;
|
||||||
|
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||||
|
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void init(String codMdep) {
|
||||||
|
this.mCodMdep = codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadCodAnagClienti(RunnableArgs<List<GtbAnag>> onComplete) {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
|
this.mUltimeConsegneClienteRESTConsumer.getAvailableCodAnagClienti(gtbAnags -> {
|
||||||
|
mGtbAnagClienti.postValue(gtbAnags);
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
|
||||||
|
onComplete.run(gtbAnags);
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void loadConsegneClienti(String codAnag, String codMart, int limitDocsForCli, int limitDays) {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
|
this.mUltimeConsegneClienteRESTConsumer.getUltimeConsegneClienti(mCodMdep, codAnag, codMart, limitDocsForCli, limitDays, documentList -> {
|
||||||
|
this.mDocuments.postValue(documentList);
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
|
RunnableArgs<List<OrdiniUscitaElencoDTO>> onBarcodeScanComplete = orderList -> {
|
||||||
|
onComplete.run();
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
};
|
||||||
|
|
||||||
|
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||||
|
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onBarcodeScanComplete);
|
||||||
|
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||||
|
this.executeEtichettaEan128(barcodeScanDTO, onBarcodeScanComplete);
|
||||||
|
} else {
|
||||||
|
onComplete.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void executeEtichettaLU(String SSCC, RunnableArgs<List<OrdiniUscitaElencoDTO>> onComplete) {
|
||||||
|
this.mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
|
||||||
|
|
||||||
|
if(mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
|
||||||
|
|
||||||
|
// if(mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) {
|
||||||
|
// //GET BY COMMESSA COLLO
|
||||||
|
// this.mOrdiniUscitaElencoRESTConsumer.getOrdiniFromCommessaCollo(mCurrentCodMdep, mtbColt, orderList -> {
|
||||||
|
//
|
||||||
|
// if(orderList != null && orderList.size() > 0) {
|
||||||
|
// List<Integer> numOrds = Stream.of(orderList)
|
||||||
|
// .map(DtbOrdt::getNumOrd)
|
||||||
|
// .toList();
|
||||||
|
//
|
||||||
|
// List<OrdiniUscitaElencoDTO> filteredOrders = Stream.of(mOrderList.getValue())
|
||||||
|
// .filter(x -> numOrds.contains(x.getNumOrd())).toList();
|
||||||
|
//
|
||||||
|
// onComplete.run(filteredOrders);
|
||||||
|
// } else {
|
||||||
|
// this.sendError(new NoOrderFoundException());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }, this::sendError);
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// this.sendError(new InvalidLUGestioneException(GestioneEnum.VENDITA));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
} else {
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
}
|
||||||
|
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, RunnableArgs<List<OrdiniUscitaElencoDTO>> onComplete) {
|
||||||
|
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||||
|
String barcodeProd = null;
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||||
|
barcodeProd = ean128Model.Content;
|
||||||
|
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||||
|
this.executeEtichettaLU(ean128Model.Sscc, onComplete);
|
||||||
|
} else {
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
}
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public MutableLiveData<List<GtbAnag>> getGtbAnagClienti() {
|
||||||
|
return mGtbAnagClienti;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableLiveData<List<DocumentoResoDTO>> getDocuments() {
|
||||||
|
return mDocuments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UltimeConsegneClienteViewModel setListener(Listener listener) {
|
||||||
|
this.mListener = listener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Listener extends ILoadingListener {
|
||||||
|
void onError(Exception ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,44 +1,31 @@
|
|||||||
package it.integry.integrywmsnative.gest.ultime_consegne_cliente.viewmodel;
|
package it.integry.integrywmsnative.gest.ultime_consegne_cliente;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.core.content.res.ResourcesCompat;
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.databinding.ObservableArrayList;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
import com.zhukic.sectionedrecyclerview.SectionedRecyclerViewAdapter;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.view.ExtendedSectionedRecyclerView;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentMainUltimeConsegneClienteListHeaderBinding;
|
import it.integry.integrywmsnative.databinding.FragmentMainUltimeConsegneClienteListHeaderBinding;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentMainUltimeConsegneClienteListSingleItemBinding;
|
import it.integry.integrywmsnative.databinding.FragmentMainUltimeConsegneClienteListSingleItemBinding;
|
||||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
|
||||||
import it.integry.integrywmsnative.ui.fastscroll.SectionTitleProvider;
|
|
||||||
|
|
||||||
public class UltimeConsegneMainListAdapter extends SectionedRecyclerViewAdapter<UltimeConsegneMainListAdapter.SubheaderHolder, UltimeConsegneMainListAdapter.SingleItemViewHolder> implements SectionTitleProvider {
|
public class UltimeConsegneMainListAdapter extends ExtendedSectionedRecyclerView<DocumentoResoDTO, UltimeConsegneMainListAdapter.SubheaderHolder, UltimeConsegneMainListAdapter.SingleItemViewHolder> {
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private List<DocumentoResoDTO> mDataset;
|
|
||||||
private ArrayList<String> mSectionTitleItems;
|
|
||||||
|
|
||||||
private RunnableArgs<DocumentoResoDTO> mOnSelectionChanged;
|
private RunnableArgs<DocumentoResoDTO> mOnSelectionChanged;
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSectionTitle(int position) {
|
|
||||||
return mSectionTitleItems.get(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static class SubheaderHolder extends RecyclerView.ViewHolder {
|
static class SubheaderHolder extends RecyclerView.ViewHolder {
|
||||||
@@ -65,12 +52,9 @@ public class UltimeConsegneMainListAdapter extends SectionedRecyclerViewAdapter<
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public UltimeConsegneMainListAdapter(Context context, ArrayList<DocumentoResoDTO> dataset) {
|
public UltimeConsegneMainListAdapter(Context context, ObservableArrayList<DocumentoResoDTO> mutableDataSet) {
|
||||||
super();
|
super(mutableDataSet);
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
this.mDataset = new ArrayList<>();
|
|
||||||
|
|
||||||
updateItems(sort(dataset));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -146,45 +130,6 @@ public class UltimeConsegneMainListAdapter extends SectionedRecyclerViewAdapter<
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemSize() {
|
|
||||||
return this.mDataset.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void updateItems(List<DocumentoResoDTO> updatedDataset) {
|
|
||||||
mDataset.clear();
|
|
||||||
mDataset.addAll(sort(updatedDataset));
|
|
||||||
notifyDataSetChanged();
|
|
||||||
notifyDataChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<DocumentoResoDTO> sort(List<DocumentoResoDTO> dataset) {
|
|
||||||
this.mSectionTitleItems = new ArrayList<>();
|
|
||||||
|
|
||||||
List<DocumentoResoDTO> sortedDataset = Stream.of(dataset)
|
|
||||||
.sortBy(DocumentoResoDTO::getRagSoc)
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
|
|
||||||
Stream.of(sortedDataset)
|
|
||||||
.map(DocumentoResoDTO::getRagSoc)
|
|
||||||
.distinct()
|
|
||||||
.forEach(x -> {
|
|
||||||
this.mSectionTitleItems.add(String.valueOf(x.charAt(0)));
|
|
||||||
|
|
||||||
long count = Stream.of(dataset)
|
|
||||||
.filter(y -> y.getRagSoc().equalsIgnoreCase(x))
|
|
||||||
.count();
|
|
||||||
|
|
||||||
|
|
||||||
for(int i = 0; i < count; i++) this.mSectionTitleItems.add(String.valueOf(x.charAt(0)));
|
|
||||||
});
|
|
||||||
|
|
||||||
return sortedDataset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOnSelectionChanged(RunnableArgs<DocumentoResoDTO> mSelectionChanged) {
|
public void setOnSelectionChanged(RunnableArgs<DocumentoResoDTO> mSelectionChanged) {
|
||||||
this.mOnSelectionChanged = mSelectionChanged;
|
this.mOnSelectionChanged = mSelectionChanged;
|
||||||
@@ -8,6 +8,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.model.GtbAnag;
|
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
|
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
|
||||||
@@ -20,65 +22,61 @@ import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
|||||||
import it.integry.integrywmsnative.gest.picking_resi.rest.WithdrawableDtbDocr;
|
import it.integry.integrywmsnative.gest.picking_resi.rest.WithdrawableDtbDocr;
|
||||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
public class UltimeConsegneClienteRESTConsumer {
|
public class UltimeConsegneClienteRESTConsumer {
|
||||||
|
|
||||||
public static void getAvailableCodAnagClienti(RunnableArgs<List<GtbAnag>> onComplete, RunnableArgs<Exception> onFailed) {
|
private final SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
|
public UltimeConsegneClienteRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||||
|
this.systemRESTConsumer = systemRESTConsumer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getAvailableCodAnagClienti(RunnableArgs<List<GtbAnag>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
String sql = "SELECT DISTINCT gtb_anag.cod_anag, gtb_anag.rag_soc " +
|
String sql = "SELECT DISTINCT gtb_anag.cod_anag, gtb_anag.rag_soc " +
|
||||||
"FROM gtb_anag " +
|
"FROM gtb_anag " +
|
||||||
"INNER JOIN vtb_clie ON vtb_clie.cod_anag = gtb_anag.cod_anag " +
|
"INNER JOIN vtb_clie ON vtb_clie.cod_anag = gtb_anag.cod_anag " +
|
||||||
"WHERE flag_stato = 'A'";
|
"WHERE flag_stato = 'A'";
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<GtbAnag>>() {}.getType();
|
Type typeOfObjectsList = new TypeToken<ArrayList<GtbAnag>>() {
|
||||||
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<GtbAnag>>() {
|
}.getType();
|
||||||
@Override
|
systemRESTConsumer.<ArrayList<GtbAnag>>processSql(sql, typeOfObjectsList, value -> {
|
||||||
public void onSuccess(ArrayList<GtbAnag> value) {
|
if (onComplete != null) onComplete.run(value);
|
||||||
if(onComplete != null) onComplete.run(value);
|
}, ex -> {
|
||||||
}
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailed(Exception ex) {
|
|
||||||
if(onFailed != null) onFailed.run(ex);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void getUltimeConsegneClienti(String codMdep, String codAnag, String codMart, Integer limitConsegnePerCli, int limitDays, RunnableArgs<ArrayList<DocumentoResoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getUltimeConsegneClienti(String codMdep, String codAnag, String codMart, Integer limitConsegnePerCli, int limitDays, RunnableArgs<ArrayList<DocumentoResoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
String sql = "SELECT consegne.*, " +
|
String sql = "SELECT consegne.*, " +
|
||||||
" rag_soc," +
|
" rag_soc," +
|
||||||
" dtb_doct.gestione " +
|
" dtb_doct.gestione " +
|
||||||
"FROM WMS_GetUltimeConsegneClienti(" +
|
"FROM WMS_GetUltimeConsegneClienti(" +
|
||||||
UtilityDB.valueToString(limitConsegnePerCli) + ", " +
|
UtilityDB.valueToString(limitConsegnePerCli >= 0 ? limitConsegnePerCli : null) + ", " +
|
||||||
UtilityDB.valueToString(codAnag) + ", " +
|
UtilityDB.valueToString(codAnag) + ", " +
|
||||||
UtilityDB.valueToString(codMart) + ", " +
|
UtilityDB.valueToString(codMart) + ", " +
|
||||||
UtilityDB.valueToString(codMdep) + ", " +
|
UtilityDB.valueToString(codMdep) + ", " +
|
||||||
UtilityDB.valueToString(limitDays) + ") consegne " +
|
UtilityDB.valueToString(limitDays) + ") consegne " +
|
||||||
"INNER JOIN dtb_doct ON consegne.num_doc = dtb_doct.num_doc AND consegne.data_doc = dtb_doct.data_doc AND consegne.cod_anag = dtb_doct.cod_anag AND consegne.cod_dtip = dtb_doct.cod_dtip AND consegne.ser_doc = dtb_doct.ser_doc " +
|
"INNER JOIN dtb_doct ON consegne.num_doc = dtb_doct.num_doc AND consegne.data_doc = dtb_doct.data_doc AND consegne.cod_anag = dtb_doct.cod_anag AND consegne.cod_dtip = dtb_doct.cod_dtip AND consegne.ser_doc = dtb_doct.ser_doc " +
|
||||||
"LEFT OUTER JOIN gtb_anag ON consegne.cod_anag = gtb_anag.cod_anag " +
|
"LEFT OUTER JOIN gtb_anag ON consegne.cod_anag = gtb_anag.cod_anag " +
|
||||||
"ORDER BY rag_soc, " +
|
"ORDER BY rag_soc, " +
|
||||||
" counter_consegna ";
|
" counter_consegna ";
|
||||||
|
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<DocumentoResoDTO>>() {}.getType();
|
Type typeOfObjectsList = new TypeToken<ArrayList<DocumentoResoDTO>>() {
|
||||||
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<DocumentoResoDTO>>() {
|
}.getType();
|
||||||
@Override
|
systemRESTConsumer.<ArrayList<DocumentoResoDTO>>processSql(sql, typeOfObjectsList, value -> {
|
||||||
public void onSuccess(ArrayList<DocumentoResoDTO> value) {
|
if (onComplete != null) onComplete.run(value);
|
||||||
if(onComplete != null) onComplete.run(value);
|
}, ex -> {
|
||||||
}
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailed(Exception ex) {
|
|
||||||
if(onFailed != null) onFailed.run(ex);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void loadDocRowFromConsegna(List<DocumentoResoDTO> consegne, RunnableArgs<ArrayList<WithdrawableDtbDocr>> onComplete, RunnableArgs<Exception> onFailed) {
|
public static void loadDocRowFromConsegna(List<DocumentoResoDTO> consegne, RunnableArgs<ArrayList<WithdrawableDtbDocr>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
List<HashMap<String, Object>> filterCond = new ArrayList<>();
|
List<HashMap<String, Object>> filterCond = new ArrayList<>();
|
||||||
|
|
||||||
for(int i = 0; i < consegne.size(); i++) {
|
for (int i = 0; i < consegne.size(); i++) {
|
||||||
HashMap<String, Object> filter = new HashMap<>();
|
HashMap<String, Object> filter = new HashMap<>();
|
||||||
|
|
||||||
filter.put("dtb_docr.data_doc", consegne.get(i).getDataDocD());
|
filter.put("dtb_docr.data_doc", consegne.get(i).getDataDocD());
|
||||||
@@ -172,17 +170,18 @@ public class UltimeConsegneClienteRESTConsumer {
|
|||||||
" (ctb_grup.sezione <> 1 OR ctb_grup.sezione IS NULL) AND " +
|
" (ctb_grup.sezione <> 1 OR ctb_grup.sezione IS NULL) AND " +
|
||||||
" dtb_docr.[qta_doc] - ISNULL(mtb_colr.qta_col, 0) > 0 AND" +
|
" dtb_docr.[qta_doc] - ISNULL(mtb_colr.qta_col, 0) > 0 AND" +
|
||||||
" ( " +
|
" ( " +
|
||||||
UtilityQuery.concatFieldListInWhereCond(filterCond) +
|
UtilityQuery.concatFieldListInWhereCond(filterCond) +
|
||||||
" ) " +
|
" ) " +
|
||||||
"ORDER BY cod_mart";
|
"ORDER BY cod_mart";
|
||||||
|
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<WithdrawableDtbDocr>>() {}.getType();
|
Type typeOfObjectsList = new TypeToken<ArrayList<WithdrawableDtbDocr>>() {
|
||||||
|
}.getType();
|
||||||
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<WithdrawableDtbDocr>>() {
|
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<WithdrawableDtbDocr>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ArrayList<WithdrawableDtbDocr> values) {
|
public void onSuccess(ArrayList<WithdrawableDtbDocr> values) {
|
||||||
|
|
||||||
if(values != null && values.size() > 0){
|
if (values != null && values.size() > 0) {
|
||||||
List<String> codMarts = Stream.of(values)
|
List<String> codMarts = Stream.of(values)
|
||||||
.map(DtbDocr::getCodMart)
|
.map(DtbDocr::getCodMart)
|
||||||
.withoutNulls()
|
.withoutNulls()
|
||||||
@@ -191,7 +190,7 @@ public class UltimeConsegneClienteRESTConsumer {
|
|||||||
|
|
||||||
ArticoloRESTConsumer.getByCodMartStatic(codMarts, arts -> {
|
ArticoloRESTConsumer.getByCodMartStatic(codMarts, arts -> {
|
||||||
|
|
||||||
if(arts != null && arts.size() > 0) {
|
if (arts != null && arts.size() > 0) {
|
||||||
for (DtbDocr value : values) {
|
for (DtbDocr value : values) {
|
||||||
|
|
||||||
MtbAart foundMtbAart = null;
|
MtbAart foundMtbAart = null;
|
||||||
@@ -199,7 +198,7 @@ public class UltimeConsegneClienteRESTConsumer {
|
|||||||
List<MtbAart> mtbAartStream = Stream.of(arts)
|
List<MtbAart> mtbAartStream = Stream.of(arts)
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(value.getCodMart())).toList();
|
.filter(x -> x.getCodMart().equalsIgnoreCase(value.getCodMart())).toList();
|
||||||
|
|
||||||
if(mtbAartStream != null && mtbAartStream.size() > 0){
|
if (mtbAartStream != null && mtbAartStream.size() > 0) {
|
||||||
foundMtbAart = mtbAartStream.get(0);
|
foundMtbAart = mtbAartStream.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,19 +206,19 @@ public class UltimeConsegneClienteRESTConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(onComplete != null) onComplete.run(values);
|
if (onComplete != null) onComplete.run(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, onFailed);
|
}, onFailed);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(onComplete != null) onComplete.run(values);
|
if (onComplete != null) onComplete.run(values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailed(Exception ex) {
|
public void onFailed(Exception ex) {
|
||||||
if(onFailed != null) onFailed.run(ex);
|
if (onFailed != null) onFailed.run(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,146 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.gest.ultime_consegne_cliente.viewmodel;
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
|
|
||||||
import com.annimon.stream.Optional;
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
|
||||||
import it.integry.integrywmsnative.core.model.GtbAnag;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
|
||||||
import it.integry.integrywmsnative.databinding.FragmentMainUltimeConsegneClienteBinding;
|
|
||||||
import it.integry.integrywmsnative.gest.picking_resi.PickingResiActivity;
|
|
||||||
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.dialog.DialogUltimeConsegneFiltroAvanzato;
|
|
||||||
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.rest.UltimeConsegneClienteRESTConsumer;
|
|
||||||
|
|
||||||
public class UltimeConsegneClienteViewModel {
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
private FragmentMainUltimeConsegneClienteBinding mBinding;
|
|
||||||
|
|
||||||
private UltimeConsegneMainListAdapter mAdapter;
|
|
||||||
private List<DocumentoResoDTO> mItems;
|
|
||||||
private List<DocumentoResoDTO> mRenderedItems = new ArrayList<>();
|
|
||||||
|
|
||||||
private List<GtbAnag> mAvailableGtbAnags = null;
|
|
||||||
|
|
||||||
private DialogUltimeConsegneFiltroAvanzato.DialogUltimeConsegneFiltroAvanzatoViewModel mAppliedFilterViewModel;
|
|
||||||
|
|
||||||
public UltimeConsegneClienteViewModel(Context context, FragmentMainUltimeConsegneClienteBinding binding) {
|
|
||||||
this.mContext = context;
|
|
||||||
this.mBinding = binding;
|
|
||||||
|
|
||||||
this.mBinding.mainFab.hide();
|
|
||||||
this.mBinding.mainFab.setOnClickListener(v -> {
|
|
||||||
dispatchConsegne();
|
|
||||||
});
|
|
||||||
|
|
||||||
openFilterDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void openFilterDialog() {
|
|
||||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
|
||||||
|
|
||||||
UltimeConsegneClienteRESTConsumer.getAvailableCodAnagClienti(gtbAnags -> {
|
|
||||||
mAvailableGtbAnags = gtbAnags;
|
|
||||||
progressDialog.dismiss();
|
|
||||||
|
|
||||||
DialogUltimeConsegneFiltroAvanzato.make(mContext, gtbAnags, mAppliedFilterViewModel, (filter) -> {
|
|
||||||
mAppliedFilterViewModel = filter;
|
|
||||||
refreshItems();
|
|
||||||
}).show();
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initDataAdapter(ArrayList<DocumentoResoDTO> dataset) {
|
|
||||||
mAdapter = new UltimeConsegneMainListAdapter(mContext, dataset);
|
|
||||||
mAdapter.setOnSelectionChanged(this::onSingleSelectionChanged);
|
|
||||||
|
|
||||||
mBinding.recyclerView.setHasFixedSize(true);
|
|
||||||
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
|
|
||||||
mBinding.recyclerView.setAdapter(mAdapter);
|
|
||||||
mBinding.fastscroll.setRecyclerView(mBinding.recyclerView);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void refreshItems(){
|
|
||||||
|
|
||||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
|
||||||
|
|
||||||
String currentAnagFilter = mAppliedFilterViewModel != null ? mAppliedFilterViewModel.ragSoc.get() : null;
|
|
||||||
String currentCodAnagFilter = null;
|
|
||||||
|
|
||||||
Optional<GtbAnag> singleGtbAnag = Stream.of(mAvailableGtbAnags)
|
|
||||||
.filter(x -> (x.getCodAnag() + " - " + x.getRagSoc()).equals(currentAnagFilter))
|
|
||||||
.findSingle();
|
|
||||||
|
|
||||||
if(singleGtbAnag.isPresent()) {
|
|
||||||
currentCodAnagFilter = singleGtbAnag.get().getCodAnag();
|
|
||||||
}
|
|
||||||
|
|
||||||
UltimeConsegneClienteRESTConsumer.getUltimeConsegneClienti(
|
|
||||||
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
|
|
||||||
currentCodAnagFilter,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
548,
|
|
||||||
consegne -> {
|
|
||||||
this.mItems = consegne;
|
|
||||||
|
|
||||||
this.initDataAdapter(consegne);
|
|
||||||
mBinding.emptyView.setVisibility((this.mItems != null && this.mItems.size() > 0) ? View.GONE : View.VISIBLE);
|
|
||||||
|
|
||||||
mRenderedItems.clear();
|
|
||||||
if(this.mItems != null) mRenderedItems.addAll(this.mItems);
|
|
||||||
mAdapter.updateItems(mRenderedItems);
|
|
||||||
|
|
||||||
progressDialog.dismiss();
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onSingleSelectionChanged(DocumentoResoDTO dto) {
|
|
||||||
List<DocumentoResoDTO> selectedOrders = getSelectedItems();
|
|
||||||
|
|
||||||
if(dto.isSelected()) {
|
|
||||||
Stream.of(selectedOrders)
|
|
||||||
.filter(x -> !x.getRagSoc().equalsIgnoreCase(dto.getRagSoc()))
|
|
||||||
.forEach(x -> x.setSelected(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(selectedOrders != null && selectedOrders.size() > 0) {
|
|
||||||
mBinding.mainFab.show();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mBinding.mainFab.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<DocumentoResoDTO> getSelectedItems() {
|
|
||||||
return Stream.of(this.mItems)
|
|
||||||
.filter(DocumentoResoDTO::isSelected)
|
|
||||||
.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void dispatchConsegne() {
|
|
||||||
List<DocumentoResoDTO> selectedConsegne = getSelectedItems();
|
|
||||||
|
|
||||||
PickingResiActivity.startActivity(mContext, mContext.getText(R.string.ultime_consegne_cliente_title).toString(), selectedConsegne, +1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface UltimiArriviFornitoreComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory{
|
||||||
|
UltimiArriviFornitoreComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(UltimiArriviFornitoreFragment ultimiArriviFornitoreFragment);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,41 +7,70 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.AppCompatTextView;
|
import androidx.appcompat.widget.AppCompatTextView;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.annimon.stream.Optional;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
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.R;
|
||||||
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||||
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IFilterableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IFilterableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||||
|
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||||
|
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.rest.model.DocumentoResoDTO;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentUltimiArriviFornitoreBinding;
|
import it.integry.integrywmsnative.databinding.FragmentUltimiArriviFornitoreBinding;
|
||||||
|
import it.integry.integrywmsnative.gest.picking_resi.PickingResiActivity;
|
||||||
|
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.core.UltimiArriviFornitoreListAdapter;
|
||||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.core.UltimiArriviFornitoreViewModel;
|
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.core.UltimiArriviFornitoreViewModel;
|
||||||
|
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.dialog.DialogUltimiArriviFornitoreFiltroAvanzato;
|
||||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link BaseFragment} subclass.
|
||||||
*/
|
*/
|
||||||
public class UltimiArriviFornitoreFragment extends Fragment implements ITitledFragment, IScrollableFragment, IFilterableFragment {
|
public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitledFragment, IScrollableFragment, IFilterableFragment, UltimiArriviFornitoreViewModel.Listener {
|
||||||
|
|
||||||
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||||
private ElevatedToolbar mToolbar;
|
private ElevatedToolbar mToolbar;
|
||||||
|
|
||||||
private UltimiArriviFornitoreViewModel mViewModel;
|
private int barcodeScannerIstanceID = -1;
|
||||||
|
|
||||||
|
private final ObservableArrayList<DocumentoResoDTO> mDocumentiMutableData = new ObservableArrayList<>();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
UltimiArriviFornitoreViewModel mViewModel;
|
||||||
|
|
||||||
|
private FragmentUltimiArriviFornitoreBinding mBindings;
|
||||||
|
private DialogUltimiArriviFornitoreFiltroAvanzato.DialogUltimiArriviFiltroAvanzatoViewModel mAppliedFilterViewModel;
|
||||||
|
|
||||||
public UltimiArriviFornitoreFragment() {
|
public UltimiArriviFornitoreFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UltimiArriviFornitoreFragment newInstance() {
|
public static UltimiArriviFornitoreFragment newInstance() {
|
||||||
UltimiArriviFornitoreFragment fragment = new UltimiArriviFornitoreFragment();
|
return new UltimiArriviFornitoreFragment();
|
||||||
Bundle args = new Bundle();
|
|
||||||
|
|
||||||
fragment.setArguments(args);
|
|
||||||
return fragment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -49,21 +78,155 @@ public class UltimiArriviFornitoreFragment extends Fragment implements ITitledFr
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
FragmentUltimiArriviFornitoreBinding mBinding = DataBindingUtil.inflate(LayoutInflater.from(getActivity()), R.layout.fragment_ultimi_arrivi_fornitore, container, false);
|
mBindings = DataBindingUtil.inflate(LayoutInflater.from(getActivity()), R.layout.fragment_ultimi_arrivi_fornitore, container, false);
|
||||||
|
|
||||||
mViewModel = new UltimiArriviFornitoreViewModel(getActivity(), mBinding);
|
MainApplication.appComponent
|
||||||
|
.ultimiArriviFornitoreComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
mBinding.setViewmodel(mViewModel);
|
mViewModel.setListener(this);
|
||||||
|
|
||||||
mToolbar.setRecyclerView(mBinding.recyclerView);
|
mBindings.setLifecycleOwner(this);
|
||||||
|
mBindings.setView(this);
|
||||||
|
mBindings.setViewmodel(mViewModel);
|
||||||
|
|
||||||
|
this.initRecyclerView();
|
||||||
|
this.initBarcodeReader();
|
||||||
|
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
return mBinding.getRoot();
|
return mBindings.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
|
mViewModel.init(codMdep);
|
||||||
|
|
||||||
|
this.mBindings.mainFab.hide();
|
||||||
|
this.mBindings.mainFab.setOnClickListener(v -> {
|
||||||
|
dispatchConsegne();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.mViewModel.getDocuments().observe(this.getViewLifecycleOwner(), this::refreshList);
|
||||||
|
|
||||||
|
openFilterDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void openFilterDialog() {
|
||||||
|
this.mViewModel.loadCodAnagFornitori(gtbAnags -> {
|
||||||
|
DialogUltimiArriviFornitoreFiltroAvanzato.make(getActivity(), gtbAnags, mAppliedFilterViewModel, (filter) -> {
|
||||||
|
mAppliedFilterViewModel = filter;
|
||||||
|
filterItems(null);
|
||||||
|
}).show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initRecyclerView() {
|
||||||
|
UltimiArriviFornitoreListAdapter mAdapter =
|
||||||
|
new UltimiArriviFornitoreListAdapter(getActivity(), mDocumentiMutableData);
|
||||||
|
mAdapter.setOnSelectionChanged(this::onSingleSelectionChanged);
|
||||||
|
mAdapter.setEmptyView(mBindings.emptyView);
|
||||||
|
|
||||||
|
mBindings.recyclerView.setHasFixedSize(true);
|
||||||
|
mBindings.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
|
mBindings.recyclerView.setAdapter(mAdapter);
|
||||||
|
// mBindings.fastscroll.setRecyclerView(mBindings.recyclerView);
|
||||||
|
|
||||||
|
if (mToolbar != null)
|
||||||
|
mToolbar.setRecyclerView(mBindings.recyclerView);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initBarcodeReader() {
|
||||||
|
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||||
|
.setOnScanSuccessfull(onScanSuccessful)
|
||||||
|
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||||
|
|
||||||
|
BarcodeManager.enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||||
|
BarcodeManager.disable();
|
||||||
|
|
||||||
|
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||||
|
BarcodeManager.enable();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
private void refreshList(List<DocumentoResoDTO> documentList) {
|
||||||
|
this.mDocumentiMutableData.clear();
|
||||||
|
this.mDocumentiMutableData.addAll(sort(documentList));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void filterItems(List<MtbAart> filteredMtbAarts) {
|
||||||
|
this.openProgress();
|
||||||
|
|
||||||
|
String currentAnagFilter = mAppliedFilterViewModel != null ? mAppliedFilterViewModel.ragSoc.get() : null;
|
||||||
|
String currentCodAnagFilter = null;
|
||||||
|
|
||||||
|
Optional<GtbAnag> singleGtbAnag = Stream.of(mViewModel.getGtbAnagClienti().getValue())
|
||||||
|
.filter(x -> (x.getCodAnag() + " - " + x.getRagSoc()).equals(currentAnagFilter))
|
||||||
|
.findSingle();
|
||||||
|
|
||||||
|
if (singleGtbAnag.isPresent()) {
|
||||||
|
currentCodAnagFilter = singleGtbAnag.get().getCodAnag();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mViewModel.loadArriviFornitori(currentCodAnagFilter,
|
||||||
|
filteredMtbAarts,
|
||||||
|
-1,
|
||||||
|
365);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DocumentoResoDTO> sort(List<DocumentoResoDTO> dataset) {
|
||||||
|
List<DocumentoResoDTO> items = Stream.of(dataset)
|
||||||
|
.sortBy(DocumentoResoDTO::getRagSoc)
|
||||||
|
.toList();
|
||||||
|
return items;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onSingleSelectionChanged(DocumentoResoDTO dto) {
|
||||||
|
List<DocumentoResoDTO> selectedOrders = getSelectedItems();
|
||||||
|
|
||||||
|
if(dto.isSelected()) {
|
||||||
|
Stream.of(selectedOrders)
|
||||||
|
.filter(x -> !x.getRagSoc().equalsIgnoreCase(dto.getRagSoc()))
|
||||||
|
.forEach(x -> x.setSelected(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(selectedOrders != null && selectedOrders.size() > 0) {
|
||||||
|
mBindings.mainFab.show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mBindings.mainFab.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private List<DocumentoResoDTO> getSelectedItems() {
|
||||||
|
return Stream.of(this.mDocumentiMutableData)
|
||||||
|
.filter(DocumentoResoDTO::isSelected)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dispatchConsegne() {
|
||||||
|
List<DocumentoResoDTO> selectedConsegne = getSelectedItems();
|
||||||
|
|
||||||
|
PickingResiActivity.startActivity(getActivity(), getActivity().getText(R.string.ultime_arrivi_fornitore_title).toString(), selectedConsegne, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
for(Runnable onPreDestroy : mOnPreDestroyList) {
|
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||||
|
|
||||||
|
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
||||||
onPreDestroy.run();
|
onPreDestroy.run();
|
||||||
}
|
}
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@@ -80,12 +243,9 @@ public class UltimiArriviFornitoreFragment extends Fragment implements ITitledFr
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFilterClick() {
|
public void onFilterClick() {
|
||||||
mViewModel.openFilterDialog();
|
openFilterDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -93,4 +253,40 @@ public class UltimiArriviFornitoreFragment extends Fragment implements ITitledFr
|
|||||||
public void addOnPreDestroy(Runnable onPreDestroy) {
|
public void addOnPreDestroy(Runnable onPreDestroy) {
|
||||||
this.mOnPreDestroyList.add(onPreDestroy);
|
this.mOnPreDestroyList.add(onPreDestroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadingStarted() {
|
||||||
|
BarcodeManager.disable();
|
||||||
|
this.openProgress();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadingEnded() {
|
||||||
|
this.closeProgress();
|
||||||
|
BarcodeManager.enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Exception ex) {
|
||||||
|
this.closeProgress();
|
||||||
|
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
||||||
|
BarcodeManager.enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMtbColtScanned(MtbColt scannedMtbColt) {
|
||||||
|
|
||||||
|
DialogChooseArtsFromListaArts
|
||||||
|
.make(getActivity(), scannedMtbColt.getMtbColr(), items -> {
|
||||||
|
|
||||||
|
List<MtbAart> mtbAarts = Stream.of(items)
|
||||||
|
.map(MtbColr::getMtbAart)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
filterItems(mtbAarts);
|
||||||
|
|
||||||
|
}, null)
|
||||||
|
.show();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.core.UltimiArriviFornitoreViewModel;
|
||||||
|
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.rest.UltimiArriviFornitoreRESTConsumer;
|
||||||
|
|
||||||
|
@Module(subcomponents = UltimiArriviFornitoreComponent.class)
|
||||||
|
public class UltimiArriviFornitoreModule {
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
UltimiArriviFornitoreRESTConsumer providesUltimiArriviFornitoreRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||||
|
return new UltimiArriviFornitoreRESTConsumer(systemRESTConsumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
UltimiArriviFornitoreViewModel providesUltimiArriviFornitoreViewModel(
|
||||||
|
UltimiArriviFornitoreRESTConsumer ultimiArriviFornitoreRESTConsumer,
|
||||||
|
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||||
|
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer) {
|
||||||
|
return new UltimiArriviFornitoreViewModel(ultimiArriviFornitoreRESTConsumer, barcodeRESTConsumer, colliMagazzinoRESTConsumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,38 +6,29 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.databinding.ObservableArrayList;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
import com.zhukic.sectionedrecyclerview.SectionedRecyclerViewAdapter;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.view.ExtendedSectionedRecyclerView;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentUltimiArriviFornitoreListHeaderBinding;
|
import it.integry.integrywmsnative.databinding.FragmentUltimiArriviFornitoreListHeaderBinding;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentUltimiArriviFornitoreListSingleItemBinding;
|
import it.integry.integrywmsnative.databinding.FragmentUltimiArriviFornitoreListSingleItemBinding;
|
||||||
import it.integry.integrywmsnative.ui.fastscroll.SectionTitleProvider;
|
|
||||||
|
|
||||||
public class UltimiArriviFornitoreListAdapter extends SectionedRecyclerViewAdapter<UltimiArriviFornitoreListAdapter.SubheaderHolder, UltimiArriviFornitoreListAdapter.SingleItemViewHolder> implements SectionTitleProvider {
|
public class UltimiArriviFornitoreListAdapter extends ExtendedSectionedRecyclerView<DocumentoResoDTO,
|
||||||
|
UltimiArriviFornitoreListAdapter.SubheaderHolder,
|
||||||
|
UltimiArriviFornitoreListAdapter.SingleItemViewHolder> {
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private List<DocumentoResoDTO> mDataset;
|
|
||||||
private ArrayList<String> mSectionTitleItems;
|
|
||||||
|
|
||||||
private RunnableArgs<DocumentoResoDTO> mOnSelectionChanged;
|
private RunnableArgs<DocumentoResoDTO> mOnSelectionChanged;
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSectionTitle(int position) {
|
|
||||||
return mSectionTitleItems.get(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static class SubheaderHolder extends RecyclerView.ViewHolder {
|
static class SubheaderHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
@@ -64,13 +55,9 @@ public class UltimiArriviFornitoreListAdapter extends SectionedRecyclerViewAdapt
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public UltimiArriviFornitoreListAdapter(Context context, ArrayList<DocumentoResoDTO> dataset) {
|
public UltimiArriviFornitoreListAdapter(Context context, ObservableArrayList<DocumentoResoDTO> mutableDataSet) {
|
||||||
super();
|
super(mutableDataSet);
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
this.mDataset = new ArrayList<>();
|
|
||||||
this.mSectionTitleItems = new ArrayList<>();
|
|
||||||
|
|
||||||
mDataset.addAll(sort(dataset));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -152,7 +139,7 @@ public class UltimiArriviFornitoreListAdapter extends SectionedRecyclerViewAdapt
|
|||||||
|
|
||||||
public void updateItems(List<DocumentoResoDTO> updatedDataset) {
|
public void updateItems(List<DocumentoResoDTO> updatedDataset) {
|
||||||
mDataset.clear();
|
mDataset.clear();
|
||||||
mDataset.addAll(sort(updatedDataset));
|
mDataset.addAll(updatedDataset);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
notifyDataChanged();
|
notifyDataChanged();
|
||||||
}
|
}
|
||||||
@@ -163,28 +150,5 @@ public class UltimiArriviFornitoreListAdapter extends SectionedRecyclerViewAdapt
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private List<DocumentoResoDTO> sort(List<DocumentoResoDTO> dataset) {
|
|
||||||
List<DocumentoResoDTO> items = Stream.of(dataset)
|
|
||||||
.sortBy(DocumentoResoDTO::getRagSoc)
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
|
|
||||||
Stream.of(items)
|
|
||||||
.map(DocumentoResoDTO::getRagSoc)
|
|
||||||
.distinct()
|
|
||||||
.forEach(x -> {
|
|
||||||
this.mSectionTitleItems.add(String.valueOf(x.charAt(0)));
|
|
||||||
|
|
||||||
long count = Stream.of(dataset)
|
|
||||||
.filter(y -> y.getRagSoc().equalsIgnoreCase(x))
|
|
||||||
.count();
|
|
||||||
|
|
||||||
|
|
||||||
for(int i = 0; i < count; i++) this.mSectionTitleItems.add(String.valueOf(x.charAt(0)));
|
|
||||||
});
|
|
||||||
return items;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,154 +1,192 @@
|
|||||||
package it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.core;
|
package it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.core;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
import android.content.Context;
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
|
|
||||||
import com.annimon.stream.Optional;
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
|
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
import it.integry.integrywmsnative.core.model.GtbAnag;
|
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
|
||||||
import it.integry.integrywmsnative.databinding.FragmentUltimiArriviFornitoreBinding;
|
|
||||||
import it.integry.integrywmsnative.gest.picking_resi.PickingResiActivity;
|
|
||||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.dialog.DialogUltimiArriviFornitoreFiltroAvanzato;
|
|
||||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.rest.UltimiArriviFornitoreRESTConsumer;
|
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.rest.UltimiArriviFornitoreRESTConsumer;
|
||||||
|
|
||||||
public class UltimiArriviFornitoreViewModel {
|
public class UltimiArriviFornitoreViewModel {
|
||||||
|
|
||||||
private Context mContext;
|
private final MutableLiveData<List<GtbAnag>> mGtbAnagClienti = new MutableLiveData<>();
|
||||||
private FragmentUltimiArriviFornitoreBinding mBinding;
|
private final MutableLiveData<List<DocumentoResoDTO>> mDocuments = new MutableLiveData<>();
|
||||||
|
|
||||||
private List<DocumentoResoDTO> mItems;
|
private final UltimiArriviFornitoreRESTConsumer mUltimiArriviFornitoreRESTConsumer;
|
||||||
private List<DocumentoResoDTO> mRenderedItems = new ArrayList<>();
|
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||||
|
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||||
|
|
||||||
private List<GtbAnag> mAvailableGtbAnags = null;
|
private Listener mListener;
|
||||||
|
|
||||||
private UltimiArriviFornitoreListAdapter mAdapter;
|
private String mCodMdep;
|
||||||
|
|
||||||
private DialogUltimiArriviFornitoreFiltroAvanzato.DialogUltimiArriviFiltroAvanzatoViewModel mAppliedFilterViewModel;
|
@Inject
|
||||||
|
public UltimiArriviFornitoreViewModel(
|
||||||
public UltimiArriviFornitoreViewModel(Context context, FragmentUltimiArriviFornitoreBinding binding) {
|
UltimiArriviFornitoreRESTConsumer ultimiArriviFornitoreRESTConsumer,
|
||||||
this.mContext = context;
|
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||||
this.mBinding = binding;
|
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer) {
|
||||||
|
this.mUltimiArriviFornitoreRESTConsumer = ultimiArriviFornitoreRESTConsumer;
|
||||||
this.mBinding.mainFab.hide();
|
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||||
this.mBinding.mainFab.setOnClickListener(v -> {
|
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||||
dispatchConsegne();
|
|
||||||
});
|
|
||||||
|
|
||||||
openFilterDialog();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void init(String codMdep) {
|
||||||
private void initDataAdapter(ArrayList<DocumentoResoDTO> dataset) {
|
this.mCodMdep = codMdep;
|
||||||
mAdapter = new UltimiArriviFornitoreListAdapter(mContext, dataset);
|
|
||||||
mAdapter.setOnSelectionChanged(this::onSingleSelectionChanged);
|
|
||||||
|
|
||||||
mBinding.recyclerView.setHasFixedSize(true);
|
|
||||||
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
|
|
||||||
mBinding.recyclerView.setAdapter(mAdapter);
|
|
||||||
mBinding.fastscroll.setRecyclerView(mBinding.recyclerView);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void openFilterDialog() {
|
public void loadCodAnagFornitori(RunnableArgs<List<GtbAnag>> onComplete) {
|
||||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
UltimiArriviFornitoreRESTConsumer.getAvailableCodAnagFornitori(gtbAnags -> {
|
this.mUltimiArriviFornitoreRESTConsumer.getAvailableCodAnagFornitori(gtbAnags -> {
|
||||||
mAvailableGtbAnags = gtbAnags;
|
mGtbAnagClienti.postValue(gtbAnags);
|
||||||
progressDialog.dismiss();
|
this.sendOnLoadingEnded();
|
||||||
|
|
||||||
DialogUltimiArriviFornitoreFiltroAvanzato.make(mContext, mAvailableGtbAnags, mAppliedFilterViewModel, (filter) -> {
|
onComplete.run(gtbAnags);
|
||||||
mAppliedFilterViewModel = filter;
|
}, this::sendError);
|
||||||
refreshItems();
|
}
|
||||||
}).show();
|
|
||||||
}, ex -> {
|
public void loadArriviFornitori(String codAnag, List<MtbAart> mtbAarts, int limitDocsForCli, int limitDays) {
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
this.sendOnLoadingStarted();
|
||||||
});
|
|
||||||
|
this.mUltimiArriviFornitoreRESTConsumer.getUltimeConsegneFornitori(mCodMdep, codAnag, mtbAarts, limitDocsForCli, limitDays, documentList -> {
|
||||||
|
this.mDocuments.postValue(documentList);
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void dispatchConsegne() {
|
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
List<DocumentoResoDTO> selectedConsegne = getSelectedItems();
|
|
||||||
|
|
||||||
PickingResiActivity.startActivity(mContext, mContext.getText(R.string.ultime_arrivi_fornitore_title).toString(), selectedConsegne, -1);
|
this.sendOnLoadingStarted();
|
||||||
}
|
|
||||||
|
|
||||||
private List<DocumentoResoDTO> getSelectedItems() {
|
Runnable onBarcodeScanComplete = () -> {
|
||||||
return Stream.of(this.mItems)
|
onComplete.run();
|
||||||
.filter(DocumentoResoDTO::isSelected)
|
this.sendOnLoadingEnded();
|
||||||
.toList();
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||||
private void refreshItems(){
|
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onBarcodeScanComplete);
|
||||||
|
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
this.executeEtichettaEan128(barcodeScanDTO, onBarcodeScanComplete);
|
||||||
|
} else {
|
||||||
String currentAnagFilter = mAppliedFilterViewModel != null ? mAppliedFilterViewModel.ragSoc.get() : null;
|
onComplete.run();
|
||||||
String currentCodAnagFilter = null;
|
|
||||||
|
|
||||||
Optional<GtbAnag> singleGtbAnag = Stream.of(mAvailableGtbAnags)
|
|
||||||
.filter(x -> (x.getCodAnag() + " - " + x.getRagSoc()).equals(currentAnagFilter))
|
|
||||||
.findSingle();
|
|
||||||
|
|
||||||
if(singleGtbAnag.isPresent()) {
|
|
||||||
currentCodAnagFilter = singleGtbAnag.get().getCodAnag();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UltimiArriviFornitoreRESTConsumer.getUltimeConsegneFornitori(
|
|
||||||
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
|
|
||||||
currentCodAnagFilter,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
365,
|
|
||||||
consegne -> {
|
|
||||||
this.mItems = consegne;
|
|
||||||
|
|
||||||
this.initDataAdapter(consegne);
|
|
||||||
|
|
||||||
mBinding.emptyView.setVisibility((this.mItems != null && this.mItems.size() > 0) ? View.GONE : View.VISIBLE);
|
|
||||||
|
|
||||||
mRenderedItems.clear();
|
|
||||||
if(this.mItems != null) mRenderedItems.addAll(this.mItems);
|
|
||||||
mAdapter.updateItems(mRenderedItems);
|
|
||||||
|
|
||||||
progressDialog.dismiss();
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void onSingleSelectionChanged(DocumentoResoDTO dto) {
|
private void executeEtichettaLU(String SSCC, Runnable onComplete) {
|
||||||
List<DocumentoResoDTO> selectedOrders = getSelectedItems();
|
this.mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> {
|
||||||
|
|
||||||
if(dto.isSelected()) {
|
if(mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) {
|
||||||
Stream.of(selectedOrders)
|
if(mtbColt.getSegno() > 0) {
|
||||||
.filter(x -> !x.getRagSoc().equalsIgnoreCase(dto.getRagSoc()))
|
|
||||||
.forEach(x -> x.setSelected(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(selectedOrders != null && selectedOrders.size() > 0) {
|
this.sendOnMtbColtScanned(mtbColt);
|
||||||
mBinding.mainFab.show();
|
|
||||||
}
|
// this.mOrdiniUscitaElencoRESTConsumer.getOrdiniFromCommessaCollo(mCurrentCodMdep, mtbColt, orderList -> {
|
||||||
else {
|
//
|
||||||
mBinding.mainFab.hide();
|
// if(orderList != null && orderList.size() > 0) {
|
||||||
}
|
// List<Integer> numOrds = Stream.of(orderList)
|
||||||
|
// .map(DtbOrdt::getNumOrd)
|
||||||
|
// .toList();
|
||||||
|
//
|
||||||
|
// List<OrdiniUscitaElencoDTO> filteredOrders = Stream.of(mOrderList.getValue())
|
||||||
|
// .filter(x -> numOrds.contains(x.getNumOrd())).toList();
|
||||||
|
//
|
||||||
|
// onComplete.run(filteredOrders);
|
||||||
|
// } else {
|
||||||
|
// this.sendError(new NoOrderFoundException());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }, this::sendError);
|
||||||
|
} else {
|
||||||
|
this.sendError(new InvalidLUException());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
}
|
||||||
|
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||||
|
String barcodeProd = null;
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||||
|
barcodeProd = ean128Model.Content;
|
||||||
|
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||||
|
this.executeEtichettaLU(ean128Model.Sscc, onComplete);
|
||||||
|
} else {
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
}
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public MutableLiveData<List<GtbAnag>> getGtbAnagClienti() {
|
||||||
|
return mGtbAnagClienti;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableLiveData<List<DocumentoResoDTO>> getDocuments() {
|
||||||
|
return mDocuments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UltimiArriviFornitoreViewModel setListener(UltimiArriviFornitoreViewModel.Listener listener) {
|
||||||
|
this.mListener = listener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 sendOnMtbColtScanned(MtbColt scannedMtbColt) {
|
||||||
|
if (this.mListener != null) mListener.onMtbColtScanned(scannedMtbColt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Listener extends ILoadingListener {
|
||||||
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
void onMtbColtScanned(MtbColt scannedMtbColt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,49 +1,62 @@
|
|||||||
package it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.rest;
|
package it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.rest;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.model.GtbAnag;
|
import javax.inject.Singleton;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
|
||||||
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.model.GtbAnag;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.DocumentoResoDTO;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
public class UltimiArriviFornitoreRESTConsumer {
|
public class UltimiArriviFornitoreRESTConsumer {
|
||||||
|
|
||||||
public static void getAvailableCodAnagFornitori(RunnableArgs<List<GtbAnag>> onComplete, RunnableArgs<Exception> onFailed) {
|
private final SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
|
public UltimiArriviFornitoreRESTConsumer(SystemRESTConsumer systemRESTConsumer) {
|
||||||
|
this.systemRESTConsumer = systemRESTConsumer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getAvailableCodAnagFornitori(RunnableArgs<List<GtbAnag>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
String sql = "SELECT DISTINCT gtb_anag.cod_anag, gtb_anag.rag_soc " +
|
String sql = "SELECT DISTINCT gtb_anag.cod_anag, gtb_anag.rag_soc " +
|
||||||
"FROM gtb_anag " +
|
"FROM gtb_anag " +
|
||||||
"INNER JOIN atb_forn ON atb_forn.cod_anag = gtb_anag.cod_anag " +
|
"INNER JOIN atb_forn ON atb_forn.cod_anag = gtb_anag.cod_anag " +
|
||||||
"WHERE flag_stato = 'A'";
|
"WHERE flag_stato = 'A'";
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<GtbAnag>>() {}.getType();
|
Type typeOfObjectsList = new TypeToken<ArrayList<GtbAnag>>() {
|
||||||
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<GtbAnag>>() {
|
}.getType();
|
||||||
@Override
|
this.systemRESTConsumer.<ArrayList<GtbAnag>>processSql(sql, typeOfObjectsList, value -> {
|
||||||
public void onSuccess(ArrayList<GtbAnag> value) {
|
if (onComplete != null) onComplete.run(value);
|
||||||
if(onComplete != null) onComplete.run(value);
|
}, ex -> {
|
||||||
}
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailed(Exception ex) {
|
|
||||||
if(onFailed != null) onFailed.run(ex);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void getUltimeConsegneFornitori(String codMdep, String codAnag, String codMart, Integer limitConsegnePerCli, int limitDays, RunnableArgs<ArrayList<DocumentoResoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getUltimeConsegneFornitori(String codMdep, String codAnag, List<MtbAart> mtbAarts, int limitConsegnePerCli, int limitDays, RunnableArgs<ArrayList<DocumentoResoDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
String codMarts = null;
|
||||||
|
|
||||||
|
if (mtbAarts != null && mtbAarts.size() > 0) {
|
||||||
|
codMarts = StringUtils.join(Stream.of(mtbAarts)
|
||||||
|
.map(MtbAart::getCodMart)
|
||||||
|
.toList(), "|");
|
||||||
|
}
|
||||||
|
|
||||||
String sql = "SELECT consegne.*, " +
|
String sql = "SELECT consegne.*, " +
|
||||||
" rag_soc " +
|
" rag_soc " +
|
||||||
"FROM WMS_GetUltimeConsegneFornitori(" +
|
"FROM WMS_GetUltimeConsegneFornitori(" +
|
||||||
UtilityDB.valueToString(limitConsegnePerCli) + ", " +
|
UtilityDB.valueToString(limitConsegnePerCli >= 0 ? limitConsegnePerCli : null) + ", " +
|
||||||
UtilityDB.valueToString(codAnag) + ", " +
|
UtilityDB.valueToString(codAnag) + ", " +
|
||||||
UtilityDB.valueToString(codMart) + ", " +
|
UtilityDB.valueToString(codMarts) + ", " +
|
||||||
UtilityDB.valueToString(codMdep) + ", " +
|
UtilityDB.valueToString(codMdep) + ", " +
|
||||||
UtilityDB.valueToString(limitDays) + ") consegne " +
|
UtilityDB.valueToString(limitDays) + ") consegne " +
|
||||||
"LEFT OUTER JOIN gtb_anag ON consegne.cod_anag = gtb_anag.cod_anag " +
|
"LEFT OUTER JOIN gtb_anag ON consegne.cod_anag = gtb_anag.cod_anag " +
|
||||||
@@ -51,17 +64,12 @@ public class UltimiArriviFornitoreRESTConsumer {
|
|||||||
" counter_consegna ";
|
" counter_consegna ";
|
||||||
|
|
||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<DocumentoResoDTO>>() {}.getType();
|
Type typeOfObjectsList = new TypeToken<ArrayList<DocumentoResoDTO>>() {
|
||||||
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<DocumentoResoDTO>>() {
|
}.getType();
|
||||||
@Override
|
this.systemRESTConsumer.<ArrayList<DocumentoResoDTO>>processSql(sql, typeOfObjectsList, value -> {
|
||||||
public void onSuccess(ArrayList<DocumentoResoDTO> value) {
|
if (onComplete != null) onComplete.run(value);
|
||||||
if(onComplete != null) onComplete.run(value);
|
}, ex -> {
|
||||||
}
|
if (onFailed != null) onFailed.run(ex);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailed(Exception ex) {
|
|
||||||
if(onFailed != null) onFailed.run(ex);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.versamento_merce;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface VersamentoMerceComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
VersamentoMerceComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void inject(VersamentoMerceFragment versamentoMerceFragment);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,90 +2,143 @@ package it.integry.integrywmsnative.gest.versamento_merce;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.text.SpannableString;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.appcompat.widget.AppCompatTextView;
|
import androidx.appcompat.widget.AppCompatTextView;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
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.R;
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||||
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentMainVersamentoMerceBinding;
|
import it.integry.integrywmsnative.databinding.FragmentMainVersamentoMerceBinding;
|
||||||
import it.integry.integrywmsnative.gest.versamento_merce.core.VersamentoMerceHelper;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||||
import it.integry.integrywmsnative.gest.versamento_merce.viewmodel.VersamentoMerceViewModel;
|
import it.integry.integrywmsnative.view.dialogs.DialogAskLivelloPosizione;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArts;
|
||||||
|
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;
|
||||||
|
|
||||||
public class VersamentoMerceFragment extends Fragment implements ITitledFragment {
|
public class VersamentoMerceFragment extends BaseFragment implements ITitledFragment, VersamentoMerceViewModel.Listener {
|
||||||
|
|
||||||
private FragmentMainVersamentoMerceBinding mBinding;
|
|
||||||
private VersamentoMerceViewModel mVersamentoMerceViewModel;
|
@Inject
|
||||||
private VersamentoMerceHelper mHelper;
|
VersamentoMerceViewModel mViewModel;
|
||||||
|
|
||||||
|
private FragmentMainVersamentoMerceBinding mBindings = null;
|
||||||
|
|
||||||
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||||
|
|
||||||
private int barcodeScannerIstanceID = -1;
|
private int barcodeScannerIstanceID = -1;
|
||||||
|
|
||||||
public VersamentoMerceFragment() {
|
|
||||||
// Required empty public constructor
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static VersamentoMerceFragment newInstance() {
|
public static VersamentoMerceFragment newInstance() {
|
||||||
VersamentoMerceFragment fragment = new VersamentoMerceFragment();
|
return new VersamentoMerceFragment();
|
||||||
return fragment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
mVersamentoMerceViewModel = new VersamentoMerceViewModel();
|
|
||||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
|
||||||
.setOnScanSuccessfull(mVersamentoMerceViewModel.onScanSuccessfull)
|
|
||||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_main_versamento_merce, container, false);
|
|
||||||
|
|
||||||
mBinding.setView(this);
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_main_versamento_merce, container, false);
|
||||||
mBinding.setViewmodel(mVersamentoMerceViewModel);
|
|
||||||
|
|
||||||
init();
|
MainApplication.appComponent
|
||||||
return mBinding.getRoot();
|
.versamentoMerceComponent()
|
||||||
}
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
private void init() {
|
mViewModel.setListener(this);
|
||||||
mHelper = new VersamentoMerceHelper(getActivity());
|
|
||||||
mVersamentoMerceViewModel.init(getActivity(), mBinding, mHelper, () -> {
|
|
||||||
((IPoppableActivity) getActivity()).pop();
|
|
||||||
});
|
|
||||||
|
|
||||||
mVersamentoMerceViewModel.openLU();
|
mBindings.setLifecycleOwner(this);
|
||||||
|
mBindings.setView(this);
|
||||||
|
mBindings.setViewmodel(mViewModel);
|
||||||
|
|
||||||
|
this.initBarcodeReader();
|
||||||
|
|
||||||
|
this.openLU();
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||||
|
|
||||||
for(Runnable onPreDestroy : mOnPreDestroyList) {
|
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
||||||
onPreDestroy.run();
|
onPreDestroy.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void openLU() {
|
||||||
|
DialogScanOrCreateLUView.newInstance(true, false, true, false, (mtbColt, created) -> {
|
||||||
|
if (mtbColt == null) {
|
||||||
|
((IPoppableActivity) getActivity()).pop();
|
||||||
|
} else if ((mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && mtbColt.getSegno().equals(+1)) {
|
||||||
|
this.mViewModel.getCurrentMtbColt().postValue(mtbColt);
|
||||||
|
} else if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA) {
|
||||||
|
this.mViewModel.getCurrentMtbColt().postValue(mtbColt);
|
||||||
|
} else {
|
||||||
|
DialogSimpleMessageView
|
||||||
|
.makeWarningDialog(new SpannableString(Html.fromHtml("Sono accettate solamente UL di <b>Acquisto</b> o <b>Lavorazione</b> di <b>CARICO</b>")),
|
||||||
|
null, this::openLU)
|
||||||
|
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
|
}
|
||||||
|
}).show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initBarcodeReader() {
|
||||||
|
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||||
|
.setOnScanSuccessfull(onScanSuccessful)
|
||||||
|
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||||
|
|
||||||
|
BarcodeManager.enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||||
|
BarcodeManager.disable();
|
||||||
|
this.openProgress();
|
||||||
|
|
||||||
|
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||||
|
BarcodeManager.enable();
|
||||||
|
this.closeProgress();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
||||||
titleText.setText(context.getText(R.string.versamento_merce_fragment_title).toString());
|
titleText.setText(context.getText(R.string.versamento_merce_fragment_title).toString());
|
||||||
@@ -95,4 +148,93 @@ public class VersamentoMerceFragment extends Fragment implements ITitledFragment
|
|||||||
public void addOnPreDestroy(Runnable onPreDestroy) {
|
public void addOnPreDestroy(Runnable onPreDestroy) {
|
||||||
this.mOnPreDestroyList.add(onPreDestroy);
|
this.mOnPreDestroyList.add(onPreDestroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadingStarted() {
|
||||||
|
BarcodeManager.disable();
|
||||||
|
this.openProgress();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadingEnded() {
|
||||||
|
this.closeProgress();
|
||||||
|
BarcodeManager.enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLivelloPosizioneRequired(MtbDepoPosizione posizione, RunnableArgs<MtbDepoPosizione> onComplete) {
|
||||||
|
DialogAskLivelloPosizione.make(getActivity(), posizione, false, onComplete, this::onError);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSpostamentoTraDepConfirmRequired(String sourceCodMdep, String destinationCodMdep, RunnableArgs<Boolean> onComplete) {
|
||||||
|
DialogSimpleMessageView.makeWarningDialog(Html.fromHtml("Stai spostando una UL dal deposito <b>" + sourceCodMdep + "</b> al deposito <b>" + destinationCodMdep + "</b>"),
|
||||||
|
null,
|
||||||
|
() -> onComplete.run(true),
|
||||||
|
() -> onComplete.run(false))
|
||||||
|
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||||
|
|
||||||
|
DialogChooseArtsFromListaArts.make(getActivity(), mtbColrList, onComplete, onAbort).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemDispatched(MtbAart mtbAart,
|
||||||
|
BigDecimal initialNumCnf,
|
||||||
|
BigDecimal initialQtaCnf,
|
||||||
|
BigDecimal initialQtaTot,
|
||||||
|
BigDecimal totalQtaAvailable,
|
||||||
|
BigDecimal totalNumCnfAvailable,
|
||||||
|
BigDecimal qtaCnfAvailable,
|
||||||
|
String partitaMag,
|
||||||
|
Date dataScad,
|
||||||
|
boolean canOverflowOrderQuantity,
|
||||||
|
boolean canBatchLotBeChanged,
|
||||||
|
RunnableArgs<PickedQuantityDTO> onComplete) {
|
||||||
|
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||||
|
.setMtbAart(mtbAart)
|
||||||
|
.setInitialNumCnf(initialNumCnf)
|
||||||
|
.setInitialQtaCnf(initialQtaCnf)
|
||||||
|
.setInitialQtaTot(initialQtaTot)
|
||||||
|
.setTotalQtaAvailable(totalQtaAvailable)
|
||||||
|
.setTotalNumCnfAvailable(totalNumCnfAvailable)
|
||||||
|
.setQtaCnfAvailable(qtaCnfAvailable)
|
||||||
|
.setPartitaMag(partitaMag)
|
||||||
|
.setDataScad(dataScad)
|
||||||
|
.setCanOverflowOrderQuantity(canOverflowOrderQuantity)
|
||||||
|
.setCanPartitaMagBeChanged(canBatchLotBeChanged)
|
||||||
|
.setCanLUBeClosed(false);
|
||||||
|
|
||||||
|
DialogInputQuantityV2View
|
||||||
|
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||||
|
|
||||||
|
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||||
|
.setNumCnf(resultDTO.getNumCnf())
|
||||||
|
.setQtaCnf(resultDTO.getQtaCnf())
|
||||||
|
.setQtaTot(resultDTO.getQtaTot())
|
||||||
|
.setPartitaMag(resultDTO.getPartitaMag())
|
||||||
|
.setDataScad(resultDTO.getDataScad());
|
||||||
|
|
||||||
|
onComplete.run(pickedQuantityDTO);
|
||||||
|
|
||||||
|
}, this::onLoadingEnded)
|
||||||
|
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDataSaved() {
|
||||||
|
DialogCommon.showDataSaved(getActivity(), () -> {
|
||||||
|
((IPoppableActivity) getActivity()).pop();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Exception ex) {
|
||||||
|
this.closeProgress();
|
||||||
|
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
||||||
|
BarcodeManager.enable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.versamento_merce;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||||
|
|
||||||
|
@Module(subcomponents = VersamentoMerceComponent.class)
|
||||||
|
public class VersamentoMerceModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
VersamentoMerceViewModel providesVersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||||
|
return new VersamentoMerceViewModel(colliMagazzinoRESTConsumer, barcodeRESTConsumer, posizioniRESTConsumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,359 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.versamento_merce;
|
||||||
|
|
||||||
|
import androidx.databinding.ObservableArrayList;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
|
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.NoArtsInLUException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
|
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.MtbDepoPosizione;
|
||||||
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||||
|
|
||||||
|
public class VersamentoMerceViewModel {
|
||||||
|
|
||||||
|
private final MutableLiveData<MtbColt> mCurrentMtbColt = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private Listener mListener;
|
||||||
|
|
||||||
|
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||||
|
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||||
|
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public VersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||||
|
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||||
|
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||||
|
this.mPosizioniRESTConsumer = posizioniRESTConsumer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
|
||||||
|
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO, false)) {
|
||||||
|
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
||||||
|
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||||
|
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), true, onComplete);
|
||||||
|
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||||
|
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||||
|
} else {
|
||||||
|
onComplete.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||||
|
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||||
|
.single();
|
||||||
|
|
||||||
|
if (foundPosizione.isFlagMonoCollo()) {
|
||||||
|
this.mPosizioniRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> {
|
||||||
|
|
||||||
|
if (mtbColtList == null || mtbColtList.size() == 0) {
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
} else if (mtbColtList.size() == 1) {
|
||||||
|
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
||||||
|
|
||||||
|
onComplete.run();
|
||||||
|
//TAKE HERE
|
||||||
|
pickMerceULtoUL(mtbColt);
|
||||||
|
|
||||||
|
}, this::sendError);
|
||||||
|
} else {
|
||||||
|
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||||
|
}
|
||||||
|
}, this::sendError);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) {
|
||||||
|
this.sendOnSpostamentoTraDepConfirmRequired(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep(), canContinue -> {
|
||||||
|
if (canContinue) {
|
||||||
|
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione));
|
||||||
|
} else {
|
||||||
|
onComplete.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Runnable onBarcodeScanComplete) {
|
||||||
|
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||||
|
|
||||||
|
String barcodeProd = null;
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||||
|
barcodeProd = ean128Model.Content;
|
||||||
|
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||||
|
this.executeEtichettaLU(ean128Model.Sscc, false, onBarcodeScanComplete);
|
||||||
|
} else {
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||||
|
onBarcodeScanComplete.run();
|
||||||
|
}
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void executeEtichettaLU(String sscc, boolean isAnonima, Runnable onComplete) {
|
||||||
|
this.mColliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, mtbColt -> {
|
||||||
|
|
||||||
|
if (mtbColt == null && !isAnonima) {
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
} else if (mtbColt != null && (/*mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO ||*/ mtbColt.getGestioneEnum() == GestioneEnum.VENDITA)) {
|
||||||
|
this.sendError(new InvalidLUGestioneException(GestioneEnum.VENDITA));
|
||||||
|
} else {
|
||||||
|
if (mtbColt == null) {
|
||||||
|
this.mColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(sscc, GestioneEnum.LAVORAZIONE, mtbColtAnonimo -> {
|
||||||
|
onComplete.run();
|
||||||
|
pickMerceULtoUL(mtbColtAnonimo);
|
||||||
|
}, this::sendError);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
onComplete.run();
|
||||||
|
pickMerceULtoUL(mtbColt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void pickMerceULtoUL(MtbColt destMtbColt) {
|
||||||
|
MtbColt sourceMtbColt = mCurrentMtbColt.getValue();
|
||||||
|
|
||||||
|
if (!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep())) {
|
||||||
|
this.sendError(new Exception("Impossibile spostare la merce tra UL di due depositi differenti"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MtbColr> mtbColrsToPick = Stream.of(sourceMtbColt.getMtbColr())
|
||||||
|
.filter(x -> x.getQtaCol().floatValue() > 0)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
if (mtbColrsToPick.size() == 0) {
|
||||||
|
this.sendError(new NoArtsInLUException());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sendOnArtsChooseRequired(mtbColrsToPick, pickedAarts -> {
|
||||||
|
List<MtbColr> destNewMtbColr = new ArrayList<>();
|
||||||
|
|
||||||
|
askQuantities(pickedAarts.iterator(), destNewMtbColr, () -> {
|
||||||
|
|
||||||
|
MtbColt clonedSourceTestata = (MtbColt) sourceMtbColt.clone();
|
||||||
|
clonedSourceTestata.setMtbColr(new ObservableArrayList<>());
|
||||||
|
clonedSourceTestata.getMtbColr().addAll(destNewMtbColr);
|
||||||
|
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
|
this.mColliMagazzinoRESTConsumer.spostaArtsTraUL(
|
||||||
|
sourceMtbColt,
|
||||||
|
destMtbColt,
|
||||||
|
this::sendOnDataSaved,
|
||||||
|
this::sendError
|
||||||
|
);
|
||||||
|
|
||||||
|
}, this::sendOnLoadingEnded);
|
||||||
|
|
||||||
|
}, this::sendOnLoadingEnded);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void askQuantities(Iterator<MtbColr> sourceMtbColrs, List<MtbColr> destMtbColr, Runnable onComplete, Runnable onAbort) {
|
||||||
|
|
||||||
|
if (sourceMtbColrs.hasNext()) {
|
||||||
|
askSingleQuantity(sourceMtbColrs.next(), mtbColr -> {
|
||||||
|
destMtbColr.add(mtbColr);
|
||||||
|
askQuantities(sourceMtbColrs, destMtbColr, onComplete, onAbort);
|
||||||
|
}, onAbort);
|
||||||
|
} else {
|
||||||
|
onComplete.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete, Runnable onAbort) {
|
||||||
|
this.sendOnItemDispatched(mtbColr.getMtbAart(),
|
||||||
|
mtbColr.getNumCnf(),
|
||||||
|
mtbColr.getQtaCnf(),
|
||||||
|
mtbColr.getQtaCol(),
|
||||||
|
mtbColr.getQtaCol(),
|
||||||
|
mtbColr.getNumCnf(),
|
||||||
|
mtbColr.getQtaCnf(),
|
||||||
|
mtbColr.getPartitaMag(),
|
||||||
|
mtbColr.getDataScadPartitaD(),
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
pickedQuantity -> {
|
||||||
|
mtbColr
|
||||||
|
.setQtaCol(pickedQuantity.getQtaTot())
|
||||||
|
.setQtaCnf(pickedQuantity.getQtaCnf())
|
||||||
|
.setNumCnf(pickedQuantity.getNumCnf())
|
||||||
|
.setDatetimeRow(UtilityDate.getDateInstance());
|
||||||
|
|
||||||
|
onComplete.run(mtbColr);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void updatePosizione(MtbDepoPosizione mtbDepoPosizione, boolean shouldAskLivello) {
|
||||||
|
|
||||||
|
if (shouldAskLivello) {
|
||||||
|
this.sendOnLivelloPosizioneRequired(mtbDepoPosizione, newPosizione -> {
|
||||||
|
|
||||||
|
if (newPosizione == null) {
|
||||||
|
updatePosizione(mtbDepoPosizione, shouldAskLivello);
|
||||||
|
} else {
|
||||||
|
updatePosizione(newPosizione, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
mColliMagazzinoRESTConsumer.changePosizione(mCurrentMtbColt.getValue(), mtbDepoPosizione, () -> {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
this.sendOnDataSaved();
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public MutableLiveData<MtbColt> getCurrentMtbColt() {
|
||||||
|
return mCurrentMtbColt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VersamentoMerceViewModel setListener(Listener listener) {
|
||||||
|
this.mListener = listener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendOnDataSaved() {
|
||||||
|
if (this.mListener != null) mListener.onDataSaved();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendOnLivelloPosizioneRequired(MtbDepoPosizione posizione, RunnableArgs<MtbDepoPosizione> onComplete) {
|
||||||
|
if (this.mListener != null)
|
||||||
|
mListener.onLivelloPosizioneRequired(posizione, onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendOnArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||||
|
if (this.mListener != null)
|
||||||
|
mListener.onArtsChooseRequired(mtbColrList, onComplete, onAbort);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendOnSpostamentoTraDepConfirmRequired(String sourceCodMdep, String destinationCodMdep, RunnableArgs<Boolean> onComplete) {
|
||||||
|
if (this.mListener != null)
|
||||||
|
mListener.onSpostamentoTraDepConfirmRequired(sourceCodMdep, destinationCodMdep, onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendOnItemDispatched(MtbAart mtbAart,
|
||||||
|
BigDecimal initialNumCnf,
|
||||||
|
BigDecimal initialQtaCnf,
|
||||||
|
BigDecimal initialQtaTot,
|
||||||
|
BigDecimal totalQtaAvailable,
|
||||||
|
BigDecimal totalNumCnfAvailable,
|
||||||
|
BigDecimal qtaCnfAvailable,
|
||||||
|
String partitaMag,
|
||||||
|
Date dataScad,
|
||||||
|
boolean canOverflowOrderQuantity,
|
||||||
|
boolean canBatchLotBeChanged,
|
||||||
|
RunnableArgs<PickedQuantityDTO> onComplete) {
|
||||||
|
if (this.mListener != null) mListener.onItemDispatched(
|
||||||
|
mtbAart,
|
||||||
|
initialNumCnf,
|
||||||
|
initialQtaCnf,
|
||||||
|
initialQtaTot,
|
||||||
|
totalQtaAvailable,
|
||||||
|
totalNumCnfAvailable,
|
||||||
|
qtaCnfAvailable,
|
||||||
|
partitaMag,
|
||||||
|
dataScad,
|
||||||
|
canOverflowOrderQuantity,
|
||||||
|
canBatchLotBeChanged,
|
||||||
|
onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Listener extends ILoadingListener {
|
||||||
|
|
||||||
|
void onLivelloPosizioneRequired(MtbDepoPosizione posizione, RunnableArgs<MtbDepoPosizione> onComplete);
|
||||||
|
|
||||||
|
void onSpostamentoTraDepConfirmRequired(String sourceCodMdep, String destinationCodMdep, RunnableArgs<Boolean> onComplete);
|
||||||
|
|
||||||
|
void onArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort);
|
||||||
|
|
||||||
|
void onItemDispatched(MtbAart mtbAart,
|
||||||
|
BigDecimal initialNumCnf,
|
||||||
|
BigDecimal initialQtaCnf,
|
||||||
|
BigDecimal initialQtaTot,
|
||||||
|
BigDecimal totalQtaAvailable,
|
||||||
|
BigDecimal totalNumCnfAvailable,
|
||||||
|
BigDecimal qtaCnfAvailable,
|
||||||
|
String partitaMag,
|
||||||
|
Date dataScad,
|
||||||
|
boolean canOverflowOrderQuantity,
|
||||||
|
boolean canBatchLotBeChanged,
|
||||||
|
RunnableArgs<PickedQuantityDTO> onComplete);
|
||||||
|
|
||||||
|
void onDataSaved();
|
||||||
|
|
||||||
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.gest.versamento_merce.core;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
public class VersamentoMerceHelper {
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
public VersamentoMerceHelper(Context context) {
|
|
||||||
this.mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,474 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.gest.versamento_merce.viewmodel;
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.text.Html;
|
|
||||||
import android.text.SpannableString;
|
|
||||||
|
|
||||||
import androidx.databinding.ObservableArrayList;
|
|
||||||
import androidx.databinding.ObservableField;
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeType;
|
|
||||||
import it.integry.integrywmsnative.R;
|
|
||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
|
||||||
import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
|
||||||
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.secondary.GestioneEnum;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
|
||||||
import it.integry.integrywmsnative.databinding.FragmentMainVersamentoMerceBinding;
|
|
||||||
import it.integry.integrywmsnative.gest.versamento_merce.core.VersamentoMerceHelper;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogAskLivelloPosizione;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArts;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLU;
|
|
||||||
|
|
||||||
public class VersamentoMerceViewModel {
|
|
||||||
|
|
||||||
|
|
||||||
private FragmentActivity mContext;
|
|
||||||
private FragmentMainVersamentoMerceBinding mBinding;
|
|
||||||
private VersamentoMerceHelper mHelper;
|
|
||||||
|
|
||||||
public ObservableField<MtbColt> mtbColt = new ObservableField<>();
|
|
||||||
|
|
||||||
|
|
||||||
private Runnable mOnVersamentoCompleted;
|
|
||||||
|
|
||||||
public void init(FragmentActivity context, FragmentMainVersamentoMerceBinding binding, VersamentoMerceHelper helper, Runnable onVersamentoCompleted) {
|
|
||||||
mContext = context;
|
|
||||||
mBinding = binding;
|
|
||||||
mHelper = helper;
|
|
||||||
mOnVersamentoCompleted = onVersamentoCompleted;
|
|
||||||
|
|
||||||
BarcodeManager.enable();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void openLU() {
|
|
||||||
DialogScanOrCreateLU.make(mContext, true, false, true, false, (mtbColt, created) -> {
|
|
||||||
if (mtbColt == null) {
|
|
||||||
((IPoppableActivity) mContext).pop();
|
|
||||||
} else if ((mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && mtbColt.getSegno().equals(+1)) {
|
|
||||||
setMtbColt(mtbColt);
|
|
||||||
} else if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA) {
|
|
||||||
setMtbColt(mtbColt);
|
|
||||||
} else {
|
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
|
||||||
new SpannableString(Html.fromHtml("Sono accettate solamente UL di <b>Acquisto</b> o <b>Lavorazione</b> di <b>CARICO</b>")),
|
|
||||||
null, this::openLU).show();
|
|
||||||
}
|
|
||||||
}).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMtbColt(MtbColt mtbColt) {
|
|
||||||
this.mtbColt.set(mtbColt);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resetMtbColt() {
|
|
||||||
this.mtbColt.set(null);
|
|
||||||
openLU();
|
|
||||||
}
|
|
||||||
|
|
||||||
public RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
|
||||||
BarcodeManager.disable();
|
|
||||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
|
||||||
|
|
||||||
if (UtilityBarcode.isEtichettaPosizione(data)) {
|
|
||||||
progressDialog.show();
|
|
||||||
this.executeEtichettaPosizione(data, progressDialog);
|
|
||||||
} else if (data.getType() == BarcodeType.EAN8 || data.getType() == BarcodeType.EAN13 || data.getType() == BarcodeType.UPCA) {
|
|
||||||
//searchArtInt(data.getStringValue());
|
|
||||||
} else if (UtilityBarcode.isEtichettaAnonima(data)) {
|
|
||||||
this.executeEtichettaLU(data.getStringValue(), true, progressDialog);
|
|
||||||
} else if (UtilityBarcode.isEtichetta128(data)) {
|
|
||||||
this.executeEtichettaEan128(data, progressDialog);
|
|
||||||
} else {
|
|
||||||
BarcodeManager.enable();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
|
||||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
|
||||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
|
||||||
.single();
|
|
||||||
|
|
||||||
if (foundPosizione.isFlagMonoCollo()) {
|
|
||||||
|
|
||||||
PosizioniRESTConsumer.getBancaliInPosizioneStatic(foundPosizione, mtbColtList -> {
|
|
||||||
|
|
||||||
if (mtbColtList == null || mtbColtList.size() == 0) {
|
|
||||||
progressDialog.dismiss();
|
|
||||||
BarcodeManager.enable();
|
|
||||||
DialogCommon.showNoULFound(mContext, null);
|
|
||||||
} else if (mtbColtList.size() == 1) {
|
|
||||||
ColliMagazzinoRESTConsumer.getByTestataStatic(mtbColtList.get(0), true, false, mtbColt -> {
|
|
||||||
|
|
||||||
//TAKE HERE
|
|
||||||
pickMerceULtoUL(mtbColt, progressDialog);
|
|
||||||
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
progressDialog.dismiss();
|
|
||||||
BarcodeManager.enable();
|
|
||||||
showTooMuchULFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione), progressDialog);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showTooMuchULFound() {
|
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
|
||||||
new SpannableString(mContext.getResources().getText(R.string.too_much_lu_found_message_in_mono_lu)),
|
|
||||||
null, null).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
|
||||||
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
|
|
||||||
|
|
||||||
String barcodeProd = null;
|
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
|
||||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
|
||||||
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
|
||||||
barcodeProd = ean128Model.Content;
|
|
||||||
|
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
|
||||||
this.executeEtichettaLU(ean128Model.Sscc, false, progressDialog);
|
|
||||||
} else {
|
|
||||||
DialogCommon.showNoULFound(mContext, null);
|
|
||||||
progressDialog.dismiss();
|
|
||||||
BarcodeManager.enable();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
|
||||||
progressDialog.dismiss();
|
|
||||||
BarcodeManager.enable();
|
|
||||||
}
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void executeEtichettaLU(String sscc, boolean isAnonima, Dialog progressDialog) {
|
|
||||||
ColliMagazzinoRESTConsumer.getBySSCCStatic(sscc, true, false, mtbColt -> {
|
|
||||||
|
|
||||||
if (mtbColt == null && !isAnonima) {
|
|
||||||
DialogCommon.showNoULFound(mContext, null);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
progressDialog.dismiss();
|
|
||||||
} else if(mtbColt != null && (/*mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO ||*/ mtbColt.getGestioneEnum() == GestioneEnum.VENDITA)) {
|
|
||||||
showWrongGestioneUL();
|
|
||||||
BarcodeManager.enable();
|
|
||||||
progressDialog.dismiss();
|
|
||||||
} else {
|
|
||||||
if (mtbColt == null && isAnonima) {
|
|
||||||
ColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(sscc, GestioneEnum.LAVORAZIONE, mtbColtAnonimo -> {
|
|
||||||
pickMerceULtoUL(mtbColtAnonimo, progressDialog);
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
|
|
||||||
} else {
|
|
||||||
pickMerceULtoUL(mtbColt, progressDialog);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updatePosizione(MtbDepoPosizione mtbDepoPosizione, boolean shouldAskLivello, Dialog progressDialog) {
|
|
||||||
|
|
||||||
if (shouldAskLivello) {
|
|
||||||
DialogAskLivelloPosizione.make(mContext, mtbDepoPosizione, false, newPosizione -> {
|
|
||||||
|
|
||||||
if (newPosizione == null) {
|
|
||||||
updatePosizione(mtbDepoPosizione, shouldAskLivello, progressDialog);
|
|
||||||
} else {
|
|
||||||
updatePosizione(newPosizione, false, progressDialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
ColliMagazzinoRESTConsumer.changePosizione(mtbColt.get(), mtbDepoPosizione, () -> {
|
|
||||||
progressDialog.dismiss();
|
|
||||||
BarcodeManager.enable();
|
|
||||||
|
|
||||||
DialogCommon.showDataSaved(mContext, mOnVersamentoCompleted);
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void pickMerceULtoUL(MtbColt destMtbColt, Dialog progressDialog) {
|
|
||||||
MtbColt sourceMtbColt = mtbColt.get();
|
|
||||||
|
|
||||||
List<MtbColr> mtbColrsToPick = Stream.of(mtbColt.get().getMtbColr())
|
|
||||||
.filter(x -> x.getQtaCol().floatValue() > 0)
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
DialogChooseArtsFromListaArts.make(mContext, mtbColrsToPick, pickedAarts -> {
|
|
||||||
|
|
||||||
progressDialog.dismiss();
|
|
||||||
|
|
||||||
List<MtbColr> destNewMtbColr = new ArrayList<>();
|
|
||||||
|
|
||||||
askQuantities(pickedAarts.iterator(), destNewMtbColr, () -> {
|
|
||||||
BarcodeManager.enable();
|
|
||||||
|
|
||||||
if (destNewMtbColr != null && destNewMtbColr.size() > 0) {
|
|
||||||
MtbColt clonedSourceTestata = (MtbColt) sourceMtbColt.clone();
|
|
||||||
MtbColt clonedDestTestata = (MtbColt) destMtbColt.clone();
|
|
||||||
|
|
||||||
ObservableArrayList<MtbColr> mtbColrSourceObservableField = new ObservableArrayList<>();
|
|
||||||
ObservableArrayList<MtbColr> mtbColrDestObservableField = new ObservableArrayList<>();
|
|
||||||
|
|
||||||
for (int i = 0; i < destNewMtbColr.size(); i++) {
|
|
||||||
MtbColr cloneMtbColr = (MtbColr) destNewMtbColr.get(i).clone();
|
|
||||||
|
|
||||||
boolean destroyMtbColrReferences = false;
|
|
||||||
|
|
||||||
//Se le gestioni sono uguali faccio uno storno sulla sorgente e non lavoro con
|
|
||||||
//i riferimenti
|
|
||||||
if ((sourceMtbColt.getGestioneEnum() == destMtbColt.getGestioneEnum() && sourceMtbColt.getGestioneEnum() == GestioneEnum.VENDITA) ||
|
|
||||||
(sourceMtbColt.getGestioneEnum() == GestioneEnum.VENDITA && sourceMtbColt.getSegno() == -1 && destMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE)) {
|
|
||||||
destroyMtbColrReferences = true;
|
|
||||||
|
|
||||||
MtbColr stornoSourceMtbColr = (MtbColr) destNewMtbColr.get(i).clone();
|
|
||||||
|
|
||||||
stornoSourceMtbColr
|
|
||||||
.setGestione((String) null)
|
|
||||||
.setNumCollo(null)
|
|
||||||
.setSerCollo(null)
|
|
||||||
.setDataCollo(null)
|
|
||||||
.setGestioneRif(null)
|
|
||||||
.setNumColloRif(null)
|
|
||||||
.setSerColloRif(null)
|
|
||||||
.setDataColloRif((String) null)
|
|
||||||
.setCausale(MtbColr.Causale.VERSAMENTO)
|
|
||||||
.setUtente(SettingsManager.i().getUser().getFullname())
|
|
||||||
|
|
||||||
.setQtaCol(stornoSourceMtbColr.getQtaCol().multiply(new BigDecimal(-1)))
|
|
||||||
.setNumCnf(stornoSourceMtbColr.getNumCnf().multiply(new BigDecimal(-1)));
|
|
||||||
|
|
||||||
mtbColrSourceObservableField.add(stornoSourceMtbColr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!destroyMtbColrReferences) {
|
|
||||||
cloneMtbColr
|
|
||||||
.setGestioneRif(cloneMtbColr.getGestione())
|
|
||||||
.setSerColloRif(cloneMtbColr.getSerCollo())
|
|
||||||
.setNumColloRif(cloneMtbColr.getNumCollo())
|
|
||||||
.setDataColloRif(cloneMtbColr.getDataColloS());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sourceMtbColt.getGestioneEnum() == GestioneEnum.VENDITA && sourceMtbColt.getSegno() == +1) {
|
|
||||||
cloneMtbColr.setCodJcom(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
cloneMtbColr
|
|
||||||
.setGestione((String) null)
|
|
||||||
.setSerCollo(null)
|
|
||||||
.setNumCollo(null)
|
|
||||||
.setDataCollo(null)
|
|
||||||
.setCausale(MtbColr.Causale.VERSAMENTO)
|
|
||||||
.setUtente(SettingsManager.i().getUser().getFullname());
|
|
||||||
|
|
||||||
mtbColrDestObservableField.add(cloneMtbColr);
|
|
||||||
}
|
|
||||||
|
|
||||||
clonedSourceTestata.setMtbColr(mtbColrSourceObservableField);
|
|
||||||
clonedDestTestata.setMtbColr(mtbColrDestObservableField);
|
|
||||||
|
|
||||||
|
|
||||||
saveLUs(clonedSourceTestata, clonedDestTestata);
|
|
||||||
}
|
|
||||||
|
|
||||||
}, () -> {
|
|
||||||
progressDialog.dismiss();
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
|
|
||||||
}, () -> {
|
|
||||||
progressDialog.dismiss();
|
|
||||||
BarcodeManager.enable();
|
|
||||||
}).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void askQuantities(Iterator<MtbColr> sourceMtbColrs, List<MtbColr> destMtbColr, Runnable onComplete, Runnable onAbort) {
|
|
||||||
|
|
||||||
if (sourceMtbColrs.hasNext()) {
|
|
||||||
|
|
||||||
askSingleQuantity(sourceMtbColrs.next(), mtbColr -> {
|
|
||||||
|
|
||||||
|
|
||||||
destMtbColr.add(mtbColr);
|
|
||||||
askQuantities(sourceMtbColrs, destMtbColr, onComplete, onAbort);
|
|
||||||
}, onAbort);
|
|
||||||
} else {
|
|
||||||
onComplete.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete, Runnable onAbort) {
|
|
||||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
|
||||||
.setMtbAart(mtbColr.getMtbAart())
|
|
||||||
.setInitialNumCnf(mtbColr.getNumCnf())
|
|
||||||
.setInitialQtaCnf(mtbColr.getQtaCnf())
|
|
||||||
.setInitialQtaTot(mtbColr.getQtaCol())
|
|
||||||
.setTotalQtaAvailable(mtbColr.getQtaCol())
|
|
||||||
.setTotalNumCnfAvailable(mtbColr.getNumCnf())
|
|
||||||
.setQtaCnfAvailable(mtbColr.getQtaCnf())
|
|
||||||
.setPartitaMag(mtbColr.getPartitaMag())
|
|
||||||
.setDataScad(mtbColr.getDataScadPartitaD())
|
|
||||||
.setCanOverflowOrderQuantity(false)
|
|
||||||
.setCanPartitaMagBeChanged(false)
|
|
||||||
.setCanLUBeClosed(false);
|
|
||||||
|
|
||||||
DialogInputQuantityV2View
|
|
||||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
|
||||||
// PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
|
||||||
// .setNumCnf(resultDTO.getNumCnf())
|
|
||||||
// .setQtaCnf(resultDTO.getQtaCnf())
|
|
||||||
// .setQtaTot(resultDTO.getQtaTot())
|
|
||||||
// .setPartitaMag(resultDTO.getPartitaMag())
|
|
||||||
// .setDataScad(resultDTO.getDataScad());
|
|
||||||
//
|
|
||||||
// onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
|
||||||
|
|
||||||
mtbColr
|
|
||||||
.setQtaCol(resultDTO.getQtaTot())
|
|
||||||
.setQtaCnf(resultDTO.getQtaCnf())
|
|
||||||
.setNumCnf(resultDTO.getNumCnf())
|
|
||||||
.setDatetimeRow(UtilityDate.getDateInstance());
|
|
||||||
|
|
||||||
onComplete.run(mtbColr);
|
|
||||||
}, onAbort)
|
|
||||||
.show(mContext.getSupportFragmentManager(), "tag");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// DialogInputQuantity.DTO dto = new DialogInputQuantity.DTO()
|
|
||||||
// .setBatchLot(mtbColr.getPartitaMag())
|
|
||||||
// .setDataScad(mtbColr.getDataScadPartitaD())
|
|
||||||
// .setMtbAart(mtbColr.getMtbAart())
|
|
||||||
// .setQtaTot(mtbColr.getQtaCol())
|
|
||||||
// .setQtaOrd(mtbColr.getQtaCol())
|
|
||||||
// .setQtaDaEvadere(new BigDecimal(-1))
|
|
||||||
// .setQtaEvasa(BigDecimal.ZERO)
|
|
||||||
// .setCanPartitaMagBeChanged(false)
|
|
||||||
// .setCanDataScadBeChanged(false)
|
|
||||||
// .setMaxQta(mtbColr.getQtaCol());
|
|
||||||
//
|
|
||||||
// DialogInputQuantity.makeBase(mContext, dto, false, quantityDTO -> {
|
|
||||||
// mtbColr
|
|
||||||
// .setQtaCol(quantityDTO.qtaTot.getBigDecimal())
|
|
||||||
// .setQtaCnf(quantityDTO.qtaCnf.getBigDecimal())
|
|
||||||
// .setNumCnf(quantityDTO.numCnf.getBigDecimal())
|
|
||||||
// .setDatetimeRow(UtilityDate.getDateInstance());
|
|
||||||
//
|
|
||||||
// onComplete.run(mtbColr);
|
|
||||||
// }, onAbort).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void askULVenditaConfirm(RunnableArgs<Boolean> callback) {
|
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(
|
|
||||||
mContext,
|
|
||||||
new SpannableString(mContext.getResources().getString(R.string.lu_gest_v_loading_alert)),
|
|
||||||
null,
|
|
||||||
() -> callback.run(true),
|
|
||||||
() -> callback.run(false)).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showWrongGestioneUL() {
|
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
|
||||||
new SpannableString(Html.fromHtml(mContext.getResources().getText(R.string.gestione_V_not_accepted_message).toString())),
|
|
||||||
null, null).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void saveLUs(MtbColt mtbColt1, MtbColt mtbColt2) {
|
|
||||||
|
|
||||||
ArrayList<MtbColt> mtbColts = new ArrayList<>();
|
|
||||||
mtbColts.add(mtbColt1);
|
|
||||||
mtbColts.add(mtbColt2);
|
|
||||||
|
|
||||||
for (MtbColt mtbColt : mtbColts) {
|
|
||||||
mtbColt.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
|
||||||
|
|
||||||
for (int i = 0; i < mtbColt.getMtbColr().size(); i++) {
|
|
||||||
mtbColt.getMtbColr().get(i)
|
|
||||||
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumer.saveColliStatic(mtbColts, value -> {
|
|
||||||
DialogCommon.showDataSaved(mContext, () -> {
|
|
||||||
mOnVersamentoCompleted.run();
|
|
||||||
});
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -3,48 +3,55 @@ package it.integry.integrywmsnative.view.dialogs;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class DialogCommon {
|
public class DialogCommon {
|
||||||
|
|
||||||
|
|
||||||
public static void showNoArtFoundDialog(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
public static void showNoArtFoundDialog(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(context,
|
DialogSimpleMessageView
|
||||||
new SpannableString(context.getResources().getText(R.string.no_result_from_barcode)),
|
.makeWarningDialog(new SpannableString(context.getResources().getText(R.string.no_result_from_barcode)),
|
||||||
null, onPositiveClick).show();
|
null, onPositiveClick)
|
||||||
|
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showNoULFound(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
public static void showNoULFound(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(context,
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(context.getResources().getText(R.string.no_lu_found_message)),
|
||||||
new SpannableString(context.getResources().getText(R.string.no_lu_found_message)),
|
null, onPositiveClick)
|
||||||
null, onPositiveClick).show();
|
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void showNoOrderFound(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
public static void showNoOrderFound(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(context,
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(context.getResources().getText(R.string.no_orders_found_message)),
|
||||||
new SpannableString(context.getResources().getText(R.string.no_orders_found_message)),
|
null, onPositiveClick)
|
||||||
null, onPositiveClick).show();
|
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void showDataSaved(@NotNull Context context, @Nullable Runnable onPositiveClick) {
|
public static void showDataSaved(@NotNull FragmentActivity context, @Nullable Runnable onPositiveClick) {
|
||||||
|
context.runOnUiThread(() -> {
|
||||||
DialogSimpleMessageHelper.makeSuccessDialog(
|
DialogSimpleMessageView.makeSuccessDialog(
|
||||||
context,
|
context.getResources().getString(R.string.completed),
|
||||||
context.getResources().getString(R.string.completed),
|
new SpannableString(context.getResources().getString(R.string.data_saved)),
|
||||||
new SpannableString(context.getResources().getString(R.string.data_saved)),
|
null, onPositiveClick)
|
||||||
null, onPositiveClick).show();
|
.show(context.getSupportFragmentManager(), "tag");
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void showRestError(@NotNull Context context, Exception ex, @Nullable Runnable onPositiveClick) {
|
public static void showRestError(@NotNull Context context, Exception ex, @Nullable Runnable onPositiveClick) {
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(context,
|
DialogSimpleMessageView
|
||||||
new SpannableString(ex.getMessage()), null, onPositiveClick).show();
|
.makeErrorDialog(new SpannableString(ex.getMessage()), null, onPositiveClick)
|
||||||
|
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,109 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
|
|
||||||
import java.util.AbstractMap;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
|
|
||||||
import it.integry.integrywmsnative.core.model.VtbDest;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogAskClienteBinding;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteDestinatarioDTO;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page1ViewModel;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page2ViewModel;
|
|
||||||
|
|
||||||
public class DialogAskCliente {
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
private Dialog mDialog;
|
|
||||||
|
|
||||||
private DialogAskClienteBinding mBinding;
|
|
||||||
|
|
||||||
|
|
||||||
public static Dialog makeBase(final Context context, RunnableArgsss<DialogConsts.Results, VtbDest, String> onComplete) {
|
|
||||||
return new DialogAskCliente(context, onComplete).mDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogAskCliente(Context context, RunnableArgsss<DialogConsts.Results, VtbDest, String> onComplete) {
|
|
||||||
mContext = context;
|
|
||||||
|
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
|
||||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_ask_cliente, null, false);
|
|
||||||
|
|
||||||
List<Map.Entry<Integer, Class>> views = new ArrayList<>();
|
|
||||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page1, DialogAskCliente_Page1ViewModel.class));
|
|
||||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page2, DialogAskCliente_Page2ViewModel.class));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DialogAskClienteAdapter adapter = new DialogAskClienteAdapter(mContext, views);
|
|
||||||
mBinding.viewpager.setAdapter(adapter);
|
|
||||||
mBinding.viewpager.beginFakeDrag();
|
|
||||||
mBinding.viewpager.addOnPageChangeListener(adapter);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mDialog = new Dialog(mContext);
|
|
||||||
mDialog.setContentView(mBinding.getRoot());
|
|
||||||
mDialog.setCanceledOnTouchOutside(false);
|
|
||||||
// mDialog.setCancelable(false);
|
|
||||||
UtilityDialog.setTo90PercentWidth(mContext, mDialog);
|
|
||||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
mDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
|
||||||
|
|
||||||
|
|
||||||
mDialog.setOnShowListener(dialog -> {
|
|
||||||
|
|
||||||
DialogAskCliente_Page1ViewModel viewModel1 = (DialogAskCliente_Page1ViewModel) adapter.getViewModel(R.layout.dialog_ask_cliente__page1);
|
|
||||||
DialogAskCliente_Page2ViewModel viewModel2 = (DialogAskCliente_Page2ViewModel) adapter.getViewModel(R.layout.dialog_ask_cliente__page2);
|
|
||||||
|
|
||||||
viewModel1
|
|
||||||
.setOnConfirmClickListener(() -> {
|
|
||||||
String codAnag = viewModel1.getCurrentCliente();
|
|
||||||
|
|
||||||
if(UtilityString.isNullOrEmpty(codAnag)) {
|
|
||||||
mDialog.dismiss();
|
|
||||||
onComplete.run(DialogConsts.Results.YES, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
viewModel2.setCodAnag(codAnag);
|
|
||||||
|
|
||||||
mBinding.viewpager.setCurrentItem(mBinding.viewpager.getCurrentItem() + 1, true);
|
|
||||||
});
|
|
||||||
|
|
||||||
viewModel1.setOnAbortClickListener(() -> {
|
|
||||||
mDialog.dismiss();
|
|
||||||
onComplete.run(DialogConsts.Results.ABORT, null, null);
|
|
||||||
});
|
|
||||||
|
|
||||||
viewModel2.setOnConfirmClickListener(() -> {
|
|
||||||
DialogAskClienteDestinatarioDTO cliente = viewModel2.getCurrentDestinatario();
|
|
||||||
|
|
||||||
onComplete.run(DialogConsts.Results.YES, cliente != null ? cliente.toVtbDestModel() : null, viewModel1.getCurrentCommessa());
|
|
||||||
mDialog.dismiss();
|
|
||||||
});
|
|
||||||
|
|
||||||
viewModel2.setOnAbortClickListener(() -> {
|
|
||||||
mDialog.dismiss();
|
|
||||||
onComplete.run(DialogConsts.Results.ABORT, null, null);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -15,13 +14,10 @@ import androidx.viewpager.widget.ViewPager;
|
|||||||
|
|
||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.BR;
|
import it.integry.integrywmsnative.BR;
|
||||||
import it.integry.integrywmsnative.R;
|
|
||||||
import it.integry.integrywmsnative.ui.DeactivatableViewPager;
|
import it.integry.integrywmsnative.ui.DeactivatableViewPager;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.IDialogAskClienteViewModel;
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.IDialogAskClienteViewModel;
|
||||||
|
|
||||||
@@ -58,9 +54,7 @@ public class DialogAskClienteAdapter extends PagerAdapter implements ViewPager.O
|
|||||||
viewModel = (IDialogAskClienteViewModel) viewModelClass.newInstance();
|
viewModel = (IDialogAskClienteViewModel) viewModelClass.newInstance();
|
||||||
viewModel.setBinding(mBinding);
|
viewModel.setBinding(mBinding);
|
||||||
viewModel.setContext(mContext);
|
viewModel.setContext(mContext);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException | InstantiationException e) {
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InstantiationException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,142 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
||||||
|
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.AbstractMap;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
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.VtbDest;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogAskClienteBinding;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteDestinatarioDTO;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page1ViewModel;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page2ViewModel;
|
||||||
|
|
||||||
|
public class DialogAskClienteView extends BaseDialogFragment {
|
||||||
|
|
||||||
|
private final RunnableArgss<VtbDest, String> mOnComplete;
|
||||||
|
private final Runnable mOnAbort;
|
||||||
|
|
||||||
|
private DialogAskClienteAdapter mAdapter;
|
||||||
|
|
||||||
|
private FragmentActivity mContext;
|
||||||
|
private DialogAskClienteBinding mBindings;
|
||||||
|
|
||||||
|
private boolean mIsClienteSelected = false;
|
||||||
|
|
||||||
|
public static DialogAskClienteView newInstance(@NotNull RunnableArgss<VtbDest, String> onComplete, @NotNull Runnable onAbort) {
|
||||||
|
return new DialogAskClienteView( onComplete, onAbort);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogAskClienteView(@NotNull RunnableArgss<VtbDest, String> onComplete, @NotNull Runnable onAbort) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.mOnComplete = onComplete;
|
||||||
|
this.mOnAbort = onAbort;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
this.mContext = getActivity();
|
||||||
|
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_ask_cliente, container, false);
|
||||||
|
mBindings.setLifecycleOwner(this);
|
||||||
|
|
||||||
|
getDialog().setCanceledOnTouchOutside(false);
|
||||||
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
|
||||||
|
|
||||||
|
List<Map.Entry<Integer, Class>> views = new ArrayList<>();
|
||||||
|
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page1, DialogAskCliente_Page1ViewModel.class));
|
||||||
|
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page2, DialogAskCliente_Page2ViewModel.class));
|
||||||
|
|
||||||
|
mAdapter = new DialogAskClienteAdapter(mContext, views);
|
||||||
|
mBindings.viewpager.setAdapter(mAdapter);
|
||||||
|
mBindings.viewpager.beginFakeDrag();
|
||||||
|
mBindings.viewpager.addOnPageChangeListener(mAdapter);
|
||||||
|
mBindings.viewpager.setCurrentItem(0, false);
|
||||||
|
|
||||||
|
getDialog().setOnShowListener(d -> {
|
||||||
|
this.initView();
|
||||||
|
});
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
UtilityDialog.setTo90PercentWidth(this.mContext, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
DialogAskCliente_Page1ViewModel viewModel1 = (DialogAskCliente_Page1ViewModel) mAdapter.getViewModel(R.layout.dialog_ask_cliente__page1);
|
||||||
|
DialogAskCliente_Page2ViewModel viewModel2 = (DialogAskCliente_Page2ViewModel) mAdapter.getViewModel(R.layout.dialog_ask_cliente__page2);
|
||||||
|
|
||||||
|
viewModel1
|
||||||
|
.setOnConfirmClickListener(() -> {
|
||||||
|
String codAnag = viewModel1.getCurrentCliente();
|
||||||
|
|
||||||
|
if(UtilityString.isNullOrEmpty(codAnag)) {
|
||||||
|
this.mIsClienteSelected = true;
|
||||||
|
dismiss();
|
||||||
|
mOnComplete.run(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel2.setCodAnag(codAnag);
|
||||||
|
|
||||||
|
mBindings.viewpager.setCurrentItem(mBindings.viewpager.getCurrentItem() + 1, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
viewModel2.setOnConfirmClickListener(() -> {
|
||||||
|
DialogAskClienteDestinatarioDTO cliente = viewModel2.getCurrentDestinatario();
|
||||||
|
|
||||||
|
this.mIsClienteSelected = true;
|
||||||
|
dismiss();
|
||||||
|
mOnComplete.run(cliente != null ? cliente.toVtbDestModel() : null, viewModel1.getCurrentCommessa());
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
viewModel1.setOnAbortClickListener(this::dismiss);
|
||||||
|
viewModel2.setOnAbortClickListener(this::dismiss);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
|
if(!mIsClienteSelected) {
|
||||||
|
this.mOnAbort.run();
|
||||||
|
}
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,243 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.base;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.res.ColorStateList;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.Rect;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.Spanned;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.Window;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.StringRes;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.core.content.res.ResourcesCompat;
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogBaseBinding;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by GiuseppeS on 22/03/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class DialogSimpleMessageHelper {
|
|
||||||
|
|
||||||
public enum TYPE {
|
|
||||||
INFO(1),
|
|
||||||
SUCCESS(2),
|
|
||||||
WARNING(3),
|
|
||||||
ERROR(4);
|
|
||||||
|
|
||||||
private int value;
|
|
||||||
|
|
||||||
TYPE(int value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TYPE fromInt(int value) {
|
|
||||||
for (TYPE b : TYPE.values()) {
|
|
||||||
if (b.value == value) return b;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Dialog makeBase(TYPE type, Context mContext, String titleText, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, Runnable onNegativeClick, @StringRes Integer rNeutralButtonString, Runnable onNeutralClick) {
|
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
|
|
||||||
int colorBackgroundTitle = -1;
|
|
||||||
Drawable titleIconRes = null;
|
|
||||||
|
|
||||||
Dialog dialog = new Dialog(mContext);
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case INFO:
|
|
||||||
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.light_blue_300);
|
|
||||||
titleIconRes = ResourcesCompat.getDrawable(mContext.getResources(), R.drawable.ic_info_78dp, null);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SUCCESS:
|
|
||||||
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.green_300);
|
|
||||||
titleIconRes = ResourcesCompat.getDrawable(mContext.getResources(), R.drawable.ic_done_white_24dp, null);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WARNING:
|
|
||||||
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.yellow_600);
|
|
||||||
titleIconRes = ResourcesCompat.getDrawable(mContext.getResources(), R.drawable.ic_warning_white_24dp, null);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ERROR:
|
|
||||||
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.red_300);
|
|
||||||
titleIconRes = ResourcesCompat.getDrawable(mContext.getResources(), R.drawable.ic_mood_bad_24dp, null);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
DialogSimpleMessageViewModel viewModel = new DialogSimpleMessageViewModel(dialog);
|
|
||||||
|
|
||||||
viewModel
|
|
||||||
.setOnPositive(onPositiveClick)
|
|
||||||
.setOnNeutral(onNeutralClick)
|
|
||||||
.setOnNegative(onNegativeClick)
|
|
||||||
|
|
||||||
.setPositiveButtonText(mContext.getText(R.string.ok).toString())
|
|
||||||
.setNeutralButtonText(rNeutralButtonString != null && rNeutralButtonString != -1 ? mContext.getText(rNeutralButtonString).toString() : null)
|
|
||||||
.setNegativeButtonText(mContext.getText(R.string.no).toString());
|
|
||||||
|
|
||||||
|
|
||||||
DialogBaseBinding mBinding = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.dialog_base, null, false);
|
|
||||||
|
|
||||||
mBinding.setViewmodel(viewModel);
|
|
||||||
|
|
||||||
|
|
||||||
Rect displayRectangle = new Rect();
|
|
||||||
Window window = ((Activity) mContext).getWindow();
|
|
||||||
window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);
|
|
||||||
mBinding.titleContainer.setMinimumWidth((int) (displayRectangle.width() * 0.8f));
|
|
||||||
|
|
||||||
|
|
||||||
//Title VIEW
|
|
||||||
mBinding.titleText.setText(titleText);
|
|
||||||
ColorStateList colorStateList = ColorStateList.valueOf(Color.WHITE);
|
|
||||||
mBinding.titleIcon.setImageTintList(colorStateList);
|
|
||||||
mBinding.titleIcon.setImageDrawable(titleIconRes);
|
|
||||||
|
|
||||||
mBinding.titleContainer.setBackgroundColor(colorBackgroundTitle);
|
|
||||||
|
|
||||||
//Content View
|
|
||||||
mBinding.descriptionText.setText(messageText);
|
|
||||||
|
|
||||||
LinearLayout hashMapContainer = mBinding.dialogContentHashmap;
|
|
||||||
|
|
||||||
if (hashmapContent != null) {
|
|
||||||
for (int i = 0; i < hashmapContent.keySet().size(); i++) {
|
|
||||||
String currentKey = hashmapContent.keySet().toArray()[i].toString();
|
|
||||||
String currentValue = hashmapContent.get(currentKey);
|
|
||||||
|
|
||||||
RelativeLayout singleMapContent = (RelativeLayout) inflater.inflate(R.layout.dialog_custom_content_hashmap_viewmodel, null);
|
|
||||||
((TextView) singleMapContent.findViewById(R.id.dialog_content_hashmap_key)).setText(currentKey);
|
|
||||||
((TextView) singleMapContent.findViewById(R.id.dialog_content_hashmap_value)).setText(currentValue);
|
|
||||||
|
|
||||||
hashMapContainer.addView(singleMapContent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog.setCancelable(false);
|
|
||||||
dialog.setCanceledOnTouchOutside(false);
|
|
||||||
dialog.setContentView(mBinding.getRoot());
|
|
||||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
|
|
||||||
return dialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static Dialog makeInfoDialog(Context mContext, String titleText, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
|
||||||
return makeBase(TYPE.INFO,
|
|
||||||
mContext,
|
|
||||||
titleText,
|
|
||||||
messageText,
|
|
||||||
hashmapContent,
|
|
||||||
onPositiveClick,
|
|
||||||
null, -1, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static Dialog makeInfoDialog(Context mContext, String titleText, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, Runnable onNegativeClick) {
|
|
||||||
return makeBase(TYPE.INFO,
|
|
||||||
mContext,
|
|
||||||
titleText,
|
|
||||||
messageText,
|
|
||||||
hashmapContent,
|
|
||||||
onPositiveClick,
|
|
||||||
onNegativeClick, -1, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static Dialog makeSuccessDialog(Context mContext, String titleText, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
|
||||||
return makeBase(TYPE.SUCCESS,
|
|
||||||
mContext,
|
|
||||||
titleText,
|
|
||||||
messageText,
|
|
||||||
hashmapContent,
|
|
||||||
onPositiveClick,
|
|
||||||
null, -1, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static Dialog makeWarningDialog(Context mContext, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, Runnable onNegativeClick) {
|
|
||||||
return makeBase(TYPE.WARNING,
|
|
||||||
mContext,
|
|
||||||
mContext.getText(R.string.warning).toString(),
|
|
||||||
messageText,
|
|
||||||
hashmapContent,
|
|
||||||
onPositiveClick,
|
|
||||||
() -> {
|
|
||||||
if (onNegativeClick != null) onNegativeClick.run();
|
|
||||||
}, -1, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static Dialog makeWarningDialog(Context mContext, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
|
||||||
return makeBase(TYPE.WARNING,
|
|
||||||
mContext,
|
|
||||||
mContext.getText(R.string.warning).toString(),
|
|
||||||
messageText,
|
|
||||||
hashmapContent,
|
|
||||||
onPositiveClick,
|
|
||||||
null, -1, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showSimpleWarningDialog(Context context, String message) {
|
|
||||||
makeErrorDialog(
|
|
||||||
context,
|
|
||||||
new SpannableString(message),
|
|
||||||
null,
|
|
||||||
null).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Dialog makeErrorDialog(Context mContext, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
|
||||||
|
|
||||||
return makeBase(TYPE.ERROR,
|
|
||||||
mContext,
|
|
||||||
mContext.getText(R.string.ops).toString(),
|
|
||||||
messageText,
|
|
||||||
hashmapContent,
|
|
||||||
onPositiveClick,
|
|
||||||
null, -1, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showSimpleErrorDialog(Context context, String message) {
|
|
||||||
makeErrorDialog(
|
|
||||||
context,
|
|
||||||
new SpannableString(message),
|
|
||||||
null,
|
|
||||||
null).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Dialog makeErrorDialog(Context mContext, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, @StringRes int rNeutralButtonString, Runnable onNeutralClick) {
|
|
||||||
|
|
||||||
return makeBase(TYPE.ERROR,
|
|
||||||
mContext,
|
|
||||||
mContext.getText(R.string.ops).toString(),
|
|
||||||
messageText,
|
|
||||||
hashmapContent,
|
|
||||||
onPositiveClick,
|
|
||||||
null, rNeutralButtonString, onNeutralClick);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,289 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.base;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.Spanned;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.StringRes;
|
||||||
|
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.core.content.res.ResourcesCompat;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogBaseBinding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by GiuseppeS on 22/03/2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DialogSimpleMessageView extends BaseDialogFragment {
|
||||||
|
|
||||||
|
public enum TYPE {
|
||||||
|
INFO(1),
|
||||||
|
SUCCESS(2),
|
||||||
|
WARNING(3),
|
||||||
|
ERROR(4);
|
||||||
|
|
||||||
|
private int value;
|
||||||
|
|
||||||
|
TYPE(int value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TYPE fromInt(int value) {
|
||||||
|
for (TYPE b : TYPE.values()) {
|
||||||
|
if (b.value == value) return b;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private final TYPE mType;
|
||||||
|
private final String mTitleText;
|
||||||
|
private final Spanned mMessageText;
|
||||||
|
private final HashMap<String, String> mHashmapContent;
|
||||||
|
private final Runnable mOnPositiveClick;
|
||||||
|
private final Runnable mOnNegativeClick;
|
||||||
|
private final @StringRes Integer mRNeutralButtonString;
|
||||||
|
private final Runnable mOnNeutralClick;
|
||||||
|
|
||||||
|
|
||||||
|
private String positiveButtonText;
|
||||||
|
private String neutralButtonText;
|
||||||
|
private String negativeButtonText;
|
||||||
|
|
||||||
|
|
||||||
|
private DialogBaseBinding mBindings;
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
public static DialogSimpleMessageView newInstance(@NonNull TYPE type, @NonNull String titleText, @NonNull Spanned messageText, HashMap<String, String> hashmapContent , Runnable onPositiveClick, Runnable onNegativeClick, @StringRes Integer rNeutralButtonString, Runnable onNeutralClick) {
|
||||||
|
return new DialogSimpleMessageView(type, titleText, messageText, hashmapContent, onPositiveClick, onNegativeClick, rNeutralButtonString, onNeutralClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogSimpleMessageView(@NonNull TYPE type, @NonNull String titleText, @NonNull Spanned messageText, HashMap<String, String> hashmapContent , Runnable onPositiveClick, Runnable onNegativeClick, @StringRes Integer rNeutralButtonString, Runnable onNeutralClick) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.mType = type;
|
||||||
|
this.mTitleText = titleText;
|
||||||
|
this.mMessageText = messageText;
|
||||||
|
this.mHashmapContent = hashmapContent;
|
||||||
|
this.mOnPositiveClick = onPositiveClick;
|
||||||
|
this.mOnNegativeClick = onNegativeClick;
|
||||||
|
this.mRNeutralButtonString = rNeutralButtonString;
|
||||||
|
this.mOnNeutralClick = onNeutralClick;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
|
||||||
|
UtilityDialog.setTo90PercentWidth(this.mContext, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
this.mContext = getActivity();
|
||||||
|
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_base, container, false);
|
||||||
|
|
||||||
|
mBindings.setView(this);
|
||||||
|
mBindings.setLifecycleOwner(this);
|
||||||
|
|
||||||
|
getDialog().setCanceledOnTouchOutside(false);
|
||||||
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
|
int colorBackgroundTitle = -1;
|
||||||
|
Drawable titleIconRes = null;
|
||||||
|
|
||||||
|
switch (mType) {
|
||||||
|
case INFO:
|
||||||
|
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.light_blue_300);
|
||||||
|
titleIconRes = ResourcesCompat.getDrawable(mContext.getResources(), R.drawable.ic_info_78dp, null);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SUCCESS:
|
||||||
|
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.green_300);
|
||||||
|
titleIconRes = ResourcesCompat.getDrawable(mContext.getResources(), R.drawable.ic_done_white_24dp, null);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WARNING:
|
||||||
|
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.yellow_600);
|
||||||
|
titleIconRes = ResourcesCompat.getDrawable(mContext.getResources(), R.drawable.ic_warning_white_24dp, null);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ERROR:
|
||||||
|
colorBackgroundTitle = ContextCompat.getColor(mContext, R.color.red_300);
|
||||||
|
titleIconRes = ResourcesCompat.getDrawable(mContext.getResources(), R.drawable.ic_mood_bad_24dp, null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.positiveButtonText = mContext.getText(R.string.ok).toString();
|
||||||
|
this.negativeButtonText = mContext.getText(R.string.no).toString();
|
||||||
|
|
||||||
|
//Title VIEW
|
||||||
|
mBindings.titleText.setText(mTitleText);
|
||||||
|
ColorStateList colorStateList = ColorStateList.valueOf(Color.WHITE);
|
||||||
|
mBindings.titleIcon.setImageTintList(colorStateList);
|
||||||
|
mBindings.titleIcon.setImageDrawable(titleIconRes);
|
||||||
|
|
||||||
|
mBindings.titleContainer.setBackgroundColor(colorBackgroundTitle);
|
||||||
|
|
||||||
|
//Content View
|
||||||
|
mBindings.descriptionText.setText(mMessageText);
|
||||||
|
|
||||||
|
LinearLayoutCompat hashMapContainer = mBindings.dialogContentHashmap;
|
||||||
|
|
||||||
|
if (mHashmapContent != null) {
|
||||||
|
for (int i = 0; i < mHashmapContent.keySet().size(); i++) {
|
||||||
|
String currentKey = mHashmapContent.keySet().toArray()[i].toString();
|
||||||
|
String currentValue = mHashmapContent.get(currentKey);
|
||||||
|
|
||||||
|
RelativeLayout singleMapContent = (RelativeLayout) inflater.inflate(R.layout.dialog_custom_content_hashmap_viewmodel, null);
|
||||||
|
((TextView) singleMapContent.findViewById(R.id.dialog_content_hashmap_key)).setText(currentKey);
|
||||||
|
((TextView) singleMapContent.findViewById(R.id.dialog_content_hashmap_value)).setText(currentValue);
|
||||||
|
|
||||||
|
hashMapContainer.addView(singleMapContent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isPositiveVisible() {
|
||||||
|
return mOnPositiveClick != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNeutralVisible() {
|
||||||
|
return mOnNeutralClick != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNegativeVisible() {
|
||||||
|
return mOnNegativeClick != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getPositiveButtonText() {
|
||||||
|
return positiveButtonText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNeutralButtonText() {
|
||||||
|
return mRNeutralButtonString != null && mRNeutralButtonString != -1 ? mContext.getText(mRNeutralButtonString).toString() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNegativeButtonText() {
|
||||||
|
return negativeButtonText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPositiveClick() {
|
||||||
|
dismiss();
|
||||||
|
if(mOnPositiveClick != null) mOnPositiveClick.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onNeutralClick() {
|
||||||
|
dismiss();
|
||||||
|
if(mOnNeutralClick != null) mOnNeutralClick.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onNegativeClick() {
|
||||||
|
dismiss();
|
||||||
|
if(mOnNegativeClick != null) mOnNegativeClick.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DialogSimpleMessageView makeInfoDialog(String titleText, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
||||||
|
return newInstance(TYPE.INFO,
|
||||||
|
titleText,
|
||||||
|
messageText,
|
||||||
|
hashmapContent,
|
||||||
|
onPositiveClick,
|
||||||
|
null, -1, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static DialogSimpleMessageView makeInfoDialog(String titleText, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, Runnable onNegativeClick) {
|
||||||
|
return newInstance(TYPE.INFO,
|
||||||
|
titleText,
|
||||||
|
messageText,
|
||||||
|
hashmapContent,
|
||||||
|
onPositiveClick,
|
||||||
|
onNegativeClick, -1, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static DialogSimpleMessageView makeSuccessDialog(String titleText, Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
||||||
|
return newInstance(TYPE.SUCCESS,
|
||||||
|
titleText,
|
||||||
|
messageText,
|
||||||
|
hashmapContent,
|
||||||
|
onPositiveClick,
|
||||||
|
null, -1, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static DialogSimpleMessageView makeWarningDialog(Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, Runnable onNegativeClick) {
|
||||||
|
return newInstance(TYPE.WARNING,
|
||||||
|
UtilityResources.getString(R.string.warning),
|
||||||
|
messageText,
|
||||||
|
hashmapContent,
|
||||||
|
onPositiveClick,
|
||||||
|
() -> {
|
||||||
|
if (onNegativeClick != null) onNegativeClick.run();
|
||||||
|
}, -1, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static DialogSimpleMessageView makeWarningDialog(Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
||||||
|
return newInstance(TYPE.WARNING,
|
||||||
|
UtilityResources.getString(R.string.warning),
|
||||||
|
messageText,
|
||||||
|
hashmapContent,
|
||||||
|
onPositiveClick,
|
||||||
|
null, -1, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DialogSimpleMessageView makeErrorDialog(Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick) {
|
||||||
|
|
||||||
|
return newInstance(TYPE.ERROR,
|
||||||
|
UtilityResources.getString(R.string.ops),
|
||||||
|
messageText,
|
||||||
|
hashmapContent,
|
||||||
|
onPositiveClick,
|
||||||
|
null, -1, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DialogSimpleMessageView makeErrorDialog(Spanned messageText, HashMap<String, String> hashmapContent, Runnable onPositiveClick, @StringRes int rNeutralButtonString, Runnable onNeutralClick) {
|
||||||
|
|
||||||
|
return newInstance(TYPE.ERROR,
|
||||||
|
UtilityResources.getString(R.string.ops),
|
||||||
|
messageText,
|
||||||
|
hashmapContent,
|
||||||
|
onPositiveClick,
|
||||||
|
null, rNeutralButtonString, onNeutralClick);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.base;
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
|
|
||||||
public class DialogSimpleMessageViewModel {
|
|
||||||
|
|
||||||
|
|
||||||
private Dialog mDialog;
|
|
||||||
|
|
||||||
private Runnable onPositive;
|
|
||||||
private Runnable onNeutral;
|
|
||||||
private Runnable onNegative;
|
|
||||||
|
|
||||||
private String positiveButtonText;
|
|
||||||
private String neutralButtonText;
|
|
||||||
private String negativeButtonText;
|
|
||||||
|
|
||||||
public DialogSimpleMessageViewModel(Dialog dialog) {
|
|
||||||
mDialog = dialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogSimpleMessageViewModel setOnPositive(Runnable onPositive) {
|
|
||||||
this.onPositive = onPositive;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogSimpleMessageViewModel setOnNeutral(Runnable onNeutral) {
|
|
||||||
this.onNeutral = onNeutral;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogSimpleMessageViewModel setOnNegative(Runnable onNegative) {
|
|
||||||
this.onNegative = onNegative;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isPositiveVisible() {
|
|
||||||
return onPositive != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNeutralVisible() {
|
|
||||||
return onNeutral != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNegativeVisible() {
|
|
||||||
return onNegative != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String getPositiveButtonText() {
|
|
||||||
return positiveButtonText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogSimpleMessageViewModel setPositiveButtonText(String positiveButtonText) {
|
|
||||||
this.positiveButtonText = positiveButtonText;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNeutralButtonText() {
|
|
||||||
return neutralButtonText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogSimpleMessageViewModel setNeutralButtonText(String neutralButtonText) {
|
|
||||||
this.neutralButtonText = neutralButtonText;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNegativeButtonText() {
|
|
||||||
return negativeButtonText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogSimpleMessageViewModel setNegativeButtonText(String negativeButtonText) {
|
|
||||||
this.negativeButtonText = negativeButtonText;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPositiveClick() {
|
|
||||||
mDialog.dismiss();
|
|
||||||
if(onPositive != null) onPositive.run();
|
|
||||||
}
|
|
||||||
public void onNeutralClick() {
|
|
||||||
mDialog.dismiss();
|
|
||||||
if(onNeutral != null) onNeutral.run();
|
|
||||||
}
|
|
||||||
public void onNegativeClick() {
|
|
||||||
mDialog.dismiss();
|
|
||||||
if(onNegative != null) onNegative.run();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.camera_barcode_reader;
|
package it.integry.integrywmsnative.view.dialogs.camera_barcode_reader;
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
@@ -53,7 +52,6 @@ public class DialogCameraBarcodeReader extends DialogFragment implements Barcode
|
|||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_camera_barcode_reader, container, false);
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_camera_barcode_reader, container, false);
|
||||||
|
|
||||||
UtilityDialog.setTo95PercentWidth(mContext, this);
|
|
||||||
|
|
||||||
getDialog().setCanceledOnTouchOutside(false);
|
getDialog().setCanceledOnTouchOutside(false);
|
||||||
getDialog().setCancelable(false);
|
getDialog().setCancelable(false);
|
||||||
@@ -68,6 +66,13 @@ public class DialogCameraBarcodeReader extends DialogFragment implements Barcode
|
|||||||
return mBindings.getRoot();
|
return mBindings.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
|
||||||
|
UtilityDialog.setTo95PercentWidth(mContext, this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class DialogInputQuantityV2DTO {
|
|||||||
private BigDecimal totalNumCnfAvailable;
|
private BigDecimal totalNumCnfAvailable;
|
||||||
private BigDecimal qtaCnfAvailable;
|
private BigDecimal qtaCnfAvailable;
|
||||||
|
|
||||||
private boolean canPartitaMagBeChanged;
|
private boolean canPartitaMagBeChanged = true;
|
||||||
private boolean canLUBeClosed;
|
private boolean canLUBeClosed;
|
||||||
|
|
||||||
private String partitaMag;
|
private String partitaMag;
|
||||||
|
|||||||
@@ -38,10 +38,11 @@ import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
|||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
||||||
import it.integry.integrywmsnative.databinding.DialogInputQuantityV2Binding;
|
import it.integry.integrywmsnative.databinding.DialogInputQuantityV2Binding;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
|
||||||
public class DialogInputQuantityV2View extends BaseDialogFragment implements DialogInputQuantityV2ViewModel.Listener {
|
public class DialogInputQuantityV2View extends BaseDialogFragment implements DialogInputQuantityV2ViewModel.Listener {
|
||||||
|
|
||||||
@@ -66,7 +67,7 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
public ObservableField<Boolean> enabledChangePartitaMag = new ObservableField<>(true);
|
public ObservableField<Boolean> enabledChangePartitaMag = new ObservableField<>(true);
|
||||||
public ObservableField<Boolean> enabledLUCloseButton = new ObservableField<>(true);
|
public ObservableField<Boolean> enabledLUCloseButton = new ObservableField<>(true);
|
||||||
|
|
||||||
public Context context;
|
private Context context;
|
||||||
|
|
||||||
private DialogInputQuantityV2Binding mBindings;
|
private DialogInputQuantityV2Binding mBindings;
|
||||||
private boolean mEnableDataCallback = true;
|
private boolean mEnableDataCallback = true;
|
||||||
@@ -99,6 +100,7 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
this.context = getActivity();
|
this.context = getActivity();
|
||||||
|
|
||||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_input_quantity_v2, container, false);
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_input_quantity_v2, container, false);
|
||||||
|
mBindings.setLifecycleOwner(this);
|
||||||
|
|
||||||
mBindings.toolbar.setTitle("Inserimento articolo");
|
mBindings.toolbar.setTitle("Inserimento articolo");
|
||||||
|
|
||||||
@@ -144,12 +146,11 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
|
|
||||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
|
|
||||||
this.openProgress();
|
this.openProgress();
|
||||||
|
|
||||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||||
BarcodeManager.enable();
|
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
|
BarcodeManager.enable();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -179,8 +180,10 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
super.onStart();
|
super.onStart();
|
||||||
this.init();
|
this.init();
|
||||||
|
|
||||||
|
int onNumCnfInputChanged = SettingsManager.iDB().getOnNumCnfInputChanged();
|
||||||
|
|
||||||
this.mViewModel.setListener(this);
|
this.mViewModel.setListener(this);
|
||||||
this.mViewModel.init();
|
this.mViewModel.init(onNumCnfInputChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
@@ -318,6 +321,7 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
this.mViewModel.setCanPartitaMagBeChanged(this.mDialogInputQuantityV2DTO.isCanPartitaMagBeChanged());
|
||||||
this.enabledChangePartitaMag.set(this.mDialogInputQuantityV2DTO.isCanPartitaMagBeChanged());
|
this.enabledChangePartitaMag.set(this.mDialogInputQuantityV2DTO.isCanPartitaMagBeChanged());
|
||||||
this.enabledLUCloseButton.set(this.mDialogInputQuantityV2DTO.isCanLUBeClosed());
|
this.enabledLUCloseButton.set(this.mDialogInputQuantityV2DTO.isCanLUBeClosed());
|
||||||
}
|
}
|
||||||
@@ -356,6 +360,8 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception ex) {
|
public void onError(Exception ex) {
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(this.context, new SpannableString(Html.fromHtml(ex.getMessage())), null, null).show();
|
DialogSimpleMessageView
|
||||||
|
.makeErrorDialog(new SpannableString(Html.fromHtml(ex.getMessage())), null, null)
|
||||||
|
.show(getActivity().getSupportFragmentManager(), "tag");;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.exception.Over
|
|||||||
|
|
||||||
public class DialogInputQuantityV2ViewModel {
|
public class DialogInputQuantityV2ViewModel {
|
||||||
|
|
||||||
|
private final int UPDATE_QTA_CNF = 1;
|
||||||
|
private final int UPDATE_QTA_TOT = 2;
|
||||||
|
|
||||||
public ObservableField<MtbAart> mtbAart = new ObservableField<>();
|
public ObservableField<MtbAart> mtbAart = new ObservableField<>();
|
||||||
|
|
||||||
public ObservableField<Boolean> blockedNumCnf = new ObservableField<>();
|
public ObservableField<Boolean> blockedNumCnf = new ObservableField<>();
|
||||||
@@ -59,6 +62,8 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
private Date internalDataScad;
|
private Date internalDataScad;
|
||||||
|
|
||||||
private boolean canOverflowOrderQuantity;
|
private boolean canOverflowOrderQuantity;
|
||||||
|
private boolean canPartitaMagBeChanged;
|
||||||
|
private int onNumCnfInputChanged;
|
||||||
|
|
||||||
private Listener mListener;
|
private Listener mListener;
|
||||||
|
|
||||||
@@ -69,7 +74,9 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init(int onNumCnfInputChanged) {
|
||||||
|
this.onNumCnfInputChanged = onNumCnfInputChanged;
|
||||||
|
|
||||||
if (this.initialNumCnf != null && this.initialQtaTot != null && this.initialQtaCnf != null) {
|
if (this.initialNumCnf != null && this.initialQtaTot != null && this.initialQtaCnf != null) {
|
||||||
this.internalNumCnf = this.initialNumCnf;
|
this.internalNumCnf = this.initialNumCnf;
|
||||||
this.internalQtaCnf = this.initialQtaCnf;
|
this.internalQtaCnf = this.initialQtaCnf;
|
||||||
@@ -124,6 +131,9 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
this.setNumCnf(BigDecimal.ONE);
|
this.setNumCnf(BigDecimal.ONE);
|
||||||
this.setQtaCnf(UtilityBigDecimal.divide(this.getQtaTot(), this.getNumCnf()));
|
this.setQtaCnf(UtilityBigDecimal.divide(this.getQtaTot(), this.getNumCnf()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.unlockNumCnf();
|
||||||
|
this.unlockQtaCnf();
|
||||||
}
|
}
|
||||||
|
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
@@ -135,18 +145,21 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(ean128Model.BatchLot)) {
|
if(canPartitaMagBeChanged) {
|
||||||
this.setPartitaMag(ean128Model.BatchLot);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
if (!UtilityString.isNullOrEmpty(ean128Model.BatchLot)) {
|
||||||
if (!UtilityString.isNullOrEmpty(ean128Model.BestBefore)) {
|
this.setPartitaMag(ean128Model.BatchLot);
|
||||||
this.setDataScad(UtilityDate.recognizeDate(ean128Model.BestBefore));
|
}
|
||||||
} else if (!UtilityString.isNullOrEmpty(ean128Model.Expiry)) {
|
|
||||||
this.setDataScad(UtilityDate.recognizeDate(ean128Model.Expiry));
|
try {
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.BestBefore)) {
|
||||||
|
this.setDataScad(UtilityDate.recognizeDate(ean128Model.BestBefore));
|
||||||
|
} else if (!UtilityString.isNullOrEmpty(ean128Model.Expiry)) {
|
||||||
|
this.setDataScad(UtilityDate.recognizeDate(ean128Model.Expiry));
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
this.mListener.onError(ex);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
|
||||||
this.mListener.onError(ex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ean128Model.Count != null && ean128Model.Count > 0) {
|
if (ean128Model.Count != null && ean128Model.Count > 0) {
|
||||||
@@ -160,6 +173,9 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
this.setNumCnf(BigDecimal.ONE);
|
this.setNumCnf(BigDecimal.ONE);
|
||||||
this.setQtaCnf(UtilityBigDecimal.divide(this.getQtaTot(), this.getNumCnf()));
|
this.setQtaCnf(UtilityBigDecimal.divide(this.getQtaTot(), this.getNumCnf()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.unlockNumCnf();
|
||||||
|
this.unlockQtaCnf();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mListener.onDataChanged();
|
this.mListener.onDataChanged();
|
||||||
@@ -262,6 +278,11 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DialogInputQuantityV2ViewModel setCanPartitaMagBeChanged(boolean canPartitaMagBeChanged) {
|
||||||
|
this.canPartitaMagBeChanged = canPartitaMagBeChanged;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public DialogInputQuantityV2ViewModel setPartitaMag(String internalPartitaMag) {
|
public DialogInputQuantityV2ViewModel setPartitaMag(String internalPartitaMag) {
|
||||||
this.internalPartitaMag = internalPartitaMag;
|
this.internalPartitaMag = internalPartitaMag;
|
||||||
return this;
|
return this;
|
||||||
@@ -289,10 +310,21 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
// return;
|
// return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
|
switch (onNumCnfInputChanged) {
|
||||||
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
|
case UPDATE_QTA_CNF:
|
||||||
else if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
|
if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
|
||||||
this.internalQtaCnf = UtilityBigDecimal.divide(newValue, internalQtaTot);
|
this.internalQtaCnf = UtilityBigDecimal.divide(internalQtaTot, newValue);
|
||||||
|
else if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
|
||||||
|
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UPDATE_QTA_TOT:if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
|
||||||
|
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
|
||||||
|
else if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
|
||||||
|
this.internalQtaCnf = UtilityBigDecimal.divide(internalQtaTot, newValue);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
this.mListener.onDataChanged();
|
this.mListener.onDataChanged();
|
||||||
}
|
}
|
||||||
@@ -336,6 +368,18 @@ public class DialogInputQuantityV2ViewModel {
|
|||||||
this.mListener.onDataChanged();
|
this.mListener.onDataChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void unlockNumCnf() {
|
||||||
|
this.blockedNumCnf.set(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unlockQtaCnf() {
|
||||||
|
this.blockedQtaCnf.set(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unlockQtaCol() {
|
||||||
|
this.blockedQtaTot.set(false);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean validate() {
|
public boolean validate() {
|
||||||
if (this.internalQtaCnf == null || UtilityBigDecimal.equalsTo(this.internalQtaCnf, BigDecimal.ZERO)) {
|
if (this.internalQtaCnf == null || UtilityBigDecimal.equalsTo(this.internalQtaCnf, BigDecimal.ZERO)) {
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.scan_art;
|
package it.integry.integrywmsnative.view.dialogs.scan_art;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
@@ -38,8 +37,6 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
|||||||
@Inject
|
@Inject
|
||||||
DialogScanArtViewModel mViewModel;
|
DialogScanArtViewModel mViewModel;
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
private DialogScanArtBinding mBindings;
|
private DialogScanArtBinding mBindings;
|
||||||
|
|
||||||
private int mBarcodeScannerIstanceID;
|
private int mBarcodeScannerIstanceID;
|
||||||
@@ -59,10 +56,10 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
this.mContext = getActivity();
|
|
||||||
this.initBarcode();
|
this.initBarcode();
|
||||||
|
|
||||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_scan_art, container, false);
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_scan_art, container, false);
|
||||||
|
mBindings.setLifecycleOwner(this);
|
||||||
|
|
||||||
MainApplication.appComponent
|
MainApplication.appComponent
|
||||||
.dialogScanArtComponent()
|
.dialogScanArtComponent()
|
||||||
@@ -96,7 +93,7 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
|||||||
private void initBarcode() {
|
private void initBarcode() {
|
||||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||||
.setOnScanSuccessfull(onScanSuccessfull)
|
.setOnScanSuccessfull(onScanSuccessfull)
|
||||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(this.mContext, ex, false)));
|
.setOnScanFailed(this::onError));
|
||||||
|
|
||||||
setBarcodeListener(true);
|
setBarcodeListener(true);
|
||||||
}
|
}
|
||||||
@@ -108,7 +105,7 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
|||||||
|
|
||||||
this.mViewModel.processBarcodeDTO(data, (status, mtbAart, ean128Model, mtbColrList) -> {
|
this.mViewModel.processBarcodeDTO(data, (status, mtbAart, ean128Model, mtbColrList) -> {
|
||||||
if(mtbColrList != null && mtbColrList.size() > 0) {
|
if(mtbColrList != null && mtbColrList.size() > 0) {
|
||||||
DialogChooseArtFromListaMtbColrView.make(mContext, mtbColrList, mtbColrChose -> {
|
DialogChooseArtFromListaMtbColrView.make(getActivity(), mtbColrList, mtbColrChose -> {
|
||||||
mOnItemChoosed.run(status, mtbAart, ean128Model, mtbColrChose);
|
mOnItemChoosed.run(status, mtbAart, ean128Model, mtbColrChose);
|
||||||
}).show();
|
}).show();
|
||||||
} else {
|
} else {
|
||||||
@@ -126,7 +123,7 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
|||||||
@Override
|
@Override
|
||||||
public void onError(Exception ex) {
|
public void onError(Exception ex) {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
UtilityExceptions.defaultException(mContext, ex);
|
UtilityExceptions.defaultException(getActivity(), ex);
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,302 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs.scan_or_create_lu;
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
|
||||||
|
|
||||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
|
||||||
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.expansion.RunnableArgs;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
|
||||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
|
||||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogScanOrCreateLuBinding;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLU;
|
|
||||||
|
|
||||||
public class DialogScanOrCreateLU {
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
private Dialog mDialog;
|
|
||||||
|
|
||||||
private DialogScanOrCreateLuBinding mBinding;
|
|
||||||
|
|
||||||
private RunnableArgss<MtbColt, Boolean> mOnDialogDismiss;
|
|
||||||
|
|
||||||
private MtbColt currentMtbColt;
|
|
||||||
|
|
||||||
|
|
||||||
private boolean mShouldCheckResiduo = false;
|
|
||||||
private boolean mShouldCheckIfExistDoc = true;
|
|
||||||
|
|
||||||
|
|
||||||
public static Dialog make(final Context context, RunnableArgss<MtbColt, Boolean> onDialogDismiss) {
|
|
||||||
return new DialogScanOrCreateLU(context, false, true, true, true, onDialogDismiss).mDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Dialog make(final Context context, boolean enableCreation, boolean shouldCheckIfExistDoc, RunnableArgss<MtbColt, Boolean> onDialogDismiss) {
|
|
||||||
return new DialogScanOrCreateLU(context, false, enableCreation, true, shouldCheckIfExistDoc, onDialogDismiss).mDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Dialog make(final Context context, boolean enableBasket, boolean enableCreation, boolean checkResiduo, boolean shouldCheckIfExistDoc, RunnableArgss<MtbColt, Boolean> onDialogDismiss) {
|
|
||||||
return new DialogScanOrCreateLU(context, enableBasket, enableCreation, checkResiduo, shouldCheckIfExistDoc, onDialogDismiss).mDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
private DialogScanOrCreateLU(Context context, boolean enableBasket, boolean enableCreation, boolean checkResiduo, boolean shouldCheckIfExistDoc, RunnableArgss<MtbColt, Boolean> onDialogDismiss) {
|
|
||||||
mOnDialogDismiss = null;
|
|
||||||
currentMtbColt = null;
|
|
||||||
mShouldCheckResiduo = checkResiduo;
|
|
||||||
mShouldCheckIfExistDoc = shouldCheckIfExistDoc;
|
|
||||||
|
|
||||||
mContext = context;
|
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
|
||||||
|
|
||||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_scan_or_create_lu, null, false);
|
|
||||||
|
|
||||||
mBinding.dialogScanOrCreateLuCreationLayout.setVisibility(enableCreation ? View.VISIBLE : View.GONE);
|
|
||||||
mBinding.dialogScanOrCreateLuBasketLayout.setVisibility(enableBasket ? View.VISIBLE : View.GONE);
|
|
||||||
|
|
||||||
mDialog = new Dialog(context);
|
|
||||||
mDialog.setContentView(mBinding.getRoot());
|
|
||||||
mDialog.setCanceledOnTouchOutside(false);
|
|
||||||
// mDialog.setCancelable(false);
|
|
||||||
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
|
|
||||||
init(onDialogDismiss);
|
|
||||||
initBarcode(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void init(RunnableArgss<MtbColt, Boolean> onDialogDismiss) {
|
|
||||||
mOnDialogDismiss = onDialogDismiss;
|
|
||||||
|
|
||||||
mBinding.createNewLuButton.setOnClickListener(v -> {
|
|
||||||
final Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumer.createColloLavorazione(+1, createdMtbColt -> {
|
|
||||||
sendMtbColt(createdMtbColt, progressDialog, true);
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
mBinding.viewBasket.setOnClickListener(v -> {
|
|
||||||
DialogBasketLU.make(mContext, mtbColt -> {
|
|
||||||
sendMtbColt(mtbColt, null, false);
|
|
||||||
}).show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initBarcode(Context context) {
|
|
||||||
|
|
||||||
int barcodeIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
|
||||||
.setOnScanSuccessfull(onScanSuccessfull)
|
|
||||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(context, ex, false)));
|
|
||||||
|
|
||||||
mDialog.setOnDismissListener(dialog -> {
|
|
||||||
BarcodeManager.removeCallback(barcodeIstanceID);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
if(currentMtbColt == null) {
|
|
||||||
mOnDialogDismiss.run(null, false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
|
||||||
BarcodeManager.disable();
|
|
||||||
|
|
||||||
final Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
|
||||||
|
|
||||||
if(UtilityBarcode.isEtichettaPosizione(data)){
|
|
||||||
this.executeEtichettaPosizione(data, progressDialog);
|
|
||||||
} else if(UtilityBarcode.isEtichettaAnonima(data)) {
|
|
||||||
this.executeEtichettaAnonima(data, progressDialog);
|
|
||||||
} else if(UtilityBarcode.isEtichetta128(data)) {
|
|
||||||
this.executeEAN128(data, progressDialog);
|
|
||||||
} else {
|
|
||||||
progressDialog.dismiss();
|
|
||||||
BarcodeManager.enable();
|
|
||||||
DialogCommon.showNoULFound(mContext, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
|
||||||
|
|
||||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
|
||||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
|
||||||
.single();
|
|
||||||
|
|
||||||
PosizioniRESTConsumer.getBancaliInPosizioneStatic(foundPosizione, mtbColtList -> {
|
|
||||||
|
|
||||||
if(mtbColtList == null || mtbColtList.size() == 0){
|
|
||||||
progressDialog.dismiss();
|
|
||||||
BarcodeManager.enable();
|
|
||||||
DialogCommon.showNoULFound(mContext, null);
|
|
||||||
} else if (mtbColtList.size() == 1) {
|
|
||||||
ColliMagazzinoRESTConsumer.getByTestataStatic(mtbColtList.get(0), mShouldCheckResiduo, false, mtbColt -> {
|
|
||||||
sendMtbColt(mtbColt, progressDialog, false);
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
progressDialog.dismiss();
|
|
||||||
BarcodeManager.enable();
|
|
||||||
showTooMuchULFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void executeEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
|
||||||
ColliMagazzinoRESTConsumer.getBySSCCStatic(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false, mtbColt -> {
|
|
||||||
|
|
||||||
if(mtbColt == null) {
|
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(barcodeScanDTO, GestioneEnum.LAVORAZIONE, createdMtbColt -> {
|
|
||||||
BarcodeManager.enable();
|
|
||||||
createdMtbColt.setDisablePrint(true);
|
|
||||||
sendMtbColt(createdMtbColt, progressDialog, true);
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if(mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
|
||||||
new SpannableString(mContext.getResources().getText(R.string.lu_already_attache_to_doc)),
|
|
||||||
null, () -> {
|
|
||||||
BarcodeManager.enable();
|
|
||||||
progressDialog.dismiss();
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
} else {
|
|
||||||
BarcodeManager.enable();
|
|
||||||
|
|
||||||
mtbColt.setDisablePrint(true);
|
|
||||||
sendMtbColt(mtbColt, progressDialog, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void executeEAN128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
|
||||||
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
|
|
||||||
|
|
||||||
if(ean128Model != null && !UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
|
||||||
|
|
||||||
ColliMagazzinoRESTConsumer.getBySSCCStatic(ean128Model.Sscc, mShouldCheckResiduo, false, mtbColt -> {
|
|
||||||
|
|
||||||
if(mtbColt != null) {
|
|
||||||
|
|
||||||
if(mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
|
||||||
new SpannableString(mContext.getResources().getText(R.string.lu_already_attache_to_doc)),
|
|
||||||
null, () -> {
|
|
||||||
BarcodeManager.enable();
|
|
||||||
progressDialog.dismiss();
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
} else {
|
|
||||||
if(mtbColt.getGestioneEnum() == GestioneEnum.VENDITA && mtbColt.getSegno() == -1) {
|
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
|
||||||
new SpannableString(mContext.getResources().getText(R.string.lu_gest_v_loading_alert)),
|
|
||||||
null, () -> {
|
|
||||||
BarcodeManager.enable();
|
|
||||||
sendMtbColt(mtbColt, progressDialog, false);
|
|
||||||
}, () -> {
|
|
||||||
BarcodeManager.enable();
|
|
||||||
progressDialog.dismiss();
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
BarcodeManager.enable();
|
|
||||||
sendMtbColt(mtbColt, progressDialog, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
BarcodeManager.enable();
|
|
||||||
progressDialog.dismiss();
|
|
||||||
DialogCommon.showNoULFound(mContext, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
|
|
||||||
} else {
|
|
||||||
BarcodeManager.enable();
|
|
||||||
progressDialog.dismiss();
|
|
||||||
|
|
||||||
DialogCommon.showNoULFound(mContext, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}, ex -> {
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
|
||||||
BarcodeManager.enable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void showTooMuchULFound() {
|
|
||||||
DialogSimpleMessageHelper.makeWarningDialog(mContext,
|
|
||||||
new SpannableString(mContext.getResources().getText(R.string.too_much_lu_found_message_in_mono_lu)),
|
|
||||||
null, null).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendMtbColt(MtbColt mtbColtToSend, Dialog progressDialog, boolean created) {
|
|
||||||
currentMtbColt = mtbColtToSend;
|
|
||||||
if(progressDialog != null) progressDialog.dismiss();
|
|
||||||
mDialog.dismiss();
|
|
||||||
mOnDialogDismiss.run(mtbColtToSend, created);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.scan_or_create_lu;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface DialogScanOrCreateLUComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
DialogScanOrCreateLUComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(DialogScanOrCreateLUView dialogScanOrCreateLUView);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.scan_or_create_lu;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||||
|
|
||||||
|
@Module(subcomponents = DialogScanOrCreateLUComponent.class)
|
||||||
|
public class DialogScanOrCreateLUModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
DialogScanOrCreateLUViewModel providesDialogScanOrCreateLUViewModel(PosizioniRESTConsumer posizioniRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||||
|
return new DialogScanOrCreateLUViewModel(posizioniRESTConsumer, barcodeRESTConsumer, colliMagazzinoRESTConsumer, articoloRESTConsumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.scan_or_create_lu;
|
||||||
|
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
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.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogScanOrCreateLuBinding;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.basket_lu.DialogBasketLU;
|
||||||
|
|
||||||
|
public class DialogScanOrCreateLUView extends BaseDialogFragment implements DialogScanOrCreateLUViewModel.Listener {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogScanOrCreateLUViewModel mViewModel;
|
||||||
|
|
||||||
|
private DialogScanOrCreateLuBinding mBindings;
|
||||||
|
private int mBarcodeScannerIstanceID;
|
||||||
|
|
||||||
|
private RunnableArgss<MtbColt, Boolean> mOnComplete;
|
||||||
|
private MtbColt openedMtbColt;
|
||||||
|
|
||||||
|
private boolean mShouldCheckResiduo;
|
||||||
|
private boolean mShouldCheckIfExistDoc;
|
||||||
|
private boolean mEnableCreation;
|
||||||
|
|
||||||
|
private final BindableBoolean basketEnabled = new BindableBoolean();
|
||||||
|
private final BindableBoolean creationEnabled = new BindableBoolean();
|
||||||
|
|
||||||
|
|
||||||
|
public static DialogScanOrCreateLUView newInstance(@NotNull RunnableArgss<MtbColt, Boolean> onComplete) {
|
||||||
|
return new DialogScanOrCreateLUView(false, true, true, true, onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DialogScanOrCreateLUView newInstance(boolean enableCreation, boolean shouldCheckIfExistDoc, @NotNull RunnableArgss<MtbColt, Boolean> onComplete) {
|
||||||
|
return new DialogScanOrCreateLUView(false, enableCreation, true, shouldCheckIfExistDoc, onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DialogScanOrCreateLUView newInstance(boolean enableBasket, boolean enableCreation, boolean checkResiduo, boolean shouldCheckIfExistDoc, @NotNull RunnableArgss<MtbColt, Boolean> onComplete) {
|
||||||
|
return new DialogScanOrCreateLUView(enableBasket, enableCreation, checkResiduo, shouldCheckIfExistDoc, onComplete);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogScanOrCreateLUView(boolean enableBasket, boolean enableCreation, boolean checkResiduo, boolean shouldCheckIfExistDoc, @NotNull RunnableArgss<MtbColt, Boolean> onComplete) {
|
||||||
|
super();
|
||||||
|
mShouldCheckResiduo = checkResiduo;
|
||||||
|
mShouldCheckIfExistDoc = shouldCheckIfExistDoc;
|
||||||
|
|
||||||
|
this.basketEnabled.set(enableBasket);
|
||||||
|
this.creationEnabled.set(enableCreation);
|
||||||
|
|
||||||
|
mEnableCreation = enableCreation;
|
||||||
|
mOnComplete = onComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
this.initBarcode();
|
||||||
|
|
||||||
|
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_scan_or_create_lu, container, false);
|
||||||
|
mBindings.setLifecycleOwner(this);
|
||||||
|
mBindings.setView(this);
|
||||||
|
|
||||||
|
MainApplication.appComponent
|
||||||
|
.dialogScanOrCreateLUComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
|
this.mViewModel
|
||||||
|
.setListener(this);
|
||||||
|
|
||||||
|
getDialog().setCanceledOnTouchOutside(false);
|
||||||
|
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
|
this.mViewModel.init(mShouldCheckResiduo, mShouldCheckIfExistDoc, mEnableCreation);
|
||||||
|
|
||||||
|
mBindings.createNewLuButton.setOnClickListener(v -> {
|
||||||
|
this.mViewModel.createNewLU();
|
||||||
|
});
|
||||||
|
|
||||||
|
mBindings.viewBasket.setOnClickListener(v -> {
|
||||||
|
DialogBasketLU.make(getActivity(), mtbColt -> {
|
||||||
|
onLUOpened(mtbColt, false);
|
||||||
|
}).show();
|
||||||
|
});
|
||||||
|
|
||||||
|
return mBindings.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
|
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||||
|
BarcodeManager.enable();
|
||||||
|
if(openedMtbColt == null) {
|
||||||
|
mOnComplete.run(null, false);
|
||||||
|
}
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initBarcode() {
|
||||||
|
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||||
|
.setOnScanSuccessfull(onScanSuccessfull)
|
||||||
|
.setOnScanFailed(this::onError));
|
||||||
|
|
||||||
|
setBarcodeListener(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||||
|
BarcodeManager.disable();
|
||||||
|
this.openProgress();
|
||||||
|
|
||||||
|
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||||
|
BarcodeManager.enable();
|
||||||
|
this.closeProgress();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
public BindableBoolean getBasketEnabled() {
|
||||||
|
return basketEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getCreationEnabled() {
|
||||||
|
return creationEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLUVenditaConfirmRequired(RunnableArgs<Boolean> onConfirm) {
|
||||||
|
DialogSimpleMessageView.makeWarningDialog(new SpannableString(getString(R.string.lu_gest_v_loading_alert)),
|
||||||
|
null, () -> {
|
||||||
|
onConfirm.run(true);
|
||||||
|
}, () -> {
|
||||||
|
onConfirm.run(false);
|
||||||
|
})
|
||||||
|
.show(((AppCompatActivity) getActivity()).getSupportFragmentManager(), "tag");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLUOpened(MtbColt mtbColt, boolean created) {
|
||||||
|
this.openedMtbColt = mtbColt;
|
||||||
|
mOnComplete.run(mtbColt, created);
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Exception ex) {
|
||||||
|
this.closeProgress();
|
||||||
|
UtilityExceptions.defaultException(getActivity(), ex);
|
||||||
|
BarcodeManager.enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadingStarted() {
|
||||||
|
this.openProgress();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadingEnded() {
|
||||||
|
this.closeProgress();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.scan_or_create_lu;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||||
|
import it.integry.integrywmsnative.core.exception.AlreadyAttachedDocumentToLUException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||||
|
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
|
||||||
|
public class DialogScanOrCreateLUViewModel {
|
||||||
|
|
||||||
|
|
||||||
|
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
||||||
|
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||||
|
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||||
|
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||||
|
|
||||||
|
private boolean mShouldCheckResiduo = false;
|
||||||
|
private boolean mShouldCheckIfExistDoc = true;
|
||||||
|
private boolean mEnableCreation = false;
|
||||||
|
|
||||||
|
private Listener mListener;
|
||||||
|
|
||||||
|
public DialogScanOrCreateLUViewModel(PosizioniRESTConsumer mPosizioniRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, ArticoloRESTConsumer articoloRESTConsumer) {
|
||||||
|
this.mPosizioniRESTConsumer = mPosizioniRESTConsumer;
|
||||||
|
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||||
|
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||||
|
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void init(boolean checkResiduo, boolean shouldCheckIfExistDoc, boolean enableCreation) {
|
||||||
|
this.mShouldCheckResiduo = checkResiduo;
|
||||||
|
this.mShouldCheckIfExistDoc = shouldCheckIfExistDoc;
|
||||||
|
this.mEnableCreation = enableCreation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createNewLU() {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
this.mColliMagazzinoRESTConsumer.createColloLavorazione(+1, createdMtbColt -> {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
this.sendOnLUOpened(createdMtbColt, true);
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
||||||
|
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
||||||
|
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||||
|
this.executeEtichettaAnonima(barcodeScanDTO, onComplete);
|
||||||
|
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||||
|
this.executeEAN128(barcodeScanDTO, onComplete);
|
||||||
|
} else {
|
||||||
|
onComplete.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
|
||||||
|
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||||
|
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||||
|
.single();
|
||||||
|
|
||||||
|
this.mPosizioniRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> {
|
||||||
|
|
||||||
|
if (mtbColtList == null || mtbColtList.size() == 0) {
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
} else if (mtbColtList.size() == 1) {
|
||||||
|
this.mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), mShouldCheckResiduo, false, mtbColt -> {
|
||||||
|
onComplete.run();
|
||||||
|
this.sendOnLUOpened(mtbColt, false);
|
||||||
|
}, this::sendError);
|
||||||
|
} else {
|
||||||
|
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||||
|
}
|
||||||
|
|
||||||
|
}, this::sendError);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void executeEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false, mtbColt -> {
|
||||||
|
|
||||||
|
if (mtbColt == null) {
|
||||||
|
if(mEnableCreation) {
|
||||||
|
this.mColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(barcodeScanDTO, GestioneEnum.LAVORAZIONE, createdMtbColt -> {
|
||||||
|
onComplete.run();
|
||||||
|
this.sendOnLUOpened(createdMtbColt, true);
|
||||||
|
}, this::sendError);
|
||||||
|
} else {
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||||
|
this.sendError(new AlreadyAttachedDocumentToLUException());
|
||||||
|
} else {
|
||||||
|
mtbColt.setDisablePrint(true);
|
||||||
|
onComplete.run();
|
||||||
|
this.sendOnLUOpened(mtbColt, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void executeEAN128(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||||
|
|
||||||
|
if (ean128Model != null && !UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||||
|
|
||||||
|
this.mColliMagazzinoRESTConsumer.getBySSCC(ean128Model.Sscc, mShouldCheckResiduo, false, mtbColt -> {
|
||||||
|
|
||||||
|
if (mtbColt != null) {
|
||||||
|
|
||||||
|
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
|
||||||
|
this.sendError(new AlreadyAttachedDocumentToLUException());
|
||||||
|
} else {
|
||||||
|
if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA && mtbColt.getSegno() == -1) {
|
||||||
|
this.sendOnLUVenditaConfirmRequired(confirmed -> {
|
||||||
|
if (confirmed) {
|
||||||
|
onComplete.run();
|
||||||
|
this.sendOnLUOpened(mtbColt, false);
|
||||||
|
} else {
|
||||||
|
onComplete.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
onComplete.run();
|
||||||
|
this.sendOnLUOpened(mtbColt, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
}
|
||||||
|
|
||||||
|
}, this::sendError);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.sendError(new NoLUFoundException());
|
||||||
|
}
|
||||||
|
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendOnLUVenditaConfirmRequired(RunnableArgs<Boolean> onConfirm) {
|
||||||
|
if (this.mListener != null) mListener.onLUVenditaConfirmRequired(onConfirm);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendOnLUOpened(MtbColt mtbColt, boolean created) {
|
||||||
|
if (this.mListener != null) mListener.onLUOpened(mtbColt, created);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListener(Listener listener) {
|
||||||
|
this.mListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Listener extends ILoadingListener {
|
||||||
|
|
||||||
|
void onLUVenditaConfirmRequired(RunnableArgs<Boolean> onConfirm);
|
||||||
|
|
||||||
|
void onLUOpened(MtbColt mtbColt, boolean created);
|
||||||
|
|
||||||
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -63,6 +63,64 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
|
<net.cachapa.expandablelayout.ExpandableLayout
|
||||||
|
android:id="@+id/filtered_arts_in_list_expandable_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:el_duration="400"
|
||||||
|
app:el_expanded="false">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingTop="12dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
android:paddingBottom="12dp">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_toStartOf="@+id/remove_art_filter_list"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/filtered_arts_in_list" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/description_filter_text"
|
||||||
|
style="@style/AppTheme.NewMaterial.Text.Medium"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:text="COD_ART_HERE" />
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/remove_art_filter_list"
|
||||||
|
style="@style/Button.DangerOutline"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:onClick="@{() -> pickingResiView.removeListFilter()}"
|
||||||
|
android:text="@string/remove_filter_button"
|
||||||
|
app:strokeColor="@color/red_600" />
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</net.cachapa.expandablelayout.ExpandableLayout>
|
||||||
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/main_list"
|
android:id="@+id/main_list"
|
||||||
|
|||||||
@@ -7,22 +7,21 @@
|
|||||||
<import type="android.view.View" />
|
<import type="android.view.View" />
|
||||||
|
|
||||||
<variable
|
<variable
|
||||||
name="viewmodel"
|
name="view"
|
||||||
type="it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageViewModel" />
|
type="it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView" />
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/base_root"
|
android:id="@+id/base_root"
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
app:cardCornerRadius="12dp"
|
app:cardCornerRadius="12dp"
|
||||||
app:cardElevation="0dp">
|
app:cardElevation="0dp">
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@@ -38,207 +37,193 @@
|
|||||||
android:id="@+id/title_icon"
|
android:id="@+id/title_icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/ic_error_white_24dp"
|
android:layout_margin="24dp"
|
||||||
android:layout_margin="24dp"/>
|
android:src="@drawable/ic_error_white_24dp" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:id="@+id/base_buttons_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
android:paddingStart="16dp"
|
||||||
android:paddingTop="24dp"
|
android:paddingTop="24dp"
|
||||||
android:paddingStart="8dp"
|
android:paddingEnd="16dp"
|
||||||
android:paddingEnd="8dp">
|
android:paddingBottom="16dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title_text"
|
||||||
<LinearLayout
|
style="@style/TextViewMaterial.DialogTitle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
tools:text="Title here" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/description_text"
|
||||||
|
style="@style/TextViewMaterial"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:gravity="left"
|
||||||
|
tools:text="Description here" />
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:id="@+id/dialog_content_hashmap"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingStart="16dp"
|
android:paddingLeft="12dp"
|
||||||
android:paddingEnd="16dp">
|
android:paddingRight="12dp">
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/title_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="@style/TextViewMaterial.DialogTitle"
|
|
||||||
tools:text="Title here"
|
|
||||||
android:gravity="center_horizontal"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/description_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="@style/TextViewMaterial"
|
|
||||||
tools:text="Description here"
|
|
||||||
android:gravity="left"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:layout_marginBottom="16dp" />
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
android:id="@+id/dialog_content_hashmap"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingLeft="12dp"
|
|
||||||
android:paddingRight="12dp"
|
|
||||||
android:layout_marginTop="12dp">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:visibility="@{viewmodel.negativeVisible && !viewmodel.neutralVisible ? View.VISIBLE : View.GONE}">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
|
||||||
android:id="@+id/center_guideline"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
app:layout_constraintGuide_percent="0.5"/>
|
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="@style/Button.PrimaryOutline"
|
|
||||||
android:layout_marginLeft="8dp"
|
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
|
||||||
app:strokeColor="@color/colorPrimary"
|
|
||||||
android:onClick="@{() -> viewmodel.onNegativeClick()}"
|
|
||||||
android:text="@{viewmodel.negativeButtonText}"/>
|
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="@style/Button.PrimaryFull"
|
|
||||||
android:layout_marginLeft="8dp"
|
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/center_guideline"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
android:onClick="@{() -> viewmodel.onPositiveClick()}"
|
|
||||||
android:text="@{viewmodel.positiveButtonText}"/>
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:visibility="@{!viewmodel.negativeVisible && !viewmodel.neutralVisible ? View.VISIBLE : View.GONE}">
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
|
||||||
android:id="@+id/ok_left_buttons_guideline"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
app:layout_constraintGuide_percent="0.25"/>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
|
||||||
android:id="@+id/ok_right_buttons_guideline"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
app:layout_constraintGuide_percent="0.75"/>
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="@style/Button.PrimaryFull"
|
|
||||||
android:layout_marginLeft="8dp"
|
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/ok_left_buttons_guideline"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/ok_right_buttons_guideline"
|
|
||||||
android:onClick="@{() -> viewmodel.onPositiveClick()}"
|
|
||||||
android:text="@{viewmodel.positiveButtonText}"/>
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:visibility="@{viewmodel.negativeVisible && viewmodel.neutralVisible ? View.VISIBLE : View.GONE}">
|
android:visibility="@{view.negativeVisible && !view.neutralVisible ? View.VISIBLE : View.GONE}">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Guideline
|
||||||
|
android:id="@+id/center_guideline"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintGuide_percent="0.5" />
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/Button.PrimaryOutline"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:onClick="@{() -> view.onNegativeClick()}"
|
||||||
|
android:text="@{view.negativeButtonText}"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:strokeColor="@color/colorPrimary" />
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/Button.PrimaryFull"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:onClick="@{() -> view.onPositiveClick()}"
|
||||||
|
android:text="@{view.positiveButtonText}"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/center_guideline"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:visibility="@{!view.negativeVisible && !view.neutralVisible ? View.VISIBLE : View.GONE}">
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Guideline
|
||||||
|
android:id="@+id/ok_left_buttons_guideline"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintGuide_percent="0.25" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Guideline
|
||||||
|
android:id="@+id/ok_right_buttons_guideline"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintGuide_percent="0.75" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/Button.PrimaryFull"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
|
||||||
|
android:onClick="@{() -> view.onPositiveClick()}"
|
||||||
|
android:text="@{view.positiveButtonText}"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/ok_right_buttons_guideline"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/ok_left_buttons_guideline"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:visibility="@{view.negativeVisible && view.neutralVisible ? View.VISIBLE : View.GONE}">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
<androidx.constraintlayout.widget.Guideline
|
||||||
android:id="@+id/left_buttons_guideline"
|
android:id="@+id/left_buttons_guideline"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintGuide_percent="0.33"/>
|
app:layout_constraintGuide_percent="0.33" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
<androidx.constraintlayout.widget.Guideline
|
||||||
android:id="@+id/right_buttons_guideline"
|
android:id="@+id/right_buttons_guideline"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintGuide_percent="0.66"/>
|
app:layout_constraintGuide_percent="0.66" />
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="@style/Button.DangerFull"
|
style="@style/Button.DangerFull"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:onClick="@{() -> view.onNegativeClick()}"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:text="@{view.negativeButtonText}"
|
||||||
app:layout_constraintEnd_toStartOf="@id/left_buttons_guideline"
|
app:layout_constraintEnd_toStartOf="@id/left_buttons_guideline"
|
||||||
android:onClick="@{() -> viewmodel.onNegativeClick()}"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:text="@{viewmodel.negativeButtonText}"/>
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="@style/Button.PrimaryOutline"
|
style="@style/Button.PrimaryOutline"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:onClick="@{() -> view.onNeutralClick()}"
|
||||||
app:layout_constraintStart_toStartOf="@id/left_buttons_guideline"
|
android:text="@{view.neutralButtonText}"
|
||||||
app:layout_constraintEnd_toStartOf="@id/right_buttons_guideline"
|
app:layout_constraintEnd_toStartOf="@id/right_buttons_guideline"
|
||||||
app:strokeColor="@color/colorPrimary"
|
app:layout_constraintStart_toStartOf="@id/left_buttons_guideline"
|
||||||
android:onClick="@{() -> viewmodel.onNeutralClick()}"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:text="@{viewmodel.neutralButtonText}"/>
|
app:strokeColor="@color/colorPrimary" />
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/Button.PrimaryFull"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="@style/Button.PrimaryFull"
|
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:onClick="@{() -> view.onPositiveClick()}"
|
||||||
app:layout_constraintStart_toStartOf="@id/right_buttons_guideline"
|
android:text="@{view.positiveButtonText}"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:onClick="@{() -> viewmodel.onPositiveClick()}"
|
app:layout_constraintStart_toStartOf="@id/right_buttons_guideline"
|
||||||
android:text="@{viewmodel.positiveButtonText}"/>
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -247,50 +232,49 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:visibility="@{!viewmodel.negativeVisible && viewmodel.neutralVisible ? View.VISIBLE : View.GONE}">
|
android:visibility="@{!view.negativeVisible && view.neutralVisible ? View.VISIBLE : View.GONE}">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
<androidx.constraintlayout.widget.Guideline
|
||||||
android:id="@+id/center_guideline2"
|
android:id="@+id/center_guideline2"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintGuide_percent="0.5"/>
|
app:layout_constraintGuide_percent="0.5" />
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
style="@style/Button.PrimaryOutline"
|
style="@style/Button.PrimaryOutline"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:onClick="@{() -> view.onNeutralClick()}"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:text="@{view.neutralButtonText}"
|
||||||
app:layout_constraintEnd_toStartOf="@id/center_guideline2"
|
app:layout_constraintEnd_toStartOf="@id/center_guideline2"
|
||||||
app:strokeColor="@color/colorPrimary"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:onClick="@{() -> viewmodel.onNeutralClick()}"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:text="@{viewmodel.neutralButtonText}"/>
|
app:strokeColor="@color/colorPrimary" />
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
|
style="@style/Button.PrimaryFull"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="@style/Button.PrimaryFull"
|
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
android:onClick="@{() -> view.onPositiveClick()}"
|
||||||
app:layout_constraintStart_toStartOf="@id/center_guideline2"
|
android:text="@{view.positiveButtonText}"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:onClick="@{() -> viewmodel.onPositiveClick()}"
|
app:layout_constraintStart_toStartOf="@id/center_guideline2"
|
||||||
android:text="@{viewmodel.positiveButtonText}"/>
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|||||||
@@ -2,6 +2,12 @@
|
|||||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
<variable
|
||||||
|
name="view"
|
||||||
|
type="it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUView" />
|
||||||
|
</data>
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/base_root"
|
android:id="@+id/base_root"
|
||||||
@@ -95,7 +101,8 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/dialog_scan_or_create_lu__creation_layout"
|
android:id="@+id/dialog_scan_or_create_lu__creation_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
app:visibility="@{view.creationEnabled}">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -138,7 +145,8 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/dialog_scan_or_create_lu__basket_layout"
|
android:id="@+id/dialog_scan_or_create_lu__basket_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
app:visibility="@{view.basketEnabled}">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,11 @@
|
|||||||
<data>
|
<data>
|
||||||
<variable
|
<variable
|
||||||
name="viewmodel"
|
name="viewmodel"
|
||||||
type="it.integry.integrywmsnative.gest.ultime_consegne_cliente.viewmodel.UltimeConsegneClienteViewModel" />
|
type="it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteViewModel" />
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="view"
|
||||||
|
type="it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteFragment" />
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
|
|
||||||
@@ -29,12 +33,12 @@
|
|||||||
android:scrollbars="none"
|
android:scrollbars="none"
|
||||||
android:paddingEnd="4dp"/>
|
android:paddingEnd="4dp"/>
|
||||||
|
|
||||||
<it.integry.integrywmsnative.ui.fastscroll.FastScroller
|
<!-- <it.integry.integrywmsnative.ui.fastscroll.FastScroller-->
|
||||||
android:id="@+id/fastscroll"
|
<!-- android:id="@+id/fastscroll"-->
|
||||||
android:orientation="vertical"
|
<!-- android:orientation="vertical"-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="match_parent"
|
<!-- android:layout_height="match_parent"-->
|
||||||
android:layout_alignParentEnd="true"/>
|
<!-- android:layout_alignParentEnd="true"/>-->
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/empty_view"
|
android:id="@+id/empty_view"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<variable
|
<variable
|
||||||
name="viewmodel"
|
name="viewmodel"
|
||||||
type="it.integry.integrywmsnative.gest.versamento_merce.viewmodel.VersamentoMerceViewModel" />
|
type="it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceViewModel" />
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
@@ -21,12 +21,12 @@
|
|||||||
android:background="@color/full_white">
|
android:background="@color/full_white">
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/gray_detail_background_round8"
|
android:background="@drawable/gray_detail_background_round8"
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
android:padding="16dp">
|
android:padding="16dp">
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
@@ -50,14 +50,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{viewmodel.mtbColt.getDataColloHumanLong()}"
|
android:text="@{viewmodel.currentMtbColt.getDataColloHumanLong()}"
|
||||||
tools:text="22 ottobre 2018"
|
tools:text="22 ottobre 2018"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
</LinearLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
@@ -72,14 +72,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{viewmodel.mtbColt.getPreparatoDa() != null ? viewmodel.mtbColt.getPreparatoDa() : `N/D`}"
|
android:text="@{viewmodel.currentMtbColt.getPreparatoDa() != null ? viewmodel.currentMtbColt.getPreparatoDa() : `N/D`}"
|
||||||
tools:text="Vito Falagario"
|
tools:text="Vito Falagario"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="italic" />
|
android:textStyle="italic" />
|
||||||
</LinearLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
@@ -95,14 +95,14 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{viewmodel.mtbColt.getPosizione() != null ? viewmodel.mtbColt.getPosizione() : `N/D`}"
|
android:text="@{viewmodel.currentMtbColt.getPosizione() != null ? viewmodel.currentMtbColt.getPosizione() : `N/D`}"
|
||||||
tools:text="A00F00C00L00"
|
tools:text="A00F00C00L00"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
</LinearLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{viewmodel.mtbColt.getCodMdep()}"
|
android:text="@{viewmodel.currentMtbColt.getCodMdep()}"
|
||||||
tools:text="10"
|
tools:text="10"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
@@ -132,13 +132,13 @@
|
|||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="bold" />-->
|
android:textStyle="bold" />-->
|
||||||
</LinearLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginEnd="16dp">
|
android:layout_marginEnd="16dp">
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
@@ -168,10 +168,10 @@
|
|||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:text="Scansiona il codice a barre di destinazione"/>
|
android:text="Scansiona il codice a barre di destinazione"/>
|
||||||
</LinearLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
</LinearLayout>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -4,6 +4,10 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
<data>
|
<data>
|
||||||
|
<variable
|
||||||
|
name="view"
|
||||||
|
type="it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreFragment" />
|
||||||
|
|
||||||
<variable
|
<variable
|
||||||
name="viewmodel"
|
name="viewmodel"
|
||||||
type="it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.core.UltimiArriviFornitoreViewModel" />
|
type="it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.core.UltimiArriviFornitoreViewModel" />
|
||||||
@@ -29,12 +33,12 @@
|
|||||||
android:scrollbars="none"
|
android:scrollbars="none"
|
||||||
android:paddingEnd="4dp"/>
|
android:paddingEnd="4dp"/>
|
||||||
|
|
||||||
<it.integry.integrywmsnative.ui.fastscroll.FastScroller
|
<!-- <it.integry.integrywmsnative.ui.fastscroll.FastScroller-->
|
||||||
android:id="@+id/fastscroll"
|
<!-- android:id="@+id/fastscroll"-->
|
||||||
android:orientation="vertical"
|
<!-- android:orientation="vertical"-->
|
||||||
android:layout_width="wrap_content"
|
<!-- android:layout_width="wrap_content"-->
|
||||||
android:layout_height="match_parent"
|
<!-- android:layout_height="match_parent"-->
|
||||||
android:layout_alignParentEnd="true"/>
|
<!-- android:layout_alignParentEnd="true"/>-->
|
||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ buildscript {
|
|||||||
google()
|
google()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
classpath 'com.android.tools.build:gradle:4.1.3'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath 'com.google.gms:google-services:4.3.5'
|
classpath 'com.google.gms:google-services:4.3.5'
|
||||||
classpath 'com.google.firebase:perf-plugin:1.3.5'
|
classpath 'com.google.firebase:perf-plugin:1.3.5'
|
||||||
|
|||||||
Reference in New Issue
Block a user