Compare commits
152 Commits
v1.32.15(3
...
v1.34.01(3
| Author | SHA1 | Date | |
|---|---|---|---|
| 8237466adf | |||
| 3c1471ee8d | |||
| 099d5fa54d | |||
| 8b04f3e696 | |||
| 04ef20c69a | |||
| d08ec43d29 | |||
| 64e5200912 | |||
| 9e79653769 | |||
| 1fee2c901a | |||
| 3713bb5e49 | |||
| fdeb98b82a | |||
| 3e68dd2d36 | |||
| 1a964d7a97 | |||
| 10f7ecd79b | |||
| 43df6fc9f5 | |||
| 9a60b1ff86 | |||
| 386d51ffd7 | |||
| d3804a4601 | |||
| 04720c1d97 | |||
| 0826aa0445 | |||
| 7ceb51a54b | |||
| e8351ca75b | |||
| f8ceb1fb2d | |||
| 4ef49f3523 | |||
| 21ed15a2ea | |||
| aacec1dfde | |||
| ac7e0443a6 | |||
| 4bbb0d5cbb | |||
| 05c28d62d8 | |||
| bf2ac81ab8 | |||
| 17a78ef044 | |||
| 3c78c2787a | |||
| c7358b536e | |||
| 4f9fe14f7e | |||
| 0934765176 | |||
| b7d3cb18b9 | |||
| 227c67dc23 | |||
| da3c9eae6e | |||
| bf37a1acaf | |||
| 2a8974e9c6 | |||
| c34d7dc777 | |||
| 461a2f705e | |||
| 705dd96a0e | |||
| 10128a1bae | |||
| 54d40ca06e | |||
| e4aa2d19d9 | |||
| 6251c0f1ac | |||
| 3caed63b7f | |||
| 75bc046cf5 | |||
| 97d27b047d | |||
| 44e00f4f98 | |||
| 81b053ee06 | |||
| f1b5a7ec1b | |||
| 2d4211d329 | |||
| c5ba78eeda | |||
| 1faaef7062 | |||
| 762c5fd5b5 | |||
| 9af5970ec7 | |||
| 3a5836ba4b | |||
| 72b0e29ae6 | |||
| e0cc802b62 | |||
| 2d4d9cef4e | |||
| 4a8a21b970 | |||
| 5103a53c11 | |||
| 11c4cba70c | |||
| b1dba20973 | |||
| 920c22083b | |||
| f9230ac341 | |||
| 6344c4b77d | |||
| d4c111dedc | |||
| 65dda1d5c0 | |||
| 4a7406fda1 | |||
| ef17e7a0c7 | |||
| c45850555e | |||
| 303690eed2 | |||
| ae62b26edf | |||
| 2e39754c20 | |||
| 0ae6bbcd96 | |||
| 529455931d | |||
| 46d0510ed8 | |||
| b02e12d76e | |||
| c6bbde2b67 | |||
| cfbb27a67b | |||
| 35283fc11b | |||
| c3d62f88b4 | |||
| fc8469bf07 | |||
| 400f1440db | |||
| ad12e7e65b | |||
| a63e3817b5 | |||
| cbd772bf7e | |||
| e90bd46a42 | |||
| 96bd5d516c | |||
| d9306e13c2 | |||
| fc80baeaee | |||
| c0b49b68f7 | |||
| 73242bc208 | |||
| d4b60a51bd | |||
| 1bc687c79a | |||
| 3a6b0949d4 | |||
| bfc03a4ef9 | |||
| 4dfa796790 | |||
| f0db805c84 | |||
| 0cc742e103 | |||
| d01319c417 | |||
| c0b9496041 | |||
| d4e7832f80 | |||
| cb4f9e68f5 | |||
| ac4a5b1d34 | |||
| 39ebc9d367 | |||
| 7ef0299282 | |||
| 6a998d6605 | |||
| 9eb4b0a621 | |||
| f55080f7ca | |||
| 7fb6109e18 | |||
| f419944699 | |||
| 8de54a504b | |||
| 6f2be2b459 | |||
| fa413aba25 | |||
| ab6eeb91a6 | |||
| 16cbe01157 | |||
| 16cb685bb3 | |||
| 28501c5509 | |||
| 79c4bdad48 | |||
| 68007ebc8e | |||
| c5eec26f8d | |||
| 5c3f8d8717 | |||
| 43aa0f0324 | |||
| 4ab7bf27d7 | |||
| 28f4ac4414 | |||
| 60414c949e | |||
| ff09147968 | |||
| 17e66af99a | |||
| 762ab2719d | |||
| 95f282cd4d | |||
| 029979c463 | |||
| e748161dda | |||
| c2c2a1f984 | |||
| fd13f2f1b4 | |||
| ac6cca1eda | |||
| dc46b36624 | |||
| 42aa655021 | |||
| b89085a9c3 | |||
| 557644f024 | |||
| 258ed9d7ca | |||
| be7d3775cc | |||
| 93ffb191b5 | |||
| 8eb58a4d64 | |||
| 4bc8374ea3 | |||
| f76295c3f6 | |||
| b8486b677f | |||
| 1ad2d9ca9b | |||
| 1c34b120db |
@@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
def appVersionCode = 355
|
def appVersionCode = 385
|
||||||
def appVersionName = '1.32.15'
|
def appVersionName = '1.34.01'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
@@ -31,8 +31,6 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileSdkVersion 33
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "it.integry.integrywmsnative"
|
applicationId "it.integry.integrywmsnative"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
@@ -65,8 +63,8 @@ android {
|
|||||||
android.buildFeatures.buildConfig true
|
android.buildFeatures.buildConfig true
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_11
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
targetCompatibility JavaVersion.VERSION_11
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
coreLibraryDesugaringEnabled true
|
coreLibraryDesugaringEnabled true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,8 +88,7 @@ android {
|
|||||||
abortOnError false
|
abortOnError false
|
||||||
}
|
}
|
||||||
namespace 'it.integry.integrywmsnative'
|
namespace 'it.integry.integrywmsnative'
|
||||||
|
compileSdk 33
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -67,8 +67,10 @@ import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamento
|
|||||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeModule;
|
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeModule;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditComponent;
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditComponent;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditModule;
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditModule;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.DialogEditArticoloComponent;
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.edit_articolo.DialogEditArticoloComponent;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.DialogEditArticoloModule;
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.edit_articolo.DialogEditArticoloModule;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.selectArtFromList.DialogSelectArtToOrderComponent;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.selectArtFromList.DialogSelectArtToOrderModule;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaComponent;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaComponent;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaModule;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaModule;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs.DialogScanGrigliaAcquistoComponent;
|
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.dialogs.DialogScanGrigliaAcquistoComponent;
|
||||||
@@ -174,7 +176,8 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
|||||||
BottomSheetMtbColrEditModalModule.class,
|
BottomSheetMtbColrEditModalModule.class,
|
||||||
DialogChooseArtsFromMtbAartListModule.class,
|
DialogChooseArtsFromMtbAartListModule.class,
|
||||||
MainSettingsModule.class,
|
MainSettingsModule.class,
|
||||||
DialogInfoSituazioneArticoloModule.class
|
DialogInfoSituazioneArticoloModule.class,
|
||||||
|
DialogSelectArtToOrderModule.class
|
||||||
})
|
})
|
||||||
public interface MainApplicationComponent {
|
public interface MainApplicationComponent {
|
||||||
|
|
||||||
@@ -258,8 +261,6 @@ public interface MainApplicationComponent {
|
|||||||
|
|
||||||
DialogSelectDocInfoComponent.Factory dialogSelectDocInfoNewViewComponent();
|
DialogSelectDocInfoComponent.Factory dialogSelectDocInfoNewViewComponent();
|
||||||
|
|
||||||
DialogSelectDocRowsComponent.Factory dialogSelectDocRowsComponent();
|
|
||||||
|
|
||||||
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
|
DocInterniEditFormComponent.Factory docInterniEditFormComponent();
|
||||||
|
|
||||||
InfoAggiuntiveLUDialogComponent.Factory infoAggiuntiveLUDialogComponent();
|
InfoAggiuntiveLUDialogComponent.Factory infoAggiuntiveLUDialogComponent();
|
||||||
@@ -294,6 +295,10 @@ public interface MainApplicationComponent {
|
|||||||
|
|
||||||
DialogInfoSituazioneArticoloComponent.Factory dialogInfoSituazioneArticoloComponent();
|
DialogInfoSituazioneArticoloComponent.Factory dialogInfoSituazioneArticoloComponent();
|
||||||
|
|
||||||
|
DialogSelectDocRowsComponent.Factory dialogSelectDocRowsNewComponent();
|
||||||
|
|
||||||
|
DialogSelectArtToOrderComponent.Factory dialogSelectArtToOrderNewComponent();
|
||||||
|
|
||||||
void inject(MainApplication mainApplication);
|
void inject(MainApplication mainApplication);
|
||||||
|
|
||||||
void inject(AppContext mainApplication);
|
void inject(AppContext mainApplication);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package it.integry.integrywmsnative;
|
|||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
|
||||||
|
|
||||||
import androidx.core.os.HandlerCompat;
|
import androidx.core.os.HandlerCompat;
|
||||||
|
|
||||||
@@ -72,7 +71,7 @@ public class MainApplicationModule {
|
|||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
public Handler providesMainThreadHandler() {
|
public Handler providesMainThreadHandler() {
|
||||||
return HandlerCompat.createAsync(Looper.getMainLooper());
|
return HandlerCompat.createAsync(mApplication.getApplicationContext().getMainLooper());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@@ -89,8 +88,8 @@ public class MainApplicationModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase) {
|
MainContext providesMainContextNew(MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer) {
|
||||||
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase);
|
return new MainContext(mApplication.getApplicationContext(), menuService, appDatabase, systemRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
|||||||
.setID(it.integry.integrywmsnative.R.id.nav_pv_doc_interni)
|
.setID(it.integry.integrywmsnative.R.id.nav_pv_doc_interni)
|
||||||
.setTitleText(it.integry.integrywmsnative.R.string.doc_interni)
|
.setTitleText(it.integry.integrywmsnative.R.string.doc_interni)
|
||||||
.setTitleIcon(R.drawable.ic_dashboard_contab_doc_interni)
|
.setTitleIcon(R.drawable.ic_dashboard_contab_doc_interni)
|
||||||
.setDrawerIcon(it.integry.integrywmsnative.R.drawable.ic_dashboard_contab_doc_interni)
|
.setDrawerIcon(R.drawable.ic_documents_outline)
|
||||||
.setFragmentFactory(DocInterniFragment::newInstance))
|
.setFragmentFactory(DocInterniFragment::newInstance))
|
||||||
|
|
||||||
// .addItem(new MenuItem()
|
// .addItem(new MenuItem()
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import android.text.SpannableString;
|
|||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.SpannedString;
|
import android.text.SpannedString;
|
||||||
|
|
||||||
|
import com.google.firebase.installations.FirebaseInstallations;
|
||||||
|
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@@ -13,6 +15,7 @@ import javax.inject.Singleton;
|
|||||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
import it.integry.integrywmsnative.core.data_store.db.AppDatabase;
|
||||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityThread;
|
import it.integry.integrywmsnative.core.utility.UtilityThread;
|
||||||
@@ -23,13 +26,15 @@ public class MainContext {
|
|||||||
private final Context applicationContext;
|
private final Context applicationContext;
|
||||||
private final MenuService menuService;
|
private final MenuService menuService;
|
||||||
private final AppDatabase appDatabase;
|
private final AppDatabase appDatabase;
|
||||||
|
private final SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
private Listener mListener;
|
private Listener mListener;
|
||||||
|
|
||||||
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase) {
|
public MainContext(Context applicationContext, MenuService menuService, AppDatabase appDatabase, SystemRESTConsumer systemRESTConsumer) {
|
||||||
this.applicationContext = applicationContext;
|
this.applicationContext = applicationContext;
|
||||||
this.menuService = menuService;
|
this.menuService = menuService;
|
||||||
this.appDatabase = appDatabase;
|
this.appDatabase = appDatabase;
|
||||||
|
this.systemRESTConsumer = systemRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
@@ -40,18 +45,40 @@ public class MainContext {
|
|||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.initDeviceId(() -> {
|
||||||
this.initDBData(() -> {
|
this.initDBData(() -> {
|
||||||
this.initMenu(() -> {
|
this.initMenu(() -> {
|
||||||
|
|
||||||
if (mListener != null) mListener.onContextInitialized();
|
if (mListener != null) mListener.onContextInitialized();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
this.initServerStatusChecker();
|
this.initServerStatusChecker();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initDeviceId(Runnable onComplete) {
|
||||||
|
if (SettingsManager.i().getUserSession().getDeviceId() != null) {
|
||||||
|
onComplete.run();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FirebaseInstallations.getInstance().getId().addOnCompleteListener(fid -> {
|
||||||
|
SettingsManager.i().getUserSession().setDeviceId(fid.getResult());
|
||||||
|
SettingsManager.update();
|
||||||
|
|
||||||
|
systemRESTConsumer.registerDevice(onComplete, ex -> {
|
||||||
|
if (mListener != null) mListener.onError(new SpannedString(ex.getMessage()));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void logout(Runnable onLoggedOut) {
|
public void logout(Runnable onLoggedOut) {
|
||||||
menuService.invalidateCache();
|
menuService.invalidateCache();
|
||||||
UtilityThread.executeParallel(() -> {
|
UtilityThread.executeParallel(() -> {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import it.integry.integrywmsnative.core.data_store.db.dao.InventarioRowDao;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||||
@@ -40,7 +41,7 @@ import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
|||||||
InventarioRoomDTO.class,
|
InventarioRoomDTO.class,
|
||||||
InventarioRowRoomDTO.class
|
InventarioRowRoomDTO.class
|
||||||
},
|
},
|
||||||
version = 15)
|
version = 17)
|
||||||
@TypeConverters({
|
@TypeConverters({
|
||||||
DateConverter.class,
|
DateConverter.class,
|
||||||
BigDecimalConverter.class,
|
BigDecimalConverter.class,
|
||||||
@@ -66,13 +67,18 @@ public abstract class AppDatabase extends RoomDatabase {
|
|||||||
.addMigrations(MIGRATION_10_11)
|
.addMigrations(MIGRATION_10_11)
|
||||||
.addMigrations(MIGRATION_11_12)
|
.addMigrations(MIGRATION_11_12)
|
||||||
.addMigrations(MIGRATION_12_13)
|
.addMigrations(MIGRATION_12_13)
|
||||||
.addMigrations(MIGRATION_13_14);
|
.addMigrations(MIGRATION_13_14)
|
||||||
|
.addMigrations(MIGRATION_14_15)
|
||||||
|
.addMigrations(MIGRATION_15_16)
|
||||||
|
.addMigrations(MIGRATION_16_17);
|
||||||
|
|
||||||
sInstance = builder.build();
|
sInstance = builder.build();
|
||||||
}
|
}
|
||||||
return sInstance;
|
return sInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract RawDao rawDao();
|
||||||
|
|
||||||
public abstract ArticoloGrigliaDao articoloGrigliaDao();
|
public abstract ArticoloGrigliaDao articoloGrigliaDao();
|
||||||
|
|
||||||
public abstract GrigliaDao grigliaDao();
|
public abstract GrigliaDao grigliaDao();
|
||||||
@@ -90,6 +96,7 @@ public abstract class AppDatabase extends RoomDatabase {
|
|||||||
public abstract InventarioRowDao inventarioRowDao();
|
public abstract InventarioRowDao inventarioRowDao();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static final Migration MIGRATION_10_11 = new Migration(10, 11) {
|
static final Migration MIGRATION_10_11 = new Migration(10, 11) {
|
||||||
@Override
|
@Override
|
||||||
public void migrate(SupportSQLiteDatabase database) {
|
public void migrate(SupportSQLiteDatabase database) {
|
||||||
@@ -154,4 +161,25 @@ public abstract class AppDatabase extends RoomDatabase {
|
|||||||
database.execSQL("CREATE UNIQUE INDEX IF NOT EXISTS index_articoli_ordine_id_ordine_cod_mart ON articoli_ordine (id_ordine, cod_mart);");
|
database.execSQL("CREATE UNIQUE INDEX IF NOT EXISTS index_articoli_ordine_id_ordine_cod_mart ON articoli_ordine (id_ordine, cod_mart);");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
static final Migration MIGRATION_15_16 = new Migration(15, 16) {
|
||||||
|
@Override
|
||||||
|
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
static final Migration MIGRATION_16_17 = new Migration(16, 17) {
|
||||||
|
@Override
|
||||||
|
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||||
|
database.execSQL("ALTER TABLE inventario_rows RENAME TO _inventario_rows_old;");
|
||||||
|
database.execSQL("DROP INDEX index_inventario_rows__id;");
|
||||||
|
database.execSQL("DROP INDEX index_inventario_rows_parent_id;");
|
||||||
|
|
||||||
|
database.execSQL("CREATE TABLE inventario_rows (_id INTEGER PRIMARY KEY AUTOINCREMENT, parent_id INTEGER, cod_mart TEXT, partita_mag TEXT, descrizione TEXT, qta REAL NOT NULL DEFAULT 0, num_cnf REAL NOT NULL DEFAULT 0, qta_cnf REAL NOT NULL DEFAULT 0, unt_mis TEXT NOT NULL DEFAULT '0', data_ora_inv INTEGER, scan_cod_barre TEXT, zona TEXT, remote_sync_date INTEGER, FOREIGN KEY(parent_id) REFERENCES inventari(_id) ON UPDATE NO ACTION ON DELETE CASCADE);");
|
||||||
|
|
||||||
|
database.execSQL("INSERT INTO inventario_rows SELECT * FROM _inventario_rows_old;");
|
||||||
|
|
||||||
|
database.execSQL("CREATE INDEX index_inventario_rows__id ON inventario_rows (_id);");
|
||||||
|
database.execSQL("CREATE INDEX index_inventario_rows_parent_id ON inventario_rows (parent_id)");
|
||||||
|
database.execSQL("DROP TABLE _inventario_rows_old;");
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import it.integry.integrywmsnative.core.data_store.db.dao.InventarioRowDao;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColrDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.MtbColtDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGrigliaRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
|
||||||
@@ -53,7 +54,11 @@ public class RoomModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
@Provides
|
||||||
|
RawDao providesRawDao(AppDatabase appDatabase) {
|
||||||
|
return appDatabase.rawDao();
|
||||||
|
}
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
@@ -104,12 +109,6 @@ public class RoomModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
InventarioRowMapper providesInventarioRowMapper() {
|
InventarioRowMapper providesInventarioRowMapper() {
|
||||||
@@ -123,62 +122,50 @@ public class RoomModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
@Provides
|
||||||
InventarioLocalDataSource providesInventarioLocalDataSource(ExecutorService executorService, InventarioDao inventarioDao) {
|
InventarioLocalDataSource providesInventarioLocalDataSource(ExecutorService executorService, InventarioDao inventarioDao) {
|
||||||
return new InventarioLocalDataSource(executorService, inventarioDao);
|
return new InventarioLocalDataSource(executorService, inventarioDao);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
@Provides
|
||||||
InventarioRowLocalDataSource providesInventarioRowLocalDataSource(ExecutorService executorService, InventarioRowDao inventarioRowDao) {
|
InventarioRowLocalDataSource providesInventarioRowLocalDataSource(ExecutorService executorService, InventarioRowDao inventarioRowDao) {
|
||||||
return new InventarioRowLocalDataSource(executorService, inventarioRowDao);
|
return new InventarioRowLocalDataSource(executorService, inventarioRowDao);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
@Provides
|
||||||
ArticoloGrigliaRepository providesArticoloGrigliaRepository(ExecutorService executorService, Handler handler, ArticoloGrigliaDao articoloGrigliaDao) {
|
ArticoloGrigliaRepository providesArticoloGrigliaRepository(ExecutorService executorService, Handler handler, ArticoloGrigliaDao articoloGrigliaDao) {
|
||||||
return new ArticoliGrigliaDataSource(executorService, handler, articoloGrigliaDao);
|
return new ArticoliGrigliaDataSource(executorService, handler, articoloGrigliaDao);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
@Provides
|
||||||
ArticoliOrdineRepository providesArticoliOrdineRepository(ExecutorService executorService, Handler handler, ArticoloOrdineDao articoloOrdineDao) {
|
ArticoliOrdineRepository providesArticoliOrdineRepository(ExecutorService executorService, Handler handler, ArticoloOrdineDao articoloOrdineDao) {
|
||||||
return new ArticoliOrdineDataSource(executorService, handler, articoloOrdineDao);
|
return new ArticoliOrdineDataSource(executorService, handler, articoloOrdineDao);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
@Provides
|
||||||
GrigliaRepository providesGrigliaRepository(ExecutorService executorService, Handler handler, GrigliaDao grigliaDao) {
|
GrigliaRepository providesGrigliaRepository(ExecutorService executorService, Handler handler, GrigliaDao grigliaDao) {
|
||||||
return new GrigliaDataSource(executorService, handler, grigliaDao);
|
return new GrigliaDataSource(executorService, handler, grigliaDao);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
@Provides
|
||||||
OrdineRepository providesOrdineRepository(ExecutorService executorService, Handler handler, OrdineDao ordineDao) {
|
OrdineRepository providesOrdineRepository(ExecutorService executorService, Handler handler, OrdineDao ordineDao) {
|
||||||
return new OrdineDataSource(executorService, handler, ordineDao);
|
return new OrdineDataSource(executorService, handler, ordineDao);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
@Provides
|
||||||
MtbColtRepository providesMtbColtRepository(ExecutorService executorService, Handler handler, MtbColtDao mtbColtDao) {
|
MtbColtRepository providesMtbColtRepository(ExecutorService executorService, Handler handler, MtbColtDao mtbColtDao) {
|
||||||
return new SqlMtbColtDataSource(executorService, handler, mtbColtDao);
|
return new SqlMtbColtDataSource(executorService, handler, mtbColtDao);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
@Provides
|
||||||
MtbColrDataSource providesMtbColrRepository(ExecutorService executorService, Handler handler, MtbColrDao mtbColrDao) {
|
MtbColrDataSource providesMtbColrRepository(ExecutorService executorService, Handler handler, MtbColrDao mtbColrDao) {
|
||||||
return new SqlMtbColrDataSource(executorService, handler, mtbColrDao);
|
return new SqlMtbColrDataSource(executorService, handler, mtbColrDao);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
@Provides
|
||||||
InventarioRepository providesInventarioRepository(ExecutorService executorService, Handler handler,
|
InventarioRepository providesInventarioRepository(ExecutorService executorService, Handler handler,
|
||||||
InventarioLocalDataSource inventarioLocalDataSource,
|
InventarioLocalDataSource inventarioLocalDataSource,
|
||||||
@@ -187,7 +174,6 @@ public class RoomModule {
|
|||||||
return new InventarioRepository(inventarioLocalDataSource, inventarioRESTConsumer, inventarioMapper, handler, executorService);
|
return new InventarioRepository(inventarioLocalDataSource, inventarioRESTConsumer, inventarioMapper, handler, executorService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
@Provides
|
||||||
InventarioRowRepository providesInventarioRowRepository(ExecutorService executorService, Handler handler,
|
InventarioRowRepository providesInventarioRowRepository(ExecutorService executorService, Handler handler,
|
||||||
InventarioRowLocalDataSource inventarioRowLocalDataSource,
|
InventarioRowLocalDataSource inventarioRowLocalDataSource,
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ public interface MtbColrDao {
|
|||||||
@Delete
|
@Delete
|
||||||
void delete(SqlMtbColr mtbColr);
|
void delete(SqlMtbColr mtbColr);
|
||||||
|
|
||||||
@Query("SELECT * from mtb_colr where id_collo = :idDocument")
|
@Query("SELECT * FROM mtb_colr WHERE id_collo = :idDocument ORDER BY id DESC")
|
||||||
List<SqlMtbColr> getDocumentRows(long idDocument);
|
List<SqlMtbColr> getDocumentRows(long idDocument);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package it.integry.integrywmsnative.core.data_store.db.dao;
|
package it.integry.integrywmsnative.core.data_store.db.dao;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.room.Dao;
|
import androidx.room.Dao;
|
||||||
import androidx.room.Delete;
|
import androidx.room.Delete;
|
||||||
import androidx.room.Insert;
|
import androidx.room.Insert;
|
||||||
@@ -33,7 +34,7 @@ public interface MtbColtDao {
|
|||||||
" AND ( mtb_colt.data_doc = :dataDoc OR (mtb_colt.data_doc is null and :dataDoc is null)) " +
|
" AND ( mtb_colt.data_doc = :dataDoc OR (mtb_colt.data_doc is null and :dataDoc is null)) " +
|
||||||
" AND ( mtb_colt.num_doc = :numDoc OR (mtb_colt.num_doc is null and :numDoc is null)) " +
|
" AND ( mtb_colt.num_doc = :numDoc OR (mtb_colt.num_doc is null and :numDoc is null)) " +
|
||||||
" and cod_dtip is null group by mtb_colt.id")
|
" and cod_dtip is null group by mtb_colt.id")
|
||||||
List<DocInternoWrapper> getLocalDocumentsByCodDtip(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc);
|
LiveData<List<DocInternoWrapper>> getLocalDocumentsByCodDtip(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc);
|
||||||
|
|
||||||
@Query("SELECT ifnull(MAX(num_collo),0) +1 as num_collo from mtb_colt")
|
@Query("SELECT ifnull(MAX(num_collo),0) +1 as num_collo from mtb_colt")
|
||||||
Integer getNextNumCollo();
|
Integer getNextNumCollo();
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package it.integry.integrywmsnative.core.data_store.db.dao;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.RawQuery;
|
||||||
|
import androidx.sqlite.db.SupportSQLiteQuery;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface RawDao {
|
||||||
|
|
||||||
|
@RawQuery
|
||||||
|
int vacuumDb(SupportSQLiteQuery supportSQLiteQuery);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -94,6 +94,9 @@ public class ArticoloOrdine {
|
|||||||
@Ignore
|
@Ignore
|
||||||
private int bgTint;
|
private int bgTint;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
private boolean invalid = false;
|
||||||
|
|
||||||
|
|
||||||
public Integer getArticoloOrdineId() {
|
public Integer getArticoloOrdineId() {
|
||||||
return articoloOrdineId;
|
return articoloOrdineId;
|
||||||
@@ -236,15 +239,15 @@ public class ArticoloOrdine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getQtaCnfPrevistaVendita() {
|
public BigDecimal getQtaCnfPrevistaVendita() {
|
||||||
return qtaPrevistaVendita.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaPrevistaVendita.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
return qtaPrevistaVendita == null || qtaPrevistaVendita.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaPrevistaVendita.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getQtaCnfProposta() {
|
public BigDecimal getQtaCnfProposta() {
|
||||||
return qtaProposta.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaProposta.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
return qtaProposta == null || qtaProposta.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : qtaProposta.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getQtaCnfGiacenza() {
|
public BigDecimal getQtaCnfGiacenza() {
|
||||||
return giacenza.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : giacenza.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
return giacenza == null || giacenza.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : giacenza.divide(BigDecimal.valueOf(qtaCnf), 0, RoundingMode.CEILING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNewNoPromo() {
|
public boolean isNewNoPromo() {
|
||||||
@@ -256,7 +259,7 @@ public class ArticoloOrdine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float getCnfDaRic() {
|
public float getCnfDaRic() {
|
||||||
return qtaCnf > 0.f ? merceDaRic * qtaCnf : 0;
|
return qtaCnf > 0.f ? merceDaRic / qtaCnf : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int checkQtaProposta() {
|
public int checkQtaProposta() {
|
||||||
@@ -300,4 +303,13 @@ public class ArticoloOrdine {
|
|||||||
this.ctMaxOrd = ctMaxOrd;
|
this.ctMaxOrd = ctMaxOrd;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInvalid() {
|
||||||
|
return invalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticoloOrdine setInvalid(boolean invalid) {
|
||||||
|
this.invalid = invalid;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ import it.integry.integrywmsnative.core.data_store.db.interfaces.EntityModelInte
|
|||||||
@ForeignKey(
|
@ForeignKey(
|
||||||
entity = InventarioRoomDTO.class,
|
entity = InventarioRoomDTO.class,
|
||||||
parentColumns = {BaseSyncDTO.Columns.ID},
|
parentColumns = {BaseSyncDTO.Columns.ID},
|
||||||
childColumns = {InventarioRowRoomDTO.Columns.PARENT_ID}
|
childColumns = {InventarioRowRoomDTO.Columns.PARENT_ID},
|
||||||
|
onDelete = ForeignKey.CASCADE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ public class Ordine {
|
|||||||
private boolean orderNewProducts = false;
|
private boolean orderNewProducts = false;
|
||||||
|
|
||||||
@ColumnInfo(name = "id_griglia")
|
@ColumnInfo(name = "id_griglia")
|
||||||
private int idGriglia;
|
@Nullable
|
||||||
|
private Integer idGriglia;
|
||||||
|
|
||||||
@ColumnInfo(name = "cod_alis")
|
@ColumnInfo(name = "cod_alis")
|
||||||
private String codAlis;
|
private String codAlis;
|
||||||
@@ -80,11 +81,11 @@ public class Ordine {
|
|||||||
this.annotazioni = annotazioni;
|
this.annotazioni = annotazioni;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIdGriglia() {
|
public Integer getIdGriglia() {
|
||||||
return idGriglia;
|
return idGriglia;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIdGriglia(int idGriglia) {
|
public void setIdGriglia(Integer idGriglia) {
|
||||||
this.idGriglia = idGriglia;
|
this.idGriglia = idGriglia;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.core.data_store.db.repository;
|
package it.integry.integrywmsnative.core.data_store.db.repository;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -17,7 +19,7 @@ public interface MtbColtRepository {
|
|||||||
|
|
||||||
void delete(SqlMtbColt mtbColt, Runnable onSuccess, RunnableArgs<Exception> onError);
|
void delete(SqlMtbColt mtbColt, Runnable onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
void getLocalDocumentsByCodDtip(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc, RunnableArgs<List<DocInternoWrapper>> onSuccess, RunnableArgs<Exception> onError);
|
LiveData<List<DocInternoWrapper>> getDocuments(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc);
|
||||||
|
|
||||||
void getNextNumCollo(RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
|
void getNextNumCollo(RunnableArgs<Integer> onSuccess, RunnableArgs<Exception> onError);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package it.integry.integrywmsnative.core.data_store.db.repository.datasource;
|
|||||||
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
@@ -50,10 +52,8 @@ public class SqlMtbColtDataSource extends BaseDataSource implements MtbColtRepos
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getLocalDocumentsByCodDtip(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc, RunnableArgs<List<DocInternoWrapper>> onSuccess, RunnableArgs<Exception> onError) {
|
public LiveData<List<DocInternoWrapper>> getDocuments(String codDtip, String codAnag, String codVdes, Date dataDoc, String numDoc) {
|
||||||
execute(() -> mMtbColtDao.getLocalDocumentsByCodDtip(codDtip, codAnag, codVdes, dataDoc, numDoc),
|
return mMtbColtDao.getLocalDocumentsByCodDtip(codDtip, codAnag, codVdes, dataDoc, numDoc);
|
||||||
onSuccess,
|
|
||||||
onError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -62,16 +62,19 @@ public class InventarioRepository extends _BaseRepository<MtbInvent, InventarioR
|
|||||||
try {
|
try {
|
||||||
var startRetrieve = new Date();
|
var startRetrieve = new Date();
|
||||||
var remoteData = remoteDataSource.makeSynchronousRetrieveRequest();
|
var remoteData = remoteDataSource.makeSynchronousRetrieveRequest();
|
||||||
Log.d("Timing [INVENTORIES RETRIEVE]", ((new Date().getTime() - startRetrieve.getTime()) / 1000) + " secs");
|
Log.d("Time INVENTORY RETRIEVE", ((new Date().getTime() - startRetrieve.getTime()) / 1000) + " secs");
|
||||||
|
|
||||||
if (remoteData == null) remoteData = new ArrayList<>();
|
if (remoteData == null) remoteData = new ArrayList<>();
|
||||||
|
|
||||||
resolveFetch(remoteData, internalLiveData.getValue(),
|
List<MtbInvent> finalRemoteData = remoteData;
|
||||||
|
|
||||||
|
resolveFetch(finalRemoteData, internalLiveData.getValue(),
|
||||||
(remoteItem, localItem) -> Objects.equals(remoteItem.getIdInventario(), localItem.getIdInventario()),
|
(remoteItem, localItem) -> Objects.equals(remoteItem.getIdInventario(), localItem.getIdInventario()),
|
||||||
(remoteItem, localItem) -> {
|
(remoteItem, localItem) -> {
|
||||||
remoteItem.setRemoteSyncDate(localItem.getRemoteSyncDate());
|
remoteItem.setRemoteSyncDate(localItem.getRemoteSyncDate());
|
||||||
remoteItem.setNew(false);
|
remoteItem.setNew(false);
|
||||||
}, onComplete, onError);
|
}, () -> handler.post(onComplete), ex -> handler.post(() -> onError.run(ex)));
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
onError.run(e);
|
onError.run(e);
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
package it.integry.integrywmsnative.core.di;
|
package it.integry.integrywmsnative.core.di;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
|
|
||||||
import androidx.databinding.BaseObservable;
|
import androidx.databinding.BaseObservable;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.CommonConst;
|
import it.integry.integrywmsnative.core.CommonConst;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||||
|
|
||||||
@@ -20,7 +19,7 @@ public class BindableFloat extends BaseObservable {
|
|||||||
|
|
||||||
if(numberOfDigits > CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS) numberOfDigits = CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS;
|
if(numberOfDigits > CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS) numberOfDigits = CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS;
|
||||||
|
|
||||||
return new BigDecimal(get());
|
return BigDecimal.valueOf(get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Float get(boolean defaultIfNull) {
|
public Float get(boolean defaultIfNull) {
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package it.integry.integrywmsnative.core.exception;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
|
public final class ExpiredProductListException extends Exception {
|
||||||
|
public ExpiredProductListException() {
|
||||||
|
super(UtilityResources.getString(R.string.expired_list_session));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package it.integry.integrywmsnative.core.exception;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
|
public class GridNotSelectedException extends Exception {
|
||||||
|
|
||||||
|
public GridNotSelectedException() {
|
||||||
|
super(UtilityResources.getString(R.string.grid_not_selected));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package it.integry.integrywmsnative.core.exception;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
|
public final class InvalidProductOrderedException extends Exception {
|
||||||
|
|
||||||
|
public InvalidProductOrderedException() {
|
||||||
|
super(UtilityResources.getString(R.string.invalid_product_ordered));
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidProductOrderedException(String product) {
|
||||||
|
super(UtilityResources.getString(R.string.invalid_product_ordered) + " (" + product + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package it.integry.integrywmsnative.core.exception;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
|
public final class MultipleResultFromBarcodeException extends Exception {
|
||||||
|
|
||||||
|
public MultipleResultFromBarcodeException() {
|
||||||
|
super(UtilityResources.getString(R.string.multiple_results_from_barcode));
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultipleResultFromBarcodeException(String barcode) {
|
||||||
|
super(UtilityResources.getString(R.string.multiple_results_from_barcode) + " (" + barcode + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package it.integry.integrywmsnative.core.exception;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||||
|
|
||||||
|
public final class NoResultFromCodMartException extends Exception {
|
||||||
|
|
||||||
|
public NoResultFromCodMartException() {
|
||||||
|
super(UtilityResources.getString(R.string.no_result_from_cod_mart));
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoResultFromCodMartException(String codMart) {
|
||||||
|
super(UtilityResources.getString(R.string.no_result_from_cod_mart) + " (" + codMart + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,7 +49,7 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void openProgress() {
|
private void openProgress() {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
if (!progressOpened && !this.mCurrentProgress.isAdded()) {
|
if (!progressOpened && !this.mCurrentProgress.isAdded() && !this.mCurrentProgress.isInLayout()) {
|
||||||
this.progressOpened = true;
|
this.progressOpened = true;
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
this.mCurrentProgress.show(getSupportFragmentManager(), "tag");
|
this.mCurrentProgress.show(getSupportFragmentManager(), "tag");
|
||||||
|
|||||||
@@ -27,6 +27,20 @@ public class BaseDialogFragment extends DialogFragment implements DialogInterfac
|
|||||||
|
|
||||||
private boolean mBarcodeListener = false;
|
private boolean mBarcodeListener = false;
|
||||||
|
|
||||||
|
private boolean cancelable = true;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelable() {
|
||||||
|
return cancelable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelable(boolean cancelable) {
|
||||||
|
super.setCancelable(cancelable);
|
||||||
|
this.cancelable = cancelable;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show(FragmentManager manager, String tag) {
|
public void show(FragmentManager manager, String tag) {
|
||||||
@@ -56,7 +70,7 @@ public class BaseDialogFragment extends DialogFragment implements DialogInterfac
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void openProgress() {
|
private void openProgress() {
|
||||||
if (!progressOpened && !this.mCurrentProgress.isAdded()) {
|
if (!progressOpened && !this.mCurrentProgress.isAdded() && !this.mCurrentProgress.isInLayout()) {
|
||||||
this.progressOpened = true;
|
this.progressOpened = true;
|
||||||
requireActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
|
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
|
|
||||||
private void openProgress() {
|
private void openProgress() {
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
if (!progressOpened && !this.mCurrentProgress.isAdded()) {
|
if (!progressOpened && !this.mCurrentProgress.isAdded() && !this.mCurrentProgress.isInLayout()) {
|
||||||
this.progressOpened = true;
|
this.progressOpened = true;
|
||||||
executorService.execute(() -> {
|
executorService.execute(() -> {
|
||||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
|
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
|
|||||||
@@ -865,4 +865,262 @@ public class MtbAart extends EntityBase {
|
|||||||
public MtbUntMis getFirstUntMis() {
|
public MtbUntMis getFirstUntMis() {
|
||||||
return getMtbUntMis() != null && !getMtbUntMis().isEmpty() ? getMtbUntMis().get(0) : null;
|
return getMtbUntMis() != null && !getMtbUntMis().isEmpty() ? getMtbUntMis().get(0) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
MtbAart mtbAart = (MtbAart) o;
|
||||||
|
|
||||||
|
if (!getCodMart().equals(mtbAart.getCodMart())) return false;
|
||||||
|
if (getDescrizione() != null ? !getDescrizione().equals(mtbAart.getDescrizione()) : mtbAart.getDescrizione() != null)
|
||||||
|
return false;
|
||||||
|
if (getUntMis() != null ? !getUntMis().equals(mtbAart.getUntMis()) : mtbAart.getUntMis() != null)
|
||||||
|
return false;
|
||||||
|
if (getBarCode() != null ? !getBarCode().equals(mtbAart.getBarCode()) : mtbAart.getBarCode() != null)
|
||||||
|
return false;
|
||||||
|
if (getPesoKg() != null ? !getPesoKg().equals(mtbAart.getPesoKg()) : mtbAart.getPesoKg() != null)
|
||||||
|
return false;
|
||||||
|
if (getQtaCnf() != null ? !getQtaCnf().equals(mtbAart.getQtaCnf()) : mtbAart.getQtaCnf() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodAliq() != null ? !getCodAliq().equals(mtbAart.getCodAliq()) : mtbAart.getCodAliq() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodScoArt() != null ? !getCodScoArt().equals(mtbAart.getCodScoArt()) : mtbAart.getCodScoArt() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodTcolUi() != null ? !getCodTcolUi().equals(mtbAart.getCodTcolUi()) : mtbAart.getCodTcolUi() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodTcolUl() != null ? !getCodTcolUl().equals(mtbAart.getCodTcolUl()) : mtbAart.getCodTcolUl() != null)
|
||||||
|
return false;
|
||||||
|
if (getArticoloComposto() != null ? !getArticoloComposto().equals(mtbAart.getArticoloComposto()) : mtbAart.getArticoloComposto() != null)
|
||||||
|
return false;
|
||||||
|
if (getEsposizioneComp() != null ? !getEsposizioneComp().equals(mtbAart.getEsposizioneComp()) : mtbAart.getEsposizioneComp() != null)
|
||||||
|
return false;
|
||||||
|
if (getDescrizioneEstesa() != null ? !getDescrizioneEstesa().equals(mtbAart.getDescrizioneEstesa()) : mtbAart.getDescrizioneEstesa() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodUltForn() != null ? !getCodUltForn().equals(mtbAart.getCodUltForn()) : mtbAart.getCodUltForn() != null)
|
||||||
|
return false;
|
||||||
|
if (getDataUltCar() != null ? !getDataUltCar().equals(mtbAart.getDataUltCar()) : mtbAart.getDataUltCar() != null)
|
||||||
|
return false;
|
||||||
|
if (getValUltCar() != null ? !getValUltCar().equals(mtbAart.getValUltCar()) : mtbAart.getValUltCar() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodUltClie() != null ? !getCodUltClie().equals(mtbAart.getCodUltClie()) : mtbAart.getCodUltClie() != null)
|
||||||
|
return false;
|
||||||
|
if (getDataUltScar() != null ? !getDataUltScar().equals(mtbAart.getDataUltScar()) : mtbAart.getDataUltScar() != null)
|
||||||
|
return false;
|
||||||
|
if (getValUltScar() != null ? !getValUltScar().equals(mtbAart.getValUltScar()) : mtbAart.getValUltScar() != null)
|
||||||
|
return false;
|
||||||
|
if (getTipoCodice() != null ? !getTipoCodice().equals(mtbAart.getTipoCodice()) : mtbAart.getTipoCodice() != null)
|
||||||
|
return false;
|
||||||
|
if (getNote() != null ? !getNote().equals(mtbAart.getNote()) : mtbAart.getNote() != null)
|
||||||
|
return false;
|
||||||
|
if (getPosizione() != null ? !getPosizione().equals(mtbAart.getPosizione()) : mtbAart.getPosizione() != null)
|
||||||
|
return false;
|
||||||
|
if (getColliPedana() != null ? !getColliPedana().equals(mtbAart.getColliPedana()) : mtbAart.getColliPedana() != null)
|
||||||
|
return false;
|
||||||
|
if (getUntMis2() != null ? !getUntMis2().equals(mtbAart.getUntMis2()) : mtbAart.getUntMis2() != null)
|
||||||
|
return false;
|
||||||
|
if (getRapConv2() != null ? !getRapConv2().equals(mtbAart.getRapConv2()) : mtbAart.getRapConv2() != null)
|
||||||
|
return false;
|
||||||
|
if (getFlagInclListino() != null ? !getFlagInclListino().equals(mtbAart.getFlagInclListino()) : mtbAart.getFlagInclListino() != null)
|
||||||
|
return false;
|
||||||
|
if (getUntMis3() != null ? !getUntMis3().equals(mtbAart.getUntMis3()) : mtbAart.getUntMis3() != null)
|
||||||
|
return false;
|
||||||
|
if (getRapConv3() != null ? !getRapConv3().equals(mtbAart.getRapConv3()) : mtbAart.getRapConv3() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodMartStat() != null ? !getCodMartStat().equals(mtbAart.getCodMartStat()) : mtbAart.getCodMartStat() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodMcon() != null ? !getCodMcon().equals(mtbAart.getCodMcon()) : mtbAart.getCodMcon() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodMgrp() != null ? !getCodMgrp().equals(mtbAart.getCodMgrp()) : mtbAart.getCodMgrp() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodMsfa() != null ? !getCodMsfa().equals(mtbAart.getCodMsfa()) : mtbAart.getCodMsfa() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodMsgr() != null ? !getCodMsgr().equals(mtbAart.getCodMsgr()) : mtbAart.getCodMsgr() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodMstp() != null ? !getCodMstp().equals(mtbAart.getCodMstp()) : mtbAart.getCodMstp() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodMtip() != null ? !getCodMtip().equals(mtbAart.getCodMtip()) : mtbAart.getCodMtip() != null)
|
||||||
|
return false;
|
||||||
|
if (getDescrizioneStat() != null ? !getDescrizioneStat().equals(mtbAart.getDescrizioneStat()) : mtbAart.getDescrizioneStat() != null)
|
||||||
|
return false;
|
||||||
|
if (getFlagStato() != null ? !getFlagStato().equals(mtbAart.getFlagStato()) : mtbAart.getFlagStato() != null)
|
||||||
|
return false;
|
||||||
|
if (getCambioDiviCar() != null ? !getCambioDiviCar().equals(mtbAart.getCambioDiviCar()) : mtbAart.getCambioDiviCar() != null)
|
||||||
|
return false;
|
||||||
|
if (getCambioDiviScar() != null ? !getCambioDiviScar().equals(mtbAart.getCambioDiviScar()) : mtbAart.getCambioDiviScar() != null)
|
||||||
|
return false;
|
||||||
|
if (getGgScadPartita() != null ? !getGgScadPartita().equals(mtbAart.getGgScadPartita()) : mtbAart.getGgScadPartita() != null)
|
||||||
|
return false;
|
||||||
|
if (getVolumeMc() != null ? !getVolumeMc().equals(mtbAart.getVolumeMc()) : mtbAart.getVolumeMc() != null)
|
||||||
|
return false;
|
||||||
|
if (getFlagEsponiPrz() != null ? !getFlagEsponiPrz().equals(mtbAart.getFlagEsponiPrz()) : mtbAart.getFlagEsponiPrz() != null)
|
||||||
|
return false;
|
||||||
|
if (getDataUltVar() != null ? !getDataUltVar().equals(mtbAart.getDataUltVar()) : mtbAart.getDataUltVar() != null)
|
||||||
|
return false;
|
||||||
|
if (getPercSfrido() != null ? !getPercSfrido().equals(mtbAart.getPercSfrido()) : mtbAart.getPercSfrido() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodBarreImb() != null ? !getCodBarreImb().equals(mtbAart.getCodBarreImb()) : mtbAart.getCodBarreImb() != null)
|
||||||
|
return false;
|
||||||
|
if (getFlagCalcPrz() != null ? !getFlagCalcPrz().equals(mtbAart.getFlagCalcPrz()) : mtbAart.getFlagCalcPrz() != null)
|
||||||
|
return false;
|
||||||
|
if (getEsposizioneCompAcq() != null ? !getEsposizioneCompAcq().equals(mtbAart.getEsposizioneCompAcq()) : mtbAart.getEsposizioneCompAcq() != null)
|
||||||
|
return false;
|
||||||
|
if (getFlagCalcPrzAcq() != null ? !getFlagCalcPrzAcq().equals(mtbAart.getFlagCalcPrzAcq()) : mtbAart.getFlagCalcPrzAcq() != null)
|
||||||
|
return false;
|
||||||
|
if (getDiacod() != null ? !getDiacod().equals(mtbAart.getDiacod()) : mtbAart.getDiacod() != null)
|
||||||
|
return false;
|
||||||
|
if (getPlu() != null ? !getPlu().equals(mtbAart.getPlu()) : mtbAart.getPlu() != null)
|
||||||
|
return false;
|
||||||
|
if (getPartIvaProd() != null ? !getPartIvaProd().equals(mtbAart.getPartIvaProd()) : mtbAart.getPartIvaProd() != null)
|
||||||
|
return false;
|
||||||
|
if (getRagSocProd() != null ? !getRagSocProd().equals(mtbAart.getRagSocProd()) : mtbAart.getRagSocProd() != null)
|
||||||
|
return false;
|
||||||
|
if (getFlagRapConvVariabile() != null ? !getFlagRapConvVariabile().equals(mtbAart.getFlagRapConvVariabile()) : mtbAart.getFlagRapConvVariabile() != null)
|
||||||
|
return false;
|
||||||
|
if (getFlagMovArtMag() != null ? !getFlagMovArtMag().equals(mtbAart.getFlagMovArtMag()) : mtbAart.getFlagMovArtMag() != null)
|
||||||
|
return false;
|
||||||
|
if (getFlagTracciabilita() != null ? !getFlagTracciabilita().equals(mtbAart.getFlagTracciabilita()) : mtbAart.getFlagTracciabilita() != null)
|
||||||
|
return false;
|
||||||
|
if (getTaraKg() != null ? !getTaraKg().equals(mtbAart.getTaraKg()) : mtbAart.getTaraKg() != null)
|
||||||
|
return false;
|
||||||
|
if (getColliStrato() != null ? !getColliStrato().equals(mtbAart.getColliStrato()) : mtbAart.getColliStrato() != null)
|
||||||
|
return false;
|
||||||
|
if (getFlagQtaCnfFissa() != null ? !getFlagQtaCnfFissa().equals(mtbAart.getFlagQtaCnfFissa()) : mtbAart.getFlagQtaCnfFissa() != null)
|
||||||
|
return false;
|
||||||
|
if (getFlagColliPedanaFisso() != null ? !getFlagColliPedanaFisso().equals(mtbAart.getFlagColliPedanaFisso()) : mtbAart.getFlagColliPedanaFisso() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodCconCosti() != null ? !getCodCconCosti().equals(mtbAart.getCodCconCosti()) : mtbAart.getCodCconCosti() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodCconRicavi() != null ? !getCodCconRicavi().equals(mtbAart.getCodCconRicavi()) : mtbAart.getCodCconRicavi() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodDgrpArt() != null ? !getCodDgrpArt().equals(mtbAart.getCodDgrpArt()) : mtbAart.getCodDgrpArt() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodDiviCar() != null ? !getCodDiviCar().equals(mtbAart.getCodDiviCar()) : mtbAart.getCodDiviCar() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodDiviScar() != null ? !getCodDiviScar().equals(mtbAart.getCodDiviScar()) : mtbAart.getCodDiviScar() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodEcrCat() != null ? !getCodEcrCat().equals(mtbAart.getCodEcrCat()) : mtbAart.getCodEcrCat() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodEcrMcat() != null ? !getCodEcrMcat().equals(mtbAart.getCodEcrMcat()) : mtbAart.getCodEcrMcat() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodEcrRep() != null ? !getCodEcrRep().equals(mtbAart.getCodEcrRep()) : mtbAart.getCodEcrRep() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodEcrStipo() != null ? !getCodEcrStipo().equals(mtbAart.getCodEcrStipo()) : mtbAart.getCodEcrStipo() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodEcrTipo() != null ? !getCodEcrTipo().equals(mtbAart.getCodEcrTipo()) : mtbAart.getCodEcrTipo() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodGrpBolla() != null ? !getCodGrpBolla().equals(mtbAart.getCodGrpBolla()) : mtbAart.getCodGrpBolla() != null)
|
||||||
|
return false;
|
||||||
|
if (getIngredienti() != null ? !getIngredienti().equals(mtbAart.getIngredienti()) : mtbAart.getIngredienti() != null)
|
||||||
|
return false;
|
||||||
|
if (getIdArtEqui() != null ? !getIdArtEqui().equals(mtbAart.getIdArtEqui()) : mtbAart.getIdArtEqui() != null)
|
||||||
|
return false;
|
||||||
|
if (getDescrCassa() != null ? !getDescrCassa().equals(mtbAart.getDescrCassa()) : mtbAart.getDescrCassa() != null)
|
||||||
|
return false;
|
||||||
|
if (getCodNcIntracee() != null ? !getCodNcIntracee().equals(mtbAart.getCodNcIntracee()) : mtbAart.getCodNcIntracee() != null)
|
||||||
|
return false;
|
||||||
|
if (getMarchio() != null ? !getMarchio().equals(mtbAart.getMarchio()) : mtbAart.getMarchio() != null)
|
||||||
|
return false;
|
||||||
|
if (getSezione() != null ? !getSezione().equals(mtbAart.getSezione()) : mtbAart.getSezione() != null)
|
||||||
|
return false;
|
||||||
|
if (getUntMisRifPeso() != mtbAart.getUntMisRifPeso()) return false;
|
||||||
|
if (getQtaEsistente() != null ? !getQtaEsistente().equals(mtbAart.getQtaEsistente()) : mtbAart.getQtaEsistente() != null)
|
||||||
|
return false;
|
||||||
|
if (getQtaImpegnata() != null ? !getQtaImpegnata().equals(mtbAart.getQtaImpegnata()) : mtbAart.getQtaImpegnata() != null)
|
||||||
|
return false;
|
||||||
|
if (getNumCnfEsistente() != null ? !getNumCnfEsistente().equals(mtbAart.getNumCnfEsistente()) : mtbAart.getNumCnfEsistente() != null)
|
||||||
|
return false;
|
||||||
|
if (getNumCnfImpegnata() != null ? !getNumCnfImpegnata().equals(mtbAart.getNumCnfImpegnata()) : mtbAart.getNumCnfImpegnata() != null)
|
||||||
|
return false;
|
||||||
|
return getMtbUntMis() != null ? getMtbUntMis().equals(mtbAart.getMtbUntMis()) : mtbAart.getMtbUntMis() == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = getCodMart().hashCode();
|
||||||
|
result = 31 * result + (getDescrizione() != null ? getDescrizione().hashCode() : 0);
|
||||||
|
result = 31 * result + (getUntMis() != null ? getUntMis().hashCode() : 0);
|
||||||
|
result = 31 * result + (getBarCode() != null ? getBarCode().hashCode() : 0);
|
||||||
|
result = 31 * result + (getPesoKg() != null ? getPesoKg().hashCode() : 0);
|
||||||
|
result = 31 * result + (getQtaCnf() != null ? getQtaCnf().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodAliq() != null ? getCodAliq().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodScoArt() != null ? getCodScoArt().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodTcolUi() != null ? getCodTcolUi().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodTcolUl() != null ? getCodTcolUl().hashCode() : 0);
|
||||||
|
result = 31 * result + (getArticoloComposto() != null ? getArticoloComposto().hashCode() : 0);
|
||||||
|
result = 31 * result + (getEsposizioneComp() != null ? getEsposizioneComp().hashCode() : 0);
|
||||||
|
result = 31 * result + (getDescrizioneEstesa() != null ? getDescrizioneEstesa().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodUltForn() != null ? getCodUltForn().hashCode() : 0);
|
||||||
|
result = 31 * result + (getDataUltCar() != null ? getDataUltCar().hashCode() : 0);
|
||||||
|
result = 31 * result + (getValUltCar() != null ? getValUltCar().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodUltClie() != null ? getCodUltClie().hashCode() : 0);
|
||||||
|
result = 31 * result + (getDataUltScar() != null ? getDataUltScar().hashCode() : 0);
|
||||||
|
result = 31 * result + (getValUltScar() != null ? getValUltScar().hashCode() : 0);
|
||||||
|
result = 31 * result + (getTipoCodice() != null ? getTipoCodice().hashCode() : 0);
|
||||||
|
result = 31 * result + (getNote() != null ? getNote().hashCode() : 0);
|
||||||
|
result = 31 * result + (getPosizione() != null ? getPosizione().hashCode() : 0);
|
||||||
|
result = 31 * result + (getColliPedana() != null ? getColliPedana().hashCode() : 0);
|
||||||
|
result = 31 * result + (getUntMis2() != null ? getUntMis2().hashCode() : 0);
|
||||||
|
result = 31 * result + (getRapConv2() != null ? getRapConv2().hashCode() : 0);
|
||||||
|
result = 31 * result + (getFlagInclListino() != null ? getFlagInclListino().hashCode() : 0);
|
||||||
|
result = 31 * result + (getUntMis3() != null ? getUntMis3().hashCode() : 0);
|
||||||
|
result = 31 * result + (getRapConv3() != null ? getRapConv3().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodMartStat() != null ? getCodMartStat().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodMcon() != null ? getCodMcon().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodMgrp() != null ? getCodMgrp().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodMsfa() != null ? getCodMsfa().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodMsgr() != null ? getCodMsgr().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodMstp() != null ? getCodMstp().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodMtip() != null ? getCodMtip().hashCode() : 0);
|
||||||
|
result = 31 * result + (getDescrizioneStat() != null ? getDescrizioneStat().hashCode() : 0);
|
||||||
|
result = 31 * result + (getFlagStato() != null ? getFlagStato().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCambioDiviCar() != null ? getCambioDiviCar().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCambioDiviScar() != null ? getCambioDiviScar().hashCode() : 0);
|
||||||
|
result = 31 * result + (getGgScadPartita() != null ? getGgScadPartita().hashCode() : 0);
|
||||||
|
result = 31 * result + (getVolumeMc() != null ? getVolumeMc().hashCode() : 0);
|
||||||
|
result = 31 * result + (getFlagEsponiPrz() != null ? getFlagEsponiPrz().hashCode() : 0);
|
||||||
|
result = 31 * result + (getDataUltVar() != null ? getDataUltVar().hashCode() : 0);
|
||||||
|
result = 31 * result + (getPercSfrido() != null ? getPercSfrido().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodBarreImb() != null ? getCodBarreImb().hashCode() : 0);
|
||||||
|
result = 31 * result + (getFlagCalcPrz() != null ? getFlagCalcPrz().hashCode() : 0);
|
||||||
|
result = 31 * result + (getEsposizioneCompAcq() != null ? getEsposizioneCompAcq().hashCode() : 0);
|
||||||
|
result = 31 * result + (getFlagCalcPrzAcq() != null ? getFlagCalcPrzAcq().hashCode() : 0);
|
||||||
|
result = 31 * result + (getDiacod() != null ? getDiacod().hashCode() : 0);
|
||||||
|
result = 31 * result + (getPlu() != null ? getPlu().hashCode() : 0);
|
||||||
|
result = 31 * result + (getPartIvaProd() != null ? getPartIvaProd().hashCode() : 0);
|
||||||
|
result = 31 * result + (getRagSocProd() != null ? getRagSocProd().hashCode() : 0);
|
||||||
|
result = 31 * result + (getFlagRapConvVariabile() != null ? getFlagRapConvVariabile().hashCode() : 0);
|
||||||
|
result = 31 * result + (getFlagMovArtMag() != null ? getFlagMovArtMag().hashCode() : 0);
|
||||||
|
result = 31 * result + (getFlagTracciabilita() != null ? getFlagTracciabilita().hashCode() : 0);
|
||||||
|
result = 31 * result + (getTaraKg() != null ? getTaraKg().hashCode() : 0);
|
||||||
|
result = 31 * result + (getColliStrato() != null ? getColliStrato().hashCode() : 0);
|
||||||
|
result = 31 * result + (getFlagQtaCnfFissa() != null ? getFlagQtaCnfFissa().hashCode() : 0);
|
||||||
|
result = 31 * result + (getFlagColliPedanaFisso() != null ? getFlagColliPedanaFisso().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodCconCosti() != null ? getCodCconCosti().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodCconRicavi() != null ? getCodCconRicavi().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodDgrpArt() != null ? getCodDgrpArt().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodDiviCar() != null ? getCodDiviCar().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodDiviScar() != null ? getCodDiviScar().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodEcrCat() != null ? getCodEcrCat().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodEcrMcat() != null ? getCodEcrMcat().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodEcrRep() != null ? getCodEcrRep().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodEcrStipo() != null ? getCodEcrStipo().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodEcrTipo() != null ? getCodEcrTipo().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodGrpBolla() != null ? getCodGrpBolla().hashCode() : 0);
|
||||||
|
result = 31 * result + (getIngredienti() != null ? getIngredienti().hashCode() : 0);
|
||||||
|
result = 31 * result + (getIdArtEqui() != null ? getIdArtEqui().hashCode() : 0);
|
||||||
|
result = 31 * result + (getDescrCassa() != null ? getDescrCassa().hashCode() : 0);
|
||||||
|
result = 31 * result + (getCodNcIntracee() != null ? getCodNcIntracee().hashCode() : 0);
|
||||||
|
result = 31 * result + (getMarchio() != null ? getMarchio().hashCode() : 0);
|
||||||
|
result = 31 * result + (getSezione() != null ? getSezione().hashCode() : 0);
|
||||||
|
result = 31 * result + (getUntMisRifPeso() != null ? getUntMisRifPeso().hashCode() : 0);
|
||||||
|
result = 31 * result + (getQtaEsistente() != null ? getQtaEsistente().hashCode() : 0);
|
||||||
|
result = 31 * result + (getQtaImpegnata() != null ? getQtaImpegnata().hashCode() : 0);
|
||||||
|
result = 31 * result + (getNumCnfEsistente() != null ? getNumCnfEsistente().hashCode() : 0);
|
||||||
|
result = 31 * result + (getNumCnfImpegnata() != null ? getNumCnfImpegnata().hashCode() : 0);
|
||||||
|
result = 31 * result + (getMtbUntMis() != null ? getMtbUntMis().hashCode() : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,28 +68,6 @@ public class MtbColt extends EntityBase {
|
|||||||
private Boolean disablePrint;
|
private Boolean disablePrint;
|
||||||
private String ragSocCliente;
|
private String ragSocCliente;
|
||||||
|
|
||||||
public void generaFiltroOrdine() throws Exception {
|
|
||||||
|
|
||||||
if (this.gestione == null) {
|
|
||||||
throw new Exception("Impossibile creare il filtro dell'ordine se la gestione non è valorizzata");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.dataOrd == null) {
|
|
||||||
throw new Exception("Impossibile creare il filtro dell'ordine se la data dell'ordine non è valorizzata");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.numOrd == null) {
|
|
||||||
throw new Exception("Impossibile creare il filtro dell'ordine se il numero dell'ordine non è valorizzato");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Date dateOrd = UtilityDate.recognizeDate(this.dataOrd);
|
|
||||||
String dateYMD = UtilityDate.formatDate(dateOrd, UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH);
|
|
||||||
|
|
||||||
this.filtroOrdini = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ROOT><FILTER><DTB_ORDT><GESTIONE type=\"V\">" + this.gestione + "</GESTIONE><DATA_ORD type=\"D\">" + dateYMD + "</DATA_ORD><NUM_ORD type=\"N\">" + this.numOrd + "</NUM_ORD></DTB_ORDT></FILTER></ROOT>";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private ObservableArrayList<MtbColr> mtbColr = new ObservableArrayList<>();
|
private ObservableArrayList<MtbColr> mtbColr = new ObservableArrayList<>();
|
||||||
|
|
||||||
public ObservableArrayList<MtbColr> getMtbColr() {
|
public ObservableArrayList<MtbColr> getMtbColr() {
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ public class MvwSitArtUdcDetInventario {
|
|||||||
private String codJfas;
|
private String codJfas;
|
||||||
private MtbAart mtbAart;
|
private MtbAart mtbAart;
|
||||||
|
|
||||||
|
|
||||||
public String getGestione() {
|
public String getGestione() {
|
||||||
return gestione;
|
return gestione;
|
||||||
}
|
}
|
||||||
@@ -283,7 +282,6 @@ public class MvwSitArtUdcDetInventario {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public MtbColr toMtbColr() {
|
public MtbColr toMtbColr() {
|
||||||
return new MtbColr()
|
return new MtbColr()
|
||||||
.setCodJcom(getCodJcom())
|
.setCodJcom(getCodJcom())
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public class HttpInterceptor implements Interceptor {
|
|||||||
final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB();
|
final String PROFILE_DB = SettingsManager.i().getUserSession() == null ? null : SettingsManager.i().getUserSession().getProfileDB();
|
||||||
final String USERNAME = SettingsManager.i().getUser().getUsername();
|
final String USERNAME = SettingsManager.i().getUser().getUsername();
|
||||||
final String PASSWORD = SettingsManager.i().getUser().getPassword();
|
final String PASSWORD = SettingsManager.i().getUser().getPassword();
|
||||||
|
final String DEVICE_ID = SettingsManager.i().getUserSession().getDeviceId();
|
||||||
|
|
||||||
final Request request = chain.request();
|
final Request request = chain.request();
|
||||||
final HttpUrl url = request.url().newBuilder()
|
final HttpUrl url = request.url().newBuilder()
|
||||||
@@ -36,6 +37,7 @@ public class HttpInterceptor implements Interceptor {
|
|||||||
.addHeader("Accept", "*/*")
|
.addHeader("Accept", "*/*")
|
||||||
.addHeader("username", USERNAME != null ? USERNAME : "")
|
.addHeader("username", USERNAME != null ? USERNAME : "")
|
||||||
.addHeader("password", PASSWORD != null ? PASSWORD : "")
|
.addHeader("password", PASSWORD != null ? PASSWORD : "")
|
||||||
|
.addHeader("device_id", DEVICE_ID != null ? DEVICE_ID : "")
|
||||||
.url(url).build();
|
.url(url).build();
|
||||||
|
|
||||||
return chain.proceed(newRequest);
|
return chain.proceed(newRequest);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class RESTBuilder {
|
|||||||
|
|
||||||
OkHttpClient client = clientBuilder.build();
|
OkHttpClient client = clientBuilder.build();
|
||||||
|
|
||||||
String endpoint = protocol + "://" + host + ":" + port + "/" + (addEmsApi ? "ems-api/" : "");
|
String endpoint = protocol + "://" + host + (port > 0 ? ":" + port : "") + "/" + (addEmsApi ? "ems-api/" : "");
|
||||||
|
|
||||||
|
|
||||||
Gson gson = new GsonBuilder()
|
Gson gson = new GsonBuilder()
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.google.gson.reflect.TypeToken;
|
|||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -14,6 +15,7 @@ import javax.inject.Singleton;
|
|||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbGrup;
|
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbUntMis;
|
||||||
import it.integry.integrywmsnative.core.model.dto.StatoArticoloDTO;
|
import it.integry.integrywmsnative.core.model.dto.StatoArticoloDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
@@ -58,6 +60,8 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
public static void getByCodMartsStatic(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
public static void getByCodMartsStatic(List<String> codMartToFind, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
String joinedCods = Stream.of(codMartToFind)
|
String joinedCods = Stream.of(codMartToFind)
|
||||||
|
.withoutNulls()
|
||||||
|
.distinct()
|
||||||
.collect(Collectors.joining(","));
|
.collect(Collectors.joining(","));
|
||||||
|
|
||||||
|
|
||||||
@@ -131,8 +135,55 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
Type typeOfObjectsList = new TypeToken<ArrayList<MtbGrup>>() {
|
Type typeOfObjectsList = new TypeToken<ArrayList<MtbGrup>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
|
|
||||||
this.systemRESTConsumer.processSql("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
this.systemRESTConsumer.processSql("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void getUntMisArts(List<String> inputUntMis, RunnableArgs<List<MtbUntMis>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
List<HashMap<String, Object>> whereCondList = Stream.of(inputUntMis)
|
||||||
|
.distinct()
|
||||||
|
.withoutNulls()
|
||||||
|
.map(x -> {
|
||||||
|
HashMap<String, Object> data = new HashMap<>();
|
||||||
|
data.put("unt_mis", x);
|
||||||
|
return data;
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
var whereCond = whereCondList.isEmpty() ? "" : " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondList);
|
||||||
|
|
||||||
|
Type typeOfObjectsList = new TypeToken<ArrayList<MtbUntMis>>() {
|
||||||
|
}.getType();
|
||||||
|
this.systemRESTConsumer.processSql("SELECT * FROM mtb_unt_mis " + whereCond, typeOfObjectsList, onComplete, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fillMtbAartsWithMtbUntMis(List<MtbAart> inputMtbAart, RunnableArgs<List<MtbAart>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
var inputUntMis = new ArrayList<String>();
|
||||||
|
|
||||||
|
if (inputMtbAart != null && !inputMtbAart.isEmpty()) {
|
||||||
|
inputUntMis.addAll(Stream.of(inputMtbAart)
|
||||||
|
.map(MtbAart::getUntMis)
|
||||||
|
.withoutNulls()
|
||||||
|
.distinct()
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inputUntMis.isEmpty()) {
|
||||||
|
onComplete.run(inputMtbAart);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getUntMisArts(inputUntMis, mtbUntMiss -> {
|
||||||
|
for (var item : inputMtbAart) {
|
||||||
|
var mtbUntMis = Stream.of(mtbUntMiss).filter(x -> x.getUntMis().equalsIgnoreCase(item.getUntMis()))
|
||||||
|
.findFirstOrElse(null);
|
||||||
|
|
||||||
|
if (mtbUntMis != null)
|
||||||
|
item.setMtbUntMis(Collections.singletonList(mtbUntMis));
|
||||||
|
}
|
||||||
|
|
||||||
|
onComplete.run(inputMtbAart);
|
||||||
|
}, onFailed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ public class DocumentRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void loadDocumentoAvailableArts(String codDtip, String codMgrp, RunnableArgs<RetrieveDocumentoArtsResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
public void loadDocumentAvailableArts(String codDtip, String codMgrp, String codAnagForn, RunnableArgs<RetrieveDocumentoArtsResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
var inventarioRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
|
var inventarioRESTConsumerService = RESTBuilder.getService(DocumentiRESTConsumerService.class);
|
||||||
inventarioRESTConsumerService.retrieveArts(codDtip, codMgrp)
|
inventarioRESTConsumerService.retrieveArts(codDtip, codMgrp, codAnagForn)
|
||||||
.enqueue(new Callback<>() {
|
.enqueue(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> response) {
|
public void onResponse(@NonNull Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> call, @NonNull Response<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> response) {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public interface DocumentiRESTConsumerService {
|
|||||||
@GET("wms/documento/arts")
|
@GET("wms/documento/arts")
|
||||||
Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> retrieveArts(
|
Call<ServiceRESTResponse<RetrieveDocumentoArtsResponseDTO>> retrieveArts(
|
||||||
@Query("codDtip") String codDtip,
|
@Query("codDtip") String codDtip,
|
||||||
@Query("codMgrp") String codMgrp);
|
@Query("codMgrp") String codMgrp,
|
||||||
|
@Query("codAnagForn") String codAnagForn);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
|||||||
import com.annimon.stream.Optional;
|
import com.annimon.stream.Optional;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@@ -13,6 +14,7 @@ import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
|||||||
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
||||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationIncomingItemDto;
|
||||||
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationResponseDto;
|
import it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationResponseDto;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
@@ -120,7 +122,10 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.enqueue(new Callback<>() {
|
.enqueue(new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, Response<ServiceRESTResponse<InstantItemSituationResponseDto>> response) {
|
public void onResponse(Call<ServiceRESTResponse<InstantItemSituationResponseDto>> call, Response<ServiceRESTResponse<InstantItemSituationResponseDto>> response) {
|
||||||
analyzeAnswer(response, "getInstantItemSituation", onComplete, onFailed);
|
analyzeAnswer(response, "getInstantItemSituation", data -> {
|
||||||
|
|
||||||
|
fillInstantItemSituationWithMtbAarts(data, onComplete, onFailed);
|
||||||
|
}, onFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -130,5 +135,54 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fillInstantItemSituationWithMtbAarts(InstantItemSituationResponseDto data, RunnableArgs<InstantItemSituationResponseDto> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
var inputCodMarts = new ArrayList<String>();
|
||||||
|
|
||||||
|
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
||||||
|
inputCodMarts.addAll(Stream.of(data.getIncomingItems())
|
||||||
|
.map(InstantItemSituationIncomingItemDto::getCodMart)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.getAvailableItems() != null && !data.getAvailableItems().isEmpty()) {
|
||||||
|
inputCodMarts.addAll(Stream.of(data.getAvailableItems())
|
||||||
|
.map(MvwSitArtUdcDetInventario::getCodMart)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inputCodMarts.isEmpty()) {
|
||||||
|
onComplete.run(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mArticoloRESTConsumer.getByCodMarts(inputCodMarts, mtbAarts -> {
|
||||||
|
|
||||||
|
mArticoloRESTConsumer.fillMtbAartsWithMtbUntMis(mtbAarts, newMtbAarts -> {
|
||||||
|
if (data.getIncomingItems() != null && !data.getIncomingItems().isEmpty()) {
|
||||||
|
for (var item : data.getIncomingItems()) {
|
||||||
|
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
||||||
|
.findFirstOrElse(null);
|
||||||
|
|
||||||
|
if (mtbAart != null)
|
||||||
|
item.setMtbAart(mtbAart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.getAvailableItems() != null && !data.getAvailableItems().isEmpty()) {
|
||||||
|
for (var item : data.getAvailableItems()) {
|
||||||
|
var mtbAart = Stream.of(newMtbAarts).filter(x -> x.getCodMart().equalsIgnoreCase(item.getCodMart()))
|
||||||
|
.findFirstOrElse(null);
|
||||||
|
|
||||||
|
if (mtbAart != null)
|
||||||
|
item.setMtbAart(mtbAart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onComplete.run(data);
|
||||||
|
}, onFailed);
|
||||||
|
|
||||||
|
}, onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,10 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
|||||||
.filter(x -> !UtilityString.isNullOrEmpty(x.getPartitaMag()))
|
.filter(x -> !UtilityString.isNullOrEmpty(x.getPartitaMag()))
|
||||||
.forEach(x -> {
|
.forEach(x -> {
|
||||||
|
|
||||||
if (!Stream.of(batchLotsToSearch).anyMatch(batchLotToSearch -> batchLotToSearch.getCodMart().equalsIgnoreCase(x.getCodMart()) && batchLotToSearch.getPartitaMag().equalsIgnoreCase(x.getPartitaMag()))) {
|
if (!Stream.of(batchLotsToSearch)
|
||||||
|
.anyMatch(batchLotToSearch ->
|
||||||
|
batchLotToSearch.getCodMart().equalsIgnoreCase(x.getCodMart()) &&
|
||||||
|
batchLotToSearch.getPartitaMag().equalsIgnoreCase(x.getPartitaMag()))) {
|
||||||
MtbPartitaMag mtbPartitaMag = new MtbPartitaMag()
|
MtbPartitaMag mtbPartitaMag = new MtbPartitaMag()
|
||||||
.setCodMart(x.getCodMart())
|
.setCodMart(x.getCodMart())
|
||||||
.setPartitaMag(x.getPartitaMag());
|
.setPartitaMag(x.getPartitaMag());
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.system.RegisterDeviceRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
@@ -39,6 +40,27 @@ import retrofit2.Response;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class SystemRESTConsumer extends _BaseRESTConsumer {
|
public class SystemRESTConsumer extends _BaseRESTConsumer {
|
||||||
|
|
||||||
|
|
||||||
|
public void registerDevice(final Runnable onSuccess, final RunnableArgs<Exception> onFailed) {
|
||||||
|
RegisterDeviceRequestDTO registerDeviceRequestDTO = new RegisterDeviceRequestDTO()
|
||||||
|
.setApp("WMS");
|
||||||
|
|
||||||
|
SystemRESTConsumerService systemRESTConsumerService = RESTBuilder.getService(SystemRESTConsumerService.class);
|
||||||
|
systemRESTConsumerService.registerDevice(registerDeviceRequestDTO)
|
||||||
|
.enqueue(new Callback<>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||||
|
analyzeAnswer(response, "device/register", Void -> onSuccess.run(), onFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||||
|
onFailed.run(new Exception(t));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public <T> void processSql(String nativeSql, final Type clazz, final RunnableArgs<T> onComplete, final RunnableArgs<Exception> onFailed) {
|
public <T> void processSql(String nativeSql, final Type clazz, final RunnableArgs<T> onComplete, final RunnableArgs<Exception> onFailed) {
|
||||||
NativeSqlRequestDTO nativeSqlDTO = new NativeSqlRequestDTO();
|
NativeSqlRequestDTO nativeSqlDTO = new NativeSqlRequestDTO();
|
||||||
nativeSqlDTO.nativeSql = nativeSql;
|
nativeSqlDTO.nativeSql = nativeSql;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.MailRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
import it.integry.integrywmsnative.core.rest.model.NativeSqlRequestDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||||
|
import it.integry.integrywmsnative.core.rest.model.system.RegisterDeviceRequestDTO;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.Body;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
@@ -14,6 +15,9 @@ import retrofit2.http.Query;
|
|||||||
|
|
||||||
public interface SystemRESTConsumerService {
|
public interface SystemRESTConsumerService {
|
||||||
|
|
||||||
|
@POST("device/register")
|
||||||
|
Call<ServiceRESTResponse<Void>> registerDevice(@Body RegisterDeviceRequestDTO registerDeviceRequestDTO);
|
||||||
|
|
||||||
@POST("processSql")
|
@POST("processSql")
|
||||||
Call<ServiceRESTResponse<Object>> processSql(@Body NativeSqlRequestDTO nativeSqlDTO);
|
Call<ServiceRESTResponse<Object>> processSql(@Body NativeSqlRequestDTO nativeSqlDTO);
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class SitArtOrdDTO {
|
|||||||
private String descrizioneMsfa;
|
private String descrizioneMsfa;
|
||||||
private String untord;
|
private String untord;
|
||||||
private BigDecimal qtaOmg;
|
private BigDecimal qtaOmg;
|
||||||
|
private BigDecimal qtaArrivo;
|
||||||
|
|
||||||
private final HashMap<String, Object> extraInfo = new HashMap<>();
|
private final HashMap<String, Object> extraInfo = new HashMap<>();
|
||||||
|
|
||||||
@@ -232,4 +233,13 @@ public class SitArtOrdDTO {
|
|||||||
this.qtaOmg = qtaOmg;
|
this.qtaOmg = qtaOmg;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaArrivo() {
|
||||||
|
return qtaArrivo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SitArtOrdDTO setQtaArrivo(BigDecimal qtaArrivo) {
|
||||||
|
this.qtaArrivo = qtaArrivo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package it.integry.integrywmsnative.core.rest.model.giacenza;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
|
|
||||||
public class InstantItemSituationIncomingItemDto {
|
public class InstantItemSituationIncomingItemDto {
|
||||||
|
|
||||||
private BigDecimal qtaOrd;
|
private BigDecimal qtaOrd;
|
||||||
@@ -21,6 +23,7 @@ public class InstantItemSituationIncomingItemDto {
|
|||||||
private String codJcom;
|
private String codJcom;
|
||||||
private String codMdep;
|
private String codMdep;
|
||||||
private String untMis;
|
private String untMis;
|
||||||
|
private MtbAart mtbAart;
|
||||||
|
|
||||||
public BigDecimal getQtaOrd() {
|
public BigDecimal getQtaOrd() {
|
||||||
return qtaOrd;
|
return qtaOrd;
|
||||||
@@ -85,4 +88,13 @@ public class InstantItemSituationIncomingItemDto {
|
|||||||
public String getUntMis() {
|
public String getUntMis() {
|
||||||
return untMis;
|
return untMis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MtbAart getMtbAart() {
|
||||||
|
return mtbAart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InstantItemSituationIncomingItemDto setMtbAart(MtbAart mtbAart) {
|
||||||
|
this.mtbAart = mtbAart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package it.integry.integrywmsnative.core.rest.model.system;
|
||||||
|
|
||||||
|
public class RegisterDeviceRequestDTO {
|
||||||
|
|
||||||
|
private String app;
|
||||||
|
|
||||||
|
public String getApp() {
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegisterDeviceRequestDTO setApp(String app) {
|
||||||
|
this.app = app;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,10 +38,13 @@ public class DBSettingsModel {
|
|||||||
private boolean flagSpedizioneUseQtaOrd;
|
private boolean flagSpedizioneUseQtaOrd;
|
||||||
private boolean flagOrdinaNuoviArticoliInGriglia;
|
private boolean flagOrdinaNuoviArticoliInGriglia;
|
||||||
private boolean flagOrdinaArticoliOnScan;
|
private boolean flagOrdinaArticoliOnScan;
|
||||||
|
private boolean flagConsentiFuoriPianoLogistico;
|
||||||
|
private boolean flagConsentiOrdineSenzaGriglia;
|
||||||
private String docInterniCheckFornitore;
|
private String docInterniCheckFornitore;
|
||||||
private String produzioneDefaultCodAnag;
|
private String produzioneDefaultCodAnag;
|
||||||
private boolean flagPrintPackingListOnOrderClose;
|
private boolean flagPrintPackingListOnOrderClose;
|
||||||
private boolean flagPrintEtichetteOnOrderClose;
|
private boolean flagPrintEtichetteOnOrderClose;
|
||||||
|
private boolean flagPrintEtichetteOnLUClose;
|
||||||
private int onNumCnfInputChanged = 1;
|
private int onNumCnfInputChanged = 1;
|
||||||
private int onQtaTotInputChanged = 1;
|
private int onQtaTotInputChanged = 1;
|
||||||
private boolean flagAccettazioneUseQtaOrd = false;
|
private boolean flagAccettazioneUseQtaOrd = false;
|
||||||
@@ -55,6 +58,9 @@ public class DBSettingsModel {
|
|||||||
private boolean showCodFornSpedizione = true;
|
private boolean showCodFornSpedizione = true;
|
||||||
private boolean flagCanCreateInventario = true;
|
private boolean flagCanCreateInventario = true;
|
||||||
private boolean flagCanAddUnknownItemsInventario = true;
|
private boolean flagCanAddUnknownItemsInventario = true;
|
||||||
|
private boolean flagShouldAskToCreateOrUpdateRowInventario = false;
|
||||||
|
private String commessaMagazzino;
|
||||||
|
private boolean flagGeneraDocumentoSpedizione = false;
|
||||||
|
|
||||||
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
public boolean isFlagSpedizioneEnableFakeGiacenza() {
|
||||||
return flagSpedizioneEnableFakeGiacenza;
|
return flagSpedizioneEnableFakeGiacenza;
|
||||||
@@ -281,6 +287,15 @@ public class DBSettingsModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFlagPrintEtichetteOnLUClose() {
|
||||||
|
return flagPrintEtichetteOnLUClose;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagPrintEtichetteOnLUClose(boolean flagPrintEtichetteOnLUClose) {
|
||||||
|
this.flagPrintEtichetteOnLUClose = flagPrintEtichetteOnLUClose;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public int getOnNumCnfInputChanged() {
|
public int getOnNumCnfInputChanged() {
|
||||||
return onNumCnfInputChanged;
|
return onNumCnfInputChanged;
|
||||||
}
|
}
|
||||||
@@ -416,4 +431,49 @@ public class DBSettingsModel {
|
|||||||
this.flagCanAddUnknownItemsInventario = flagCanAddUnknownItemsInventario;
|
this.flagCanAddUnknownItemsInventario = flagCanAddUnknownItemsInventario;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFlagShouldAskToCreateOrUpdateRowInventario() {
|
||||||
|
return flagShouldAskToCreateOrUpdateRowInventario;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagShouldAskToCreateOrUpdateRowInventario(boolean flagShouldAskToCreateOrUpdateRowInventario) {
|
||||||
|
this.flagShouldAskToCreateOrUpdateRowInventario = flagShouldAskToCreateOrUpdateRowInventario;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFlagConsentiFuoriPianoLogistico() {
|
||||||
|
return flagConsentiFuoriPianoLogistico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagConsentiFuoriPianoLogistico(boolean flagConsentiFuoriPianoLogistico) {
|
||||||
|
this.flagConsentiFuoriPianoLogistico = flagConsentiFuoriPianoLogistico;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFlagConsentiOrdineSenzaGriglia() {
|
||||||
|
return flagConsentiOrdineSenzaGriglia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagConsentiOrdineSenzaGriglia(boolean flagConsentiOrdineSenzaGriglia) {
|
||||||
|
this.flagConsentiOrdineSenzaGriglia = flagConsentiOrdineSenzaGriglia;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCommessaMagazzino() {
|
||||||
|
return commessaMagazzino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setCommessaMagazzino(String commessaMagazzino) {
|
||||||
|
this.commessaMagazzino = commessaMagazzino;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFlagGeneraDocumentoSpedizione() {
|
||||||
|
return flagGeneraDocumentoSpedizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DBSettingsModel setFlagGeneraDocumentoSpedizione(boolean flagGeneraDocumentoSpedizione) {
|
||||||
|
this.flagGeneraDocumentoSpedizione = flagGeneraDocumentoSpedizione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import java.util.List;
|
|||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.CommonConst;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.model.StbGestSetup;
|
import it.integry.integrywmsnative.core.model.StbGestSetup;
|
||||||
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
|
||||||
@@ -24,6 +25,7 @@ import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
|||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
import it.integry.integrywmsnative.core.rest.model.AvailableCodMdepsDTO;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityFirebase;
|
import it.integry.integrywmsnative.core.utility.UtilityFirebase;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class SettingsManager {
|
public class SettingsManager {
|
||||||
@@ -108,6 +110,7 @@ public class SettingsManager {
|
|||||||
};
|
};
|
||||||
|
|
||||||
RunnableArgs<Exception> tmpOnFailed = ex -> {
|
RunnableArgs<Exception> tmpOnFailed = ex -> {
|
||||||
|
UtilityLogger.error(ex);
|
||||||
perfTrace.putAttribute("failed", "true");
|
perfTrace.putAttribute("failed", "true");
|
||||||
if (!(ex instanceof SocketTimeoutException)) onFailed.run(ex);
|
if (!(ex instanceof SocketTimeoutException)) onFailed.run(ex);
|
||||||
else
|
else
|
||||||
@@ -305,6 +308,14 @@ public class SettingsManager {
|
|||||||
.setGestName("PVM")
|
.setGestName("PVM")
|
||||||
.setSection("ORDINI_A")
|
.setSection("ORDINI_A")
|
||||||
.setKeySection("ORDINA_ARTICOLI_ON_SCAN"));
|
.setKeySection("ORDINA_ARTICOLI_ON_SCAN"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PVM")
|
||||||
|
.setSection("ORDINI_A")
|
||||||
|
.setKeySection("FLAG_CONSENTI_ORDINE_DA_GRIGLIA"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PVM")
|
||||||
|
.setSection("ORDINI_A")
|
||||||
|
.setKeySection("FLAG_CONSENTI_ORDINE_SENZA_GRIGLIA"));
|
||||||
stbGestSetupList.add(new StbGestSetup()
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
.setGestName("PVM")
|
.setGestName("PVM")
|
||||||
.setSection("DOC_INTERNI")
|
.setSection("DOC_INTERNI")
|
||||||
@@ -325,6 +336,10 @@ public class SettingsManager {
|
|||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("SPEDIZIONE")
|
.setSection("SPEDIZIONE")
|
||||||
.setKeySection("FLAG_PRINT_ETICHETTE_ON_CLOSE"));
|
.setKeySection("FLAG_PRINT_ETICHETTE_ON_CLOSE"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("SPEDIZIONE")
|
||||||
|
.setKeySection("FLAG_PRINT_ETICHETTE_ON_LU_CLOSE"));
|
||||||
stbGestSetupList.add(new StbGestSetup()
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("SPEDIZIONE")
|
.setSection("SPEDIZIONE")
|
||||||
@@ -357,6 +372,18 @@ public class SettingsManager {
|
|||||||
.setGestName("PICKING")
|
.setGestName("PICKING")
|
||||||
.setSection("INVENTARIO")
|
.setSection("INVENTARIO")
|
||||||
.setKeySection("FLAG_CAN_ADD_UNKNOWN_ITEMS"));
|
.setKeySection("FLAG_CAN_ADD_UNKNOWN_ITEMS"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("INVENTARIO")
|
||||||
|
.setKeySection("FLAG_SHOULD_ASK_TO_CREATE_OR_UPDATE_ROW"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("SETUP")
|
||||||
|
.setKeySection("COMMESSA_MAGAZZINO"));
|
||||||
|
stbGestSetupList.add(new StbGestSetup()
|
||||||
|
.setGestName("PICKING")
|
||||||
|
.setSection("SPEDIZIONE")
|
||||||
|
.setKeySection("GENERA_DOC"));
|
||||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
|
|
||||||
mGestSetupRESTConsumer.getValues(codMdep, stbGestSetupList, list -> {
|
mGestSetupRESTConsumer.getValues(codMdep, stbGestSetupList, list -> {
|
||||||
@@ -381,8 +408,11 @@ public class SettingsManager {
|
|||||||
dbSettingsModelIstance.setFlagAccettazioneUseQtaOrd(getValueFromList(list, "ACCETTAZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
dbSettingsModelIstance.setFlagAccettazioneUseQtaOrd(getValueFromList(list, "ACCETTAZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagPickLiberoAllowEmptyDest(getValueFromList(list, "PICKING_LIBERO", "FLAG_ALLOW_EMPTY_DEST", Boolean.class));
|
dbSettingsModelIstance.setFlagPickLiberoAllowEmptyDest(getValueFromList(list, "PICKING_LIBERO", "FLAG_ALLOW_EMPTY_DEST", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagOrdinaArticoliOnScan(getValueFromList(list, "ORDINI_A", "ORDINA_ARTICOLI_ON_SCAN", Boolean.class));
|
dbSettingsModelIstance.setFlagOrdinaArticoliOnScan(getValueFromList(list, "ORDINI_A", "ORDINA_ARTICOLI_ON_SCAN", Boolean.class));
|
||||||
|
dbSettingsModelIstance.setFlagConsentiFuoriPianoLogistico(getValueFromList(list, "ORDINI_A", "FLAG_CONSENTI_ORDINE_DA_GRIGLIA", Boolean.class));
|
||||||
|
dbSettingsModelIstance.setFlagConsentiOrdineSenzaGriglia(getValueFromList(list, "ORDINI_A", "FLAG_CONSENTI_ORDINE_SENZA_GRIGLIA", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagPrintPackingListOnOrderClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_PACKING_LIST_ON_CLOSE", Boolean.class));
|
dbSettingsModelIstance.setFlagPrintPackingListOnOrderClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_PACKING_LIST_ON_CLOSE", Boolean.class));
|
||||||
dbSettingsModelIstance.setFlagPrintEtichetteOnOrderClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_ETICHETTE_ON_CLOSE", Boolean.class));
|
dbSettingsModelIstance.setFlagPrintEtichetteOnOrderClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_ETICHETTE_ON_CLOSE", Boolean.class));
|
||||||
|
dbSettingsModelIstance.setFlagPrintEtichetteOnLUClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_ETICHETTE_ON_LU_CLOSE", Boolean.class, true));
|
||||||
dbSettingsModelIstance.setFlagAskInfoAggiuntiveSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_ASK_INFO_AGGIUNTIVE", Boolean.class));
|
dbSettingsModelIstance.setFlagAskInfoAggiuntiveSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_ASK_INFO_AGGIUNTIVE", Boolean.class));
|
||||||
dbSettingsModelIstance.setFilterFornitoreProd(getValueFromList(list, "PRODUZIONE", "FILTER_FORNTIORE_PROD", String.class));
|
dbSettingsModelIstance.setFilterFornitoreProd(getValueFromList(list, "PRODUZIONE", "FILTER_FORNTIORE_PROD", String.class));
|
||||||
dbSettingsModelIstance.setCodDtipOrdTrasfV(getValueFromList(list, "SPEDIZIONE", "COD_DTIP_ORD_TRASF", String.class));
|
dbSettingsModelIstance.setCodDtipOrdTrasfV(getValueFromList(list, "SPEDIZIONE", "COD_DTIP_ORD_TRASF", String.class));
|
||||||
@@ -391,6 +421,9 @@ public class SettingsManager {
|
|||||||
dbSettingsModelIstance.setGroupShippingByCommodityGroup(getValueFromList(list, "SPEDIZIONE", "FLAG_GROUP_BY_GRP_MERC", Boolean.class, Boolean.FALSE));
|
dbSettingsModelIstance.setGroupShippingByCommodityGroup(getValueFromList(list, "SPEDIZIONE", "FLAG_GROUP_BY_GRP_MERC", Boolean.class, Boolean.FALSE));
|
||||||
dbSettingsModelIstance.setFlagCanCreateInventario(getValueFromList(list, "INVENTARIO", "FLAG_CAN_CREATE_INVENTARIO", Boolean.class, Boolean.TRUE));
|
dbSettingsModelIstance.setFlagCanCreateInventario(getValueFromList(list, "INVENTARIO", "FLAG_CAN_CREATE_INVENTARIO", Boolean.class, Boolean.TRUE));
|
||||||
dbSettingsModelIstance.setFlagCanAddUnknownItemsInventario(getValueFromList(list, "INVENTARIO", "FLAG_CAN_ADD_UNKNOWN_ITEMS", Boolean.class, Boolean.TRUE));
|
dbSettingsModelIstance.setFlagCanAddUnknownItemsInventario(getValueFromList(list, "INVENTARIO", "FLAG_CAN_ADD_UNKNOWN_ITEMS", Boolean.class, Boolean.TRUE));
|
||||||
|
dbSettingsModelIstance.setFlagShouldAskToCreateOrUpdateRowInventario(getValueFromList(list, "INVENTARIO", "FLAG_SHOULD_ASK_TO_CREATE_OR_UPDATE_ROW", Boolean.class, Boolean.FALSE));
|
||||||
|
dbSettingsModelIstance.setCommessaMagazzino(getValueFromList(list, "SETUP", "COMMESSA_MAGAZZINO", String.class, CommonConst.Config.COMMESSA_MAG));
|
||||||
|
dbSettingsModelIstance.setFlagGeneraDocumentoSpedizione(getValueFromList(list, "SPEDIZIONE", "GENERA_DOC", Boolean.class, Boolean.FALSE));
|
||||||
|
|
||||||
String notePerdita = getValueFromList(list, "DOC_INTERNI", "NOTE_PERDITA", String.class);
|
String notePerdita = getValueFromList(list, "DOC_INTERNI", "NOTE_PERDITA", String.class);
|
||||||
if (notePerdita != null)
|
if (notePerdita != null)
|
||||||
@@ -428,6 +461,12 @@ public class SettingsManager {
|
|||||||
} else if (clazz == Integer.class && value.getValue() != null) {
|
} else if (clazz == Integer.class && value.getValue() != null) {
|
||||||
return clazz.cast(Integer.parseInt(value.getValue()));
|
return clazz.cast(Integer.parseInt(value.getValue()));
|
||||||
}
|
}
|
||||||
|
} else if (defaultValue == null) {
|
||||||
|
if (clazz == Boolean.class) {
|
||||||
|
return clazz.cast(Boolean.FALSE);
|
||||||
|
} else if (clazz == Integer.class) {
|
||||||
|
return clazz.cast(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
|||||||
@@ -95,10 +95,19 @@ public class SettingsModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class UserSession {
|
public static class UserSession {
|
||||||
|
private String deviceId;
|
||||||
private String profileDB;
|
private String profileDB;
|
||||||
private AvailableCodMdepsDTO depo;
|
private AvailableCodMdepsDTO depo;
|
||||||
private Integer defaultOrdinamentoPickingAccettazione = 0;
|
private Integer defaultOrdinamentoPickingAccettazione = 0;
|
||||||
|
|
||||||
|
public String getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceId(String deviceId) {
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getProfileDB() {
|
public String getProfileDB() {
|
||||||
return profileDB;
|
return profileDB;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,11 @@ public class UpdatesManager {
|
|||||||
public void init(AppCompatActivity activityContext) {
|
public void init(AppCompatActivity activityContext) {
|
||||||
this.mContext = activityContext;
|
this.mContext = activityContext;
|
||||||
|
|
||||||
|
final String baseEndpoint = SettingsManager.i().getServer().getProtocol() + "://" + SettingsManager.i().getServer().getHost() +
|
||||||
|
(SettingsManager.i().getServer().getPort() > 0 ? ":" + SettingsManager.i().getServer().getPort() : "");
|
||||||
|
|
||||||
String currentVersionUrl = SettingsManager.i().getServer().getProtocol() + "://" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "/ems-api/wms/currentVersion";
|
final String currentVersionUrl = baseEndpoint + "/ems-api/wms/currentVersion";
|
||||||
String currentDownloadUrl = SettingsManager.i().getServer().getProtocol() + "://" + SettingsManager.i().getServer().getHost() + ":" + SettingsManager.i().getServer().getPort() + "/ems-api/wms/android-release.apk";
|
final String currentDownloadUrl = baseEndpoint + "/ems-api/wms/android-release.apk";
|
||||||
|
|
||||||
|
|
||||||
AppUpdater appUpdater = new AppUpdater(mContext)
|
AppUpdater appUpdater = new AppUpdater(mContext)
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ public class PermissionsHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String[] permissionArray = new String[permissionsToAsk.size()];
|
String[] permissionArray = new String[permissionsToAsk.size()];
|
||||||
permissionsToAsk.toArray(permissionArray);
|
permissionsToAsk.toArray(permissionArray);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package it.integry.integrywmsnative.core.utility;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
|
||||||
|
public class UntMisUtils {
|
||||||
|
|
||||||
|
public static boolean shouldBeShowInColli(MtbAart mtbAart) {
|
||||||
|
return SettingsManager.iDB().isFlagForceAllToColli() || (mtbAart == null || !mtbAart.isFlagQtaCnfFissaBoolean());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -36,6 +36,10 @@ public class UtilityBarcode {
|
|||||||
return barcodeScanDTO != null && barcodeScanDTO.getType() == BarcodeType.EAN128;
|
return barcodeScanDTO != null && barcodeScanDTO.getType() == BarcodeType.EAN128;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isCode128(BarcodeScanDTO barcodeScanDTO) {
|
||||||
|
return barcodeScanDTO != null && barcodeScanDTO.getType() == BarcodeType.CODE128;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isEtichettaPosizione(BarcodeScanDTO barcodeScanDTO) {
|
public static boolean isEtichettaPosizione(BarcodeScanDTO barcodeScanDTO) {
|
||||||
return isEtichettaPosizione(barcodeScanDTO, true);
|
return isEtichettaPosizione(barcodeScanDTO, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ public class UtilityExceptions {
|
|||||||
public static void defaultException(Context context, Exception ex, boolean sendEmail) {
|
public static void defaultException(Context context, Exception ex, boolean sendEmail) {
|
||||||
|
|
||||||
if (ex.getMessage() != null) {
|
if (ex.getMessage() != null) {
|
||||||
Logger.e(ex, Html.fromHtml(ex.getMessage()).toString());
|
Logger.e(ex, Html.fromHtml(ex.getMessage()).toString(), ex.getStackTrace());
|
||||||
} else {
|
} else {
|
||||||
Logger.e(ex, "Errore");
|
Logger.e(ex, "Errore", ex.getStackTrace());
|
||||||
}
|
}
|
||||||
|
|
||||||
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.core.utility;
|
|
||||||
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
|
||||||
|
|
||||||
public class UtilityProgress {
|
|
||||||
|
|
||||||
public static DialogProgressView createDefaultProgressDialog(FragmentActivity mContext) {
|
|
||||||
var progress = DialogProgressView.newInstance(null, null, true);
|
|
||||||
progress.show(mContext.getSupportFragmentManager(), "tag");
|
|
||||||
return progress;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -41,9 +41,15 @@ public class UtilityServer {
|
|||||||
public static void isEmsApiAvailable(final String protocol, final String serverAddress, final int serverTCPport, final Runnable onComplete, final RunnableArgs<Exception> onFailed) {
|
public static void isEmsApiAvailable(final String protocol, final String serverAddress, final int serverTCPport, final Runnable onComplete, final RunnableArgs<Exception> onFailed) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
|
|
||||||
|
String url = null;
|
||||||
|
|
||||||
|
if(serverTCPport > 0)
|
||||||
|
url = String.format("%s://%s:%d/ems-api/system/ok", protocol, serverAddress, serverTCPport);
|
||||||
|
else
|
||||||
|
url = String.format("%s://%s/ems-api/system/ok", protocol, serverAddress);
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(String.format("%s://%s:%d/ems-api/system/ok", protocol, serverAddress, serverTCPport))
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ public class MainAccettazioneFragment extends BaseFragment implements ISearchabl
|
|||||||
DialogSimpleMessageView.makeInfoDialog(getText(R.string.orders).toString(),
|
DialogSimpleMessageView.makeInfoDialog(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.ordered_articles, (int) artsCounter)),
|
||||||
null,
|
null,
|
||||||
() -> {
|
() -> {
|
||||||
|
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ public class AccettazionePickingViewModel {
|
|||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if (codAnags != null && codAnags.size() == 1) {
|
if (codAnags.size() == 1) {
|
||||||
mtbColt.setCodAnag(codAnags.get(0));
|
mtbColt.setCodAnag(codAnags.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,7 +399,7 @@ public class AccettazionePickingViewModel {
|
|||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if (rifOrds != null && rifOrds.size() == 1) {
|
if (rifOrds.size() == 1) {
|
||||||
mtbColt.setRifOrd(rifOrds.get(0));
|
mtbColt.setRifOrd(rifOrds.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,16 +409,9 @@ public class AccettazionePickingViewModel {
|
|||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if (numDataOrds != null && numDataOrds.size() == 1) {
|
if (numDataOrds.size() == 1) {
|
||||||
mtbColt.setNumOrd(mOrders.get(0).getNumero());
|
mtbColt.setNumOrd(mOrders.get(0).getNumero());
|
||||||
mtbColt.setDataOrd(mOrders.get(0).getData());
|
mtbColt.setDataOrd(mOrders.get(0).getData());
|
||||||
|
|
||||||
try {
|
|
||||||
mtbColt.generaFiltroOrdine();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
this.sendError(ex);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mColliMagazzinoRESTConsumer.saveCollo(mtbColt, savedMtbColt -> {
|
this.mColliMagazzinoRESTConsumer.saveCollo(mtbColt, savedMtbColt -> {
|
||||||
|
|||||||
@@ -3,11 +3,12 @@ package it.integry.integrywmsnative.gest.contab_doc_interni;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Html;
|
|
||||||
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.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.databinding.ObservableArrayList;
|
import androidx.databinding.ObservableArrayList;
|
||||||
@@ -28,7 +29,6 @@ import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
|||||||
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.rest.model.documento.DocumentoArtDTO;
|
import it.integry.integrywmsnative.core.rest.model.documento.DocumentoArtDTO;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
|
||||||
import it.integry.integrywmsnative.databinding.FragmentDocInterniBinding;
|
import it.integry.integrywmsnative.databinding.FragmentDocInterniBinding;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoResponseDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoResponseDTO;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoView;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dialog.DialogSelectDocInfoView;
|
||||||
@@ -83,23 +83,29 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
|||||||
mBinding.setView(this);
|
mBinding.setView(this);
|
||||||
mBinding.setViewModel(mViewModel);
|
mBinding.setViewModel(mViewModel);
|
||||||
|
|
||||||
mViewModel.mtbGrup.observe(getViewLifecycleOwner(), mtbGrup -> mViewModel.fetchProducts());
|
|
||||||
mViewModel.dtbTipi.observe(getViewLifecycleOwner(), dtbTipi -> mViewModel.fetchDocuments());
|
|
||||||
this.initRecyclerView();
|
this.initRecyclerView();
|
||||||
|
|
||||||
return mBinding.getRoot();
|
return mBinding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
super.onStart();
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
if (!this.mViewModel.hasDocDetails()) {
|
if (!this.mViewModel.hasDocDetails()) {
|
||||||
mViewModel.init();
|
mViewModel.init();
|
||||||
} else {
|
} else {
|
||||||
this.mViewModel.fetchDocuments();
|
this.onLoadingStarted();
|
||||||
|
this.mViewModel.fetchDocuments(this::onLoadingEnded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
||||||
@@ -117,27 +123,7 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
|||||||
@Override
|
@Override
|
||||||
public void onDocDetailsChanged(DialogSelectDocInfoResponseDTO selection) {
|
public void onDocDetailsChanged(DialogSelectDocInfoResponseDTO selection) {
|
||||||
mViewModel.setSelectedDocDetails(selection);
|
mViewModel.setSelectedDocDetails(selection);
|
||||||
|
mBinding.invalidateAll();
|
||||||
if (selection.isFornitoreRequired()) {
|
|
||||||
mBinding.codAnagContainer.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
mBinding.codAnagContainer.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// if (selection.getGruppoArt() != null) {
|
|
||||||
// mBinding.mtbGrpContainer.setVisibility(View.VISIBLE);
|
|
||||||
// } else {
|
|
||||||
// mBinding.mtbGrpContainer.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (selection.isDocumentRequired()) {
|
|
||||||
mBinding.docContainer.setVisibility(View.VISIBLE);
|
|
||||||
mBinding.document.setText(Html.fromHtml(getString(R.string.doc_testata, String.valueOf(selection.getNumDoc()), UtilityDate.formatDate(selection.getDataDoc(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN))));
|
|
||||||
} else {
|
|
||||||
mBinding.docContainer.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -158,12 +144,9 @@ public class DocInterniFragment extends BaseFragment implements ITitledFragment,
|
|||||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showInfoArtDialog() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initRecyclerView() {
|
private void initRecyclerView() {
|
||||||
this.mViewModel.getDocsList().observe(getViewLifecycleOwner(), this::refreshList);
|
this.mViewModel.getDocsList().observe(getViewLifecycleOwner(), this::refreshList);
|
||||||
|
|
||||||
DocInterniListAdapter docInterniListAdapter = new DocInterniListAdapter(this.requireActivity(), this.mDocInterniMutableData);
|
DocInterniListAdapter docInterniListAdapter = new DocInterniListAdapter(this.requireActivity(), this.mDocInterniMutableData);
|
||||||
docInterniListAdapter.setEmptyView(this.mBinding.docInterniEmptyView);
|
docInterniListAdapter.setEmptyView(this.mBinding.docInterniEmptyView);
|
||||||
this.mBinding.docInterniMainList.setAdapter(docInterniListAdapter);
|
this.mBinding.docInterniMainList.setAdapter(docInterniListAdapter);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package it.integry.integrywmsnative.gest.contab_doc_interni;
|
package it.integry.integrywmsnative.gest.contab_doc_interni;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -37,12 +37,12 @@ public class DocInterniViewModel {
|
|||||||
private List<DocumentoArtDTO> availableArts;
|
private List<DocumentoArtDTO> availableArts;
|
||||||
private final MutableLiveData<List<DocInternoWrapper>> mDocsList = new MutableLiveData<>();
|
private final MutableLiveData<List<DocInternoWrapper>> mDocsList = new MutableLiveData<>();
|
||||||
|
|
||||||
public final MutableLiveData<TipoDocDTO> dtbTipi = new MutableLiveData<>();
|
public TipoDocDTO dtbTipi;
|
||||||
public final MutableLiveData<GruppoArticoloDTO> mtbGrup = new MutableLiveData<>();
|
public GruppoArticoloDTO mtbGrup;
|
||||||
public final MutableLiveData<FornitoreDTO> fornitore = new MutableLiveData<>();
|
public FornitoreDTO fornitore;
|
||||||
public final MutableLiveData<Date> dataDoc = new MutableLiveData<>();
|
public Date dataDoc;
|
||||||
public final MutableLiveData<String> numDoc = new MutableLiveData<>();
|
public String numDoc;
|
||||||
public final MutableLiveData<String> note = new MutableLiveData<>();
|
public String note;
|
||||||
public final BindableInteger artsSize = new BindableInteger(0);
|
public final BindableInteger artsSize = new BindableInteger(0);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -52,8 +52,6 @@ public class DocInterniViewModel {
|
|||||||
this.docInterniRESTConsumer = docInterniRESTConsumer;
|
this.docInterniRESTConsumer = docInterniRESTConsumer;
|
||||||
this.documentRepository = documentRepository;
|
this.documentRepository = documentRepository;
|
||||||
this.documentRESTConsumer = documentRESTConsumer;
|
this.documentRESTConsumer = documentRESTConsumer;
|
||||||
|
|
||||||
this.mDocsList.setValue(new ArrayList<>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -83,54 +81,62 @@ public class DocInterniViewModel {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MutableLiveData<List<DocInternoWrapper>> getDocsList() {
|
public LiveData<List<DocInternoWrapper>> getDocsList() {
|
||||||
return mDocsList;
|
return mDocsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectedDocDetails(DialogSelectDocInfoResponseDTO selection) {
|
public void setSelectedDocDetails(DialogSelectDocInfoResponseDTO selection) {
|
||||||
|
this.fornitore = selection.getFornitore();
|
||||||
|
this.dtbTipi = selection.getTipoDoc();
|
||||||
|
|
||||||
this.fornitore.postValue(selection.getFornitore());
|
this.mtbGrup = selection.getGruppoArt();
|
||||||
this.dtbTipi.postValue(selection.getTipoDoc());
|
this.dataDoc = selection.getDataDoc();
|
||||||
|
this.numDoc = selection.getNumDoc() != null ? selection.getNumDoc().toString() : null;
|
||||||
|
this.note = selection.getNote();
|
||||||
|
|
||||||
this.mtbGrup.postValue(selection.getGruppoArt());
|
this.sendOnLoadingStarted();
|
||||||
this.dataDoc.postValue(selection.getDataDoc());
|
fetchProducts(() -> {
|
||||||
this.numDoc.postValue(selection.getNumDoc() != null ? selection.getNumDoc().toString() : null);
|
fetchDocuments(this::sendOnLoadingEnded);
|
||||||
this.note.postValue(selection.getNote());
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fetchProducts() {
|
public void fetchProducts(Runnable onComplete) {
|
||||||
this.productsFetched = false;
|
documentRESTConsumer.loadDocumentAvailableArts(
|
||||||
this.sendOnLoadingStarted();
|
this.getCodDtip(),
|
||||||
|
this.getCodMgrp(),
|
||||||
documentRESTConsumer.loadDocumentoAvailableArts(this.getCodDtip(), this.getCodMgrp(), data -> {
|
this.getCodAnagForn(),
|
||||||
|
data -> {
|
||||||
this.productsFetched = true;
|
this.productsFetched = true;
|
||||||
this.availableArts = data.getArts();
|
this.availableArts = data.getArts();
|
||||||
this.artsSize.set(this.availableArts.size());
|
this.artsSize.set(this.availableArts.size());
|
||||||
|
|
||||||
if (this.docsFetched)
|
onComplete.run();
|
||||||
this.sendOnLoadingEnded();
|
|
||||||
|
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fetchDocuments() {
|
public void fetchDocuments(Runnable onComplete) {
|
||||||
this.docsFetched = false;
|
String codAnag = null;
|
||||||
this.sendOnLoadingStarted();
|
String codVdes = null;
|
||||||
String codAnag = null, codVdes = null;
|
|
||||||
FornitoreDTO fornitore = this.fornitore.getValue();
|
FornitoreDTO fornitore = this.fornitore;
|
||||||
if (fornitore != null) {
|
if (fornitore != null) {
|
||||||
codAnag = fornitore.getCodAnag();
|
codAnag = fornitore.getCodAnag();
|
||||||
codVdes = fornitore.getCodVdes();
|
codVdes = fornitore.getCodVdes();
|
||||||
}
|
}
|
||||||
documentRepository.getLocalDocumentsByCodDtip(this.getCodDtip(), codAnag, codVdes, dataDoc.getValue(), numDoc.getValue(), list -> {
|
|
||||||
|
|
||||||
|
var docsList = documentRepository.getDocuments(this.getCodDtip(),
|
||||||
|
codAnag, codVdes, dataDoc, numDoc);
|
||||||
|
|
||||||
|
docsList.observeForever(data -> {
|
||||||
|
this.mDocsList.postValue(data);
|
||||||
|
});
|
||||||
|
|
||||||
documentRepository.getNextNumCollo(nextNumCollo -> {
|
documentRepository.getNextNumCollo(nextNumCollo -> {
|
||||||
this.mDocsList.postValue(list);
|
|
||||||
this.setNextNumCollo(nextNumCollo);
|
this.setNextNumCollo(nextNumCollo);
|
||||||
this.docsFetched = true;
|
this.docsFetched = true;
|
||||||
if (this.productsFetched) {
|
|
||||||
this.sendOnLoadingEnded();
|
onComplete.run();
|
||||||
}
|
|
||||||
}, this::sendError);
|
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,24 +145,28 @@ public class DocInterniViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getCodDtip() {
|
private String getCodDtip() {
|
||||||
if (this.dtbTipi.getValue() == null) {
|
if (this.dtbTipi == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return this.dtbTipi.getValue().getCodDtip();
|
return this.dtbTipi.getCodDtip();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TipoDocDTO getTipoDoc() {
|
public TipoDocDTO getTipoDoc() {
|
||||||
if (this.dtbTipi.getValue() == null) {
|
return this.dtbTipi;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return this.dtbTipi.getValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCodMgrp() {
|
private String getCodMgrp() {
|
||||||
if (this.mtbGrup.getValue() == null) {
|
if (this.mtbGrup == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return this.mtbGrup.getValue().getCodMgrp();
|
return this.mtbGrup.getCodMgrp();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCodAnagForn() {
|
||||||
|
if (this.fornitore == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.fornitore.getCodAnag();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void editDocument(SqlMtbColt document) {
|
public void editDocument(SqlMtbColt document) {
|
||||||
@@ -165,7 +175,7 @@ public class DocInterniViewModel {
|
|||||||
|
|
||||||
public void newDocument() {
|
public void newDocument() {
|
||||||
SqlMtbColt document = new SqlMtbColt();
|
SqlMtbColt document = new SqlMtbColt();
|
||||||
if (this.dtbTipi.getValue() == null) {
|
if (this.dtbTipi == null) {
|
||||||
this.sendError(new NoDocTypeSelectedException());
|
this.sendError(new NoDocTypeSelectedException());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -173,18 +183,18 @@ public class DocInterniViewModel {
|
|||||||
document.setCodMgrp(this.getCodMgrp());
|
document.setCodMgrp(this.getCodMgrp());
|
||||||
document.setDataCollo(new Date());
|
document.setDataCollo(new Date());
|
||||||
document.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
document.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep());
|
||||||
document.setAnnotazioni(this.note.getValue());
|
document.setAnnotazioni(this.note);
|
||||||
document.setSegno(-1);
|
document.setSegno(-1);
|
||||||
document.setSerCollo("/");
|
document.setSerCollo("/");
|
||||||
document.setNumCollo(this.nextNumCollo);
|
document.setNumCollo(this.nextNumCollo);
|
||||||
document.setGestione("L");
|
document.setGestione("L");
|
||||||
document.setDataDoc(this.dataDoc.getValue());
|
document.setDataDoc(this.dataDoc);
|
||||||
if (this.numDoc.getValue() != null) {
|
if (this.numDoc != null) {
|
||||||
document.setNumDoc(Integer.parseInt(this.numDoc.getValue()));
|
document.setNumDoc(Integer.parseInt(this.numDoc));
|
||||||
}
|
}
|
||||||
if (this.fornitore.getValue() != null) {
|
if (this.fornitore != null) {
|
||||||
document.setCodAnag(this.fornitore.getValue().getCodAnag());
|
document.setCodAnag(this.fornitore.getCodAnag());
|
||||||
document.setCodVdes(this.fornitore.getValue().getCodVdes());
|
document.setCodVdes(this.fornitore.getCodVdes());
|
||||||
}
|
}
|
||||||
documentRepository.insert(document, id -> {
|
documentRepository.insert(document, id -> {
|
||||||
document.setId(id);
|
document.setId(id);
|
||||||
@@ -193,7 +203,7 @@ public class DocInterniViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasDocDetails() {
|
public boolean hasDocDetails() {
|
||||||
return this.dtbTipi.getValue() != null;
|
return this.dtbTipi != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Listener extends ILoadingListener {
|
public interface Listener extends ILoadingListener {
|
||||||
|
|||||||
@@ -90,17 +90,17 @@ public class DialogSelectDocInfoView extends BaseDialogFragment {
|
|||||||
.create()
|
.create()
|
||||||
.inject(this);
|
.inject(this);
|
||||||
|
|
||||||
|
setCancelable(false);
|
||||||
|
|
||||||
mBindings = DialogSelectDocInfoViewBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
mBindings = DialogSelectDocInfoViewBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||||
mBindings.setLifecycleOwner(this);
|
mBindings.setLifecycleOwner(this);
|
||||||
mBindings.setView(this);
|
mBindings.setView(this);
|
||||||
|
|
||||||
mViewModel.setFornitori(mDocInputData.getFornitori());
|
mViewModel.setFornitori(mDocInputData.getFornitori());
|
||||||
|
|
||||||
var cancelable = false;
|
|
||||||
|
|
||||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||||
.setView(mBindings.getRoot())
|
.setView(mBindings.getRoot())
|
||||||
.setCancelable(cancelable)
|
.setCancelable(isCancelable())
|
||||||
.setPositiveButton(R.string.confirm, (dialog, which) -> {
|
.setPositiveButton(R.string.confirm, (dialog, which) -> {
|
||||||
//Volutamente vuoto
|
//Volutamente vuoto
|
||||||
})
|
})
|
||||||
@@ -110,7 +110,7 @@ public class DialogSelectDocInfoView extends BaseDialogFragment {
|
|||||||
.create();
|
.create();
|
||||||
|
|
||||||
alertDialog.setOnShowListener(this);
|
alertDialog.setOnShowListener(this);
|
||||||
alertDialog.setCanceledOnTouchOutside(cancelable);
|
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||||
alertDialog.setOnDismissListener(this);
|
alertDialog.setOnDismissListener(this);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,85 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.gest.contab_doc_interni.dto;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColr;
|
|
||||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
|
||||||
|
|
||||||
public class DialogChooseRowFromListaDocRowsListModel {
|
|
||||||
|
|
||||||
private String codMart;
|
|
||||||
private String descrizione;
|
|
||||||
private String qtaOrdReadable;
|
|
||||||
private String barcode;
|
|
||||||
private boolean isNew;
|
|
||||||
private SqlMtbColr originalModel;
|
|
||||||
private BindableBoolean checked = new BindableBoolean(false);
|
|
||||||
|
|
||||||
public DialogChooseRowFromListaDocRowsListModel() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public BindableBoolean getChecked() {
|
|
||||||
return checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogChooseRowFromListaDocRowsListModel setChecked(BindableBoolean checked) {
|
|
||||||
this.checked = checked;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void toggleCheck() {
|
|
||||||
this.checked.set(!this.checked.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCodMart() {
|
|
||||||
return codMart;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogChooseRowFromListaDocRowsListModel setCodMart(String codMart) {
|
|
||||||
this.codMart = codMart;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescrizione() {
|
|
||||||
return descrizione;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogChooseRowFromListaDocRowsListModel setDescrizione(String descrizione) {
|
|
||||||
this.descrizione = descrizione;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getQtaOrdReadable() {
|
|
||||||
return qtaOrdReadable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogChooseRowFromListaDocRowsListModel setQtaOrdReadable(String qtaOrdReadable) {
|
|
||||||
this.qtaOrdReadable = qtaOrdReadable;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBarcode() {
|
|
||||||
return barcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogChooseRowFromListaDocRowsListModel setBarcode(String barcode) {
|
|
||||||
this.barcode = barcode;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isNew() {
|
|
||||||
return isNew;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogChooseRowFromListaDocRowsListModel setNew(boolean aNew) {
|
|
||||||
isNew = aNew;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SqlMtbColr getOriginalModel() {
|
|
||||||
return originalModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogChooseRowFromListaDocRowsListModel setOriginalModel(SqlMtbColr originalModel) {
|
|
||||||
this.originalModel = originalModel;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -41,13 +40,15 @@ import it.integry.integrywmsnative.core.rest.model.documento.DocumentoArtDTO;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.databinding.ActivityContabDocInterniEditBinding;
|
import it.integry.integrywmsnative.databinding.ActivityContabDocInterniEditBinding;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipoDocDTO;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.TipoDocDTO;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsItemListModel;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsView;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsView;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.ui.DocumentRowsListAdapter;
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.ui.DocumentRowsListAdapter;
|
||||||
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditModalView;
|
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditModalView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.available_items.DialogAvailableItemListModel;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.available_items.DialogAvailableItemsView;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArtsView;
|
|
||||||
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;
|
||||||
|
|
||||||
@@ -128,7 +129,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
if (document.getCodAnag() != null) {
|
if (document.getCodAnag() != null) {
|
||||||
this.codAnag.set(document.getCodAnag() + (document.getCodVdes() != null ? " - " + document.getCodVdes() : ""));
|
this.codAnag.set(document.getCodAnag() + (document.getCodVdes() != null ? " - " + document.getCodVdes() : ""));
|
||||||
} else {
|
} else {
|
||||||
this.binding.supplierLayout.setVisibility(View.GONE);
|
this.codAnag.set(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.documentHeader.set(String.format(this.getString(R.string.doc_interni_doc_header), document.getId(), document.getCodDtipProvv()));
|
this.documentHeader.set(String.format(this.getString(R.string.doc_interni_doc_header), document.getId(), document.getCodDtipProvv()));
|
||||||
@@ -136,7 +137,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
if (document.getNumDoc() != null && document.getDataDoc() != null) {
|
if (document.getNumDoc() != null && document.getDataDoc() != null) {
|
||||||
this.documentRifHeader.set(String.format(this.getString(R.string.doc_testata), document.getNumDoc().toString(), UtilityDate.formatDate(document.getDataDoc(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)));
|
this.documentRifHeader.set(String.format(this.getString(R.string.doc_testata), document.getNumDoc().toString(), UtilityDate.formatDate(document.getDataDoc(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)));
|
||||||
} else {
|
} else {
|
||||||
this.binding.docRifLayout.setVisibility(View.GONE);
|
this.documentRifHeader.set(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +185,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
"Ricerca articolo",
|
"Ricerca articolo",
|
||||||
null,
|
null,
|
||||||
"Cod articolo / Barcode",
|
"Cod articolo / Barcode",
|
||||||
barcodeProd -> this.viewModel.loadArticolo(barcodeProd, null), BarcodeManager::enable).show();
|
barcodeProd -> this.viewModel.loadArticoloByCodMartOrBarcode(barcodeProd), BarcodeManager::enable).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -230,7 +231,6 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEditRowRequest(SqlMtbColr row, boolean flagTracciabilita, boolean isUntMisDig) {
|
public void onEditRowRequest(SqlMtbColr row, boolean flagTracciabilita, boolean isUntMisDig) {
|
||||||
this.onLoadingStarted();
|
|
||||||
MtbAart mtbAart = new MtbAart();
|
MtbAart mtbAart = new MtbAart();
|
||||||
mtbAart.setBarCode(row.getCodBarre());
|
mtbAart.setBarCode(row.getCodBarre());
|
||||||
mtbAart.setDiacod(row.getCodBarre());
|
mtbAart.setDiacod(row.getCodBarre());
|
||||||
@@ -256,6 +256,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
.setSaveOnImeDone(true)
|
.setSaveOnImeDone(true)
|
||||||
.setPartitaMag(row.getPartitaMag())
|
.setPartitaMag(row.getPartitaMag())
|
||||||
.setDataScad(row.getDataScad())
|
.setDataScad(row.getDataScad())
|
||||||
|
.setCanInputZeroQuantity(true)
|
||||||
.setCanOverflowOrderQuantity(false)
|
.setCanOverflowOrderQuantity(false)
|
||||||
.setCanLUBeClosed(false)
|
.setCanLUBeClosed(false)
|
||||||
.setNotesAllowed(true)
|
.setNotesAllowed(true)
|
||||||
@@ -278,7 +279,7 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
this.onLoadingStarted();
|
this.onLoadingStarted();
|
||||||
this.viewModel.saveRow(row, resultDTO);
|
this.viewModel.saveRow(row, resultDTO);
|
||||||
})
|
})
|
||||||
.setOnAbort(this::onLoadingEnded)
|
.setOnAbort(() -> {})
|
||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,13 +320,22 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMultipleRowsFound(List<SqlMtbColr> rows, DocumentoArtDTO articolo) {
|
public void onMultipleRowsFound(List<SqlMtbColr> rows, DocumentoArtDTO articolo) {
|
||||||
DialogSelectDocRowsView.newInstance(rows, (row) -> {
|
List<DialogSelectDocRowsItemListModel<Object>> dataset =
|
||||||
this.onLoadingEnded();
|
Stream.of(rows)
|
||||||
if (row != null) {
|
.map(x -> new DialogSelectDocRowsItemListModel<>()
|
||||||
this.viewModel.dispatchRowEdit(row, articolo.isFlagTracciabilita(), articolo.isUntMisDigitale());
|
.setCodMart(x.getCodMart())
|
||||||
}
|
.setBarcode(x.getCodBarre())
|
||||||
}
|
.setOriginalModel(x)
|
||||||
).show(this.getSupportFragmentManager(), "dialogSelectDocRows");
|
.setNew(x.getId() < 1)
|
||||||
|
.setDescrizione(x.getDescrizione())
|
||||||
|
.setQtaOrd(BigDecimal.valueOf(x.getQtaCol()))
|
||||||
|
.setUntMisOrd(x.getUntMis()))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
DialogSelectDocRowsView.newInstance(dataset, data -> {
|
||||||
|
this.viewModel.dispatchRowEdit((SqlMtbColr) data.getOriginalModel(), articolo.isFlagTracciabilita(), articolo.isUntMisDigitale());
|
||||||
|
}, () -> {})
|
||||||
|
.show(this.getSupportFragmentManager(), "dialogSelectDocRowsNew");
|
||||||
}
|
}
|
||||||
|
|
||||||
private MtbColr sqlToEntity(SqlMtbColr sqlMtbColr) {
|
private MtbColr sqlToEntity(SqlMtbColr sqlMtbColr) {
|
||||||
@@ -357,19 +367,24 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void showInfoArtDialog() {
|
public void showInfoArtDialog() {
|
||||||
var listaMtbAart = Stream.of(this.viewModel.getProductsList())
|
var listaMtbAart = Stream.of(this.viewModel.getProductsList())
|
||||||
.map(x -> new MtbAart()
|
.map(x -> new DialogAvailableItemListModel()
|
||||||
.setCodMart(x.getCodMart())
|
.setCodMart(x.getCodMart())
|
||||||
.setUntMis(x.getUntMis())
|
.setDescrizioneEstesa(x.getDescrizione()))
|
||||||
.setDescrizione(x.getDescrizione())
|
|
||||||
.setDescrizioneEstesa(x.getDescrizione())
|
|
||||||
.setQtaCnf(x.getQtaCnf()))
|
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
new DialogChooseArtFromListaArtsView(false, listaMtbAart, null)
|
for (var documentRow : viewModel.getDocumentRows()) {
|
||||||
.show(getSupportFragmentManager(), "tag");
|
var codMart = documentRow.getCodMart();
|
||||||
|
|
||||||
|
Stream.of(listaMtbAart)
|
||||||
|
.filter(x -> x.getCodMart().equalsIgnoreCase(codMart))
|
||||||
|
.forEach(x -> x.setAggiunto(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
new DialogAvailableItemsView(listaMtbAart, null)
|
||||||
|
.show(getSupportFragmentManager(), "DialogAvailableInventarioItemsView");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,11 @@ import androidx.lifecycle.MutableLiveData;
|
|||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -21,6 +19,7 @@ import it.integry.integrywmsnative.core.data_store.db.entity.SqlMtbColt;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrDataSource;
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColrDataSource;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.MtbColtRepository;
|
||||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.NoResultFromCodMartException;
|
||||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||||
@@ -37,17 +36,17 @@ import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQua
|
|||||||
|
|
||||||
public class DocInterniEditFormViewModel {
|
public class DocInterniEditFormViewModel {
|
||||||
|
|
||||||
@Inject
|
private final MtbColrDataSource mtbColrRepository;
|
||||||
MtbColrDataSource mtbColrRepository;
|
private final MtbColtRepository mtbColtRepository;
|
||||||
@Inject
|
|
||||||
MtbColtRepository mtbColtRepository;
|
|
||||||
private final DocInterniRESTConsumer docInterniRESTConsumer;
|
private final DocInterniRESTConsumer docInterniRESTConsumer;
|
||||||
private DocInterniEditFormViewModel.Listener listener;
|
private Listener listener;
|
||||||
private List<DocumentoArtDTO> productsList;
|
private List<DocumentoArtDTO> productsList;
|
||||||
private HashMap<String, String> flattedBarcodesCodMarts;
|
|
||||||
private TipoDocDTO tipoDoc;
|
private TipoDocDTO tipoDoc;
|
||||||
|
|
||||||
private boolean isCheckPartitaMag = false;
|
private boolean isCheckPartitaMag = false;
|
||||||
private JSONObject checkFornitoreRules = null;
|
private JSONObject checkFornitoreRules = null;
|
||||||
|
|
||||||
|
|
||||||
public MutableLiveData<SqlMtbColt> document = new MutableLiveData<>();
|
public MutableLiveData<SqlMtbColt> document = new MutableLiveData<>();
|
||||||
public MutableLiveData<List<SqlMtbColr>> docRows = new MutableLiveData<>();
|
public MutableLiveData<List<SqlMtbColr>> docRows = new MutableLiveData<>();
|
||||||
|
|
||||||
@@ -129,16 +128,29 @@ public class DocInterniEditFormViewModel {
|
|||||||
this.listener.onDocumentHoldRequest();
|
this.listener.onDocumentHoldRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadArticolo(String barcodeProd, Ean128Model ean128Model) {
|
public void loadArticoloByCodMartOrBarcode(String codMart) {
|
||||||
|
var matchedArt = Stream.of(productsList)
|
||||||
|
.filter(x -> x.getCodMart().equalsIgnoreCase(codMart) ||
|
||||||
|
x.getBarcode().contains(codMart))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
|
||||||
|
if (matchedArt == null) {
|
||||||
|
this.sendError(new NoResultFromCodMartException(codMart));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
loadArticolo(matchedArt, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadArticoloByBarcode(String barcodeProd, Ean128Model ean128Model) {
|
||||||
DocumentoArtDTO matchedArt;
|
DocumentoArtDTO matchedArt;
|
||||||
String usedBarcode = null;
|
String usedBarcode = null;
|
||||||
|
|
||||||
String leftBarcode = StringUtils.leftPad(barcodeProd, 13, '0');
|
|
||||||
|
|
||||||
matchedArt = Stream.of(productsList)
|
matchedArt = Stream.of(productsList)
|
||||||
.filter(x -> x.getCodMart().equalsIgnoreCase(barcodeProd) ||
|
.filter(x -> x.getBarcode().contains(barcodeProd))
|
||||||
leftBarcode.equalsIgnoreCase(x.getCodMart()) ||
|
|
||||||
x.getBarcode().contains(barcodeProd))
|
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
@@ -151,15 +163,17 @@ public class DocInterniEditFormViewModel {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SqlMtbColr> rows = this.getRowsForArticolo(matchedArt, usedBarcode);
|
loadArticolo(matchedArt, usedBarcode);
|
||||||
|
|
||||||
if (rows.size() > 1) {
|
|
||||||
this.listener.onMultipleRowsFound(rows, matchedArt);
|
|
||||||
} else {
|
|
||||||
this.dispatchRowEdit(rows.get(0), matchedArt.isFlagTracciabilita(), matchedArt.isUntMisDigitale());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadArticolo(DocumentoArtDTO documentoArtDTO, String usedBarcode) {
|
||||||
|
List<SqlMtbColr> rows = this.getRowsForArticolo(documentoArtDTO, usedBarcode);
|
||||||
|
|
||||||
|
if (rows.size() > 1) {
|
||||||
|
this.listener.onMultipleRowsFound(rows, documentoArtDTO);
|
||||||
|
} else {
|
||||||
|
this.dispatchRowEdit(rows.get(0), documentoArtDTO.isFlagTracciabilita(), documentoArtDTO.isUntMisDigitale());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<SqlMtbColr> getRowsForArticolo(DocumentoArtDTO articolo, String barcode) {
|
private List<SqlMtbColr> getRowsForArticolo(DocumentoArtDTO articolo, String barcode) {
|
||||||
@@ -245,20 +259,32 @@ public class DocInterniEditFormViewModel {
|
|||||||
|
|
||||||
private void initCheckFornitore() {
|
private void initCheckFornitore() {
|
||||||
SqlMtbColt doc = this.document.getValue();
|
SqlMtbColt doc = this.document.getValue();
|
||||||
|
|
||||||
|
if (doc == null)
|
||||||
|
return;
|
||||||
|
|
||||||
boolean isCheckPartitaMag = false;
|
boolean isCheckPartitaMag = false;
|
||||||
if (doc != null && this.checkFornitoreRules != null) {
|
|
||||||
|
try {
|
||||||
|
if (this.checkFornitoreRules != null && this.checkFornitoreRules.has("value")) {
|
||||||
|
isCheckPartitaMag = this.checkFornitoreRules.getBoolean("value");
|
||||||
|
} else if (this.checkFornitoreRules != null) {
|
||||||
String key = doc.getCodAnag();
|
String key = doc.getCodAnag();
|
||||||
if (doc.getCodVdes() != null && !doc.getCodVdes().isEmpty()) {
|
if (doc.getCodVdes() != null && !doc.getCodVdes().isEmpty()) {
|
||||||
key += "-" + doc.getCodVdes();
|
key += "-" + doc.getCodVdes();
|
||||||
}
|
}
|
||||||
try {
|
if (this.checkFornitoreRules.has(key) &&
|
||||||
if (this.checkFornitoreRules.has(key) && ((String) ((JSONObject) this.checkFornitoreRules.get(key)).get(doc.getCodDtipProvv())).equalsIgnoreCase("check-partitaMag")) {
|
((String) ((JSONObject) this.checkFornitoreRules.get(key))
|
||||||
|
.get(doc.getCodDtipProvv()))
|
||||||
|
.equalsIgnoreCase("check-partitaMag")) {
|
||||||
isCheckPartitaMag = true;
|
isCheckPartitaMag = true;
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
this.sendError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
this.isCheckPartitaMag = isCheckPartitaMag;
|
this.isCheckPartitaMag = isCheckPartitaMag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,13 +298,6 @@ public class DocInterniEditFormViewModel {
|
|||||||
|
|
||||||
public void setProductsList(List<DocumentoArtDTO> productsList) {
|
public void setProductsList(List<DocumentoArtDTO> productsList) {
|
||||||
this.productsList = productsList;
|
this.productsList = productsList;
|
||||||
this.flattedBarcodesCodMarts = new HashMap<>();
|
|
||||||
|
|
||||||
for (DocumentoArtDTO documentArt : productsList) {
|
|
||||||
for (String barcode : documentArt.getBarcode()) {
|
|
||||||
this.flattedBarcodesCodMarts.put(barcode, documentArt.getCodMart());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processBarcode(BarcodeScanDTO dto) {
|
public void processBarcode(BarcodeScanDTO dto) {
|
||||||
@@ -291,7 +310,7 @@ public class DocInterniEditFormViewModel {
|
|||||||
this.executeEtichettaEanPeso(barcodeScanDTO);
|
this.executeEtichettaEanPeso(barcodeScanDTO);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.loadArticolo(barcodeScanDTO.getStringValue(), null);
|
this.loadArticoloByBarcode(barcodeScanDTO.getStringValue(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,7 +318,7 @@ public class DocInterniEditFormViewModel {
|
|||||||
private void executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO) {
|
private void executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO) {
|
||||||
try {
|
try {
|
||||||
Ean13PesoModel ean13PesoModel = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
|
Ean13PesoModel ean13PesoModel = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
|
||||||
this.loadArticolo(ean13PesoModel.getPrecode(), ean13PesoModel.toEan128());
|
this.loadArticoloByBarcode(ean13PesoModel.getPrecode(), ean13PesoModel.toEan128());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
this.sendError(ex);
|
this.sendError(ex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,5 @@ public interface DialogSelectDocRowsComponent {
|
|||||||
DialogSelectDocRowsComponent create();
|
DialogSelectDocRowsComponent create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void inject(DialogSelectDocRowsView dialogSelectDocRowsView);
|
||||||
void inject(DialogSelectDocRowsView dialogSelectDocInfoView);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
|
||||||
|
public class DialogSelectDocRowsItemListModel<T> {
|
||||||
|
|
||||||
|
private String codMart;
|
||||||
|
private String descrizione;
|
||||||
|
private BigDecimal qtaOrd;
|
||||||
|
private String untMisOrd;
|
||||||
|
private String barcode;
|
||||||
|
private boolean isNew;
|
||||||
|
private T originalModel;
|
||||||
|
private BindableBoolean checked = new BindableBoolean(false);
|
||||||
|
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectDocRowsItemListModel<T> setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectDocRowsItemListModel<T> setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaOrd() {
|
||||||
|
return qtaOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectDocRowsItemListModel<T> setQtaOrd(BigDecimal qtaOrd) {
|
||||||
|
this.qtaOrd = qtaOrd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUntMisOrd() {
|
||||||
|
return untMisOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectDocRowsItemListModel<T> setUntMisOrd(String untMisOrd) {
|
||||||
|
this.untMisOrd = untMisOrd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBarcode() {
|
||||||
|
return barcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectDocRowsItemListModel<T> setBarcode(String barcode) {
|
||||||
|
this.barcode = barcode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNew() {
|
||||||
|
return isNew;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectDocRowsItemListModel<T> setNew(boolean aNew) {
|
||||||
|
isNew = aNew;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectDocRowsItemListModel<T> setOriginalModel(T originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getChecked() {
|
||||||
|
return checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectDocRowsItemListModel<T> setChecked(BindableBoolean checked) {
|
||||||
|
this.checked = checked;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows;
|
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows;
|
||||||
|
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
|
||||||
@Module(subcomponents = DialogSelectDocRowsComponent.class)
|
@Module(subcomponents = DialogSelectDocRowsComponent.class)
|
||||||
public class DialogSelectDocRowsModule {
|
public class DialogSelectDocRowsModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
DialogSelectDocRowsViewModel providesDialogSelectDocRowsNewViewModel() {
|
||||||
|
return new DialogSelectDocRowsViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,143 +1,128 @@
|
|||||||
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows;
|
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
import androidx.lifecycle.MutableLiveData;
|
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.ravikoradiya.liveadapter.LiveAdapter;
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
import com.ravikoradiya.liveadapter.Type;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.BR;
|
import it.integry.integrywmsnative.BR;
|
||||||
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.data_store.db.entity.SqlMtbColr;
|
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.databinding.DialogChooseRowFromListaDocRowsLayoutBinding;
|
import it.integry.integrywmsnative.databinding.DialogSelectDocRowsBinding;
|
||||||
import it.integry.integrywmsnative.gest.contab_doc_interni.dto.DialogChooseRowFromListaDocRowsListModel;
|
import it.integry.integrywmsnative.databinding.DialogSelectDocRowsItemModelBinding;
|
||||||
import kotlin.Unit;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @noinspection rawtypes
|
||||||
|
*/
|
||||||
public class DialogSelectDocRowsView extends BaseDialogFragment {
|
public class DialogSelectDocRowsView extends BaseDialogFragment {
|
||||||
|
|
||||||
private final RunnableArgs<SqlMtbColr> onRowSelected;
|
|
||||||
private final List<SqlMtbColr> listArts;
|
|
||||||
private final MutableLiveData<List<DialogChooseRowFromListaDocRowsListModel>> listModels = new MutableLiveData<>();
|
|
||||||
private DialogChooseRowFromListaDocRowsLayoutBinding binding;
|
|
||||||
public MutableLiveData<SqlMtbColr> selectedRow = new MutableLiveData<>();
|
|
||||||
|
|
||||||
public static DialogSelectDocRowsView newInstance(
|
@Inject
|
||||||
List<SqlMtbColr> listArts,
|
DialogSelectDocRowsViewModel mViewModel;
|
||||||
RunnableArgs<SqlMtbColr> onDismiss
|
|
||||||
) {
|
private DialogSelectDocRowsBinding mBindings;
|
||||||
return new DialogSelectDocRowsView(listArts, onDismiss);
|
private Context mContext;
|
||||||
|
|
||||||
|
private final List<DialogSelectDocRowsItemListModel<Object>> listArts;
|
||||||
|
private final RunnableArgs<DialogSelectDocRowsItemListModel> onConfirm;
|
||||||
|
private final Runnable onAbort;
|
||||||
|
|
||||||
|
//Pass here all external parameters
|
||||||
|
public static DialogSelectDocRowsView newInstance(List<DialogSelectDocRowsItemListModel<Object>> listArts,
|
||||||
|
RunnableArgs<DialogSelectDocRowsItemListModel> onConfirm,
|
||||||
|
Runnable onAbort) {
|
||||||
|
return new DialogSelectDocRowsView(listArts, onConfirm, onAbort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DialogSelectDocRowsView(List<DialogSelectDocRowsItemListModel<Object>> listArts,
|
||||||
private DialogSelectDocRowsView(List<SqlMtbColr> listArts, RunnableArgs<SqlMtbColr> onDismiss) {
|
RunnableArgs<DialogSelectDocRowsItemListModel> onConfirm,
|
||||||
|
Runnable onAbort) {
|
||||||
super();
|
super();
|
||||||
this.onRowSelected = onDismiss;
|
|
||||||
this.listArts = listArts;
|
this.listArts = listArts;
|
||||||
|
this.onConfirm = onConfirm;
|
||||||
|
this.onAbort = onAbort;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
|
||||||
super.onDismiss(dialog);
|
|
||||||
if (onRowSelected != null) onRowSelected.run(this.selectedRow.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
binding = DataBindingUtil.inflate(inflater, R.layout.dialog_choose_row_from_lista_doc_rows_layout, container, false);
|
this.mContext = requireContext();
|
||||||
binding.setLifecycleOwner(this);
|
|
||||||
MainApplication
|
mBindings = DialogSelectDocRowsBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||||
.appComponent
|
mBindings.setLifecycleOwner(this);
|
||||||
.dialogSelectDocRowsComponent()
|
|
||||||
|
MainApplication.appComponent
|
||||||
|
.dialogSelectDocRowsNewComponent()
|
||||||
.create()
|
.create()
|
||||||
.inject(this);
|
.inject(this);
|
||||||
binding.setView(this);
|
|
||||||
|
|
||||||
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
setCancelable(false);
|
||||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
initView();
|
|
||||||
this.refreshList();
|
|
||||||
|
|
||||||
|
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||||
|
.setView(mBindings.getRoot())
|
||||||
|
.setCancelable(isCancelable())
|
||||||
|
.setPositiveButton(R.string.confirm, (dialog, which) -> {
|
||||||
|
final DialogSelectDocRowsItemListModel<Object> selectedItem = Stream.of(listArts)
|
||||||
|
.filter(x -> x.getChecked().get())
|
||||||
|
.findFirstOrElse(null);
|
||||||
|
if (selectedItem != null)
|
||||||
|
this.onConfirm.run(selectedItem);
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.abort, (dialog, which) -> {
|
||||||
|
if (this.onAbort != null) this.onAbort.run();
|
||||||
|
})
|
||||||
|
.create();
|
||||||
|
|
||||||
binding.positiveButton.setOnClickListener(view -> {
|
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||||
getDialog().dismiss();
|
alertDialog.setOnShowListener(this);
|
||||||
|
return alertDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShow(DialogInterface dialogInterface) {
|
||||||
|
super.onShow(dialogInterface);
|
||||||
|
|
||||||
|
this.listArts.get(0).getChecked().set(true);
|
||||||
|
this.initRecyclerView();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initRecyclerView() {
|
||||||
|
var itemType = new Type<DialogSelectDocRowsItemListModel, DialogSelectDocRowsItemModelBinding>(R.layout.dialog_select_doc_rows__item_model, BR.row);
|
||||||
|
// itemType.areItemSame((oldItem, newItem) -> Objects.equals(oldItem.getId(), newItem.getId()));
|
||||||
|
itemType.areContentsTheSame(DialogSelectDocRowsItemListModel::equals);
|
||||||
|
itemType.onClick(x -> {
|
||||||
|
resetChecks();
|
||||||
|
x.getBinding().getRow().getChecked().set(true);
|
||||||
|
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
binding.negativeButton.setOnClickListener(view -> {
|
new LiveAdapter(listArts)
|
||||||
this.selectedRow.setValue(null);
|
.map(DialogSelectDocRowsItemListModel.class, itemType)
|
||||||
getDialog().dismiss();
|
.into(this.mBindings.itemList);
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
this.onLoadingEnded();
|
|
||||||
return binding.getRoot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshList() {
|
private void resetChecks() {
|
||||||
var list = Stream.of(this.listArts).map(row -> {
|
for (var item : listArts) {
|
||||||
DialogChooseRowFromListaDocRowsListModel model = new DialogChooseRowFromListaDocRowsListModel();
|
item.getChecked().set(false);
|
||||||
model.setCodMart(row.getCodMart());
|
|
||||||
model.setBarcode(row.getCodMart());
|
|
||||||
model.setOriginalModel(row);
|
|
||||||
model.setNew(row.getId() < 1);
|
|
||||||
model.setDescrizione(row.getDescrizione());
|
|
||||||
model.setQtaOrdReadable(row.getQtaCol() + "\n" + row.getUntMis());
|
|
||||||
model.getChecked().addOnPropertyChangedCallback(() -> {
|
|
||||||
this.checkRow(row, model.getChecked().get());
|
|
||||||
});
|
|
||||||
return model;
|
|
||||||
}).toList();
|
|
||||||
this.listModels.postValue(list);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkRow(SqlMtbColr row, boolean checked) {
|
|
||||||
if (checked) {
|
|
||||||
this.selectedRow.setValue(row);
|
|
||||||
var models = this.listModels.getValue();
|
|
||||||
if (models != null && !models.isEmpty()) {
|
|
||||||
Stream.of(models).filter(model -> model.getOriginalModel().getId() != row.getId()).forEach(model -> {
|
|
||||||
model.getChecked().set(false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var selectedRow = this.selectedRow.getValue();
|
|
||||||
if (selectedRow != null && selectedRow.getId() == row.getId()) {
|
|
||||||
this.selectedRow.setValue(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initView() {
|
|
||||||
initArrayAdapters();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initArrayAdapters() {
|
|
||||||
|
|
||||||
new LiveAdapter(listModels, getViewLifecycleOwner(), BR.row)
|
|
||||||
.map(DialogChooseRowFromListaDocRowsListModel.class, R.layout.dialog_choose_row_from_lista_doc_rows__item_model)
|
|
||||||
.onNoData(noData -> {
|
|
||||||
binding.emptyView.setVisibility(noData ? View.VISIBLE : View.GONE);
|
|
||||||
return Unit.INSTANCE;
|
|
||||||
}
|
|
||||||
).into(binding.listaDocRows);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows;
|
||||||
|
|
||||||
|
public class DialogSelectDocRowsViewModel {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@ package it.integry.integrywmsnative.gest.inventario;
|
|||||||
|
|
||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -65,8 +67,7 @@ public class ElencoInventariViewModel {
|
|||||||
this.sendCreateInventarioRequest(inventoryId, zone);
|
this.sendCreateInventarioRequest(inventoryId, zone);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
var matchedInventory = getInventarioList().getValue()
|
var matchedInventory = Stream.of(getInventarioList().getValue())
|
||||||
.stream()
|
|
||||||
.filter(x -> Objects.equals(x.getIdInventario(), inventoryId) && UtilityString.equalsIgnoreCase(x.getZona(), zone) &&
|
.filter(x -> Objects.equals(x.getIdInventario(), inventoryId) && UtilityString.equalsIgnoreCase(x.getZona(), zone) &&
|
||||||
!x.isSyncronized())
|
!x.isSyncronized())
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
|||||||
@@ -63,11 +63,11 @@ public class DialogAskInfoInventarioView extends BaseDialogFragment {
|
|||||||
.create()
|
.create()
|
||||||
.inject(this);
|
.inject(this);
|
||||||
|
|
||||||
var cancelable = true;
|
setCancelable(true);
|
||||||
|
|
||||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||||
.setView(mBindings.getRoot())
|
.setView(mBindings.getRoot())
|
||||||
.setCancelable(cancelable)
|
.setCancelable(isCancelable())
|
||||||
.setPositiveButton(R.string.ok, (dialog, which) -> {
|
.setPositiveButton(R.string.ok, (dialog, which) -> {
|
||||||
var zone = UtilityString.empty2null(this.zone.get());
|
var zone = UtilityString.empty2null(this.zone.get());
|
||||||
if(zone != null) zone = StringUtils.capitalize(zone);
|
if(zone != null) zone = StringUtils.capitalize(zone);
|
||||||
@@ -81,7 +81,7 @@ public class DialogAskInfoInventarioView extends BaseDialogFragment {
|
|||||||
})
|
})
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
alertDialog.setCanceledOnTouchOutside(cancelable);
|
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||||
alertDialog.setOnShowListener(this);
|
alertDialog.setOnShowListener(this);
|
||||||
return alertDialog;
|
return alertDialog;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,11 +36,15 @@ 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.databinding.ActivityPickingInventarioBinding;
|
import it.integry.integrywmsnative.databinding.ActivityPickingInventarioBinding;
|
||||||
import it.integry.integrywmsnative.databinding.ActivityPickingInventarioListItemBinding;
|
import it.integry.integrywmsnative.databinding.ActivityPickingInventarioListItemBinding;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsItemListModel;
|
||||||
|
import it.integry.integrywmsnative.gest.contab_doc_interni.edit_form.dialog.selectDocRows.DialogSelectDocRowsView;
|
||||||
import it.integry.integrywmsnative.gest.inventario.bottom_sheet__inventario_row_actions.BottomSheetInventarioRowActionsView;
|
import it.integry.integrywmsnative.gest.inventario.bottom_sheet__inventario_row_actions.BottomSheetInventarioRowActionsView;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
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.view.dialogs.DialogConsts;
|
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||||
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArtsView;
|
import it.integry.integrywmsnative.view.dialogs.available_items.DialogAvailableItemListModel;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.available_items.DialogAvailableItemsView;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
||||||
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.yes_no.DialogYesNoView;
|
import it.integry.integrywmsnative.view.dialogs.yes_no.DialogYesNoView;
|
||||||
@@ -98,7 +102,8 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
|||||||
mViewModel.init(
|
mViewModel.init(
|
||||||
DataCache.retrieveItem(getIntent().getStringExtra(KEY_INVENTARIO)),
|
DataCache.retrieveItem(getIntent().getStringExtra(KEY_INVENTARIO)),
|
||||||
DataCache.retrieveItem(getIntent().getStringExtra(KEY_INVENTARIO_ARTS)),
|
DataCache.retrieveItem(getIntent().getStringExtra(KEY_INVENTARIO_ARTS)),
|
||||||
SettingsManager.iDB().isFlagCanAddUnknownItemsInventario());
|
SettingsManager.iDB().isFlagCanAddUnknownItemsInventario(),
|
||||||
|
SettingsManager.iDB().isFlagShouldAskToCreateOrUpdateRowInventario());
|
||||||
|
|
||||||
initToolbar();
|
initToolbar();
|
||||||
initBarcodeReader();
|
initBarcodeReader();
|
||||||
@@ -131,6 +136,9 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
|||||||
if (menuItem.getItemId() == R.id.export) {
|
if (menuItem.getItemId() == R.id.export) {
|
||||||
requestExportConfirm();
|
requestExportConfirm();
|
||||||
return true;
|
return true;
|
||||||
|
} else if (menuItem.getItemId() == R.id.search_art) {
|
||||||
|
manualSearch();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -175,8 +183,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
this.mViewModel.processBarcodeDTO(data, this::onLoadingEnded);
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -201,6 +208,18 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
|||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void manualSearch() {
|
||||||
|
BarcodeManager.disable();
|
||||||
|
DialogSimpleInputHelper.makeInputDialog(this,
|
||||||
|
"Ricerca articolo",
|
||||||
|
null,
|
||||||
|
"Cod articolo / Barcode",
|
||||||
|
barcodeProd ->
|
||||||
|
this.mViewModel.loadArticoloByCodMartOrBarcode(barcodeProd, BarcodeManager::enable),
|
||||||
|
BarcodeManager::enable)
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, boolean canOverflowOrderQuantity, boolean canPartitaMagBeChanged, boolean canLUBeClosed, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
public void onItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, boolean canOverflowOrderQuantity, boolean canPartitaMagBeChanged, boolean canLUBeClosed, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
||||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||||
@@ -214,6 +233,7 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
|||||||
.setTotalQtaToBeTaken(totalQtaToBeTaken)
|
.setTotalQtaToBeTaken(totalQtaToBeTaken)
|
||||||
.setTotalNumCnfToBeTaken(totalNumCnfToBeTaken)
|
.setTotalNumCnfToBeTaken(totalNumCnfToBeTaken)
|
||||||
.setQtaCnfToBeTaken(qtaCnfToBeTaken)
|
.setQtaCnfToBeTaken(qtaCnfToBeTaken)
|
||||||
|
.setCanInputZeroQuantity(true)
|
||||||
.setCanOverflowOrderQuantity(canOverflowOrderQuantity)
|
.setCanOverflowOrderQuantity(canOverflowOrderQuantity)
|
||||||
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
|
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
|
||||||
.setCanLUBeClosed(canLUBeClosed)
|
.setCanLUBeClosed(canLUBeClosed)
|
||||||
@@ -234,12 +254,52 @@ public class PickingInventarioActivity extends BaseActivity implements PickingIn
|
|||||||
.show(getSupportFragmentManager(), "tag");
|
.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemAlreadyFound(InventarioArtDTO matchedArt, List<InventarioRowRoomDTO> alreadyScannedItems) {
|
||||||
|
final List<DialogSelectDocRowsItemListModel<Object>> dialogSelectDocRowsItemListModels = Stream.of(alreadyScannedItems)
|
||||||
|
.map(x -> new DialogSelectDocRowsItemListModel<>()
|
||||||
|
.setBarcode(x.getScanCodBarre())
|
||||||
|
.setCodMart(x.getCodMart())
|
||||||
|
.setDescrizione(x.getDescrizione())
|
||||||
|
.setQtaOrd(x.getQta())
|
||||||
|
.setUntMisOrd(x.getUntMis())
|
||||||
|
.setNew(false)
|
||||||
|
.setOriginalModel(x))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
dialogSelectDocRowsItemListModels.add(new DialogSelectDocRowsItemListModel<>()
|
||||||
|
.setCodMart(matchedArt.getCodMart())
|
||||||
|
.setDescrizione(matchedArt.getDescrizione())
|
||||||
|
.setQtaOrd(BigDecimal.ZERO)
|
||||||
|
.setUntMisOrd(matchedArt.getUntMis())
|
||||||
|
.setNew(true));
|
||||||
|
|
||||||
|
DialogSelectDocRowsView.newInstance(dialogSelectDocRowsItemListModels, data -> {
|
||||||
|
if (data.isNew())
|
||||||
|
this.mViewModel.dispatchRowInsert(null, matchedArt, null);
|
||||||
|
else
|
||||||
|
this.mViewModel.dispatchRowEdit(matchedArt.toMtbAart(), (InventarioRowRoomDTO) data.getOriginalModel());
|
||||||
|
}, () -> {
|
||||||
|
|
||||||
|
}).show(this.getSupportFragmentManager(), "DialogSelectDocRowsView");
|
||||||
|
}
|
||||||
|
|
||||||
public void showAvailableArts() {
|
public void showAvailableArts() {
|
||||||
var listaMtbAart = Stream.of(this.mViewModel.getAvailableArts())
|
var listaMtbAart = Stream.of(this.mViewModel.getAvailableArts())
|
||||||
.map(InventarioArtDTO::toMtbAart)
|
.map(InventarioArtDTO::toMtbAart)
|
||||||
|
.map(DialogAvailableItemListModel::fromMtbAart)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
new DialogChooseArtFromListaArtsView(false, listaMtbAart, null)
|
for (var inventoryItem : mViewModel.currentInventarioRows.getValue()) {
|
||||||
.show(getSupportFragmentManager(), "tag");
|
var codMart = inventoryItem.getCodMart();
|
||||||
|
|
||||||
|
Stream.of(listaMtbAart)
|
||||||
|
.filter(x -> x.getCodMart().equalsIgnoreCase(codMart))
|
||||||
|
.forEach(x -> x.setAggiunto(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
new DialogAvailableItemsView(listaMtbAart, mtbAartClicked -> this.mViewModel.loadArticoloByMtbAart(mtbAartClicked, null))
|
||||||
|
.show(getSupportFragmentManager(), "DialogAvailableInventarioItemsView");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,13 +4,16 @@ import dagger.Module;
|
|||||||
import dagger.Provides;
|
import dagger.Provides;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRepository;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRowRepository;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRowRepository;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
|
|
||||||
@Module(subcomponents = PickingInventarioComponent.class)
|
@Module(subcomponents = PickingInventarioComponent.class)
|
||||||
public class PickingInventarioModule {
|
public class PickingInventarioModule {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
PickingInventarioViewModel providesPickingInventarioViewModel(InventarioRepository inventarioRepository, InventarioRowRepository inventarioRowRepository) {
|
PickingInventarioViewModel providesPickingInventarioViewModel(InventarioRepository inventarioRepository,
|
||||||
return new PickingInventarioViewModel(inventarioRepository, inventarioRowRepository);
|
InventarioRowRepository inventarioRowRepository,
|
||||||
|
BarcodeRESTConsumer barcodeRESTConsumer) {
|
||||||
|
return new PickingInventarioViewModel(inventarioRepository, inventarioRowRepository, barcodeRESTConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,8 @@ import androidx.lifecycle.LiveData;
|
|||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
import androidx.lifecycle.ViewModel;
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -15,10 +17,12 @@ import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRowRoomDT
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRepository;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRowRepository;
|
import it.integry.integrywmsnative.core.data_store.db.respository_new.InventarioRowRepository;
|
||||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.NoResultFromCodMartException;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||||
import it.integry.integrywmsnative.core.rest.model.inventario.InventarioArtDTO;
|
import it.integry.integrywmsnative.core.rest.model.inventario.InventarioArtDTO;
|
||||||
@@ -26,6 +30,7 @@ import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
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.UtilityLiveData;
|
import it.integry.integrywmsnative.core.utility.UtilityLiveData;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGException;
|
import it.integry.integrywmsnative.gest.spedizione.exceptions.InvalidPesoKGException;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||||
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
||||||
@@ -33,26 +38,27 @@ import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
|
|||||||
public class PickingInventarioViewModel extends ViewModel {
|
public class PickingInventarioViewModel extends ViewModel {
|
||||||
|
|
||||||
|
|
||||||
|
private final BarcodeRESTConsumer barcodeRESTConsumer;
|
||||||
private final InventarioRepository inventarioRepository;
|
private final InventarioRepository inventarioRepository;
|
||||||
private final InventarioRowRepository inventarioRowRepository;
|
private final InventarioRowRepository inventarioRowRepository;
|
||||||
|
|
||||||
private boolean canAddUnknownItems;
|
|
||||||
|
|
||||||
public MutableLiveData<InventarioRoomDTO> currentInventario = new MutableLiveData<>();
|
public MutableLiveData<InventarioRoomDTO> currentInventario = new MutableLiveData<>();
|
||||||
public LiveData<List<InventarioRowRoomDTO>> currentInventarioRows = new MutableLiveData<>();
|
public LiveData<List<InventarioRowRoomDTO>> currentInventarioRows = new MutableLiveData<>();
|
||||||
|
private boolean canAddUnknownItems;
|
||||||
|
private boolean flagShouldAskToCreateOrUpdateRowInventario;
|
||||||
private List<InventarioArtDTO> availableInventarioArts;
|
private List<InventarioArtDTO> availableInventarioArts;
|
||||||
private Listener mListener;
|
private Listener mListener;
|
||||||
|
|
||||||
public PickingInventarioViewModel(
|
public PickingInventarioViewModel(InventarioRepository inventarioRepository,
|
||||||
InventarioRepository inventarioRepository,
|
InventarioRowRepository inventarioRowRepository,
|
||||||
InventarioRowRepository inventarioRowRepository) {
|
BarcodeRESTConsumer barcodeRESTConsumer) {
|
||||||
this.inventarioRepository = inventarioRepository;
|
this.inventarioRepository = inventarioRepository;
|
||||||
this.inventarioRowRepository = inventarioRowRepository;
|
this.inventarioRowRepository = inventarioRowRepository;
|
||||||
|
this.barcodeRESTConsumer = barcodeRESTConsumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(InventarioRoomDTO inventarioRoomDTO, List<InventarioArtDTO> inventarioArts, boolean canAddUnknownItems) {
|
public void init(InventarioRoomDTO inventarioRoomDTO, List<InventarioArtDTO> inventarioArts, boolean canAddUnknownItems, boolean flagShouldAskToCreateOrUpdateRowInventario) {
|
||||||
this.canAddUnknownItems = canAddUnknownItems;
|
this.canAddUnknownItems = canAddUnknownItems;
|
||||||
|
this.flagShouldAskToCreateOrUpdateRowInventario = flagShouldAskToCreateOrUpdateRowInventario;
|
||||||
|
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
@@ -80,61 +86,39 @@ public class PickingInventarioViewModel extends ViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
if (UtilityBarcode.isEanPeso(barcodeScanDTO)) {
|
if (UtilityBarcode.isEanPeso(barcodeScanDTO)) {
|
||||||
//Cerco tramite etichetta ean peso
|
//Cerco tramite etichetta ean peso
|
||||||
this.executeEtichettaEanPeso(barcodeScanDTO, onComplete);
|
this.executeEtichettaEanPeso(barcodeScanDTO, onComplete);
|
||||||
|
|
||||||
|
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||||
|
//Cerco tramite etichetta ean 128 (che può indicarmi un articolo o una UL)
|
||||||
|
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.loadArticolo(barcodeScanDTO.getStringValue(), null, onComplete);
|
this.loadArticolo(barcodeScanDTO.getStringValue(), null, onComplete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRow(InventarioRowRoomDTO itemToUpdate) {
|
public void loadArticoloByCodMartOrBarcode(String codMart, Runnable onComplete) {
|
||||||
var barcodeList = new ArrayList<String>();
|
var matchedArt = Stream.of(this.availableInventarioArts)
|
||||||
barcodeList.add(itemToUpdate.getScanCodBarre());
|
.filter(x -> x.getCodMart().equalsIgnoreCase(codMart) ||
|
||||||
|
x.getBarcode().contains(codMart))
|
||||||
var matchedArt = availableInventarioArts.stream()
|
|
||||||
.filter(x -> itemToUpdate.getCodMart() != null && x.getCodMart().contains(itemToUpdate.getCodMart()))
|
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
MtbAart articolo;
|
|
||||||
|
|
||||||
if (canAddUnknownItems && matchedArt == null) {
|
if (matchedArt == null) {
|
||||||
matchedArt = new InventarioArtDTO()
|
this.sendError(new NoResultFromCodMartException(codMart));
|
||||||
.setBarcode(barcodeList)
|
|
||||||
.setFlagQtaCnfFissa(true)
|
|
||||||
.setPlu(false)
|
|
||||||
.setUntMis(itemToUpdate.getUntMis())
|
|
||||||
.setQtaCnf(itemToUpdate.getQtaConf());
|
|
||||||
}
|
|
||||||
if (matchedArt != null) {
|
|
||||||
articolo = matchedArt.toMtbAart()
|
|
||||||
.setFlagTracciabilita("N");
|
|
||||||
dispatchRowEdit(articolo, itemToUpdate);
|
|
||||||
} else
|
|
||||||
this.sendError(new NoResultFromBarcodeException(itemToUpdate.getScanCodBarre()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteRow(InventarioRowRoomDTO itemToDelete) {
|
|
||||||
this.inventarioRowRepository.delete(itemToDelete, () -> {
|
|
||||||
}, this::sendError);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void exportAll(Runnable onComplete) {
|
|
||||||
if (this.currentInventarioRows.getValue().isEmpty()) {
|
|
||||||
this.sendError(new Exception("Impossibile esportare un inventario senza righe"));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sendOnLoadingStarted();
|
|
||||||
currentInventario.getValue().setInventarioRowList(this.currentInventarioRows.getValue());
|
|
||||||
|
|
||||||
this.inventarioRepository.export(currentInventario.getValue(), () -> {
|
loadArticolo(matchedArt.getBarcode().get(0), null, onComplete);
|
||||||
this.sendOnLoadingEnded();
|
}
|
||||||
onComplete.run();
|
|
||||||
}, this::sendError);
|
public void loadArticoloByMtbAart(MtbAart mtbAart, Runnable onComplete) {
|
||||||
|
loadArticolo(mtbAart.getBarCode(), null, onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -147,12 +131,38 @@ public class PickingInventarioViewModel extends ViewModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||||
|
barcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||||
|
|
||||||
|
String barcodeProd = null;
|
||||||
|
String codMart = null;
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||||
|
barcodeProd = ean128Model.Content;
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(ean128Model.Internal1))
|
||||||
|
codMart = ean128Model.Internal1;
|
||||||
|
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||||
|
this.loadArticolo(barcodeProd, ean128Model, onComplete);
|
||||||
|
|
||||||
|
} else if (!UtilityString.isNullOrEmpty(codMart)) {
|
||||||
|
this.loadArticoloByCodMartOrBarcode(codMart, onComplete);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||||
|
onComplete.run();
|
||||||
|
}
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
private void loadArticolo(String barcodeProd, Ean128Model ean128Model, Runnable onComplete) {
|
private void loadArticolo(String barcodeProd, Ean128Model ean128Model, Runnable onComplete) {
|
||||||
var barcodeList = new ArrayList<String>();
|
var barcodeList = new ArrayList<String>();
|
||||||
barcodeList.add(barcodeProd);
|
barcodeList.add(barcodeProd);
|
||||||
|
|
||||||
var matchedArt = availableInventarioArts.stream()
|
var matchedArt = availableInventarioArts.stream().filter(x -> x.getBarcode().contains(barcodeProd))
|
||||||
.filter(x -> x.getBarcode().contains(barcodeProd))
|
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
@@ -164,25 +174,36 @@ public class PickingInventarioViewModel extends ViewModel {
|
|||||||
.setPlu(false)
|
.setPlu(false)
|
||||||
.setUntMis("PZ")
|
.setUntMis("PZ")
|
||||||
.setQtaCnf(BigDecimal.ONE);
|
.setQtaCnf(BigDecimal.ONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchedArt != null) {
|
if (matchedArt != null) {
|
||||||
this.dispatchRowInsert(barcodeProd, matchedArt, ean128Model);
|
var alreadyScannedItems = searchArtInAlreadyScannedItems(matchedArt);
|
||||||
onComplete.run();
|
|
||||||
} else
|
|
||||||
this.sendError(new NoResultFromBarcodeException(barcodeProd));
|
|
||||||
|
|
||||||
|
if (alreadyScannedItems == null || alreadyScannedItems.isEmpty() || !flagShouldAskToCreateOrUpdateRowInventario)
|
||||||
|
this.dispatchRowInsert(barcodeProd, matchedArt, ean128Model);
|
||||||
|
|
||||||
|
else {
|
||||||
|
this.sendOnItemAlreadyFound(matchedArt, alreadyScannedItems);
|
||||||
|
|
||||||
|
}
|
||||||
|
if(onComplete != null) onComplete.run();
|
||||||
|
} else this.sendError(new NoResultFromBarcodeException(barcodeProd));
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<InventarioRowRoomDTO> searchArtInAlreadyScannedItems(InventarioArtDTO inventarioArtDTO) {
|
||||||
|
final List<InventarioRowRoomDTO> inventarioRows = this.currentInventarioRows.getValue();
|
||||||
|
|
||||||
|
if (inventarioRows == null || inventarioRows.isEmpty()) return null;
|
||||||
|
|
||||||
|
return Stream.of(inventarioRows).filter(x -> x.getCodMart() != null ? x.getCodMart().equalsIgnoreCase(inventarioArtDTO.getCodMart()) : inventarioArtDTO.getBarcode().contains(x.getScanCodBarre())).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void dispatchRowInsert(String barcode, InventarioArtDTO inventarioArtDTO, Ean128Model ean128Model) {
|
public void dispatchRowInsert(String barcode, InventarioArtDTO inventarioArtDTO, Ean128Model ean128Model) {
|
||||||
var mtbAart = inventarioArtDTO.toMtbAart();
|
var mtbAart = inventarioArtDTO.toMtbAart();
|
||||||
mtbAart.setFlagTracciabilita("N");
|
mtbAart.setFlagTracciabilita("N");
|
||||||
|
|
||||||
PickingObjectDTO pickingObjectDTO = new PickingObjectDTO()
|
PickingObjectDTO pickingObjectDTO = new PickingObjectDTO().setMtbAart(mtbAart).setTempPickData(PickDataDTO.fromEan128(ean128Model));
|
||||||
.setMtbAart(mtbAart)
|
|
||||||
.setTempPickData(PickDataDTO.fromEan128(ean128Model));
|
|
||||||
|
|
||||||
BigDecimal numCnfDaPrelevare = null;
|
BigDecimal numCnfDaPrelevare = null;
|
||||||
BigDecimal qtaColDaPrelevare = null;
|
BigDecimal qtaColDaPrelevare = null;
|
||||||
@@ -256,64 +277,25 @@ public class PickingInventarioViewModel extends ViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inventarioArtDTO.isPlu()) {
|
if (inventarioArtDTO.isPlu()) {
|
||||||
this.saveNewRow(pickingObjectDTO,
|
this.saveNewRow(pickingObjectDTO, initialNumCnf, initialQtaCnf, initialQtaTot, null, barcode);
|
||||||
initialNumCnf,
|
|
||||||
initialQtaCnf,
|
|
||||||
initialQtaTot,
|
|
||||||
null,
|
|
||||||
barcode);
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.sendOnItemDispatched(
|
this.sendOnItemDispatched(pickingObjectDTO, pickingObjectDTO.getMtbAart(), null, //initialNumCnf,
|
||||||
pickingObjectDTO,
|
initialQtaCnf, null, //initialQtaTot,
|
||||||
pickingObjectDTO.getMtbAart(),
|
null, null, null, null, null, null, false, true, false, (pickedQuantityDTO, shouldCloseLU) -> {
|
||||||
null, //initialNumCnf,
|
this.saveNewRow(pickingObjectDTO, pickedQuantityDTO.getNumCnf(), pickedQuantityDTO.getQtaCnf(), pickedQuantityDTO.getQtaTot(), pickedQuantityDTO.getPartitaMag(), barcode);
|
||||||
initialQtaCnf,
|
|
||||||
null, //initialQtaTot,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
|
||||||
this.saveNewRow(pickingObjectDTO,
|
|
||||||
pickedQuantityDTO.getNumCnf(),
|
|
||||||
pickedQuantityDTO.getQtaCnf(),
|
|
||||||
pickedQuantityDTO.getQtaTot(),
|
|
||||||
pickedQuantityDTO.getPartitaMag(),
|
|
||||||
barcode);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dispatchRowEdit(MtbAart mtbAart, InventarioRowRoomDTO inventarioRowRoomDTO) {
|
public void dispatchRowEdit(MtbAart mtbAart, InventarioRowRoomDTO inventarioRowRoomDTO) {
|
||||||
|
|
||||||
final PickingObjectDTO pickingObjectDTO = new PickingObjectDTO()
|
final PickingObjectDTO pickingObjectDTO = new PickingObjectDTO().setMtbAart(mtbAart);
|
||||||
.setMtbAart(mtbAart);
|
|
||||||
|
|
||||||
|
|
||||||
this.sendOnItemDispatched(
|
this.sendOnItemDispatched(pickingObjectDTO, pickingObjectDTO.getMtbAart(), inventarioRowRoomDTO.getNumConf(), inventarioRowRoomDTO.getQtaConf(), inventarioRowRoomDTO.getQta(), null, null, null, null, null, null, false, false, false, (pickedQuantityDTO, shouldCloseLU) -> {
|
||||||
pickingObjectDTO,
|
|
||||||
pickingObjectDTO.getMtbAart(),
|
|
||||||
inventarioRowRoomDTO.getNumConf(),
|
|
||||||
inventarioRowRoomDTO.getQtaConf(),
|
|
||||||
inventarioRowRoomDTO.getQta(),
|
|
||||||
null, null, null,
|
|
||||||
null, null, null,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
(pickedQuantityDTO, shouldCloseLU) -> {
|
|
||||||
|
|
||||||
this.saveEditedRow(inventarioRowRoomDTO,
|
this.saveEditedRow(inventarioRowRoomDTO, pickedQuantityDTO.getNumCnf(), pickedQuantityDTO.getQtaCnf(), pickedQuantityDTO.getQtaTot(), pickedQuantityDTO.getPartitaMag());
|
||||||
pickedQuantityDTO.getNumCnf(),
|
|
||||||
pickedQuantityDTO.getQtaCnf(),
|
|
||||||
pickedQuantityDTO.getQtaTot(),
|
|
||||||
pickedQuantityDTO.getPartitaMag());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -348,6 +330,47 @@ public class PickingInventarioViewModel extends ViewModel {
|
|||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateRow(InventarioRowRoomDTO itemToUpdate) {
|
||||||
|
var barcodeList = new ArrayList<String>();
|
||||||
|
barcodeList.add(itemToUpdate.getScanCodBarre());
|
||||||
|
|
||||||
|
var matchedArt = availableInventarioArts.stream()
|
||||||
|
.filter(x -> itemToUpdate.getCodMart() != null && x.getCodMart().contains(itemToUpdate.getCodMart()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
MtbAart articolo;
|
||||||
|
|
||||||
|
if (canAddUnknownItems && matchedArt == null) {
|
||||||
|
matchedArt = new InventarioArtDTO().setBarcode(barcodeList).setFlagQtaCnfFissa(true).setPlu(false).setUntMis(itemToUpdate.getUntMis()).setQtaCnf(itemToUpdate.getQtaConf());
|
||||||
|
}
|
||||||
|
if (matchedArt != null) {
|
||||||
|
articolo = matchedArt.toMtbAart().setFlagTracciabilita("N");
|
||||||
|
dispatchRowEdit(articolo, itemToUpdate);
|
||||||
|
} else this.sendError(new NoResultFromBarcodeException(itemToUpdate.getScanCodBarre()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteRow(InventarioRowRoomDTO itemToDelete) {
|
||||||
|
this.inventarioRowRepository.delete(itemToDelete, () -> {
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void exportAll(Runnable onComplete) {
|
||||||
|
if (this.currentInventarioRows.getValue().isEmpty()) {
|
||||||
|
this.sendError(new Exception("Impossibile esportare un inventario senza righe"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
currentInventario.getValue().setInventarioRowList(this.currentInventarioRows.getValue());
|
||||||
|
|
||||||
|
this.inventarioRepository.export(currentInventario.getValue(), () -> {
|
||||||
|
this.sendOnLoadingEnded();
|
||||||
|
onComplete.run();
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void sendOnLoadingStarted() {
|
private void sendOnLoadingStarted() {
|
||||||
if (this.mListener != null) mListener.onLoadingStarted();
|
if (this.mListener != null) mListener.onLoadingStarted();
|
||||||
@@ -361,36 +384,14 @@ public class PickingInventarioViewModel extends ViewModel {
|
|||||||
if (this.mListener != null) mListener.onError(ex);
|
if (this.mListener != null) mListener.onError(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnItemDispatched(PickingObjectDTO pickingObjectDTO,
|
private void sendOnItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, boolean canOverflowOrderQuantity, boolean canPartitaMagBeChanged, boolean canLUBeClosed, RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
||||||
MtbAart mtbAart,
|
if (this.mListener != null)
|
||||||
BigDecimal initialNumCnf,
|
mListener.onItemDispatched(pickingObjectDTO, mtbAart, initialNumCnf, initialQtaCnf, initialQtaTot, totalQtaAvailable, totalNumCnfAvailable, qtaCnfAvailable, totalQtaToBeTaken, totalNumCnfToBeTaken, qtaCnfToBeTaken, canOverflowOrderQuantity, canPartitaMagBeChanged, canLUBeClosed, onComplete);
|
||||||
BigDecimal initialQtaCnf,
|
}
|
||||||
BigDecimal initialQtaTot,
|
|
||||||
BigDecimal totalQtaAvailable,
|
private void sendOnItemAlreadyFound(InventarioArtDTO matchedArt, List<InventarioRowRoomDTO> alreadyScannedItems) {
|
||||||
BigDecimal totalNumCnfAvailable,
|
if (this.mListener != null)
|
||||||
BigDecimal qtaCnfAvailable,
|
this.mListener.onItemAlreadyFound(matchedArt, alreadyScannedItems);
|
||||||
BigDecimal totalQtaToBeTaken,
|
|
||||||
BigDecimal totalNumCnfToBeTaken,
|
|
||||||
BigDecimal qtaCnfToBeTaken,
|
|
||||||
boolean canOverflowOrderQuantity,
|
|
||||||
boolean canPartitaMagBeChanged,
|
|
||||||
boolean canLUBeClosed,
|
|
||||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete) {
|
|
||||||
if (this.mListener != null) mListener.onItemDispatched(pickingObjectDTO,
|
|
||||||
mtbAart,
|
|
||||||
initialNumCnf,
|
|
||||||
initialQtaCnf,
|
|
||||||
initialQtaTot,
|
|
||||||
totalQtaAvailable,
|
|
||||||
totalNumCnfAvailable,
|
|
||||||
qtaCnfAvailable,
|
|
||||||
totalQtaToBeTaken,
|
|
||||||
totalNumCnfToBeTaken,
|
|
||||||
qtaCnfToBeTaken,
|
|
||||||
canOverflowOrderQuantity,
|
|
||||||
canPartitaMagBeChanged,
|
|
||||||
canLUBeClosed,
|
|
||||||
onComplete);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PickingInventarioViewModel setListener(Listener listener) {
|
public PickingInventarioViewModel setListener(Listener listener) {
|
||||||
@@ -402,22 +403,10 @@ public class PickingInventarioViewModel extends ViewModel {
|
|||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|
||||||
void onItemDispatched(PickingObjectDTO pickingObjectDTO,
|
void onItemDispatched(PickingObjectDTO pickingObjectDTO, MtbAart mtbAart, BigDecimal initialNumCnf, BigDecimal initialQtaCnf, BigDecimal initialQtaTot, BigDecimal totalQtaAvailable, BigDecimal totalNumCnfAvailable, BigDecimal qtaCnfAvailable, BigDecimal totalQtaToBeTaken, BigDecimal totalNumCnfToBeTaken, BigDecimal qtaCnfToBeTaken, boolean canOverflowOrderQuantity, boolean canPartitaMagBeChanged, boolean canLUBeClosed, RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
|
||||||
MtbAart mtbAart,
|
|
||||||
BigDecimal initialNumCnf,
|
|
||||||
BigDecimal initialQtaCnf,
|
|
||||||
BigDecimal initialQtaTot,
|
|
||||||
BigDecimal totalQtaAvailable,
|
|
||||||
BigDecimal totalNumCnfAvailable,
|
|
||||||
BigDecimal qtaCnfAvailable,
|
|
||||||
BigDecimal totalQtaToBeTaken,
|
|
||||||
BigDecimal totalNumCnfToBeTaken,
|
|
||||||
BigDecimal qtaCnfToBeTaken,
|
|
||||||
boolean canOverflowOrderQuantity,
|
|
||||||
boolean canPartitaMagBeChanged,
|
|
||||||
boolean canLUBeClosed,
|
|
||||||
RunnableArgss<PickedQuantityDTO, Boolean> onComplete);
|
|
||||||
|
|
||||||
|
|
||||||
|
void onItemAlreadyFound(InventarioArtDTO matchedArt, List<InventarioRowRoomDTO> alreadyScannedItems);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,8 @@ import android.text.Html;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
|
import com.google.firebase.installations.FirebaseInstallations;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -16,6 +18,7 @@ import it.integry.integrywmsnative.SplashActivity;
|
|||||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
import it.integry.integrywmsnative.core.di.BindableString;
|
import it.integry.integrywmsnative.core.di.BindableString;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
import it.integry.integrywmsnative.core.expansion.BaseActivity;
|
||||||
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityWindow;
|
import it.integry.integrywmsnative.core.utility.UtilityWindow;
|
||||||
import it.integry.integrywmsnative.databinding.ActivityLoginBinding;
|
import it.integry.integrywmsnative.databinding.ActivityLoginBinding;
|
||||||
@@ -29,6 +32,9 @@ public class LoginActivity extends BaseActivity implements LoginViewModel.Listen
|
|||||||
@Inject
|
@Inject
|
||||||
LoginViewModel mViewmodel;
|
LoginViewModel mViewmodel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
|
|
||||||
public BindableString username = new BindableString();
|
public BindableString username = new BindableString();
|
||||||
public BindableString password = new BindableString();
|
public BindableString password = new BindableString();
|
||||||
@@ -119,9 +125,13 @@ public class LoginActivity extends BaseActivity implements LoginViewModel.Listen
|
|||||||
|
|
||||||
private void showProfileDBSelectionDialog(final String protocol, final String host, final int port, final List<String> availableProfiles) {
|
private void showProfileDBSelectionDialog(final String protocol, final String host, final int port, final List<String> availableProfiles) {
|
||||||
Runnable onComplete = () -> {
|
Runnable onComplete = () -> {
|
||||||
|
|
||||||
|
FirebaseInstallations.getInstance().getId().addOnCompleteListener(fid -> {
|
||||||
|
SettingsManager.i().getUserSession().setDeviceId(fid.getResult());
|
||||||
SettingsManager.update();
|
SettingsManager.update();
|
||||||
|
|
||||||
startSplashActivity();
|
systemRESTConsumer.registerDevice(this::startSplashActivity, this::onError);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
loginButtonEnabled.set(true);
|
loginButtonEnabled.set(true);
|
||||||
|
|||||||
@@ -861,7 +861,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
|||||||
DialogSimpleMessageView.makeInfoDialog(getText(R.string.orders).toString(),
|
DialogSimpleMessageView.makeInfoDialog(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.ordered_articles, codMarts.size())
|
||||||
+ "<br />" +
|
+ "<br />" +
|
||||||
"<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,
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ public class ProdOrdineProduzioneElencoFragment extends BaseFragment implements
|
|||||||
DialogSimpleMessageView.makeInfoDialog(getText(R.string.orders).toString(),
|
DialogSimpleMessageView.makeInfoDialog(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.ordered_articles, (int) artsCounter)),
|
||||||
null,
|
null,
|
||||||
() -> {
|
() -> {
|
||||||
|
|
||||||
|
|||||||
@@ -5,22 +5,14 @@ import android.content.Context;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
|
||||||
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.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
|
||||||
import it.integry.integrywmsnative.databinding.DialogInputQuantityToReturnBinding;
|
import it.integry.integrywmsnative.databinding.DialogInputQuantityToReturnBinding;
|
||||||
|
|
||||||
public class InputQuantityToReturnDialog {
|
public class InputQuantityToReturnDialog {
|
||||||
|
|||||||
@@ -28,8 +28,9 @@ public class ProdRientroMerceViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void refreshOrderList() {
|
public void refreshOrderList() {
|
||||||
new Thread(this::sendOnOrdersLoadingStarted).start();
|
this.sendOnOrdersLoadingStarted();
|
||||||
String codAnag = SettingsManager.iDB().getFilterFornitoreProd();
|
String codAnag = SettingsManager.iDB().getFilterFornitoreProd();
|
||||||
|
|
||||||
this.mMesRESTConsumer.getOrdiniLavorazione("I", null, codAnag, ordiniLavorazioneList -> {
|
this.mMesRESTConsumer.getOrdiniLavorazione("I", null, codAnag, ordiniLavorazioneList -> {
|
||||||
this.mOrdiniLavorazioneAperti.postValue(ordiniLavorazioneList);
|
this.mOrdiniLavorazioneAperti.postValue(ordiniLavorazioneList);
|
||||||
this.sendOnOrdersLoadingEnded();
|
this.sendOnOrdersLoadingEnded();
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ import androidx.core.content.ContextCompat;
|
|||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
import com.ravikoradiya.liveadapter.LiveAdapter;
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
import com.ravikoradiya.liveadapter.Type;
|
import com.ravikoradiya.liveadapter.Type;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -36,7 +38,9 @@ import it.integry.integrywmsnative.core.settings.SettingsManager;
|
|||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.databinding.ActivityPvOrdineAcquistoEditBinding;
|
import it.integry.integrywmsnative.databinding.ActivityPvOrdineAcquistoEditBinding;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentPvArticoliOrdineAcquistoListSingleItemBinding;
|
import it.integry.integrywmsnative.databinding.FragmentPvArticoliOrdineAcquistoListSingleItemBinding;
|
||||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.DialogEditArticoloView;
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.edit_articolo.DialogEditArticoloView;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.selectArtFromList.DialogSelectArtToOrderItemListModel;
|
||||||
|
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.selectArtFromList.DialogSelectArtToOrderView;
|
||||||
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
import it.integry.integrywmsnative.ui.FabMenuCustomAnimations;
|
||||||
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogAskActionView;
|
import it.integry.integrywmsnative.view.dialogs.DialogAskActionView;
|
||||||
@@ -165,7 +169,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
|||||||
() -> {
|
() -> {
|
||||||
this.deleteArticolo(articoloOrdine);
|
this.deleteArticolo(articoloOrdine);
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
}).show(getSupportFragmentManager(), "tag");
|
}, BarcodeManager::enable).show(getSupportFragmentManager(), "tag");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +195,7 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
|||||||
Toast.makeText(this, "Articolo aggiunto all'ordine!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Articolo aggiunto all'ordine!", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
this.mViewModel.refreshListArticoli(onSuccess);
|
this.mViewModel.refreshListArticoli(onSuccess);
|
||||||
}, null).show(this.getSupportFragmentManager(), "DialogEditArticoloView");
|
}, this::onLoadingEnded).show(this.getSupportFragmentManager(), "DialogEditArticoloView");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -202,6 +206,16 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
|||||||
onSuccess, this::onLoadingEnded).show(getSupportFragmentManager(), "confirmExceedingQtyOrder");
|
onSuccess, this::onLoadingEnded).show(getSupportFragmentManager(), "confirmExceedingQtyOrder");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void confirmCheckForUnlistedProduct(String barcode) {
|
||||||
|
DialogSimpleMessageView.makeInfoDialog(getText(R.string.info).toString(),
|
||||||
|
Html.fromHtml(getResources().getString(R.string.confirm_order_unlisted_item)),
|
||||||
|
null,
|
||||||
|
() -> {
|
||||||
|
this.mViewModel.loadArticolo(barcode);
|
||||||
|
}, this::onLoadingEnded).show(getSupportFragmentManager(), "confirmExceedingQtyOrder");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColorFromResource(int resId) {
|
public int getColorFromResource(int resId) {
|
||||||
return getResources().getColor(resId);
|
return getResources().getColor(resId);
|
||||||
@@ -236,4 +250,34 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
|||||||
return SettingsManager.iDB().getFlagOrdinaNuoviArticoliInGriglia();
|
return SettingsManager.iDB().getFlagOrdinaNuoviArticoliInGriglia();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void confirmExportInvalidProducts(Runnable onConfirm) {
|
||||||
|
DialogSimpleMessageView.makeInfoDialog(getText(R.string.warning).toString(),
|
||||||
|
Html.fromHtml(getResources().getString(R.string.confirm_export_invalid_product)),
|
||||||
|
null,
|
||||||
|
onConfirm
|
||||||
|
,
|
||||||
|
this::onLoadingEnded).show(getSupportFragmentManager(), "confirmExportInvalidProducts");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void chooseArtFromList(List<ArticoloOrdinabileDTO> listArticoli, RunnableArgs<ArticoloOrdinabileDTO> onArtChosen) {
|
||||||
|
List<DialogSelectArtToOrderItemListModel<Object>> dataset =
|
||||||
|
Stream.of(listArticoli)
|
||||||
|
.map(x -> new DialogSelectArtToOrderItemListModel<>()
|
||||||
|
.setCodMart(x.getCodMart())
|
||||||
|
.setBarcode(x.getSelectedBarcode())
|
||||||
|
.setOriginalModel(x)
|
||||||
|
.setNew(mViewModel.isArtInOrder(x))
|
||||||
|
.setDescrizione(x.getDescrizione())
|
||||||
|
.setQtaOrd(BigDecimal.valueOf(x.getQtaOrd()))
|
||||||
|
.setCodAlis(x.getCodAlis())
|
||||||
|
.setUntMisOrd(x.getUntMis()))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
DialogSelectArtToOrderView.newInstance(dataset,
|
||||||
|
data -> onArtChosen.run((ArticoloOrdinabileDTO) data.getOriginalModel()),
|
||||||
|
this::onLoadingEnded)
|
||||||
|
.show(this.getSupportFragmentManager(), "dialogSelectDocRowsNew");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@@ -22,7 +22,10 @@ import it.integry.integrywmsnative.core.data_store.db.repository.ArticoloGriglia
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.view_model.ArticoloOrdinabileDTO;
|
import it.integry.integrywmsnative.core.data_store.db.view_model.ArticoloOrdinabileDTO;
|
||||||
|
import it.integry.integrywmsnative.core.exception.ArtNotFoundInGridException;
|
||||||
import it.integry.integrywmsnative.core.exception.EmptyOrderException;
|
import it.integry.integrywmsnative.core.exception.EmptyOrderException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.ExpiredProductListException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.MultipleResultFromBarcodeException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoArtsInGridException;
|
import it.integry.integrywmsnative.core.exception.NoArtsInGridException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
@@ -31,6 +34,7 @@ import it.integry.integrywmsnative.core.rest.consumers.PVOrdiniAcquistoRESTConsu
|
|||||||
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.UtilityBigDecimal;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
|
|
||||||
public class PVOrdineAcquistoEditViewModel {
|
public class PVOrdineAcquistoEditViewModel {
|
||||||
|
|
||||||
@@ -58,6 +62,8 @@ public class PVOrdineAcquistoEditViewModel {
|
|||||||
private List<ArticoloOrdinabileDTO> mArticoliGriglia = new ArrayList<>();
|
private List<ArticoloOrdinabileDTO> mArticoliGriglia = new ArrayList<>();
|
||||||
private final MutableLiveData<List<ArticoloOrdine>> mArticoli = new MutableLiveData<>();
|
private final MutableLiveData<List<ArticoloOrdine>> mArticoli = new MutableLiveData<>();
|
||||||
|
|
||||||
|
private Calendar dataInizioModifica;
|
||||||
|
|
||||||
|
|
||||||
public PVOrdineAcquistoEditViewModel(OrdineRepository ordineRepository,
|
public PVOrdineAcquistoEditViewModel(OrdineRepository ordineRepository,
|
||||||
GrigliaRepository grigliaRepository,
|
GrigliaRepository grigliaRepository,
|
||||||
@@ -75,6 +81,14 @@ public class PVOrdineAcquistoEditViewModel {
|
|||||||
this.mCurrentOrdine = ordine;
|
this.mCurrentOrdine = ordine;
|
||||||
mArticoliGriglia.clear();
|
mArticoliGriglia.clear();
|
||||||
mArticoliGriglia.addAll(articoliGriglia);
|
mArticoliGriglia.addAll(articoliGriglia);
|
||||||
|
|
||||||
|
Calendar today = Calendar.getInstance();
|
||||||
|
today.set(Calendar.MILLISECOND, 0);
|
||||||
|
today.set(Calendar.SECOND, 0);
|
||||||
|
today.set(Calendar.MINUTE, 0);
|
||||||
|
today.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
|
||||||
|
this.dataInizioModifica = today;
|
||||||
this.refreshListArticoli();
|
this.refreshListArticoli();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,10 +96,21 @@ public class PVOrdineAcquistoEditViewModel {
|
|||||||
refreshListArticoli(null);
|
refreshListArticoli(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isOrderSessionInvalid() {
|
||||||
|
Calendar today = Calendar.getInstance();
|
||||||
|
today.set(Calendar.MILLISECOND, 0);
|
||||||
|
today.set(Calendar.SECOND, 0);
|
||||||
|
today.set(Calendar.MINUTE, 0);
|
||||||
|
today.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
|
||||||
|
return today.after(this.dataInizioModifica);
|
||||||
|
}
|
||||||
|
|
||||||
public void refreshListArticoli(Runnable onSuccess) {
|
public void refreshListArticoli(Runnable onSuccess) {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
this.loadArticoli(mCurrentOrdine, articoli -> {
|
this.loadArticoli(mCurrentOrdine, articoli -> {
|
||||||
articoli = Stream.of(articoli).map(this::completeDataArticoli).sorted((a, b) -> a.getDataIns().after(b.getDataIns()) ? -1 : 1).toList();
|
articoli = Stream.of(articoli).map(this::completeDataArticoli).sorted((a, b) -> a.getDataIns().after(b.getDataIns()) ? -1 : 1).toList();
|
||||||
|
|
||||||
this.mArticoli.postValue(articoli);
|
this.mArticoli.postValue(articoli);
|
||||||
this.sendOnLoadingEnded();
|
this.sendOnLoadingEnded();
|
||||||
if (onSuccess != null)
|
if (onSuccess != null)
|
||||||
@@ -109,6 +134,8 @@ public class PVOrdineAcquistoEditViewModel {
|
|||||||
art.setFlagQtaMultipla(artGrid.getFlagQtaMultipla());
|
art.setFlagQtaMultipla(artGrid.getFlagQtaMultipla());
|
||||||
art.setCtMaxOrd(BigDecimal.valueOf(artGrid.getCtMaxOrd()));
|
art.setCtMaxOrd(BigDecimal.valueOf(artGrid.getCtMaxOrd()));
|
||||||
art.setSystemNote(artGrid.generateSystemNote());
|
art.setSystemNote(artGrid.generateSystemNote());
|
||||||
|
} else {
|
||||||
|
art.setInvalid(true);
|
||||||
}
|
}
|
||||||
return art;
|
return art;
|
||||||
}
|
}
|
||||||
@@ -133,15 +160,29 @@ public class PVOrdineAcquistoEditViewModel {
|
|||||||
try {
|
try {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
ArticoloOrdinabileDTO articoloDTO = getArticoloFromBarcode(barcode);
|
List<ArticoloOrdinabileDTO> listArticoli = matchArticoliForBarcode(barcode);
|
||||||
if (articoloDTO == null) {
|
if (listArticoli == null || listArticoli.isEmpty()) {
|
||||||
|
if (SettingsManager.iDB().isFlagConsentiFuoriPianoLogistico() && UtilityString.isNullOrEmpty(mCurrentOrdine.getCodAlis())) {
|
||||||
|
this.mListener.confirmCheckForUnlistedProduct(barcode);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
throw new NoResultFromBarcodeException(barcode);
|
throw new NoResultFromBarcodeException(barcode);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (listArticoli.size() == 1) {
|
||||||
this.addArticoloToOrdine(
|
this.addArticoloToOrdine(
|
||||||
articoloDTO,
|
listArticoli.get(0),
|
||||||
this::sendOnLoadingEnded,
|
this::sendOnLoadingEnded,
|
||||||
this::sendError
|
this::sendError
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
this.mListener.chooseArtFromList(listArticoli, (art) -> {
|
||||||
|
this.addArticoloToOrdine(
|
||||||
|
art,
|
||||||
|
this::sendOnLoadingEnded,
|
||||||
|
this::sendError);
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.sendError(e);
|
this.sendError(e);
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
@@ -163,17 +204,19 @@ public class PVOrdineAcquistoEditViewModel {
|
|||||||
|
|
||||||
var articolo = foundArt != null ? completeDataArticoli(foundArt) : convertToArticoloOrdine(art, mCurrentOrdine);
|
var articolo = foundArt != null ? completeDataArticoli(foundArt) : convertToArticoloOrdine(art, mCurrentOrdine);
|
||||||
Runnable saveAction = () -> {
|
Runnable saveAction = () -> {
|
||||||
|
|
||||||
articolo.setQtaOrd(articolo.getQtaOrd() + articolo.getQtaCnf());
|
articolo.setQtaOrd(articolo.getQtaOrd() + articolo.getQtaCnf());
|
||||||
mArticoliOrdineRepository.saveArticoloToOrdine(articolo, () -> this.refreshListArticoli(onSuccess), onFail);
|
mArticoliOrdineRepository.saveArticoloToOrdine(articolo, () -> this.refreshListArticoli(onSuccess), onFail);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isAutoOrderOnScan()) {
|
if (isAutoOrderOnScan()) {
|
||||||
if (!UtilityBigDecimal.isNullOrZero(articolo.getCtMaxOrd()) && UtilityBigDecimal.greaterThan(BigDecimal.valueOf(articolo.getQtaOrd() + articolo.getQtaCnf()), articolo.getCtMaxOrd())) {
|
if (!UtilityBigDecimal.isNullOrZero(articolo.getCtMaxOrd()) && UtilityBigDecimal.greaterThan(BigDecimal.valueOf(articolo.getQtaOrd() + articolo.getQtaCnf()), articolo.getCtMaxOrd().multiply(BigDecimal.valueOf(articolo.getQtaCnf())))) {
|
||||||
mListener.confirmExceedingQtyOrder(saveAction);
|
mListener.confirmExceedingQtyOrder(saveAction);
|
||||||
} else {
|
} else {
|
||||||
saveAction.run();
|
saveAction.run();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
articolo.setQtaOrd(articolo.getQtaOrd() > 0f ? articolo.getQtaOrd() : articolo.getQtaCnf());
|
||||||
this.sendOnItemDispatched(articolo, onSuccess);
|
this.sendOnItemDispatched(articolo, onSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +240,6 @@ public class PVOrdineAcquistoEditViewModel {
|
|||||||
articolo.setFlagQtaMultipla(art.getFlagQtaMultipla());
|
articolo.setFlagQtaMultipla(art.getFlagQtaMultipla());
|
||||||
articolo.setQtaMinOrdinabile(art.getQtaMinOrdinabile());
|
articolo.setQtaMinOrdinabile(art.getQtaMinOrdinabile());
|
||||||
articolo.setMerceDaRic(art.getMerceDaRic());
|
articolo.setMerceDaRic(art.getMerceDaRic());
|
||||||
articolo.setQtaCnf(art.getQtaCnf());
|
|
||||||
articolo.setUntMis(art.getUntMis());
|
articolo.setUntMis(art.getUntMis());
|
||||||
articolo.setDescrizione(art.getDescrizione());
|
articolo.setDescrizione(art.getDescrizione());
|
||||||
articolo.setDataIns(UtilityDate.getDateInstance());
|
articolo.setDataIns(UtilityDate.getDateInstance());
|
||||||
@@ -207,29 +249,27 @@ public class PVOrdineAcquistoEditViewModel {
|
|||||||
articolo.setQtaProposta(art.getQtaProposta());
|
articolo.setQtaProposta(art.getQtaProposta());
|
||||||
articolo.setNewNoPromo(art.isNewNoPromo());
|
articolo.setNewNoPromo(art.isNewNoPromo());
|
||||||
articolo.setSystemNote(art.generateSystemNote());
|
articolo.setSystemNote(art.generateSystemNote());
|
||||||
articolo.setQtaOrd(art.getQtaOrd());
|
articolo.setQtaCnf(art.getQtaCnf() > 0f ? art.getQtaCnf() : 1);
|
||||||
articolo.setCodAlis(art.getCodAlis());
|
articolo.setCodAlis(art.getCodAlis());
|
||||||
articolo.setCtMaxOrd(BigDecimal.valueOf(art.getCtMaxOrd()));
|
articolo.setCtMaxOrd(BigDecimal.valueOf(art.getCtMaxOrd()));
|
||||||
|
|
||||||
return articolo;
|
return articolo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArticoloOrdinabileDTO getArticoloFromBarcode(String barcode) throws NoArtsInGridException {
|
public List<ArticoloOrdinabileDTO> matchArticoliForBarcode(String barcode) throws NoArtsInGridException, MultipleResultFromBarcodeException, NoResultFromBarcodeException {
|
||||||
if (mArticoliGriglia == null || mArticoliGriglia.isEmpty()) {
|
if (mArticoliGriglia == null || mArticoliGriglia.isEmpty()) {
|
||||||
throw new NoArtsInGridException();
|
throw new NoArtsInGridException();
|
||||||
}
|
}
|
||||||
ArticoloOrdinabileDTO art = Stream.of(mArticoliGriglia).filter(articolo ->
|
List<ArticoloOrdinabileDTO> articoli = Stream.of(mArticoliGriglia).filter(articolo ->
|
||||||
articolo.getCodMart().equalsIgnoreCase(barcode) ||
|
articolo.getCodMart().equalsIgnoreCase(barcode) ||
|
||||||
articolo.getBarcode().contains(barcode) ||
|
articolo.getBarcode().contains(barcode) ||
|
||||||
articolo.getBarcode().contains(StringUtils.leftPad(barcode, 13, "0"))
|
articolo.getBarcode().contains(StringUtils.leftPad(barcode, 13, "0"))
|
||||||
|
|
||||||
)
|
).map((art) -> art.setSelectedBarcode(barcode))
|
||||||
// .sortBy(x -> x.getSortByBarcodeCondition(barcode))
|
// .sortBy(x -> x.getSortByBarcodeCondition(barcode))
|
||||||
.findFirst().orElse(null);
|
.toList();
|
||||||
if (art != null) {
|
|
||||||
art.setSelectedBarcode(barcode);
|
return articoli;
|
||||||
}
|
|
||||||
return art;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -238,9 +278,9 @@ public class PVOrdineAcquistoEditViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<ArticoloOrdinabileDTO> getNewArticoli() {
|
private List<ArticoloOrdinabileDTO> getNewArticoli() {
|
||||||
return mArticoliGriglia.stream()
|
return Stream.of(mArticoliGriglia)
|
||||||
.filter(x -> x.getQtaOrd() > 0f)
|
.filter(x -> x.getQtaOrd() > 0f)
|
||||||
.collect(Collectors.toList());
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void orderNewProducts() {
|
public void orderNewProducts() {
|
||||||
@@ -280,11 +320,17 @@ public class PVOrdineAcquistoEditViewModel {
|
|||||||
|
|
||||||
public void exportOrdine(Runnable onComplete) {
|
public void exportOrdine(Runnable onComplete) {
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
if (mArticoli.getValue() == null) {
|
if (isOrderSessionInvalid()) {
|
||||||
|
this.sendError(new ExpiredProductListException());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mArticoli.getValue() == null || mArticoli.getValue().isEmpty()) {
|
||||||
this.sendError(new EmptyOrderException());
|
this.sendError(new EmptyOrderException());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
|
|
||||||
|
Runnable saveOrdine = () -> {
|
||||||
pvOrdiniAcquistoRESTConsumer.saveOrdine(mCurrentOrdine, mArticoli.getValue(), codMdep, (ordine) -> {
|
pvOrdiniAcquistoRESTConsumer.saveOrdine(mCurrentOrdine, mArticoli.getValue(), codMdep, (ordine) -> {
|
||||||
|
|
||||||
mOrdineRepository.updateOrder(ordine, ord -> {
|
mOrdineRepository.updateOrder(ordine, ord -> {
|
||||||
@@ -293,6 +339,15 @@ public class PVOrdineAcquistoEditViewModel {
|
|||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
|
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (Stream.of(mArticoli.getValue()).anyMatch(ArticoloOrdine::isInvalid)) {
|
||||||
|
|
||||||
|
this.mListener.confirmExportInvalidProducts(saveOrdine);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
saveOrdine.run();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendOnItemDispatched(ArticoloOrdine articoloOrdine, Runnable onSuccess) {
|
private void sendOnItemDispatched(ArticoloOrdine articoloOrdine, Runnable onSuccess) {
|
||||||
@@ -311,6 +366,51 @@ public class PVOrdineAcquistoEditViewModel {
|
|||||||
if (this.mListener != null) mListener.onError(ex);
|
if (this.mListener != null) mListener.onError(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void loadArticolo(String barcode) {
|
||||||
|
this.sendOnLoadingStarted();
|
||||||
|
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
|
||||||
|
pvOrdiniAcquistoRESTConsumer.retrieveArticolo(null, codMdep, barcode, (grigliaDTO) -> {
|
||||||
|
|
||||||
|
RunnableArgs<ArticoloOrdinabileDTO> addArtToOrder = (articolo) -> {
|
||||||
|
ArticoloOrdinabileDTO existingArt = Stream.of(mArticoliGriglia).filter(x -> x.getCodMart().equalsIgnoreCase(articolo.getCodMart())).findFirstOrElse(null);
|
||||||
|
if (existingArt != null) {
|
||||||
|
List<String> barcodes = existingArt.getBarcode();
|
||||||
|
barcodes.addAll(articolo.getBarcode());
|
||||||
|
barcodes = Stream.of(barcodes).distinct().toList();
|
||||||
|
existingArt.setBarcode(barcodes);
|
||||||
|
} else {
|
||||||
|
mArticoliGriglia.add(articolo);
|
||||||
|
}
|
||||||
|
this.processBarcode(barcode);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (grigliaDTO == null || grigliaDTO.getArticoli().isEmpty()) {
|
||||||
|
this.sendError(new ArtNotFoundInGridException());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (grigliaDTO.getArticoli().size() > 1) {
|
||||||
|
this.mListener.chooseArtFromList(grigliaDTO.getArticoli(), addArtToOrder);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ArticoloOrdinabileDTO newArt = Stream.of(grigliaDTO.getArticoli()).findFirstOrElse(null);
|
||||||
|
if (newArt == null) {
|
||||||
|
this.sendError(new ArtNotFoundInGridException());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
addArtToOrder.run(newArt);
|
||||||
|
|
||||||
|
|
||||||
|
}, this::sendError);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isArtInOrder(ArticoloOrdinabileDTO articolo) {
|
||||||
|
if (mArticoli.getValue() == null || mArticoli.getValue().isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Stream.of(mArticoli.getValue()).noneMatch(x -> x.getCodMart().equalsIgnoreCase(articolo.getCodMart()));
|
||||||
|
}
|
||||||
|
|
||||||
public interface Listener extends ILoadingListener {
|
public interface Listener extends ILoadingListener {
|
||||||
void onItemDispatched(ArticoloOrdine articoloOrdine, Runnable onSuccess);
|
void onItemDispatched(ArticoloOrdine articoloOrdine, Runnable onSuccess);
|
||||||
|
|
||||||
@@ -319,6 +419,12 @@ public class PVOrdineAcquistoEditViewModel {
|
|||||||
int getColorFromResource(int resId);
|
int getColorFromResource(int resId);
|
||||||
|
|
||||||
void onError(Exception ex);
|
void onError(Exception ex);
|
||||||
|
|
||||||
|
void confirmCheckForUnlistedProduct(String barcode);
|
||||||
|
|
||||||
|
void confirmExportInvalidProducts(Runnable onConfirm);
|
||||||
|
|
||||||
|
void chooseArtFromList(List<ArticoloOrdinabileDTO> listArticoli, RunnableArgs<ArticoloOrdinabileDTO> onArtChosen);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PVOrdineAcquistoEditViewModel setListener(Listener listener) {
|
public PVOrdineAcquistoEditViewModel setListener(Listener listener) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog;
|
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.edit_articolo;
|
||||||
|
|
||||||
import dagger.Subcomponent;
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog;
|
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.edit_articolo;
|
||||||
|
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
import dagger.Provides;
|
import dagger.Provides;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog;
|
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.edit_articolo;
|
||||||
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
@@ -85,7 +85,7 @@ public class DialogEditArticoloView extends BaseDialogFragment implements Dialog
|
|||||||
this.mViewModel
|
this.mViewModel
|
||||||
.setListener(this)
|
.setListener(this)
|
||||||
.setCurrentArticolo(this.mArticolo)
|
.setCurrentArticolo(this.mArticolo)
|
||||||
.setInitialQtaCnf(BigDecimal.valueOf(mArticolo.getQtaCnf()))
|
.setInitialQtaCnf(BigDecimal.valueOf(mArticolo.getQtaCnf()).setScale(5, RoundingMode.HALF_UP))
|
||||||
.setInitialNumCnf(UtilityBigDecimal.divide(BigDecimal.valueOf(mArticolo.getQtaOrd()), BigDecimal.valueOf(mArticolo.getQtaCnf())).setScale(0, RoundingMode.CEILING))
|
.setInitialNumCnf(UtilityBigDecimal.divide(BigDecimal.valueOf(mArticolo.getQtaOrd()), BigDecimal.valueOf(mArticolo.getQtaCnf())).setScale(0, RoundingMode.CEILING))
|
||||||
.setInitialQtaTot(BigDecimal.valueOf(mArticolo.getQtaOrd()));
|
.setInitialQtaTot(BigDecimal.valueOf(mArticolo.getQtaOrd()));
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog;
|
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.edit_articolo;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.selectArtFromList;
|
||||||
|
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
|
||||||
|
@Subcomponent
|
||||||
|
public interface DialogSelectArtToOrderComponent {
|
||||||
|
|
||||||
|
@Subcomponent.Factory
|
||||||
|
interface Factory {
|
||||||
|
DialogSelectArtToOrderComponent create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void inject(DialogSelectArtToOrderView DialogSelectArtView);
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.selectArtFromList;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||||
|
|
||||||
|
public class DialogSelectArtToOrderItemListModel<T> {
|
||||||
|
|
||||||
|
private String codMart;
|
||||||
|
private String descrizione;
|
||||||
|
private BigDecimal qtaOrd;
|
||||||
|
private String untMisOrd;
|
||||||
|
private String barcode;
|
||||||
|
|
||||||
|
private String codAlis;
|
||||||
|
private boolean isNew;
|
||||||
|
private T originalModel;
|
||||||
|
private BindableBoolean checked = new BindableBoolean(false);
|
||||||
|
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectArtToOrderItemListModel<T> setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectArtToOrderItemListModel<T> setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaOrd() {
|
||||||
|
return qtaOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectArtToOrderItemListModel<T> setQtaOrd(BigDecimal qtaOrd) {
|
||||||
|
this.qtaOrd = qtaOrd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUntMisOrd() {
|
||||||
|
return untMisOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectArtToOrderItemListModel<T> setUntMisOrd(String untMisOrd) {
|
||||||
|
this.untMisOrd = untMisOrd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBarcode() {
|
||||||
|
return barcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectArtToOrderItemListModel<T> setBarcode(String barcode) {
|
||||||
|
this.barcode = barcode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNew() {
|
||||||
|
return isNew;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectArtToOrderItemListModel<T> setNew(boolean aNew) {
|
||||||
|
isNew = aNew;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectArtToOrderItemListModel<T> setOriginalModel(T originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableBoolean getChecked() {
|
||||||
|
return checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectArtToOrderItemListModel<T> setChecked(BindableBoolean checked) {
|
||||||
|
this.checked = checked;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodAlis() {
|
||||||
|
return codAlis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogSelectArtToOrderItemListModel<T> setCodAlis(String codAlis) {
|
||||||
|
this.codAlis = codAlis;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.selectArtFromList;
|
||||||
|
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
|
||||||
|
@Module(subcomponents = DialogSelectArtToOrderComponent.class)
|
||||||
|
public class DialogSelectArtToOrderModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
DialogSelectArtToOrderViewModel providesDialogSelectArtNewViewModel() {
|
||||||
|
return new DialogSelectArtToOrderViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.selectArtFromList;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||||
|
import com.ravikoradiya.liveadapter.Type;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.BR;
|
||||||
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogSelectArtToOrderBinding;
|
||||||
|
import it.integry.integrywmsnative.databinding.DialogSelectArtToOrderItemModelBinding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @noinspection rawtypes
|
||||||
|
*/
|
||||||
|
public class DialogSelectArtToOrderView extends BaseDialogFragment {
|
||||||
|
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DialogSelectArtToOrderViewModel mViewModel;
|
||||||
|
|
||||||
|
private DialogSelectArtToOrderBinding mBindings;
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
private final List<DialogSelectArtToOrderItemListModel<Object>> listArts;
|
||||||
|
private final RunnableArgs<DialogSelectArtToOrderItemListModel> onConfirm;
|
||||||
|
private final Runnable onAbort;
|
||||||
|
|
||||||
|
//Pass here all external parameters
|
||||||
|
public static DialogSelectArtToOrderView newInstance(List<DialogSelectArtToOrderItemListModel<Object>> listArts,
|
||||||
|
RunnableArgs<DialogSelectArtToOrderItemListModel> onConfirm,
|
||||||
|
Runnable onAbort) {
|
||||||
|
return new DialogSelectArtToOrderView(listArts, onConfirm, onAbort);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogSelectArtToOrderView(List<DialogSelectArtToOrderItemListModel<Object>> listArts,
|
||||||
|
RunnableArgs<DialogSelectArtToOrderItemListModel> onConfirm,
|
||||||
|
Runnable onAbort) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.listArts = listArts;
|
||||||
|
this.onConfirm = onConfirm;
|
||||||
|
this.onAbort = onAbort;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
|
this.mContext = requireContext();
|
||||||
|
|
||||||
|
mBindings = DialogSelectArtToOrderBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||||
|
mBindings.setLifecycleOwner(this);
|
||||||
|
|
||||||
|
MainApplication.appComponent
|
||||||
|
.dialogSelectArtToOrderNewComponent()
|
||||||
|
.create()
|
||||||
|
.inject(this);
|
||||||
|
|
||||||
|
setCancelable(false);
|
||||||
|
|
||||||
|
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||||
|
.setView(mBindings.getRoot())
|
||||||
|
.setCancelable(isCancelable())
|
||||||
|
.setPositiveButton(R.string.confirm, (dialog, which) -> {
|
||||||
|
final DialogSelectArtToOrderItemListModel<Object> selectedItem = Stream.of(listArts)
|
||||||
|
.filter(x -> x.getChecked().get())
|
||||||
|
.findFirstOrElse(null);
|
||||||
|
|
||||||
|
if (selectedItem != null)
|
||||||
|
this.onConfirm.run(selectedItem);
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.abort, (dialog, which) -> {
|
||||||
|
if (this.onAbort != null) this.onAbort.run();
|
||||||
|
})
|
||||||
|
.create();
|
||||||
|
|
||||||
|
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||||
|
alertDialog.setOnShowListener(this);
|
||||||
|
return alertDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShow(DialogInterface dialogInterface) {
|
||||||
|
super.onShow(dialogInterface);
|
||||||
|
|
||||||
|
this.listArts.get(0).getChecked().set(true);
|
||||||
|
this.initRecyclerView();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initRecyclerView() {
|
||||||
|
var itemType = new Type<DialogSelectArtToOrderItemListModel, DialogSelectArtToOrderItemModelBinding>(R.layout.dialog_select_art_to_order__item_model, BR.row);
|
||||||
|
// itemType.areItemSame((oldItem, newItem) -> Objects.equals(oldItem.getId(), newItem.getId()));
|
||||||
|
itemType.areContentsTheSame(DialogSelectArtToOrderItemListModel::equals);
|
||||||
|
itemType.onClick(x -> {
|
||||||
|
resetChecks();
|
||||||
|
x.getBinding().getRow().getChecked().set(true);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
|
new LiveAdapter(listArts)
|
||||||
|
.map(DialogSelectArtToOrderItemListModel.class, itemType)
|
||||||
|
.into(this.mBindings.itemList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetChecks() {
|
||||||
|
for (var item : listArts) {
|
||||||
|
item.getChecked().set(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.selectArtFromList;
|
||||||
|
|
||||||
|
public class DialogSelectArtToOrderViewModel {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -14,8 +14,15 @@ import androidx.core.content.ContextCompat;
|
|||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.annimon.stream.Collectors;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@@ -30,6 +37,7 @@ import it.integry.integrywmsnative.core.data_store.db.repository.GrigliaReposito
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepository;
|
import it.integry.integrywmsnative.core.data_store.db.repository.OrdineRepository;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.view_model.ArticoloOrdinabileDTO;
|
import it.integry.integrywmsnative.core.data_store.db.view_model.ArticoloOrdinabileDTO;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.wrappers.OrdineWrapper;
|
import it.integry.integrywmsnative.core.data_store.db.wrappers.OrdineWrapper;
|
||||||
|
import it.integry.integrywmsnative.core.exception.ExpiredProductListException;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||||
@@ -107,6 +115,7 @@ public class PVOrdiniAcquistoGrigliaFragment extends BaseFragment implements ITi
|
|||||||
} else {
|
} else {
|
||||||
setGriglia(griglia);
|
setGriglia(griglia);
|
||||||
setListaArticoli(listArticoli);
|
setListaArticoli(listArticoli);
|
||||||
|
this.onGrigliaRetrieved();
|
||||||
}
|
}
|
||||||
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
|
|
||||||
@@ -117,6 +126,33 @@ public class PVOrdiniAcquistoGrigliaFragment extends BaseFragment implements ITi
|
|||||||
titleText.setText(context.getText(R.string.pv_elenco_ordiniA_title_fragment).toString());
|
titleText.setText(context.getText(R.string.pv_elenco_ordiniA_title_fragment).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onGrigliaRetrieved() {
|
||||||
|
if (UtilityString.isNullOrEmpty(mGriglia.getCodAlis())) {
|
||||||
|
|
||||||
|
Map<String, Long> downloadedGrids = Stream.of(mListArticoli).collect(Collectors.groupingBy(ArticoloOrdinabileDTO::getCodAlis, Collectors.counting()));
|
||||||
|
if (downloadedGrids != null && !downloadedGrids.isEmpty()) {
|
||||||
|
|
||||||
|
List<String> gridsDetails = Stream.of(downloadedGrids)
|
||||||
|
.map((el) -> "<b>" + el.getKey() + ":</b> " + el.getValue() + " " + getResources().getQuantityString(R.plurals.available_articles, el.getValue().intValue()))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
|
||||||
|
DialogSimpleMessageView.makeInfoDialog(getText(R.string.grid_details).toString(),
|
||||||
|
Html.fromHtml(
|
||||||
|
String.format(getResources().getQuantityString(R.plurals.loaded_grids_message, (int) downloadedGrids.size()), downloadedGrids.size())
|
||||||
|
+ "<br /><br />" +
|
||||||
|
StringUtils.join(gridsDetails, "<br/>")),
|
||||||
|
null,
|
||||||
|
this::fetchOrders)
|
||||||
|
.show(requireActivity().getSupportFragmentManager(), "downloadedGridDetails");
|
||||||
|
} else {
|
||||||
|
fetchOrders();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fetchOrders();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setGriglia(Griglia griglia) {
|
private void setGriglia(Griglia griglia) {
|
||||||
mGriglia = griglia;
|
mGriglia = griglia;
|
||||||
mBinding.fabNewOrder.setVisibility(View.VISIBLE);
|
mBinding.fabNewOrder.setVisibility(View.VISIBLE);
|
||||||
@@ -127,12 +163,18 @@ public class PVOrdiniAcquistoGrigliaFragment extends BaseFragment implements ITi
|
|||||||
mBinding.descrLis.setText(griglia.getDescrLisa());
|
mBinding.descrLis.setText(griglia.getDescrLisa());
|
||||||
}
|
}
|
||||||
mBinding.descrDepo.setText(griglia.getDescrDepo());
|
mBinding.descrDepo.setText(griglia.getDescrDepo());
|
||||||
fetchOrders();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setListaArticoli(List<ArticoloOrdinabileDTO> listArticoli) {
|
private void setListaArticoli(List<ArticoloOrdinabileDTO> listArticoli) {
|
||||||
mListArticoli.clear();
|
mListArticoli.clear();
|
||||||
mListArticoli.addAll(listArticoli);
|
mListArticoli.addAll(listArticoli);
|
||||||
|
Calendar today = Calendar.getInstance();
|
||||||
|
today.set(Calendar.MILLISECOND, 0);
|
||||||
|
today.set(Calendar.SECOND, 0);
|
||||||
|
today.set(Calendar.MINUTE, 0);
|
||||||
|
today.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
|
||||||
|
this.mPvOrdiniAcquistoGrigliaViewModel.setDataCaricamentoListino(today);
|
||||||
mBinding.countArtLis.setText(String.valueOf(listArticoli.size()));
|
mBinding.countArtLis.setText(String.valueOf(listArticoli.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +194,7 @@ public class PVOrdiniAcquistoGrigliaFragment extends BaseFragment implements ITi
|
|||||||
mBinding.ordiniAEmptyView.setVisibility(ordini == null || ordini.size() <= 0 ? View.VISIBLE : View.GONE);
|
mBinding.ordiniAEmptyView.setVisibility(ordini == null || ordini.size() <= 0 ? View.VISIBLE : View.GONE);
|
||||||
refreshRenderedOrdini(ordini);
|
refreshRenderedOrdini(ordini);
|
||||||
mAdapter.updateItems(mRenderedOrderList);
|
mAdapter.updateItems(mRenderedOrderList);
|
||||||
if (mRenderedOrderList.size() <= 0 && mRedirectToNewOrder) {
|
if (mRenderedOrderList.isEmpty() && mRedirectToNewOrder) {
|
||||||
createNewOrder();
|
createNewOrder();
|
||||||
} else {
|
} else {
|
||||||
mRedirectToNewOrder = false;
|
mRedirectToNewOrder = false;
|
||||||
@@ -172,6 +214,10 @@ public class PVOrdiniAcquistoGrigliaFragment extends BaseFragment implements ITi
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void editOrdine(Ordine ordine) {
|
private void editOrdine(Ordine ordine) {
|
||||||
|
if (this.mPvOrdiniAcquistoGrigliaViewModel.isProductListSessionInvalid()) {
|
||||||
|
this.onError(new ExpiredProductListException());
|
||||||
|
return;
|
||||||
|
}
|
||||||
requireActivity().startActivity(PVOrdineAcquistoEditActivity.newInstance(requireActivity(), ordine, mListArticoli));
|
requireActivity().startActivity(PVOrdineAcquistoEditActivity.newInstance(requireActivity(), ordine, mListArticoli));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,6 +253,10 @@ public class PVOrdiniAcquistoGrigliaFragment extends BaseFragment implements ITi
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void createNewOrder() {
|
public void createNewOrder() {
|
||||||
|
if (this.mPvOrdiniAcquistoGrigliaViewModel.isProductListSessionInvalid()) {
|
||||||
|
this.onError(new ExpiredProductListException());
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.onLoadingStarted();
|
this.onLoadingStarted();
|
||||||
|
|
||||||
mPvOrdiniAcquistoGrigliaViewModel.createNewOrder(mGriglia, order -> {
|
mPvOrdiniAcquistoGrigliaViewModel.createNewOrder(mGriglia, order -> {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.gest.pv_ordini_acquisto;
|
package it.integry.integrywmsnative.gest.pv_ordini_acquisto;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||||
@@ -18,6 +20,8 @@ public class PVOrdiniAcquistoGrigliaViewModel {
|
|||||||
private final OrdineRepository ordineRepository;
|
private final OrdineRepository ordineRepository;
|
||||||
private final GrigliaRepository grigliaRepository;
|
private final GrigliaRepository grigliaRepository;
|
||||||
|
|
||||||
|
private Calendar dataCaricamentoListino;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public PVOrdiniAcquistoGrigliaViewModel(PVOrdiniAcquistoRESTConsumer pvOrdiniAcquistoRESTConsumer,
|
public PVOrdiniAcquistoGrigliaViewModel(PVOrdiniAcquistoRESTConsumer pvOrdiniAcquistoRESTConsumer,
|
||||||
ArticoloGrigliaRepository articoloGrigliaRepository,
|
ArticoloGrigliaRepository articoloGrigliaRepository,
|
||||||
@@ -45,4 +49,23 @@ public class PVOrdiniAcquistoGrigliaViewModel {
|
|||||||
ordineRepository.delete(ordine, onSuccess, onFail);
|
ordineRepository.delete(ordine, onSuccess, onFail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Calendar getDataCaricamentoListino() {
|
||||||
|
return dataCaricamentoListino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PVOrdiniAcquistoGrigliaViewModel setDataCaricamentoListino(Calendar dataCaricamentoListino) {
|
||||||
|
this.dataCaricamentoListino = dataCaricamentoListino;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isProductListSessionInvalid() {
|
||||||
|
Calendar today = Calendar.getInstance();
|
||||||
|
today.set(Calendar.MILLISECOND, 0);
|
||||||
|
today.set(Calendar.SECOND, 0);
|
||||||
|
today.set(Calendar.MINUTE, 0);
|
||||||
|
today.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
|
||||||
|
return today.after(this.dataCaricamentoListino);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
|||||||
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
|
||||||
import it.integry.integrywmsnative.core.data_store.db.view_model.ArticoloOrdinabileDTO;
|
import it.integry.integrywmsnative.core.data_store.db.view_model.ArticoloOrdinabileDTO;
|
||||||
import it.integry.integrywmsnative.core.exception.GridNotFoundException;
|
import it.integry.integrywmsnative.core.exception.GridNotFoundException;
|
||||||
|
import it.integry.integrywmsnative.core.exception.GridNotSelectedException;
|
||||||
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
import it.integry.integrywmsnative.core.exception.NoArtsFoundException;
|
||||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
@@ -36,6 +37,7 @@ public class DialogScanGrigliaAcquistoView extends BaseDialogFragment {
|
|||||||
|
|
||||||
private DialogScanCodiceGrigliaBinding mBinding;
|
private DialogScanCodiceGrigliaBinding mBinding;
|
||||||
private int mBarcodeScannerIstanceID;
|
private int mBarcodeScannerIstanceID;
|
||||||
|
public boolean canIgnoreGrid;
|
||||||
|
|
||||||
private final RunnableArgss<Griglia, List<ArticoloOrdinabileDTO>> mOnDialogDismiss;
|
private final RunnableArgss<Griglia, List<ArticoloOrdinabileDTO>> mOnDialogDismiss;
|
||||||
|
|
||||||
@@ -53,6 +55,7 @@ public class DialogScanGrigliaAcquistoView extends BaseDialogFragment {
|
|||||||
private DialogScanGrigliaAcquistoView(RunnableArgss<Griglia, List<ArticoloOrdinabileDTO>> onDialogDismiss) {
|
private DialogScanGrigliaAcquistoView(RunnableArgss<Griglia, List<ArticoloOrdinabileDTO>> onDialogDismiss) {
|
||||||
super();
|
super();
|
||||||
mOnDialogDismiss = onDialogDismiss;
|
mOnDialogDismiss = onDialogDismiss;
|
||||||
|
canIgnoreGrid = SettingsManager.iDB().isFlagConsentiOrdineSenzaGriglia();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@@ -80,6 +83,12 @@ public class DialogScanGrigliaAcquistoView extends BaseDialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void ignore() {
|
public void ignore() {
|
||||||
|
|
||||||
|
if (!this.canIgnoreGrid) {
|
||||||
|
this.onError(new GridNotSelectedException());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
|
|
||||||
RunnableArgs<Exception> mOnError = exception -> {
|
RunnableArgs<Exception> mOnError = exception -> {
|
||||||
|
|||||||
@@ -217,7 +217,8 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
|||||||
mViewModel.init(
|
mViewModel.init(
|
||||||
SettingsManager.i().getUser().getFullname(),
|
SettingsManager.i().getUser().getFullname(),
|
||||||
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
|
SettingsManager.i().getUserSession().getDepo().getCodMdep(),
|
||||||
mCurrentGestione);
|
mCurrentGestione,
|
||||||
|
SettingsManager.iDB().isFlagGeneraDocumentoSpedizione());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public class RettificaGiacenzeViewModel {
|
|||||||
private String mCurrentUser;
|
private String mCurrentUser;
|
||||||
private String mCurrentCodMdep;
|
private String mCurrentCodMdep;
|
||||||
private boolean mIsCreatedLU;
|
private boolean mIsCreatedLU;
|
||||||
|
private boolean generaDocIfVendita;
|
||||||
|
|
||||||
private boolean mAnyEditDone = false;
|
private boolean mAnyEditDone = false;
|
||||||
|
|
||||||
@@ -74,10 +75,11 @@ public class RettificaGiacenzeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void init(String currentUser, String currentCodMdep, GestioneEnum defaultGestione) {
|
public void init(String currentUser, String currentCodMdep, GestioneEnum defaultGestione, boolean generaDocIfVendita) {
|
||||||
this.mCurrentUser = currentUser;
|
this.mCurrentUser = currentUser;
|
||||||
this.mCurrentCodMdep = currentCodMdep;
|
this.mCurrentCodMdep = currentCodMdep;
|
||||||
this.mDefaultGestione = defaultGestione;
|
this.mDefaultGestione = defaultGestione;
|
||||||
|
this.generaDocIfVendita = generaDocIfVendita;
|
||||||
|
|
||||||
this.sendOnLoadingStarted();
|
this.sendOnLoadingStarted();
|
||||||
|
|
||||||
@@ -352,7 +354,6 @@ public class RettificaGiacenzeViewModel {
|
|||||||
|
|
||||||
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||||
|
|
||||||
// if (!mIsCreatedLU && mCurrentMtbColt.isDocumentPresent()) {
|
|
||||||
mtbColr
|
mtbColr
|
||||||
.setQtaCol(BigDecimal.ZERO)
|
.setQtaCol(BigDecimal.ZERO)
|
||||||
.setNumCnf(BigDecimal.ZERO)
|
.setNumCnf(BigDecimal.ZERO)
|
||||||
@@ -382,39 +383,6 @@ public class RettificaGiacenzeViewModel {
|
|||||||
|
|
||||||
if (shouldCloseLU) closeLU(true, null);
|
if (shouldCloseLU) closeLU(true, null);
|
||||||
}, this::sendError);
|
}, this::sendError);
|
||||||
// } else {
|
|
||||||
// mtbColr
|
|
||||||
// .setQtaCol(qtaTot)
|
|
||||||
// .setQtaCnf(qtaCnf)
|
|
||||||
// .setNumCnf(numCnf);
|
|
||||||
//
|
|
||||||
// MtbColt cloneMtbColt = (MtbColt) mCurrentMtbColt.clone();
|
|
||||||
// cloneMtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
|
|
||||||
//
|
|
||||||
// cloneMtbColt.setMtbColr(new ObservableArrayList<>());
|
|
||||||
//
|
|
||||||
// cloneMtbColt.getMtbColr().add(mtbColr);
|
|
||||||
//
|
|
||||||
// mColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, value -> {
|
|
||||||
// mtbColr
|
|
||||||
// .setDataCollo(value.getDataColloS())
|
|
||||||
// .setNumCollo(value.getNumCollo())
|
|
||||||
// .setGestione(value.getGestione())
|
|
||||||
// .setSerCollo(value.getSerCollo())
|
|
||||||
// .setRiga(value.getMtbColr().get(0).getRiga())
|
|
||||||
// .setUntMis(pickingObjectDTO.getMtbAart().getUntMis())
|
|
||||||
// .setMtbAart(pickingObjectDTO.getMtbAart());
|
|
||||||
//
|
|
||||||
// mCurrentMtbColt.getMtbColr().add(mtbColr);
|
|
||||||
//
|
|
||||||
// this.mAnyEditDone = true;
|
|
||||||
//
|
|
||||||
// this.sendOnRowSaved();
|
|
||||||
// this.sendOnLoadingEnded();
|
|
||||||
//
|
|
||||||
// if (shouldCloseLU) closeLU(true, null);
|
|
||||||
// }, this::sendError);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -482,7 +450,7 @@ public class RettificaGiacenzeViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createDoc(MtbColt mtbColt, Runnable onComplete) {
|
private void createDoc(MtbColt mtbColt, Runnable onComplete) {
|
||||||
if (!(mtbColt.getGestioneEnum() == GestioneEnum.VENDITA && mtbColt.getSegno() == -1)) {
|
if (!(mtbColt.getGestioneEnum() == GestioneEnum.VENDITA && mtbColt.getSegno() == -1) || !generaDocIfVendita) {
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,16 +15,19 @@ import androidx.preference.EditTextPreference;
|
|||||||
import androidx.preference.ListPreference;
|
import androidx.preference.ListPreference;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceFragmentCompat;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
|
import androidx.sqlite.db.SimpleSQLiteQuery;
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import com.harrysoft.androidbluetoothserial.BluetoothManager;
|
import com.harrysoft.androidbluetoothserial.BluetoothManager;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -34,6 +37,7 @@ 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.context.AppContext;
|
import it.integry.integrywmsnative.core.context.AppContext;
|
||||||
|
import it.integry.integrywmsnative.core.data_store.db.dao.RawDao;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.rest.model.MailAttachmentDTO;
|
import it.integry.integrywmsnative.core.rest.model.MailAttachmentDTO;
|
||||||
@@ -47,10 +51,16 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AppContext appContext;
|
public AppContext appContext;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public RawDao rawDao;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public SystemRESTConsumer systemRESTConsumer;
|
public SystemRESTConsumer systemRESTConsumer;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DialogProgressView mCurrentProgress;
|
public DialogProgressView mCurrentProgress;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ExecutorService executorService;
|
public ExecutorService executorService;
|
||||||
|
|
||||||
@@ -223,29 +233,52 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
|
|||||||
executorService.execute(() -> {
|
executorService.execute(() -> {
|
||||||
|
|
||||||
|
|
||||||
File yourFile = appContext.getLogFilePath();
|
File logFilePath = appContext.getLogFilePath();
|
||||||
var files = yourFile.listFiles();
|
var files = logFilePath.listFiles();
|
||||||
|
|
||||||
var fileToShare = Stream.of(files)
|
var fileToShare = Stream.of(files)
|
||||||
.sortBy(x -> -1 * x.lastModified())
|
.sortBy(x -> -1 * x.lastModified())
|
||||||
.findFirstOrElse(null);
|
.findFirstOrElse(null);
|
||||||
try {
|
try {
|
||||||
|
List<MailAttachmentDTO> attachmentDTOList = new ArrayList<>();
|
||||||
|
|
||||||
|
if(fileToShare != null) {
|
||||||
var htmlContent = createAppLogAttachment(fileToShare);
|
var htmlContent = createAppLogAttachment(fileToShare);
|
||||||
|
|
||||||
byte[] buffer = htmlContent.getBytes();//specify the size to allow.
|
byte[] buffer = htmlContent.getBytes();//specify the size to allow.
|
||||||
String base64 = Base64.encodeToString(buffer, Base64.NO_WRAP);
|
String base64 = Base64.encodeToString(buffer, Base64.NO_WRAP);
|
||||||
|
|
||||||
var attachment = new MailAttachmentDTO()
|
var logAttachment = new MailAttachmentDTO()
|
||||||
.setFileName("wms_log.html")
|
.setFileName("wms_log.html")
|
||||||
.setFileb64Content(base64);
|
.setFileb64Content(base64);
|
||||||
|
attachmentDTOList.add(logAttachment);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
rawDao.vacuumDb(new SimpleSQLiteQuery("pragma wal_checkpoint(full)"));
|
||||||
|
File[] dbFiles = new File[3];
|
||||||
|
dbFiles[0] = requireContext().getDatabasePath("integry_wms");
|
||||||
|
dbFiles[1] = requireContext().getDatabasePath("integry_wms-shm");
|
||||||
|
dbFiles[2] = requireContext().getDatabasePath("integry_wms-wal");
|
||||||
|
|
||||||
|
for(int i = 0; i < dbFiles.length; i++){
|
||||||
|
byte[] dbFileBytes = new byte[(int) dbFiles[i].length()];
|
||||||
|
FileInputStream inputStream = new FileInputStream(dbFiles[i]);
|
||||||
|
final int read = inputStream.read(dbFileBytes);
|
||||||
|
inputStream.close();
|
||||||
|
|
||||||
|
var dbAttachment = new MailAttachmentDTO()
|
||||||
|
.setFileName(dbFiles[i].getName())
|
||||||
|
.setFileb64Content(Base64.encodeToString(dbFileBytes, Base64.NO_WRAP));
|
||||||
|
attachmentDTOList.add(dbAttachment);
|
||||||
|
}
|
||||||
|
|
||||||
var mailRequest = new MailRequestDTO()
|
var mailRequest = new MailRequestDTO()
|
||||||
.setTo("developer@integry.it")
|
.setTo("developer@integry.it")
|
||||||
.setMsgText("Questo è una mail che contiene il log del WMS")
|
.setMsgText("Questo è una mail che contiene il log del WMS")
|
||||||
.setSubject("U vuemmeess")
|
.setSubject("U vuemmeess")
|
||||||
.setAttachments(new ArrayList<>());
|
.setAttachments(attachmentDTOList);
|
||||||
|
|
||||||
mailRequest.getAttachments().add(attachment);
|
|
||||||
|
|
||||||
systemRESTConsumer.sendMail(mailRequest, this::closeProgress, ex -> {
|
systemRESTConsumer.sendMail(mailRequest, this::closeProgress, ex -> {
|
||||||
this.closeProgress();
|
this.closeProgress();
|
||||||
@@ -367,7 +400,13 @@ public class MainSettingsFragment extends PreferenceFragmentCompat implements IT
|
|||||||
htmlContent.append("<hr/>");
|
htmlContent.append("<hr/>");
|
||||||
}
|
}
|
||||||
|
|
||||||
htmlContent.append("\n" + "<script type=\"text/javascript\">\n" + " document.querySelectorAll(\".message\").forEach(el => el.innerHTML = el.innerHTML.replaceAll(/at it\\.integry.*?(?:<br>)/g, '<b>$&</b>'));\n" + "</script>\n" + "</body>\n" + "</html>");
|
htmlContent.append("""
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
document.querySelectorAll(".message").forEach(el => el.innerHTML = el.innerHTML.replaceAll(/at it\\.integry.*?(?:<br>)/g, '<b>$&</b>'));
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>""");
|
||||||
|
|
||||||
return htmlContent.toString();
|
return htmlContent.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
|||||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UntMisUtils;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
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;
|
||||||
@@ -337,12 +338,11 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
qtaColWithdrawRows.addAndGet(row.getQtaCol());
|
qtaColWithdrawRows.addAndGet(row.getQtaCol());
|
||||||
});
|
});
|
||||||
|
|
||||||
spedizioneListModel.setBadge2(x.getSitArtOrdDTO().getCodJcom());
|
|
||||||
|
|
||||||
if (!anyLUPresent) {
|
if (!anyLUPresent) {
|
||||||
spedizioneListModel.setGroupTitle(!mEnableFakeGiacenza ? getString(R.string.picking_not_available) : "");
|
spedizioneListModel.setGroupTitle(!mEnableFakeGiacenza ? getString(R.string.picking_not_available) : "");
|
||||||
|
spedizioneListModel.setBadge2(getCommessa(x.getSitArtOrdDTO().getCodJcom()));
|
||||||
|
|
||||||
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().isFlagQtaCnfFissaBoolean())) {
|
if (UntMisUtils.shouldBeShowInColli(x.getMtbAart())) {
|
||||||
spedizioneListModel.setUntMis(UtilityResources.getString(R.string.unt_mis_col));
|
spedizioneListModel.setUntMis(UtilityResources.getString(R.string.unt_mis_col));
|
||||||
spedizioneListModel.setQtaTot(x.getSitArtOrdDTO().getNumCnfOrd());
|
spedizioneListModel.setQtaTot(x.getSitArtOrdDTO().getNumCnfOrd());
|
||||||
spedizioneListModel.setQtaEvasa(numCnfWithdrawRows.getBigDecimalValue());
|
spedizioneListModel.setQtaEvasa(numCnfWithdrawRows.getBigDecimalValue());
|
||||||
@@ -378,15 +378,19 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
cloneModel.setGroupTitle(String.format("%s: %s", getString(R.string.position_text), UtilityString.isNullOrEmpty(mtbColtToPick.getPosizione()) ? "N.A." : mtbColtToPick.getPosizione()));
|
cloneModel.setGroupTitle(String.format("%s: %s", getString(R.string.position_text), UtilityString.isNullOrEmpty(mtbColtToPick.getPosizione()) ? "N.A." : mtbColtToPick.getPosizione()));
|
||||||
|
|
||||||
MtbColr mtbColrToDispatch = mtbColtToPick.getMtbColr() != null && mtbColtToPick.getMtbColr().size() > 0 ? mtbColtToPick.getMtbColr().get(0) : null;
|
MtbColr mtbColrToDispatch = mtbColtToPick.getMtbColr() != null && mtbColtToPick.getMtbColr().size() > 0 ? mtbColtToPick.getMtbColr().get(0) : null;
|
||||||
if (mtbColrToDispatch != null && !UtilityString.isNullOrEmpty(mtbColrToDispatch.getPartitaMag())) {
|
if (mtbColrToDispatch != null) {
|
||||||
|
if(!UtilityString.isNullOrEmpty(mtbColrToDispatch.getPartitaMag()))
|
||||||
cloneModel.setSubDescrizione1(String.format(getString(R.string.batch_lot_text), mtbColrToDispatch.getPartitaMag()));
|
cloneModel.setSubDescrizione1(String.format(getString(R.string.batch_lot_text), mtbColrToDispatch.getPartitaMag()));
|
||||||
cloneModel.setBadge2(mtbColrToDispatch.getCodJcom());
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(x.getSitArtOrdDTO().getCodJcom())) {
|
||||||
|
cloneModel.setBadge2(getCommessa(mtbColrToDispatch.getCodJcom()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cloneModel.setSourceMtbColr(mtbColrToDispatch);
|
cloneModel.setSourceMtbColr(mtbColrToDispatch);
|
||||||
|
|
||||||
cloneModel.setSubDescrizione2(String.format(getString(R.string.lu_number_data_text), mtbColtToPick.getNumCollo(), UtilityDate.formatDate(mtbColtToPick.getDataColloD(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)));
|
cloneModel.setSubDescrizione2(String.format(getString(R.string.lu_number_data_text), mtbColtToPick.getNumCollo(), UtilityDate.formatDate(mtbColtToPick.getDataColloD(), UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)));
|
||||||
|
|
||||||
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().isFlagQtaCnfFissaBoolean())) {
|
|
||||||
|
if (UntMisUtils.shouldBeShowInColli(x.getMtbAart())) {
|
||||||
cloneModel.setUntMis(UtilityResources.getString(R.string.unt_mis_col));
|
cloneModel.setUntMis(UtilityResources.getString(R.string.unt_mis_col));
|
||||||
|
|
||||||
BigDecimal numCnfOrdToSubstract = UtilityBigDecimal.getLowerBetween(mtbColrToDispatch.getNumCnf(), numCnfOrdCounter);
|
BigDecimal numCnfOrdToSubstract = UtilityBigDecimal.getLowerBetween(mtbColrToDispatch.getNumCnf(), numCnfOrdCounter);
|
||||||
@@ -514,9 +518,9 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
spedizioneListModel.setGroupTitle(groupTitle);
|
spedizioneListModel.setGroupTitle(groupTitle);
|
||||||
|
|
||||||
if (!anyLUPresent) {
|
if (!anyLUPresent) {
|
||||||
spedizioneListModel.setBadge2(x.getSitArtOrdDTO().getCodJcom());
|
spedizioneListModel.setBadge2(getCommessa(x.getSitArtOrdDTO().getCodJcom()));
|
||||||
|
|
||||||
if (SettingsManager.iDB().isFlagForceAllToColli() || (x.getMtbAart() == null || !x.getMtbAart().isFlagQtaCnfFissaBoolean())) {
|
if (UntMisUtils.shouldBeShowInColli(x.getMtbAart())) {
|
||||||
spedizioneListModel.setUntMis(UtilityResources.getString(R.string.unt_mis_col));
|
spedizioneListModel.setUntMis(UtilityResources.getString(R.string.unt_mis_col));
|
||||||
spedizioneListModel.setQtaTot(x.getSitArtOrdDTO().getNumCnfOrd());
|
spedizioneListModel.setQtaTot(x.getSitArtOrdDTO().getNumCnfOrd());
|
||||||
spedizioneListModel.setQtaEvasa(numCnfWithdrawRows.getBigDecimalValue());
|
spedizioneListModel.setQtaEvasa(numCnfWithdrawRows.getBigDecimalValue());
|
||||||
@@ -547,9 +551,11 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
|
|
||||||
|
|
||||||
MtbColr mtbColrToDispatch = mtbColtToPick.getMtbColr() != null && mtbColtToPick.getMtbColr().size() > 0 ? mtbColtToPick.getMtbColr().get(0) : null;
|
MtbColr mtbColrToDispatch = mtbColtToPick.getMtbColr() != null && mtbColtToPick.getMtbColr().size() > 0 ? mtbColtToPick.getMtbColr().get(0) : null;
|
||||||
if (mtbColrToDispatch != null && !UtilityString.isNullOrEmpty(mtbColrToDispatch.getPartitaMag())) {
|
if (mtbColrToDispatch != null) {
|
||||||
|
if (!UtilityString.isNullOrEmpty(mtbColrToDispatch.getPartitaMag()))
|
||||||
cloneModel.setSubDescrizione1(String.format(getString(R.string.batch_lot_text), mtbColrToDispatch.getPartitaMag()));
|
cloneModel.setSubDescrizione1(String.format(getString(R.string.batch_lot_text), mtbColrToDispatch.getPartitaMag()));
|
||||||
cloneModel.setBadge2(mtbColrToDispatch.getCodJcom());
|
|
||||||
|
cloneModel.setBadge2(getCommessa(mtbColrToDispatch.getCodJcom()));
|
||||||
}
|
}
|
||||||
cloneModel.setSourceMtbColr(mtbColrToDispatch);
|
cloneModel.setSourceMtbColr(mtbColrToDispatch);
|
||||||
|
|
||||||
@@ -632,6 +638,19 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
|||||||
return sortedList;
|
return sortedList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getCommessa(String codJcom) {
|
||||||
|
var commessaMagazzino = SettingsManager.iDB().getCommessaMagazzino();
|
||||||
|
|
||||||
|
if(UtilityString.isNullOrEmpty(commessaMagazzino)) {
|
||||||
|
return UtilityString.isNull(codJcom, "Magazzino").toUpperCase();
|
||||||
|
} else {
|
||||||
|
if(commessaMagazzino.equalsIgnoreCase(codJcom) || codJcom == null)
|
||||||
|
return "Magazzino".toUpperCase();
|
||||||
|
else
|
||||||
|
return codJcom.toUpperCase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isThereAnyItemToPick(List<PickingObjectDTO> dataList) {
|
private boolean isThereAnyItemToPick(List<PickingObjectDTO> dataList) {
|
||||||
return Stream.of(dataList)
|
return Stream.of(dataList)
|
||||||
.anyMatch(x -> !x.isHidden());
|
.anyMatch(x -> !x.isHidden());
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ public class SpedizioneViewModel {
|
|||||||
|
|
||||||
private Listener mListener;
|
private Listener mListener;
|
||||||
|
|
||||||
|
private String mDefaultRagSocOfUL = null;
|
||||||
private GestioneEnum mDefaultGestioneOfUL = null;
|
private GestioneEnum mDefaultGestioneOfUL = null;
|
||||||
private int mDefaultSegnoCol = -1;
|
private int mDefaultSegnoCol = -1;
|
||||||
private String mDefaultCodMdep = null;
|
private String mDefaultCodMdep = null;
|
||||||
@@ -205,6 +206,12 @@ public class SpedizioneViewModel {
|
|||||||
private void initDefaultVars() {
|
private void initDefaultVars() {
|
||||||
if (this.mTestateOrdini != null && this.mTestateOrdini.size() > 0) {
|
if (this.mTestateOrdini != null && this.mTestateOrdini.size() > 0) {
|
||||||
|
|
||||||
|
List<String> foundRagSoc = Stream.of(mTestateOrdini).map(OrdineUscitaInevasoDTO::getRagSocOrd).distinctBy(x -> x).toList();
|
||||||
|
|
||||||
|
if (foundRagSoc != null && foundRagSoc.size() == 1) {
|
||||||
|
mDefaultRagSocOfUL = foundRagSoc.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (mDefaultGestioneOfUL == null) {
|
if (mDefaultGestioneOfUL == null) {
|
||||||
//Definizione della gestione collo di default
|
//Definizione della gestione collo di default
|
||||||
List<GestioneEnum> foundGestioni = Stream.of(mTestateOrdini).map(OrdineUscitaInevasoDTO::getGestioneEnum).withoutNulls().distinct().toList();
|
List<GestioneEnum> foundGestioni = Stream.of(mTestateOrdini).map(OrdineUscitaInevasoDTO::getGestioneEnum).withoutNulls().distinct().toList();
|
||||||
@@ -588,7 +595,9 @@ public class SpedizioneViewModel {
|
|||||||
|
|
||||||
private void executeMagazzinoAutomatico(MtbDepoPosizione mtbDepoPosizione, Runnable onComplete) {
|
private void executeMagazzinoAutomatico(MtbDepoPosizione mtbDepoPosizione, Runnable onComplete) {
|
||||||
var magazzinoAutomaticoPickableArts = Stream.of(Objects.requireNonNull(this.mPickingList.getValue()))
|
var magazzinoAutomaticoPickableArts = Stream.of(Objects.requireNonNull(this.mPickingList.getValue()))
|
||||||
.filter(x -> Stream.of(x.getMtbColts()).anyMatch(y -> y.getPosizione() != null && y.getPosizione().equalsIgnoreCase(mtbDepoPosizione.getPosizione())))
|
.filter(x -> Stream.of(x.getMtbColts()).anyMatch(y -> y.getPosizione() != null && y.getPosizione().equalsIgnoreCase(mtbDepoPosizione.getPosizione())) &&
|
||||||
|
x.getSitArtOrdDTO() != null &&
|
||||||
|
UtilityBigDecimal.greaterThan(x.getSitArtOrdDTO().getQtaOrd(), BigDecimal.ZERO))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
var mtbAarts = Stream.of(magazzinoAutomaticoPickableArts)
|
var mtbAarts = Stream.of(magazzinoAutomaticoPickableArts)
|
||||||
@@ -599,7 +608,7 @@ public class SpedizioneViewModel {
|
|||||||
|
|
||||||
final List<MagazzinoAutomaticoPickOrderRequestDTO> orders = Stream.of(this.mTestateOrdini)
|
final List<MagazzinoAutomaticoPickOrderRequestDTO> orders = Stream.of(this.mTestateOrdini)
|
||||||
.map(x -> new MagazzinoAutomaticoPickOrderRequestDTO(UtilityDate.toLocalDate(x.getDataOrdD()), x.getGestione(), x.getNumOrd())
|
.map(x -> new MagazzinoAutomaticoPickOrderRequestDTO(UtilityDate.toLocalDate(x.getDataOrdD()), x.getGestione(), x.getNumOrd())
|
||||||
.setDataCons(UtilityDate.toLocalDate(x.getDataConsD())))
|
.setDataCons(x.getDataConsD() != null ? UtilityDate.toLocalDate(x.getDataConsD()) : null))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
final List<MagazzinoAutomaticoPickItemRequestDTO> magazzinoAutomaticoPickItemRequestDTOList = new ArrayList<>();
|
final List<MagazzinoAutomaticoPickItemRequestDTO> magazzinoAutomaticoPickItemRequestDTOList = new ArrayList<>();
|
||||||
@@ -609,6 +618,10 @@ public class SpedizioneViewModel {
|
|||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
|
if (pickingObjectDTO == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
MagazzinoAutomaticoPickItemRequestDTO itemDto = new MagazzinoAutomaticoPickItemRequestDTO(selectedArt.getCodMart())
|
MagazzinoAutomaticoPickItemRequestDTO itemDto = new MagazzinoAutomaticoPickItemRequestDTO(selectedArt.getCodMart())
|
||||||
.setQtaTot(pickingObjectDTO.getSitArtOrdDTO().getQtaOrd())
|
.setQtaTot(pickingObjectDTO.getSitArtOrdDTO().getQtaOrd())
|
||||||
.setNumCnf(pickingObjectDTO.getSitArtOrdDTO().getNumCnfOrd())
|
.setNumCnf(pickingObjectDTO.getSitArtOrdDTO().getNumCnfOrd())
|
||||||
@@ -652,7 +665,12 @@ public class SpedizioneViewModel {
|
|||||||
if (mEnableGiacenza) {
|
if (mEnableGiacenza) {
|
||||||
|
|
||||||
Stream.of(pickingList).forEach(pickingObjectDTO -> {
|
Stream.of(pickingList).forEach(pickingObjectDTO -> {
|
||||||
if (Stream.of(pickingObjectDTO.getMtbColts()).anyMatch(x -> Objects.equals(x.getNumCollo(), scannedUL.getNumCollo()) && x.getDataColloS().equals(scannedUL.getDataColloS()) && x.getSerCollo().equalsIgnoreCase(scannedUL.getSerCollo()) && (scannedUL.getGestioneEnum() == GestioneEnum.ACQUISTO || scannedUL.getGestioneEnum() == GestioneEnum.LAVORAZIONE))) {
|
if (Stream.of(pickingObjectDTO.getMtbColts())
|
||||||
|
.anyMatch(x ->
|
||||||
|
Objects.equals(x.getNumCollo(), scannedUL.getNumCollo()) &&
|
||||||
|
x.getDataColloS().equals(scannedUL.getDataColloS()) &&
|
||||||
|
x.getSerCollo().equalsIgnoreCase(scannedUL.getSerCollo()) &&
|
||||||
|
(scannedUL.getGestioneEnum() == GestioneEnum.ACQUISTO || scannedUL.getGestioneEnum() == GestioneEnum.LAVORAZIONE))) {
|
||||||
|
|
||||||
matchPickingObject.add(pickingObjectDTO);
|
matchPickingObject.add(pickingObjectDTO);
|
||||||
}
|
}
|
||||||
@@ -679,7 +697,13 @@ public class SpedizioneViewModel {
|
|||||||
ObservableArrayList<MtbColr> cloneMtbColrs = (ObservableArrayList<MtbColr>) cloneMtbColt.getMtbColr().clone();
|
ObservableArrayList<MtbColr> cloneMtbColrs = (ObservableArrayList<MtbColr>) cloneMtbColt.getMtbColr().clone();
|
||||||
|
|
||||||
|
|
||||||
Stream.of(cloneMtbColt.getMtbColr()).filter(x -> !(UtilityString.equalsIgnoreCase(x.getCodMart(), matchedObject.getSitArtOrdDTO().getCodMart()) && UtilityString.equalsIgnoreCase(x.getCodTagl(), matchedObject.getSitArtOrdDTO().getCodTagl()) && UtilityString.equalsIgnoreCase(x.getCodCol(), matchedObject.getSitArtOrdDTO().getCodCol()) && (!mEnableCheckPartitaMag || UtilityString.equalsIgnoreCase(x.getPartitaMag(), matchedObject.getSitArtOrdDTO().getPartitaMag()) || UtilityString.isNullOrEmpty(matchedObject.getSitArtOrdDTO().getPartitaMag())))).forEach(cloneMtbColrs::remove);
|
Stream.of(cloneMtbColt.getMtbColr())
|
||||||
|
.filter(x -> !(UtilityString.equalsIgnoreCase(x.getCodMart(), matchedObject.getSitArtOrdDTO().getCodMart()) &&
|
||||||
|
UtilityString.equalsIgnoreCase(x.getCodTagl(), matchedObject.getSitArtOrdDTO().getCodTagl()) &&
|
||||||
|
UtilityString.equalsIgnoreCase(x.getCodCol(), matchedObject.getSitArtOrdDTO().getCodCol()) &&
|
||||||
|
(!mEnableCheckPartitaMag || UtilityString.equalsIgnoreCase(x.getPartitaMag(), matchedObject.getSitArtOrdDTO().getPartitaMag()) ||
|
||||||
|
UtilityString.isNullOrEmpty(matchedObject.getSitArtOrdDTO().getPartitaMag()))))
|
||||||
|
.forEach(cloneMtbColrs::remove);
|
||||||
|
|
||||||
cloneMtbColt.setMtbColr(cloneMtbColrs);
|
cloneMtbColt.setMtbColr(cloneMtbColrs);
|
||||||
|
|
||||||
@@ -1213,6 +1237,7 @@ public class SpedizioneViewModel {
|
|||||||
mMtbColtSessionID = this.mColliDataRecoverService.startNewSession(createdUDS, mTestateOrdini);
|
mMtbColtSessionID = this.mColliDataRecoverService.startNewSession(createdUDS, mTestateOrdini);
|
||||||
|
|
||||||
this.mCurrentMtbColt = createdUDS;
|
this.mCurrentMtbColt = createdUDS;
|
||||||
|
this.mCurrentMtbColt.setRagSocCliente(mDefaultRagSocOfUL);
|
||||||
this.mIsNewLU = true;
|
this.mIsNewLU = true;
|
||||||
|
|
||||||
if (onComplete != null) onComplete.run();
|
if (onComplete != null) onComplete.run();
|
||||||
@@ -1404,7 +1429,7 @@ public class SpedizioneViewModel {
|
|||||||
filledMtbColts,
|
filledMtbColts,
|
||||||
positionedMtbColts -> {
|
positionedMtbColts -> {
|
||||||
|
|
||||||
this.askPrint(shouldPrint, positionedMtbColts, () -> {
|
this.askPrint((shouldPrint && SettingsManager.iDB().isFlagPrintEtichetteOnLUClose()), positionedMtbColts, () -> {
|
||||||
Stream.of(positionedMtbColts)
|
Stream.of(positionedMtbColts)
|
||||||
.filter(x -> !this.mColliRegistrati.contains(x))
|
.filter(x -> !this.mColliRegistrati.contains(x))
|
||||||
.forEach(x -> this.mColliRegistrati.add(x));
|
.forEach(x -> this.mColliRegistrati.add(x));
|
||||||
|
|||||||
@@ -62,15 +62,15 @@ public class DialogInfoSituazioneArticoloView extends BaseDialogRowInfoView {
|
|||||||
.create()
|
.create()
|
||||||
.inject(this);
|
.inject(this);
|
||||||
|
|
||||||
var cancelable = true;
|
setCancelable(true);
|
||||||
|
|
||||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||||
.setView(mBindings.getRoot())
|
.setView(mBindings.getRoot())
|
||||||
.setNeutralButton(R.string.action_close, null)
|
.setNeutralButton(R.string.action_close, null)
|
||||||
.setCancelable(cancelable)
|
.setCancelable(isCancelable())
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
alertDialog.setCanceledOnTouchOutside(cancelable);
|
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||||
alertDialog.setOnShowListener(this);
|
alertDialog.setOnShowListener(this);
|
||||||
return alertDialog;
|
return alertDialog;
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ public class DialogInfoSituazioneArticoloView extends BaseDialogRowInfoView {
|
|||||||
availableItems = new ArrayList<>();
|
availableItems = new ArrayList<>();
|
||||||
|
|
||||||
availableItems = Stream.of(availableItems)
|
availableItems = Stream.of(availableItems)
|
||||||
.filter(x -> UtilityDate.isAfterToday(x.getDataScad()))
|
.filter(x -> x.getDataScad() == null || UtilityDate.isAfterToday(x.getDataScad()))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if(availableItems.isEmpty())
|
if(availableItems.isEmpty())
|
||||||
@@ -141,7 +141,7 @@ public class DialogInfoSituazioneArticoloView extends BaseDialogRowInfoView {
|
|||||||
|
|
||||||
var itemListCommessaNotMatchMatch = Stream.of(itemList)
|
var itemListCommessaNotMatchMatch = Stream.of(itemList)
|
||||||
.filter(dialogInfoSituazioneArticoloAvailableListItem -> !dialogInfoSituazioneArticoloAvailableListItem.isCommessaMatch())
|
.filter(dialogInfoSituazioneArticoloAvailableListItem -> !dialogInfoSituazioneArticoloAvailableListItem.isCommessaMatch())
|
||||||
.sortBy(x -> x.getDataScad())
|
.sortBy(x -> x.getDataScad() == null ? UtilityDate.getNow() : x.getDataScad())
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
|
import it.integry.integrywmsnative.core.CommonConst;
|
||||||
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||||
import it.integry.integrywmsnative.core.expansion.OnSingleClickListener;
|
import it.integry.integrywmsnative.core.expansion.OnSingleClickListener;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
|
||||||
@@ -150,8 +151,18 @@ public class SpedizioneListAdapter extends SectionedRecyclerViewAdapter<Spedizio
|
|||||||
holder.mBinding.freeQty.setVisibility(View.GONE);
|
holder.mBinding.freeQty.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.mBinding.qtaEvasa.setText(UtilityNumber.decimalToString(pickingObjectDTO.getQtaEvasa()));
|
int cifreDec = CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS;
|
||||||
holder.mBinding.qtaTot.setText(UtilityNumber.decimalToString(pickingObjectDTO.getQtaTot()));
|
if (pickingObjectDTO.getOriginalModel().getMtbAart() != null &&
|
||||||
|
pickingObjectDTO.getOriginalModel().getMtbAart().getMtbUntMis() != null &&
|
||||||
|
!pickingObjectDTO.getOriginalModel().getMtbAart().getMtbUntMis().isEmpty()) {
|
||||||
|
|
||||||
|
var mtbUntMis = pickingObjectDTO.getOriginalModel().getMtbAart().getMtbUntMis().get(0);
|
||||||
|
if (mtbUntMis.isFlagDig()) cifreDec = 0;
|
||||||
|
else cifreDec = Math.min(mtbUntMis.getCifreDec().intValue(), CommonConst.Config.NUMBER_OF_DECIMAL_DIGITS);
|
||||||
|
}
|
||||||
|
|
||||||
|
holder.mBinding.qtaEvasa.setText(UtilityNumber.decimalToString(pickingObjectDTO.getQtaEvasa(), cifreDec));
|
||||||
|
holder.mBinding.qtaTot.setText(UtilityNumber.decimalToString(pickingObjectDTO.getQtaTot(), cifreDec));
|
||||||
|
|
||||||
holder.mBinding.untMis.setText(pickingObjectDTO.getUntMis());
|
holder.mBinding.untMis.setText(pickingObjectDTO.getUntMis());
|
||||||
holder.mBinding.untMis.setVisibility(UtilityString.isNullOrEmpty(pickingObjectDTO.getUntMis()) ? View.GONE : View.VISIBLE);
|
holder.mBinding.untMis.setVisibility(UtilityString.isNullOrEmpty(pickingObjectDTO.getUntMis()) ? View.GONE : View.VISIBLE);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.view.dialogs;
|
package it.integry.integrywmsnative.view.dialogs;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
|
||||||
@@ -19,14 +20,19 @@ public class DialogAskActionView extends BaseDialogFragment {
|
|||||||
|
|
||||||
private final Runnable mOnEditSelected;
|
private final Runnable mOnEditSelected;
|
||||||
private final Runnable mOnDeleteSelected;
|
private final Runnable mOnDeleteSelected;
|
||||||
|
private boolean runOnDismissAction = true;
|
||||||
|
private final Runnable mOnDismiss;
|
||||||
|
|
||||||
|
|
||||||
|
public static DialogAskActionView newInstance(String title, String subtitle, Runnable onEdit, Runnable onDelete, Runnable onDismiss) {
|
||||||
public static DialogAskActionView newInstance(String title, String subtitle, Runnable onEdit, Runnable onDelete) {
|
return new DialogAskActionView(title, subtitle, onEdit, onDelete, onDismiss);
|
||||||
return new DialogAskActionView(title, subtitle, onEdit, onDelete);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private DialogAskActionView(String title, String subTitle, Runnable onEditSelected, Runnable onDeleteSelected) {
|
public static DialogAskActionView newInstance(String title, String subtitle, Runnable onEdit, Runnable onDelete) {
|
||||||
|
return newInstance(title, subtitle, onEdit, onDelete, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogAskActionView(String title, String subTitle, Runnable onEditSelected, Runnable onDeleteSelected, Runnable onDismiss) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
mTitle = title;
|
mTitle = title;
|
||||||
@@ -34,6 +40,7 @@ public class DialogAskActionView extends BaseDialogFragment {
|
|||||||
|
|
||||||
mOnEditSelected = onEditSelected;
|
mOnEditSelected = onEditSelected;
|
||||||
mOnDeleteSelected = onDeleteSelected;
|
mOnDeleteSelected = onDeleteSelected;
|
||||||
|
mOnDismiss = onDismiss;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@@ -53,14 +60,23 @@ public class DialogAskActionView extends BaseDialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onEdit() {
|
public void onEdit() {
|
||||||
|
runOnDismissAction = false;
|
||||||
dismiss();
|
dismiss();
|
||||||
mOnEditSelected.run();
|
mOnEditSelected.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDelete() {
|
public void onDelete() {
|
||||||
|
runOnDismissAction = false;
|
||||||
dismiss();
|
dismiss();
|
||||||
mOnDeleteSelected.run();
|
mOnDeleteSelected.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
|
if (runOnDismissAction && mOnDismiss != null) {
|
||||||
|
mOnDismiss.run();
|
||||||
|
}
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ public class DialogProgressView extends DialogFragment {
|
|||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.create();
|
.create();
|
||||||
alertDialog.setCanceledOnTouchOutside(false);
|
alertDialog.setCanceledOnTouchOutside(false);
|
||||||
|
|
||||||
|
setCancelable(false);
|
||||||
return alertDialog;
|
return alertDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package it.integry.integrywmsnative.view.dialogs.available_items;
|
||||||
|
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
|
|
||||||
|
public class DialogAvailableItemListModel {
|
||||||
|
|
||||||
|
private String codMart;
|
||||||
|
private String descrizioneEstesa;
|
||||||
|
|
||||||
|
private boolean aggiunto;
|
||||||
|
|
||||||
|
private boolean clickable;
|
||||||
|
private MtbAart originalModel;
|
||||||
|
|
||||||
|
public boolean isAggiunto() {
|
||||||
|
return aggiunto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogAvailableItemListModel setAggiunto(boolean aggiunto) {
|
||||||
|
this.aggiunto = aggiunto;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogAvailableItemListModel setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizioneEstesa() {
|
||||||
|
return descrizioneEstesa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogAvailableItemListModel setDescrizioneEstesa(String descrizioneEstesa) {
|
||||||
|
this.descrizioneEstesa = descrizioneEstesa;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isClickable() {
|
||||||
|
return clickable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogAvailableItemListModel setClickable(boolean clickable) {
|
||||||
|
this.clickable = clickable;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbAart getOriginalModel() {
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogAvailableItemListModel setOriginalModel(MtbAart originalModel) {
|
||||||
|
this.originalModel = originalModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DialogAvailableItemListModel fromMtbAart(MtbAart mtbAart) {
|
||||||
|
return new DialogAvailableItemListModel()
|
||||||
|
.setCodMart(mtbAart.getCodMart())
|
||||||
|
.setDescrizioneEstesa(mtbAart.getDescrizioneEstesa())
|
||||||
|
.setOriginalModel(mtbAart);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
DialogAvailableItemListModel that = (DialogAvailableItemListModel) o;
|
||||||
|
|
||||||
|
return getOriginalModel().equals(that.getOriginalModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return getOriginalModel().hashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user