Compare commits
53 Commits
v1.30.04__
...
v1.30.14(3
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e87130d6c | |||
| 0f6a9cdae2 | |||
| 79ec6430f6 | |||
| 0c46fb09c1 | |||
| 8aad7337bf | |||
| c49197d002 | |||
| 16f611c147 | |||
| 7b623913d8 | |||
| 0a8997f30b | |||
| 702d0a7348 | |||
| f4ae1fbed3 | |||
| 8c0639be9b | |||
| c9ea13a1d2 | |||
| bef5423a06 | |||
| 22b072aff7 | |||
| 50acee47e9 | |||
| ba041d1133 | |||
| 21c26ab3ad | |||
| 5288ad8bb0 | |||
| 0ccff458f7 | |||
| a1c8a52dd2 | |||
| e6e8b22554 | |||
| 9371e5824f | |||
| bda1328dec | |||
| 2030893249 | |||
| fa695ca9a4 | |||
| 8b9c9437ae | |||
| 6f026145ef | |||
| 0744d3713e | |||
| 3275422af8 | |||
| a49aab1fb0 | |||
| e25cc9e825 | |||
| 92e9529cc5 | |||
| 7990f38c37 | |||
| 134dff5aba | |||
| 0c359e5110 | |||
| 7b913e607e | |||
| ee5d30ff80 | |||
| 6c41506a97 | |||
| ab14d6736c | |||
| b6c82c869e | |||
| f3f04e9473 | |||
| ef753f9bcd | |||
| e764ad1148 | |||
| 82cc4f989c | |||
| 650d1670de | |||
| 6ca7943d78 | |||
| 013646eae3 | |||
| 341359d871 | |||
| 545081444c | |||
| b35819c9c9 | |||
| ec44275e41 | |||
| f5d78edfd1 |
17
.idea/deploymentTargetDropDown.xml
generated
17
.idea/deploymentTargetDropDown.xml
generated
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="SERIAL_NUMBER" />
|
||||
<value value="20119B1E55" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2022-12-12T15:40:54.351888Z" />
|
||||
</component>
|
||||
</project>
|
||||
15
.idea/git_toolbox_prj.xml
generated
Normal file
15
.idea/git_toolbox_prj.xml
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitToolBoxProjectSettings">
|
||||
<option name="commitMessageIssueKeyValidationOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
<option name="commitMessageValidationEnabledOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
8
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
8
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,com.annimon.stream.Stream,of" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
@@ -10,8 +10,8 @@ apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
android {
|
||||
|
||||
def appVersionCode = 322
|
||||
def appVersionName = '1.30.04'
|
||||
def appVersionCode = 332
|
||||
def appVersionName = '1.30.14'
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
@@ -31,16 +31,17 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
compileSdkVersion 32
|
||||
compileSdkVersion 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId "it.integry.integrywmsnative"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 32
|
||||
targetSdkVersion 33
|
||||
versionCode appVersionCode
|
||||
versionName appVersionName
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
signingConfig signingConfigs.release
|
||||
multiDexEnabled true
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
@@ -115,9 +116,9 @@ dependencies {
|
||||
implementation 'com.google.android.gms:play-services-basement:18.1.0'
|
||||
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.5.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.6.1'
|
||||
implementation 'com.google.android.material:material:1.8.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||
@@ -156,12 +157,12 @@ dependencies {
|
||||
implementation 'com.github.pedromassango:doubleClick:3.0'
|
||||
|
||||
//SQLite ROOM
|
||||
def room_version = "2.4.3"
|
||||
def room_version = "2.5.0"
|
||||
|
||||
implementation "androidx.room:room-runtime:$room_version"
|
||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||
implementation "androidx.room:room-rxjava3:$room_version"
|
||||
androidTestImplementation "androidx.room:room-testing:2.4.3"
|
||||
androidTestImplementation "androidx.room:room-testing:2.5.0"
|
||||
|
||||
//AppUpdate
|
||||
implementation 'com.github.javiersantos:AppUpdater:2.7'
|
||||
@@ -188,9 +189,7 @@ dependencies {
|
||||
// RxJava is also required.
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
|
||||
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.0'
|
||||
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.2'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -92,8 +92,10 @@ import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetM
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditModalModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.InfoAggiuntiveLUDialogComponent;
|
||||
@@ -148,7 +150,7 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
ProdOrdineProduzioneElencoModule.class,
|
||||
ProdRecuperoMaterialeModule.class,
|
||||
ProdVersamentoMaterialeModule.class,
|
||||
DialogChooseArtsFromListaArtsModule.class,
|
||||
DialogChooseArtsFromMtbColrListModule.class,
|
||||
DocInterniModule.class,
|
||||
DialogSelectDocInfoModule.class,
|
||||
DocInterniEditFormModule.class,
|
||||
@@ -166,6 +168,8 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
BottomSheetInventarioActionsModule.class,
|
||||
BottomSheetInventarioRowActionsModule.class,
|
||||
BottomSheetMtbColrEditModalModule.class,
|
||||
DialogChooseArtsFromMtbAartListModule.class,
|
||||
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
@@ -243,7 +247,7 @@ public interface MainApplicationComponent {
|
||||
|
||||
ProdVersamentoMaterialeComponent.Factory prodVersamentoMaterialeComponent();
|
||||
|
||||
DialogChooseArtsFromListaArtsComponent.Factory dialogChooseArtsFromListaArtsComponent();
|
||||
DialogChooseArtsFromMtbColrListComponent.Factory dialogChooseArtsFromListaArtsComponent();
|
||||
|
||||
DocInterniComponent.Factory docInterniComponent();
|
||||
|
||||
@@ -279,6 +283,8 @@ public interface MainApplicationComponent {
|
||||
|
||||
BottomSheetMtbColrEditModalComponent.Factory bottomSheetMtbColrEditModalComponent();
|
||||
|
||||
DialogChooseArtsFromMtbAartListComponent.Factory dialogDialogDialogChooseArtsFromMtbAartListViewComponent();
|
||||
|
||||
void inject(MainApplication mainApplication);
|
||||
|
||||
void inject(AppContext mainApplication);
|
||||
|
||||
@@ -22,13 +22,16 @@ import it.integry.integrywmsnative.core.menu.MenuService;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.AziendaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.CommessaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.DocumentiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.EntityRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
|
||||
@@ -254,4 +257,22 @@ public class MainApplicationModule {
|
||||
return new DocumentiRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ColliSpedizioneRESTConsumer provideColliSpedizioneRESTConsumer() {
|
||||
return new ColliSpedizioneRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ColliLavorazioneRESTConsumer provideColliLavorazioneRESTConsumer() {
|
||||
return new ColliLavorazioneRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MagazzinoAutomaticoRESTConsumer provideMagazzinoAutomaticoRESTConsumer() {
|
||||
return new MagazzinoAutomaticoRESTConsumer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.class_router.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
|
||||
public interface IOrdiniVendita {
|
||||
|
||||
void distribuisciCollo(MtbColt mtbColt, List<OrdineUscitaInevasoDTO> testateOrdini, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package it.integry.integrywmsnative.core.class_router.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
|
||||
public interface OrdiniVenditaInterface {
|
||||
|
||||
boolean isTrasfOrder(List<OrdineUscitaInevasoDTO> testateOrdini);
|
||||
|
||||
}
|
||||
@@ -255,7 +255,7 @@ public class ArticoloOrdine {
|
||||
|
||||
public int checkQtaProposta() {
|
||||
int check = 0;
|
||||
if (!qtaProposta.equals(BigDecimal.ZERO)) {
|
||||
if (qtaProposta != null && !qtaProposta.equals(BigDecimal.ZERO)) {
|
||||
check = BigDecimal.valueOf(qtaOrd).compareTo(qtaProposta);
|
||||
}
|
||||
return check;
|
||||
|
||||
@@ -15,6 +15,7 @@ import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
|
||||
public class ArticoliOrdineDataSource extends BaseDataSource implements ArticoliOrdineRepository {
|
||||
|
||||
@@ -53,6 +54,7 @@ public class ArticoliOrdineDataSource extends BaseDataSource implements Articoli
|
||||
}
|
||||
|
||||
public void saveArticoloToOrdine(ArticoloOrdine articolo, Runnable onSuccess, RunnableArgs<Exception> onError) {
|
||||
articolo.setDataIns(UtilityDate.getDateInstance());
|
||||
if (articolo.getArticoloOrdineId() != null && articolo.getArticoloOrdineId() > 0) {
|
||||
execute(() -> mArticoloOrdineDao.update(articolo), onSuccess, onError);
|
||||
} else {
|
||||
|
||||
@@ -18,7 +18,6 @@ public class BindableBoolean implements Observable {
|
||||
this.mValue = startValue;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addOnPropertyChangedCallback(@NonNull OnPropertyChangedCallback callback) {
|
||||
synchronized (this) {
|
||||
|
||||
@@ -37,14 +37,12 @@ public class BaseActivity extends AppCompatActivity {
|
||||
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
public void onError(Exception ex) {
|
||||
this.runOnUiThread(() -> {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(this, ex);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.expansion;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
@@ -18,7 +19,7 @@ import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
|
||||
public class BaseDialogFragment extends DialogFragment {
|
||||
public class BaseDialogFragment extends DialogFragment implements DialogInterface.OnShowListener {
|
||||
|
||||
@Inject
|
||||
public DialogProgressView mCurrentProgress;
|
||||
@@ -41,20 +42,7 @@ public class BaseDialogFragment extends DialogFragment {
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
MainApplication.appComponent
|
||||
.baseDialogFragmentComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator()) {
|
||||
getDialog().setOnKeyListener((dialog, keyCode, event) -> {
|
||||
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
public void onLoadingStarted() {
|
||||
@@ -107,4 +95,24 @@ public class BaseDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
MainApplication.appComponent
|
||||
.baseDialogFragmentComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
if (BarcodeManager.isEnabled() && BarcodeManager.isKeyboardEmulator() && getDialog() != null) {
|
||||
getDialog().setOnKeyListener((dialog, keyCode, event) -> {
|
||||
if (mBarcodeListener && (event.getAction() == KeyEvent.ACTION_DOWN || event.getAction() == KeyEvent.ACTION_MULTIPLE) && !isControlKey(event)) {
|
||||
return BarcodeManager.onKeyDown(event.getKeyCode(), event);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package it.integry.integrywmsnative.core.expansion;
|
||||
|
||||
public interface RunnableArgsssss<S, T, U, V, X> {
|
||||
|
||||
void run(S data1, T data2, U data3, V data4, X data5);
|
||||
}
|
||||
@@ -2,16 +2,16 @@ package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import androidx.databinding.Observable;
|
||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsItemModel;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrListItemModel;
|
||||
|
||||
public class CheckableMtbColr {
|
||||
|
||||
|
||||
private DialogChooseArtsFromListaArtsItemModel item;
|
||||
private DialogChooseArtsFromMtbColrListItemModel item;
|
||||
private BindableBoolean checked = new BindableBoolean(false);
|
||||
private BindableBoolean hidden = new BindableBoolean(false);
|
||||
|
||||
public CheckableMtbColr(DialogChooseArtsFromListaArtsItemModel item) {
|
||||
public CheckableMtbColr(DialogChooseArtsFromMtbColrListItemModel item) {
|
||||
this.item = item;
|
||||
|
||||
this.item.getHidden().addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||
@@ -22,11 +22,11 @@ public class CheckableMtbColr {
|
||||
});
|
||||
}
|
||||
|
||||
public DialogChooseArtsFromListaArtsItemModel getItem() {
|
||||
public DialogChooseArtsFromMtbColrListItemModel getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public CheckableMtbColr setItem(DialogChooseArtsFromListaArtsItemModel item) {
|
||||
public CheckableMtbColr setItem(DialogChooseArtsFromMtbColrListItemModel item) {
|
||||
this.item = item;
|
||||
|
||||
this.item.getHidden().addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||
@@ -60,8 +60,4 @@ public class CheckableMtbColr {
|
||||
this.hidden = hidden;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void toggleCheck() {
|
||||
this.checked.set(!this.checked.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,33 +600,6 @@ public class MtbColt extends EntityBase {
|
||||
}
|
||||
}
|
||||
|
||||
/*if (filtroOrdineDtos != null && filtroOrdineDtos.size() > 0) {
|
||||
|
||||
for (int i = 0; i < filtroOrdineDtos.size(); i++) {
|
||||
FiltroOrdineDTO x = filtroOrdineDtos.get(i);
|
||||
|
||||
try {
|
||||
whereCond.append("(");
|
||||
whereCond.append(String.format("d.g = %s AND d.d = %s and d.n = %s",
|
||||
UtilityDB.valueToString(x.getGestioneOrd()),
|
||||
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataOrdD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH)),
|
||||
UtilityDB.valueToString(x.getNumOrd())));
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(x.getDataConsS())) {
|
||||
whereCond.append(String.format(" AND dr.dc = %s",
|
||||
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataConsD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH))));
|
||||
}
|
||||
|
||||
whereCond.append(")");
|
||||
if (i < filtroOrdineDtos.size() - 1) {
|
||||
whereCond.append(" OR ");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
whereCond = TextUtils.join(" OR ", conditions);
|
||||
|
||||
this.filtroOrdini = xmlPrefix + whereCond + xmlSuffix;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.integrywmsnative.core.model;
|
||||
|
||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
|
||||
public class MtbDepoPosizione {
|
||||
|
||||
@@ -11,6 +12,8 @@ public class MtbDepoPosizione {
|
||||
private String flagLineaProduzione;
|
||||
private Integer priorita;
|
||||
|
||||
private String tipoMagazAutomatico;
|
||||
|
||||
|
||||
|
||||
public MtbDepoPosizione clone() {
|
||||
@@ -85,4 +88,17 @@ public class MtbDepoPosizione {
|
||||
this.priorita = priorita;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTipoMagazAutomatico() {
|
||||
return tipoMagazAutomatico;
|
||||
}
|
||||
|
||||
public MtbDepoPosizione setTipoMagazAutomatico(String tipoMagazAutomatico) {
|
||||
this.tipoMagazAutomatico = tipoMagazAutomatico;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isMagazzinoAutomatico() {
|
||||
return !UtilityString.isNullOrEmpty(getTipoMagazAutomatico());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,4 +270,23 @@ public class MvwSitArtUdcDetInventario {
|
||||
this.mtbAart = mtbAart;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MtbColr toMtbColr() {
|
||||
return new MtbColr()
|
||||
.setCodJcom(getCodJcom())
|
||||
.setCodMart(getCodMart())
|
||||
.setDataCollo(getDataCollo())
|
||||
.setNumCollo(getNumCollo())
|
||||
.setSerCollo(getSerCollo())
|
||||
.setGestione(getGestione())
|
||||
.setMtbAart(getMtbAart())
|
||||
.setNumCnf(getNumCnf())
|
||||
.setQtaCnf(getQtaCnf())
|
||||
.setQtaCol(getQtaCol())
|
||||
.setPartitaMag(getPartitaMag())
|
||||
.setPesoNettoKg(getPesoNettoKg())
|
||||
.setPesoLordoKg(getPesoLordoKg())
|
||||
.setUntMis(getUntMis());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,20 +59,17 @@ public class RESTBuilder {
|
||||
|
||||
String endpoint = "http://" + host + ":" + port + "/" + (addEmsApi ? "ems-api/" : "");
|
||||
|
||||
|
||||
Gson gson = new GsonBuilder()
|
||||
.setDateFormat("dd/MM/yyyy HH:mm:ss")
|
||||
.excludeFieldsWithModifiers(Modifier.TRANSIENT)
|
||||
.registerTypeAdapter(LocalDate.class, new LocalDateDeserializer())
|
||||
.registerTypeAdapter(LocalDate.class, new LocalDateSerializer())
|
||||
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeDeserializer())
|
||||
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer())
|
||||
.excludeFieldsWithModifiers(Modifier.TRANSIENT)
|
||||
.create();
|
||||
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.baseUrl(endpoint)
|
||||
.client(client)
|
||||
.build();
|
||||
Retrofit retrofit = new Retrofit.Builder().addConverterFactory(GsonConverterFactory.create(gson)).baseUrl(endpoint).client(client).build();
|
||||
|
||||
return retrofit.create(service);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CanUDSBeDeletedRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class ColliLavorazioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface {
|
||||
|
||||
|
||||
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/closeUDS", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void canUDSBeDeleted(CanUDSBeDeletedRequestDTO canUDSBeDeletedRequestDTO, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.canUDSBeDeleted(canUDSBeDeletedRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
|
||||
analyzeAnswer(response, "lavorazione/canUDSBeDeleted", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUDS(DeleteUDSRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.deleteUDS(deleteUDSRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "lavorazione/deleteUDS", Void -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printUDS(PrintUDSRequestDTO printUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.printUDS(printUDSRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "lavorazione/printUDS", Void -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "lavorazione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliLavorazioneRESTConsumerService colliLavorazioneRESTConsumerService = RESTBuilder.getService(ColliLavorazioneRESTConsumerService.class);
|
||||
|
||||
colliLavorazioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "lavorazione/deleteUDSRow", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CanUDSBeDeletedRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface ColliLavorazioneRESTConsumerService {
|
||||
|
||||
@POST("wms/lavorazione/createUDS")
|
||||
Call<ServiceRESTResponse<CreateUDSResponseDTO>> createUDS(@Body CreateUDSRequestDTO createUDSRequestDTO);
|
||||
|
||||
@POST("wms/lavorazione/closeUDS")
|
||||
Call<ServiceRESTResponse<CloseUDSResponseDTO>> closeUDS(@Body CloseUDSRequestDTO createUDSRequestDTO);
|
||||
|
||||
@POST("wms/lavorazione/canUDSBeDeleted")
|
||||
Call<ServiceRESTResponse<Boolean>> canUDSBeDeleted(@Body CanUDSBeDeletedRequestDTO canUDSBeDeletedRequestDTO);
|
||||
|
||||
@POST("wms/lavorazione/deleteUDS")
|
||||
Call<ServiceRESTResponse<Void>> deleteUDS(@Body DeleteUDSRequestDTO deleteUDSRequestDTO);
|
||||
|
||||
@POST("wms/lavorazione/printUDS")
|
||||
Call<ServiceRESTResponse<Void>> printUDS(@Body PrintUDSRequestDTO printUDSRequestDTO);
|
||||
|
||||
@POST("wms/lavorazione/insertUDSRow")
|
||||
Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> insertUDSRow(@Body InsertUDSRowRequestDTO insertUDSRowRequestDTO);
|
||||
|
||||
@POST("wms/lavorazione/deleteUDSRow")
|
||||
Call<ServiceRESTResponse<Void>> deleteUDSRow(@Body DeleteUDSRowRequestDTO deleteUDSRowRequestDTO);
|
||||
|
||||
}
|
||||
@@ -4,8 +4,6 @@ import androidx.databinding.ObservableArrayList;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -29,7 +27,6 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||
@@ -280,48 +277,6 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
public static void distribuisciCollo(MtbColt mtbColtToDistribute, DistribuzioneColloDTO.CriterioDistribuzione criterioDistribuzione, RunnableArgs<List<MtbColt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
DistribuzioneColloDTO distribuzioneColloDTO = new DistribuzioneColloDTO()
|
||||
.setCriterioDistribuzione(criterioDistribuzione)
|
||||
.setDataCollo(mtbColtToDistribute.getDataColloS())
|
||||
.setNumCollo(mtbColtToDistribute.getNumCollo())
|
||||
.setGestione(mtbColtToDistribute.getGestione())
|
||||
.setSerCollo(mtbColtToDistribute.getSerCollo());
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.distribuisciCollo(distribuzioneColloDTO)
|
||||
.enqueue(new Callback<ServiceRESTResponse<JsonObject>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<JsonObject>> call, Response<ServiceRESTResponse<JsonObject>> response) {
|
||||
analyzeAnswerList(response, "DistribuzioneCollo", obj -> {
|
||||
|
||||
Gson gson = new Gson();
|
||||
List<JsonObject> jsons = response.body().getEntityList();
|
||||
|
||||
List<MtbColt> newList = new ArrayList<>();
|
||||
|
||||
if (jsons != null) {
|
||||
for (int i = 0; i < jsons.size(); i++) {
|
||||
JsonObject jsonTmp = jsons.get(i);
|
||||
|
||||
newList.add(gson.fromJson(jsonTmp, MtbColt.class));
|
||||
}
|
||||
}
|
||||
|
||||
onComplete.run(newList);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<JsonObject>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void getBySSCC(String ssccString, boolean onlyResiduo, boolean throwExcIfNull, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.getColloByBarcode(ssccString, onlyResiduo, throwExcIfNull).enqueue(new Callback<>() {
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CanUDSBeDeletedRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class ColliSpedizioneRESTConsumer extends _BaseRESTConsumer implements ColliScaricoRESTConsumerInterface {
|
||||
|
||||
|
||||
public void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.createUDS(createUDSRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Response<ServiceRESTResponse<CreateUDSResponseDTO>> response) {
|
||||
analyzeAnswer(response, "spedizione/createUDS", data -> onComplete.run(data.getMtbColt()), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CreateUDSResponseDTO>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.closeUDS(closeUDSRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Response<ServiceRESTResponse<CloseUDSResponseDTO>> response) {
|
||||
analyzeAnswer(response, "spedizione/closeUDS", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<CloseUDSResponseDTO>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void canUDSBeDeleted(CanUDSBeDeletedRequestDTO canUDSBeDeletedRequestDTO, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.canUDSBeDeleted(canUDSBeDeletedRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
|
||||
analyzeAnswer(response, "spedizione/canUDSBeDeleted", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void deleteUDS(DeleteUDSRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.deleteUDS(deleteUDSRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "spedizione/deleteUDS", Void -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void printUDS(PrintUDSRequestDTO printUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.printUDS(printUDSRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "spedizione/printUDS", Void -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.insertUDSRow(insertUDSRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Response<ServiceRESTResponse<InsertUDSRowResponseDTO>> response) {
|
||||
analyzeAnswer(response, "spedizione/insertUDSRow", data -> onComplete.run(data.getSavedMtbColr()), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRowRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
ColliSpedizioneRESTConsumerService colliSpedizioneRESTConsumerService = RESTBuilder.getService(ColliSpedizioneRESTConsumerService.class);
|
||||
|
||||
colliSpedizioneRESTConsumerService.deleteUDSRow(deleteUDSRowRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "spedizione/deleteUDSRow", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CanUDSBeDeletedRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface ColliSpedizioneRESTConsumerService {
|
||||
|
||||
@POST("wms/spedizione/createUDS")
|
||||
Call<ServiceRESTResponse<CreateUDSResponseDTO>> createUDS(@Body CreateUDSRequestDTO createUDSRequestDTO);
|
||||
|
||||
@POST("wms/spedizione/closeUDS")
|
||||
Call<ServiceRESTResponse<CloseUDSResponseDTO>> closeUDS(@Body CloseUDSRequestDTO createUDSRequestDTO);
|
||||
|
||||
@POST("wms/spedizione/canUDSBeDeleted")
|
||||
Call<ServiceRESTResponse<Boolean>> canUDSBeDeleted(@Body CanUDSBeDeletedRequestDTO canUDSBeDeletedRequestDTO);
|
||||
|
||||
@POST("wms/spedizione/deleteUDS")
|
||||
Call<ServiceRESTResponse<Void>> deleteUDS(@Body DeleteUDSRequestDTO deleteUDSRequestDTO);
|
||||
|
||||
@POST("wms/spedizione/printUDS")
|
||||
Call<ServiceRESTResponse<Void>> printUDS(@Body PrintUDSRequestDTO printUDSRequestDTO);
|
||||
|
||||
@POST("wms/spedizione/insertUDSRow")
|
||||
Call<ServiceRESTResponse<InsertUDSRowResponseDTO>> insertUDSRow(@Body InsertUDSRowRequestDTO insertUDSRowRequestDTO);
|
||||
|
||||
@POST("wms/spedizione/deleteUDSRow")
|
||||
Call<ServiceRESTResponse<Void>> deleteUDSRow(@Body DeleteUDSRowRequestDTO deleteUDSRowRequestDTO);
|
||||
|
||||
}
|
||||
@@ -2,11 +2,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
@@ -15,7 +11,11 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityQuery;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||
@@ -30,39 +30,41 @@ public class GiacenzaRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void getGiacenzeInPosizione(MtbDepoPosizione posizione, RunnableArgs<List<MvwSitArtUdcDetInventario>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
GiacenzaRESTConsumerService giacenzaRESTConsumerService = RESTBuilder.getService(GiacenzaRESTConsumerService.class);
|
||||
giacenzaRESTConsumerService.retrieveAvailableItems(posizione.getPosizione()).enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Response<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> response) {
|
||||
analyzeAnswer(response, "getGiacenzeInPosizione", inventarioList -> {
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
params.put("posizione", posizione.getPosizione());
|
||||
String whereCond = UtilityQuery.concatFieldsInWhereCond(params);
|
||||
String query = "SELECT * from mvw_sitart_udc_det_inventario" +
|
||||
" WHERE " + whereCond;
|
||||
List<String> codMarts = Stream.of(inventarioList)
|
||||
.map(x -> x.getCodMart().trim())
|
||||
.toList();
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||
for (var row : inventarioList) {
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<MvwSitArtUdcDetInventario>>() {
|
||||
}.getType();
|
||||
this.mSystemRESTConsumer.<ArrayList<MvwSitArtUdcDetInventario>>processSql(query, typeOfObjectsList, inventarioList -> {
|
||||
List<String> codMarts = Stream.of(inventarioList)
|
||||
.map(x -> x.getCodMart().trim())
|
||||
.toList();
|
||||
MtbAart foundMtbAart = null;
|
||||
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(row.getCodMart()))
|
||||
.findFirst();
|
||||
|
||||
mArticoloRESTConsumer.getByCodMarts(codMarts, mtbAarts -> {
|
||||
for (var row : inventarioList) {
|
||||
if (mtbAartOpt.isPresent()) {
|
||||
foundMtbAart = mtbAartOpt.get();
|
||||
}
|
||||
|
||||
MtbAart foundMtbAart = null;
|
||||
Optional<MtbAart> mtbAartOpt = Stream.of(mtbAarts)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(row.getCodMart()))
|
||||
.findFirst();
|
||||
row.setMtbAart(foundMtbAart);
|
||||
}
|
||||
|
||||
if (mtbAartOpt.isPresent()) {
|
||||
foundMtbAart = mtbAartOpt.get();
|
||||
}
|
||||
onComplete.run(inventarioList);
|
||||
}, onFailed);
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
row.setMtbAart(foundMtbAart);
|
||||
}
|
||||
|
||||
onComplete.run(inventarioList);
|
||||
}, onFailed);
|
||||
}, onFailed);
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface GiacenzaRESTConsumerService {
|
||||
|
||||
@GET("wms/giacenza/availableItems")
|
||||
Call<ServiceRESTResponse<List<MvwSitArtUdcDetInventario>>> retrieveAvailableItems(
|
||||
@Query("posizione") String posizione);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPutItemsRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class MagazzinoAutomaticoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void pickItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = RESTBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
|
||||
magazzinoAutomaticoRESTConsumerService.pickItems(posizione.getPosizione(), magazzinoAutomaticoPickItemsRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "magazzino-automatico/pickItems", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void putItems(MtbDepoPosizione posizione, MagazzinoAutomaticoPutItemsRequestDTO magazzinoAutomaticoPutItemsRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoAutomaticoRESTConsumerService magazzinoAutomaticoRESTConsumerService = RESTBuilder.getService(MagazzinoAutomaticoRESTConsumerService.class);
|
||||
magazzinoAutomaticoRESTConsumerService.putItems(posizione.getPosizione(), magazzinoAutomaticoPutItemsRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "magazzino-automatico/putItems", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPutItemsRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Path;
|
||||
|
||||
public interface MagazzinoAutomaticoRESTConsumerService {
|
||||
|
||||
@POST("wms/magazzino-automatico/{posizione}/pickItems")
|
||||
Call<ServiceRESTResponse<Void>> pickItems(
|
||||
@Path("posizione") String posizione,
|
||||
@Body MagazzinoAutomaticoPickItemsRequestDTO magazzinoAutomaticoPickItemsRequestDTO);
|
||||
|
||||
@POST("wms/magazzino-automatico/{posizione}/putItems")
|
||||
Call<ServiceRESTResponse<Void>> putItems(
|
||||
@Path("posizione") String posizione,
|
||||
@Body MagazzinoAutomaticoPutItemsRequestDTO magazzinoAutomaticoPutItemsRequestDTO);
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class MagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public void saveOrdine(SaveDTO saveDTO, RunnableArgs<DtbOrdt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoRESTConsumerService service = RESTBuilder.getService(MagazzinoRESTConsumerService.class);
|
||||
MagazzinoRESTConsumerService service = RESTBuilder.getService(MagazzinoRESTConsumerService.class, 240);
|
||||
service.saveOrdine(saveDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
|
||||
@@ -46,9 +46,7 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
public void getSuggestedPickingList(String codMdep, List<SitArtOrdDTO> sitArtOrdList, RunnableArgs<List<PickingObjectDTO>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
OrdiniRESTConsumerService service = RESTBuilder.getService(OrdiniRESTConsumerService.class, 90);
|
||||
|
||||
service
|
||||
.getSuggestedPickingList(codMdep, sitArtOrdList)
|
||||
.enqueue(new Callback<>() {
|
||||
@@ -109,7 +107,6 @@ public class OrdiniRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<List<PickingObjectDTO>>> call, Throwable t) {
|
||||
UtilityLogger.error(new Exception(t));
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -97,7 +97,6 @@ public class PVOrdiniAcquistoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
ordineDTO.setChiaveGriglia(ordine.getCodAlis());
|
||||
ordineDTO.setDataCons(UtilityDate.getDateInstance());
|
||||
ordineDTO.setArtRows(artRows);
|
||||
saveDTO.setGestione("O");
|
||||
saveDTO.setOrdineDTO(ordineDTO);
|
||||
|
||||
@@ -66,24 +66,23 @@ public class PrinterRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
PrinterRESTConsumerService printerService = RESTBuilder.getService(PrinterRESTConsumerService.class);
|
||||
Call<ServiceRESTResponse<Object>> callable = null;
|
||||
callable = printerService.printCollo(testataColloToPrint);
|
||||
printerService
|
||||
.printCollo(testataColloToPrint)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "printCollo", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
callable.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "printCollo", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
if (t.getMessage().contains("Printer not found")) {
|
||||
onFailed.run(new NoPrintersFoundException());
|
||||
} else onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
if (t.getMessage().contains("Printer not found")) {
|
||||
onFailed.run(new NoPrintersFoundException());
|
||||
} else onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,8 +30,9 @@ public abstract class _BaseRESTConsumer {
|
||||
onComplete.run(dataObj);
|
||||
}
|
||||
} else {
|
||||
Log.e(logTitle, response.body().getErrorMessage());
|
||||
onFailed.run(CommonRESTException.tryRecognizeException(response.body().getErrorMessage()));
|
||||
String errorMessage = UtilityString.isNull(response.body().getErrorMessage(), "Empty message");
|
||||
Log.e(logTitle, errorMessage);
|
||||
onFailed.run(CommonRESTException.tryRecognizeException(errorMessage));
|
||||
}
|
||||
} else {
|
||||
Log.e(logTitle, response.message());
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers.interfaces;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CanUDSBeDeletedRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.InsertUDSRowRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.PrintUDSRequestDTO;
|
||||
|
||||
public interface ColliScaricoRESTConsumerInterface {
|
||||
|
||||
void createUDS(CreateUDSRequestDTO createUDSRequestDTO, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
void closeUDS(CloseUDSRequestDTO closeUDSRequestDTO, RunnableArgs<CloseUDSResponseDTO> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
void canUDSBeDeleted(CanUDSBeDeletedRequestDTO canUDSBeDeletedRequestDTO, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
void deleteUDS(DeleteUDSRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
void printUDS(PrintUDSRequestDTO printUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
void insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed);
|
||||
|
||||
void deleteUDSRow(DeleteUDSRowRequestDTO deleteUDSRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed);
|
||||
}
|
||||
@@ -26,6 +26,7 @@ public class OrdineUscitaInevasoDTO extends OrdineInevasoDTO {
|
||||
private String ragSocCom;
|
||||
private String ragSocOrd;
|
||||
private String destinatario;
|
||||
private String codVdes;
|
||||
private String citta;
|
||||
private String provincia;
|
||||
private String indirizzo;
|
||||
@@ -424,4 +425,13 @@ public class OrdineUscitaInevasoDTO extends OrdineInevasoDTO {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public String getCodVdes() {
|
||||
return codVdes;
|
||||
}
|
||||
|
||||
public OrdineUscitaInevasoDTO setCodVdes(String codVdes) {
|
||||
this.codVdes = codVdes;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.magazzino_automatico;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class MagazzinoAutomaticoPickItemRequestDTO {
|
||||
|
||||
private String codMart;
|
||||
private String partitaMag;
|
||||
private String untMis;
|
||||
private BigDecimal qtaTot;
|
||||
private BigDecimal qtaCnf;
|
||||
private BigDecimal numCnf;
|
||||
|
||||
public MagazzinoAutomaticoPickItemRequestDTO(String codMart) {
|
||||
this.codMart = codMart;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public MagazzinoAutomaticoPickItemRequestDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPartitaMag() {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public MagazzinoAutomaticoPickItemRequestDTO setPartitaMag(String partitaMag) {
|
||||
this.partitaMag = partitaMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUntMis() {
|
||||
return untMis;
|
||||
}
|
||||
|
||||
public MagazzinoAutomaticoPickItemRequestDTO setUntMis(String untMis) {
|
||||
this.untMis = untMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaTot() {
|
||||
return qtaTot;
|
||||
}
|
||||
|
||||
public MagazzinoAutomaticoPickItemRequestDTO setQtaTot(BigDecimal qtaTot) {
|
||||
this.qtaTot = qtaTot;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public MagazzinoAutomaticoPickItemRequestDTO setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getNumCnf() {
|
||||
return numCnf;
|
||||
}
|
||||
|
||||
public MagazzinoAutomaticoPickItemRequestDTO setNumCnf(BigDecimal numCnf) {
|
||||
this.numCnf = numCnf;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.magazzino_automatico;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class MagazzinoAutomaticoPickItemsRequestDTO {
|
||||
|
||||
private boolean shouldCreateUDS;
|
||||
private String defaultGestioneOfNewUDS;
|
||||
private List<MagazzinoAutomaticoPickOrderRequestDTO> ordersOfNewUDS;
|
||||
private MtbColt inputMtbColt;
|
||||
private List<MagazzinoAutomaticoPickItemRequestDTO> itemsToPick;
|
||||
|
||||
public boolean isShouldCreateUDS() {
|
||||
return shouldCreateUDS;
|
||||
}
|
||||
|
||||
public MagazzinoAutomaticoPickItemsRequestDTO setShouldCreateUDS(boolean shouldCreateUDS) {
|
||||
this.shouldCreateUDS = shouldCreateUDS;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDefaultGestioneOfNewUDS() {
|
||||
return defaultGestioneOfNewUDS;
|
||||
}
|
||||
|
||||
public MagazzinoAutomaticoPickItemsRequestDTO setDefaultGestioneOfNewUDS(String defaultGestioneOfNewUDS) {
|
||||
this.defaultGestioneOfNewUDS = defaultGestioneOfNewUDS;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MagazzinoAutomaticoPickOrderRequestDTO> getOrdersOfNewUDS() {
|
||||
return ordersOfNewUDS;
|
||||
}
|
||||
|
||||
public MagazzinoAutomaticoPickItemsRequestDTO setOrdersOfNewUDS(List<MagazzinoAutomaticoPickOrderRequestDTO> ordersOfNewUDS) {
|
||||
this.ordersOfNewUDS = ordersOfNewUDS;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbColt getInputMtbColt() {
|
||||
return inputMtbColt;
|
||||
}
|
||||
|
||||
public MagazzinoAutomaticoPickItemsRequestDTO setInputMtbColt(MtbColt inputMtbColt) {
|
||||
this.inputMtbColt = inputMtbColt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MagazzinoAutomaticoPickItemRequestDTO> getItemsToPick() {
|
||||
return itemsToPick;
|
||||
}
|
||||
|
||||
public MagazzinoAutomaticoPickItemsRequestDTO setItemsToPick(List<MagazzinoAutomaticoPickItemRequestDTO> itemsToPick) {
|
||||
this.itemsToPick = itemsToPick;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.magazzino_automatico;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class MagazzinoAutomaticoPickOrderRequestDTO {
|
||||
|
||||
private final String type = "dtb_ordr";
|
||||
private LocalDate dataCons;
|
||||
private LocalDate dataOrd;
|
||||
private String gestione;
|
||||
private int numOrd;
|
||||
|
||||
public MagazzinoAutomaticoPickOrderRequestDTO(LocalDate dataOrd, String gestione, int numOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
this.gestione = gestione;
|
||||
this.numOrd = numOrd;
|
||||
}
|
||||
|
||||
public LocalDate getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public int getNumOrd() {
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
public LocalDate getDataCons() {
|
||||
return dataCons;
|
||||
}
|
||||
|
||||
public MagazzinoAutomaticoPickOrderRequestDTO setDataCons(LocalDate dataCons) {
|
||||
this.dataCons = dataCons;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.magazzino_automatico;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class MagazzinoAutomaticoPutItemsRequestDTO {
|
||||
|
||||
private MtbColt inputMtbColt;
|
||||
|
||||
|
||||
public MtbColt getInputMtbColt() {
|
||||
return inputMtbColt;
|
||||
}
|
||||
|
||||
public MagazzinoAutomaticoPutItemsRequestDTO setInputMtbColt(MtbColt inputMtbColt) {
|
||||
this.inputMtbColt = inputMtbColt;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class CanUDSBeDeletedRequestDTO {
|
||||
|
||||
|
||||
private MtbColt mtbColt;
|
||||
|
||||
public MtbColt getMtbColt() {
|
||||
return mtbColt;
|
||||
}
|
||||
|
||||
public CanUDSBeDeletedRequestDTO setMtbColt(MtbColt mtbColt) {
|
||||
this.mtbColt = mtbColt;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class CloseUDSRequestDTO {
|
||||
|
||||
private boolean printSSCC;
|
||||
private boolean enableTransferLogic;
|
||||
private String orderCodMdep;
|
||||
private MtbColt mtbColt;
|
||||
|
||||
public boolean isPrintSSCC() {
|
||||
return printSSCC;
|
||||
}
|
||||
|
||||
public CloseUDSRequestDTO setPrintSSCC(boolean printSSCC) {
|
||||
this.printSSCC = printSSCC;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isEnableTransferLogic() {
|
||||
return enableTransferLogic;
|
||||
}
|
||||
|
||||
public CloseUDSRequestDTO setEnableTransferLogic(boolean enableTransferLogic) {
|
||||
this.enableTransferLogic = enableTransferLogic;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOrderCodMdep() {
|
||||
return orderCodMdep;
|
||||
}
|
||||
|
||||
public CloseUDSRequestDTO setOrderCodMdep(String orderCodMdep) {
|
||||
this.orderCodMdep = orderCodMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbColt getMtbColt() {
|
||||
return mtbColt;
|
||||
}
|
||||
|
||||
public CloseUDSRequestDTO setMtbColt(MtbColt mtbColt) {
|
||||
this.mtbColt = mtbColt;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class CloseUDSResponseDTO {
|
||||
private boolean saved;
|
||||
private boolean deleted;
|
||||
|
||||
private List<MtbColt> generatedMtbColts;
|
||||
|
||||
public boolean isSaved() {
|
||||
return saved;
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
public List<MtbColt> getGeneratedMtbColts() {
|
||||
return generatedMtbColts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CreateUDSRequestDTO {
|
||||
|
||||
private String codMdep;
|
||||
private int segno;
|
||||
private String ragSoc;
|
||||
private Integer numCollo;
|
||||
private String serCollo;
|
||||
private int causaleCollo;
|
||||
|
||||
private List<CreateUDSRequestOrderDTO> orders;
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public CreateUDSRequestDTO setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getSegno() {
|
||||
return segno;
|
||||
}
|
||||
|
||||
public CreateUDSRequestDTO setSegno(int segno) {
|
||||
this.segno = segno;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRagSoc() {
|
||||
return ragSoc;
|
||||
}
|
||||
|
||||
public CreateUDSRequestDTO setRagSoc(String ragSoc) {
|
||||
this.ragSoc = ragSoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumCollo() {
|
||||
return numCollo;
|
||||
}
|
||||
|
||||
public CreateUDSRequestDTO setNumCollo(Integer numCollo) {
|
||||
this.numCollo = numCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSerCollo() {
|
||||
return serCollo;
|
||||
}
|
||||
|
||||
public CreateUDSRequestDTO setSerCollo(String serCollo) {
|
||||
this.serCollo = serCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getCausaleCollo() {
|
||||
return causaleCollo;
|
||||
}
|
||||
|
||||
public CreateUDSRequestDTO setCausaleCollo(int causaleCollo) {
|
||||
this.causaleCollo = causaleCollo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<CreateUDSRequestOrderDTO> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
public CreateUDSRequestDTO setOrders(List<CreateUDSRequestOrderDTO> orders) {
|
||||
this.orders = orders;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class Causale {
|
||||
public static final int SCARICO = 0;
|
||||
public static final int POSIZIONAMENTO = 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class CreateUDSRequestOrderDTO {
|
||||
|
||||
|
||||
private String gestione;
|
||||
private LocalDate dataOrd;
|
||||
private LocalDate dataCons;
|
||||
private int numOrd;
|
||||
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public CreateUDSRequestOrderDTO setGestione(String gestione) {
|
||||
this.gestione = gestione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDate getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public CreateUDSRequestOrderDTO setDataOrd(LocalDate dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDate getDataCons() {
|
||||
return dataCons;
|
||||
}
|
||||
|
||||
public CreateUDSRequestOrderDTO setDataCons(LocalDate dataCons) {
|
||||
this.dataCons = dataCons;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getNumOrd() {
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
public CreateUDSRequestOrderDTO setNumOrd(int numOrd) {
|
||||
this.numOrd = numOrd;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class CreateUDSResponseDTO {
|
||||
|
||||
private MtbColt mtbColt;
|
||||
|
||||
public MtbColt getMtbColt() {
|
||||
return mtbColt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class DeleteUDSRequestDTO {
|
||||
|
||||
private MtbColt mtbColt;
|
||||
|
||||
public MtbColt getMtbColt() {
|
||||
return mtbColt;
|
||||
}
|
||||
|
||||
public DeleteUDSRequestDTO setMtbColt(MtbColt mtbColt) {
|
||||
this.mtbColt = mtbColt;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
|
||||
public class DeleteUDSRowRequestDTO {
|
||||
|
||||
private MtbColr mtbColrToDelete;
|
||||
|
||||
public MtbColr getMtbColrToDelete() {
|
||||
return mtbColrToDelete;
|
||||
}
|
||||
|
||||
public DeleteUDSRowRequestDTO setMtbColrToDelete(MtbColr mtbColrToDelete) {
|
||||
this.mtbColrToDelete = mtbColrToDelete;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class InsertUDSRowRequestDTO {
|
||||
|
||||
private MtbColr sourceMtbColr;
|
||||
private MtbColt targetMtbColt;
|
||||
|
||||
private String codMart;
|
||||
private BigDecimal qtaTot;
|
||||
private BigDecimal qtaCnf;
|
||||
private BigDecimal numCnf;
|
||||
private String partitaMag;
|
||||
private LocalDate dataScad;
|
||||
|
||||
public MtbColr getSourceMtbColr() {
|
||||
return sourceMtbColr;
|
||||
}
|
||||
|
||||
public InsertUDSRowRequestDTO setSourceMtbColr(MtbColr sourceMtbColr) {
|
||||
this.sourceMtbColr = sourceMtbColr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbColt getTargetMtbColt() {
|
||||
return targetMtbColt;
|
||||
}
|
||||
|
||||
public InsertUDSRowRequestDTO setTargetMtbColt(MtbColt targetMtbColt) {
|
||||
this.targetMtbColt = targetMtbColt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public InsertUDSRowRequestDTO setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaTot() {
|
||||
return qtaTot;
|
||||
}
|
||||
|
||||
public InsertUDSRowRequestDTO setQtaTot(BigDecimal qtaTot) {
|
||||
this.qtaTot = qtaTot;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public InsertUDSRowRequestDTO setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getNumCnf() {
|
||||
return numCnf;
|
||||
}
|
||||
|
||||
public InsertUDSRowRequestDTO setNumCnf(BigDecimal numCnf) {
|
||||
this.numCnf = numCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPartitaMag() {
|
||||
return partitaMag;
|
||||
}
|
||||
|
||||
public InsertUDSRowRequestDTO setPartitaMag(String partitaMag) {
|
||||
this.partitaMag = partitaMag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDate getDataScad() {
|
||||
return dataScad;
|
||||
}
|
||||
|
||||
public InsertUDSRowRequestDTO setDataScad(LocalDate dataScad) {
|
||||
this.dataScad = dataScad;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
|
||||
public class InsertUDSRowResponseDTO {
|
||||
|
||||
private MtbColr savedMtbColr;
|
||||
|
||||
public MtbColr getSavedMtbColr() {
|
||||
return savedMtbColr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.uds;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class PrintUDSRequestDTO {
|
||||
|
||||
private List<MtbColt> mtbColts;
|
||||
|
||||
public List<MtbColt> getMtbColts() {
|
||||
return mtbColts;
|
||||
}
|
||||
|
||||
public PrintUDSRequestDTO setMtbColts(List<MtbColt> mtbColts) {
|
||||
this.mtbColts = mtbColts;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,12 @@ import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
|
||||
public class ServerStatusChecker {
|
||||
|
||||
private static ServerStatusChecker instance = new ServerStatusChecker();
|
||||
private static final ServerStatusChecker instance = new ServerStatusChecker();
|
||||
|
||||
private List<RunnableArgs<Boolean>> mCallback = new ArrayList<>();
|
||||
private final List<RunnableArgs<Boolean>> mCallback = new ArrayList<>();
|
||||
|
||||
private RunnableArgs<Boolean> mInternalCallback = value -> {
|
||||
for (RunnableArgs callback : mCallback) {
|
||||
private final RunnableArgs<Boolean> mInternalCallback = value -> {
|
||||
for (RunnableArgs<Boolean> callback : mCallback) {
|
||||
callback.run(value);
|
||||
}
|
||||
};
|
||||
@@ -26,8 +26,8 @@ public class ServerStatusChecker {
|
||||
private final long MILLIS_DELAY = 5 * 1000;
|
||||
|
||||
|
||||
private Handler handler = new Handler();
|
||||
private Runnable runnableCode = new Runnable() {
|
||||
private final Handler handler = new Handler();
|
||||
private final Runnable runnableCode = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (shouldExecute && !UtilityString.isNullOrEmpty(SettingsManager.i().getServer().getHost())) {
|
||||
|
||||
@@ -215,15 +215,6 @@ public class DBSettingsModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagUseNewPickingListSpedizione() {
|
||||
return flagUseNewPickingListSpedizione;
|
||||
}
|
||||
|
||||
public DBSettingsModel setFlagUseNewPickingListSpedizione(boolean flagUseNewPickingListSpedizione) {
|
||||
this.flagUseNewPickingListSpedizione = flagUseNewPickingListSpedizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagVersamentoDirettoProduzione() {
|
||||
return flagVersamentoDirettoProduzione;
|
||||
}
|
||||
|
||||
@@ -356,7 +356,6 @@ public class SettingsManager {
|
||||
dbSettingsModelIstance.setFlagEnableCheckDepositoSpedizione(getValueFromList(list, "SPEDIZIONE", "ENABLE_CHECK_DEPOSITO", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagForceAllToColli(getValueFromList(list, "SETUP", "FLAG_FORCE_ALL_TO_COLLI", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagAskPesoColloSpedizione(getValueFromList(list, "SETUP", "FLAG_ASK_PESO_COLLO", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagUseNewPickingListSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_NEW_PICKING_LIST", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagVersamentoDirettoProduzione(getValueFromList(list, "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagSpedizioneEnableManualPick(getValueFromList(list, "SPEDIZIONE", "ENABLE_MANUAL_PICK", Boolean.class));
|
||||
dbSettingsModelIstance.setFlagSpedizioneEnableFakeGiacenza(getValueFromList(list, "SPEDIZIONE", "ENABLE_FAKE_GIACENZA", Boolean.class));
|
||||
|
||||
@@ -43,10 +43,10 @@ public class UtilityDate {
|
||||
public static final String DMY_HUMAN_LONG = "dd MMMM yyyy";
|
||||
}
|
||||
|
||||
public static Date recognizeDateWithExceptionHandler(String dateString) {
|
||||
try{
|
||||
public static Date recognizeDateWithExceptionHandler(String dateString) {
|
||||
try {
|
||||
return UtilityDate.recognizeDate(dateString);
|
||||
} catch (ParseException | DateNotRecognizedException | TimeNotRecognizedException pex){
|
||||
} catch (ParseException | DateNotRecognizedException | TimeNotRecognizedException pex) {
|
||||
UtilityLogger.error(pex);
|
||||
return null;
|
||||
}
|
||||
@@ -64,9 +64,9 @@ public class UtilityDate {
|
||||
char dateSeparator;
|
||||
|
||||
String onlyDateSubstring = dateString.substring(0, 10);
|
||||
if(onlyDateSubstring.contains("/")) dateSeparator = '/';
|
||||
else if(onlyDateSubstring.contains("-")) dateSeparator = '-';
|
||||
else if(onlyDateSubstring.contains(".")) dateSeparator = '.';
|
||||
if (onlyDateSubstring.contains("/")) dateSeparator = '/';
|
||||
else if (onlyDateSubstring.contains("-")) dateSeparator = '-';
|
||||
else if (onlyDateSubstring.contains(".")) dateSeparator = '.';
|
||||
else throw new DateNotRecognizedException(dateString);
|
||||
|
||||
String dateFormatString = (dateString.charAt(2) == dateSeparator)
|
||||
@@ -74,13 +74,13 @@ public class UtilityDate {
|
||||
: "yyyy" + dateSeparator + "MM" + dateSeparator + "dd";
|
||||
|
||||
|
||||
if(dateString.length() > 10){
|
||||
if (dateString.length() > 10) {
|
||||
|
||||
char timeSeparator;
|
||||
|
||||
String onlyTimeSubstring = dateString.substring(10, 14);
|
||||
if(onlyTimeSubstring.contains("-")) timeSeparator = '-';
|
||||
else if(onlyTimeSubstring.contains(":")) timeSeparator = ':';
|
||||
if (onlyTimeSubstring.contains("-")) timeSeparator = '-';
|
||||
else if (onlyTimeSubstring.contains(":")) timeSeparator = ':';
|
||||
else throw new TimeNotRecognizedException(dateString);
|
||||
|
||||
String timeFormatString = "HH" + timeSeparator + "mm" + timeSeparator + "ss";
|
||||
@@ -99,12 +99,11 @@ public class UtilityDate {
|
||||
|
||||
|
||||
public static String formatDate(Date dateToFormat, String format) {
|
||||
if(dateToFormat != null) {
|
||||
if (dateToFormat != null) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||
//sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
return sdf.format(dateToFormat);
|
||||
}
|
||||
else return null;
|
||||
} else return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +115,7 @@ public class UtilityDate {
|
||||
public static Date getDateInstance(boolean removeTime) {
|
||||
var calendar = getCalendarInstance();
|
||||
|
||||
if(removeTime) {
|
||||
if (removeTime) {
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
@@ -131,8 +130,6 @@ public class UtilityDate {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static String formatDate(LocalDate dateToFormat, String format) {
|
||||
if (dateToFormat != null) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
|
||||
@@ -185,7 +182,6 @@ public class UtilityDate {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static LocalDate getNow() {
|
||||
return Instant.now()
|
||||
.atZone(currentZone)
|
||||
@@ -197,6 +193,7 @@ public class UtilityDate {
|
||||
.atZone(currentZone)
|
||||
.toLocalDateTime();
|
||||
}
|
||||
|
||||
public static LocalDate timeToLocalDate(long time, @Nullable String timezone) {
|
||||
return Instant.ofEpochSecond(time)
|
||||
.atZone(timezone == null ? currentZone : ZoneId.of(timezone))
|
||||
@@ -210,7 +207,6 @@ public class UtilityDate {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static long localDateTimeToTime(LocalDateTime localDateTime, @Nullable String timezone) {
|
||||
return localDateTime
|
||||
.atZone(timezone == null ? currentZone : ZoneId.of(timezone))
|
||||
|
||||
@@ -43,7 +43,7 @@ public class UtilityServer {
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(String.format("http://%s:%d/ems-api/retail/status", serverAddress, serverTCPport))
|
||||
.url(String.format("http://%s:%d/ems-api/system/ok", serverAddress, serverTCPport))
|
||||
.build();
|
||||
|
||||
try {
|
||||
|
||||
@@ -82,6 +82,7 @@ public class DialogAskInfoInventarioView extends BaseDialogFragment {
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(cancelable);
|
||||
alertDialog.setOnShowListener(this);
|
||||
return alertDialog;
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.class_router.ClassRouter;
|
||||
import it.integry.integrywmsnative.core.class_router.configs.BaseMenuConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.configs.MenuConfiguration;
|
||||
import it.integry.integrywmsnative.core.class_router.interfaces.IOrdiniVendita;
|
||||
import it.integry.integrywmsnative.core.class_router.interfaces.OrdiniVenditaInterface;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverDTO;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
@@ -40,13 +40,16 @@ import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.menu.MenuService;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CloseUDSResponseDTO;
|
||||
import it.integry.integrywmsnative.core.rest.watcher.ServerStatusChecker;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDimension;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainBinding;
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainMenuGroupLayoutBinding;
|
||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
@@ -61,6 +64,13 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
@Inject
|
||||
ColliDataRecoverService colliDataRecoverService;
|
||||
|
||||
@Inject
|
||||
ColliSpedizioneRESTConsumer colliSpedizioneRESTConsumer;
|
||||
|
||||
@Inject
|
||||
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer;
|
||||
|
||||
|
||||
@Inject
|
||||
MenuService menuService;
|
||||
|
||||
@@ -189,36 +199,50 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
cyclicRecover(sessionsIterator, onComplete, onFailed);
|
||||
};
|
||||
|
||||
if (sessionsIterator.hasNext()) {
|
||||
Integer recoveredMtbColtID = sessionsIterator.next();
|
||||
ColliDataRecoverDTO recoveredMtbColtDto = colliDataRecoverService.getSession(recoveredMtbColtID);
|
||||
MtbColt recoveredMtbColt = recoveredMtbColtDto.getMtbColt();
|
||||
if (!sessionsIterator.hasNext()) {
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
|
||||
if (recoveredMtbColt != null && (recoveredMtbColt.getGestioneEnum() == GestioneEnum.VENDITA || recoveredMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && !UtilityString.isNullOrEmpty(recoveredMtbColt.getFiltroOrdini())) {
|
||||
Integer recoveredMtbColtID = sessionsIterator.next();
|
||||
ColliDataRecoverDTO recoveredMtbColtDto = colliDataRecoverService.getSession(recoveredMtbColtID);
|
||||
MtbColt recoveredMtbColt = recoveredMtbColtDto.getMtbColt();
|
||||
|
||||
IOrdiniVendita ordiniVendita = ClassRouter.getInstance(ClassRouter.PATH.ORDINI_VENDITA);
|
||||
if (recoveredMtbColt != null &&
|
||||
(recoveredMtbColt.getGestioneEnum() == GestioneEnum.VENDITA ||
|
||||
recoveredMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE)) {
|
||||
|
||||
this.colliMagazzinoRESTConsumer.updateDataFine(recoveredMtbColt, () -> {
|
||||
ordiniVendita.distribuisciCollo(recoveredMtbColt, recoveredMtbColtDto.getTestateOrdini(),
|
||||
mtbColts -> {
|
||||
colliDataRecoverService.closeSession(recoveredMtbColtID);
|
||||
OrdiniVenditaInterface ordiniVendita = ClassRouter.getInstance(ClassRouter.PATH.ORDINI_VENDITA);
|
||||
boolean isTransferLogicEnabled = ordiniVendita != null && ordiniVendita.isTrasfOrder(recoveredMtbColtDto.getTestateOrdini());
|
||||
|
||||
cyclicRecover(sessionsIterator, onComplete, onFailed);
|
||||
}, ex -> {
|
||||
tmpOnFailed.run(ex, recoveredMtbColtID);
|
||||
}
|
||||
);
|
||||
}, ex -> {
|
||||
tmpOnFailed.run(ex, recoveredMtbColtID);
|
||||
});
|
||||
} else {
|
||||
var closeUDSRequestDto = new CloseUDSRequestDTO()
|
||||
.setMtbColt(recoveredMtbColt)
|
||||
//.setPrintSSCC(shouldPrint)
|
||||
.setOrderCodMdep(recoveredMtbColtDto.getTestateOrdini().get(0).getCodMdep())
|
||||
.setEnableTransferLogic(isTransferLogicEnabled);
|
||||
|
||||
RunnableArgs<CloseUDSResponseDTO> onRequestComplete = closeUDSResponseDto -> {
|
||||
colliDataRecoverService.closeSession(recoveredMtbColtID);
|
||||
cyclicRecover(sessionsIterator, onComplete, onFailed);
|
||||
}
|
||||
};
|
||||
|
||||
switch (recoveredMtbColt.getGestioneEnum()) {
|
||||
case LAVORAZIONE:
|
||||
colliLavorazioneRESTConsumer.closeUDS(closeUDSRequestDto, onRequestComplete, ex -> {
|
||||
tmpOnFailed.run(ex, recoveredMtbColtID);
|
||||
});
|
||||
break;
|
||||
case VENDITA:
|
||||
colliSpedizioneRESTConsumer.closeUDS(closeUDSRequestDto, onRequestComplete, ex -> {
|
||||
tmpOnFailed.run(ex, recoveredMtbColtID);
|
||||
});
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
onComplete.run();
|
||||
colliDataRecoverService.closeSession(recoveredMtbColtID);
|
||||
cyclicRecover(sessionsIterator, onComplete, onFailed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void collapseNoConnectionLayout() {
|
||||
@@ -314,7 +338,7 @@ public class MainFragment extends Fragment implements ITitledFragment, IScrollab
|
||||
|
||||
|
||||
public void toggleEasterEggMode() {
|
||||
easterEggToggle =! easterEggToggle;
|
||||
easterEggToggle = !easterEggToggle;
|
||||
|
||||
|
||||
int rootBgStart, rootBgEnd;
|
||||
|
||||
@@ -12,6 +12,7 @@ import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterPaese
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterTermConsLayoutView;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterVettoreLayoutView;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterViaggioLayoutView;
|
||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.filters.FilterCommessaLayoutView;
|
||||
import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO;
|
||||
|
||||
public class OrdiniUscitaElencoBindings {
|
||||
@@ -28,6 +29,7 @@ public class OrdiniUscitaElencoBindings {
|
||||
public static final int TERM_CONS_FILTER_ID = 8;
|
||||
public static final int DATA_CONS_FILTER_ID = 9;
|
||||
public static final int GRUPPO_MERC_FILTER_ID = 10;
|
||||
public static final int COMMESSA_FILTER_ID = 11;
|
||||
|
||||
public static final HashMap<Integer, FilterChipDTO> AVAILABLE_FILTERS = new HashMap<>() {{
|
||||
put(DEPOSITO_FILTER_ID, new FilterChipDTO()
|
||||
@@ -94,6 +96,12 @@ public class OrdiniUscitaElencoBindings {
|
||||
.setPosizione(7)
|
||||
.setFilterChipText("Gruppo merceologico")
|
||||
.setFilterLayoutView(new FilterGruppoMercLayoutView()));
|
||||
|
||||
put(COMMESSA_FILTER_ID, new FilterChipDTO()
|
||||
.setID(COMMESSA_FILTER_ID)
|
||||
.setPosizione(11)
|
||||
.setFilterChipText("Commessa")
|
||||
.setFilterLayoutView(new FilterCommessaLayoutView()));
|
||||
}};
|
||||
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.model.JtbComt;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
@@ -45,6 +46,7 @@ import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.CommessaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO;
|
||||
@@ -66,6 +68,7 @@ import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterViagg
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.VenditaFiltroOrdiniViewModel;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui.OrdiniUscitaElencoAdapter;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui.OrdiniUscitaElencoListModel;
|
||||
import it.integry.integrywmsnative.gest.prod_accettazione_ord_produzione.filters.FilterCommessaLayoutView;
|
||||
import it.integry.integrywmsnative.gest.spedizione.SpedizioneActivity;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.BaseDialogRowInfoView;
|
||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
@@ -83,6 +86,9 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
@Inject
|
||||
ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||
|
||||
@Inject
|
||||
CommessaRESTConsumer mCommessaRESTConsumer;
|
||||
|
||||
@Inject
|
||||
OrdiniUscitaElencoViewModel mViewModel;
|
||||
|
||||
@@ -104,6 +110,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
|
||||
private List<MtbDepo> mtbDepoCache;
|
||||
private List<MtbGrup> mtbGrupCache;
|
||||
private List<JtbComt> jtbComtCache;
|
||||
|
||||
public OrdiniUscitaElencoFragment() {
|
||||
// Required empty public constructor
|
||||
@@ -193,7 +200,9 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
|
||||
this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), v -> {
|
||||
this.onLoadingStarted();
|
||||
this.initMtbGrupsCache(this::onLoadingEnded);
|
||||
this.initMtbGrupsCache(() -> {
|
||||
this.initJtbComtCache(this::onLoadingEnded);
|
||||
});
|
||||
|
||||
mAppliedFilterViewModel.init(mViewModel.getOrderList().getValue());
|
||||
|
||||
@@ -265,6 +274,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
mAppliedFilterViewModel.getCurrentTermConsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||
mAppliedFilterViewModel.getCurrentDataConsPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||
mAppliedFilterViewModel.getCurrentGruppoMercPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||
mAppliedFilterViewModel.getCurrentCommessaPredicate().addOnPropertyChangedCallback(onPredicateChanged);
|
||||
|
||||
List<FilterChipDTO> filterList = Stream.of(OrdiniUscitaElencoBindings.AVAILABLE_FILTERS.entrySet())
|
||||
.map(Map.Entry::getValue)
|
||||
@@ -527,6 +537,31 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
});
|
||||
break;
|
||||
|
||||
case OrdiniUscitaElencoBindings.COMMESSA_FILTER_ID:
|
||||
mAppliedFilterViewModel.getCurrentCommessaPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mAppliedFilterViewModel.getCurrentCommessaPredicate().get() == null) {
|
||||
filterChipView.disableCloseIcon();
|
||||
|
||||
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||
mBindings.filterChipsGroup.addView(filterChipView);
|
||||
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||
} else {
|
||||
filterChipView.enableCloseIcon();
|
||||
|
||||
mBindings.filterChipsGroup.removeView(filterChipView);
|
||||
mBindings.filterChipsGroup.addView(filterChipView, 0);
|
||||
mBindings.filterChips.smoothScrollTo(0, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
filterChipView.setOnResetClicked(() -> {
|
||||
mAppliedFilterViewModel.setCommessaFilter(null);
|
||||
mAppliedFilterViewModel.getCurrentCommessaPredicate().set(null);
|
||||
});
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
this.mBindings.filterChipsGroup.addView(filterChipView);
|
||||
@@ -559,6 +594,19 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
.getFilterLayoutView();
|
||||
|
||||
switch (filterChipDTO.getID()) {
|
||||
case OrdiniUscitaElencoBindings.COMMESSA_FILTER_ID:
|
||||
((FilterCommessaLayoutView) filterLayoutView)
|
||||
.setAllCommesse(mAppliedFilterViewModel.getAllCommesse(this.jtbComtCache))
|
||||
.setAvailableCommesse(mAppliedFilterViewModel.getAvailableCommesse(this.jtbComtCache))
|
||||
.setOnFilterApplied(mAppliedFilterViewModel::setCommessaFilter)
|
||||
.setPreSelectedCommesse(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue()))
|
||||
.filter(mAppliedFilterViewModel.getCurrentCommessaPredicate().get() == null ?
|
||||
x -> false :
|
||||
mAppliedFilterViewModel.getCurrentCommessaPredicate().get())
|
||||
.map(x -> Stream.of(jtbComtCache).filter(y -> x.getCodJcom().equalsIgnoreCase(y.getCodJcom())).findFirst().get())
|
||||
.toList());
|
||||
break;
|
||||
|
||||
case OrdiniUscitaElencoBindings.DEPOSITO_FILTER_ID:
|
||||
((FilterDepositoLayoutView) filterLayoutView)
|
||||
.setAllCodMdeps(mAppliedFilterViewModel.getAllCodMdeps(mtbDepoCache))
|
||||
@@ -865,4 +913,23 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
|
||||
onComplete.run();
|
||||
}, this::onError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void initJtbComtCache(Runnable onComplete) {
|
||||
if (this.mViewModel.getOrderList().getValue() == null) {
|
||||
this.jtbComtCache = new ArrayList<>();
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
var jtbComts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrderList().getValue()))
|
||||
.flatMap(x -> Stream.of(x.getCodJcom()))
|
||||
.toList();
|
||||
|
||||
this.mCommessaRESTConsumer.getJtbComts(jtbComts, jtbComtCache -> {
|
||||
this.jtbComtCache = jtbComtCache;
|
||||
onComplete.run();
|
||||
}, this::onError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.JtbComt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepo;
|
||||
import it.integry.integrywmsnative.core.model.MtbGrup;
|
||||
import it.integry.integrywmsnative.core.model.OrdineInevasoDTO;
|
||||
@@ -33,6 +34,7 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentAutomezzoPredicate = new ObservableField<>();
|
||||
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentPaesePredicate = new ObservableField<>();
|
||||
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentGruppoMercPredicate = new ObservableField<>();
|
||||
private final ObservableField<Predicate<OrdiniUscitaElencoDTO>> currentCommessaPredicate = new ObservableField<>();
|
||||
|
||||
private Date selectedDataCons = null;
|
||||
private List<MtbGrup> selectedMtbGrup = new ArrayList<>();
|
||||
@@ -123,6 +125,14 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
public void setCommessaFilter(List<JtbComt> jtbComtList) {
|
||||
if (jtbComtList == null || jtbComtList.isEmpty()) currentCommessaPredicate.set(null);
|
||||
else {
|
||||
List<String> codJcoms = Stream.of(jtbComtList).map(JtbComt::getCodJcom).toList();
|
||||
currentCommessaPredicate.set(o -> codJcoms.contains(o.getCodJcom()));
|
||||
}
|
||||
}
|
||||
|
||||
public void setGruppoMercFilter(List<MtbGrup> mtbGrupList) {
|
||||
if (mtbGrupList == null || mtbGrupList.isEmpty()) {
|
||||
currentGruppoMercPredicate.set(null);
|
||||
@@ -159,7 +169,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
currentIdViaggioPredicate.get() == null &&
|
||||
currentAgentePredicate.get() == null &&
|
||||
currentPaesePredicate.get() == null &&
|
||||
currentGruppoMercPredicate.get() == null
|
||||
currentGruppoMercPredicate.get() == null &&
|
||||
currentCommessaPredicate.get() == null
|
||||
) {
|
||||
returnList = this.initialOrderList;
|
||||
} else {
|
||||
@@ -175,7 +186,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||
);
|
||||
|
||||
returnList = tmpStream.toList();
|
||||
@@ -228,6 +240,10 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
return currentGruppoMercPredicate;
|
||||
}
|
||||
|
||||
public ObservableField<Predicate<OrdiniUscitaElencoDTO>> getCurrentCommessaPredicate() {
|
||||
return currentCommessaPredicate;
|
||||
}
|
||||
|
||||
public List<MtbDepo> getAllCodMdeps(List<MtbDepo> mtbDepoFullList) {
|
||||
List<String> codMdeps = Stream.of(initialOrderList)
|
||||
.map(OrdineInevasoDTO::getCodMdep)
|
||||
@@ -253,7 +269,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
currentIdViaggioPredicate.get() == null &&
|
||||
currentAgentePredicate.get() == null &&
|
||||
currentPaesePredicate.get() == null &&
|
||||
currentGruppoMercPredicate.get() == null
|
||||
currentGruppoMercPredicate.get() == null &&
|
||||
currentCommessaPredicate.get() == null
|
||||
) {
|
||||
return getAllCodMdeps(mtbDepoFullList);
|
||||
} else {
|
||||
@@ -268,7 +285,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||
)
|
||||
.map(OrdineInevasoDTO::getCodMdep)
|
||||
.distinct()
|
||||
@@ -305,7 +323,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
currentDepositoPredicate.get() == null &&
|
||||
currentAgentePredicate.get() == null &&
|
||||
currentPaesePredicate.get() == null &&
|
||||
currentGruppoMercPredicate.get() == null
|
||||
currentGruppoMercPredicate.get() == null &&
|
||||
currentCommessaPredicate.get() == null
|
||||
) {
|
||||
return getAllIDViaggio();
|
||||
} else {
|
||||
@@ -320,7 +339,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||
)
|
||||
.map(OrdineUscitaInevasoDTO::getIdViaggio)
|
||||
.distinct()
|
||||
@@ -350,7 +370,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
currentDepositoPredicate.get() == null &&
|
||||
currentAgentePredicate.get() == null &&
|
||||
currentPaesePredicate.get() == null &&
|
||||
currentGruppoMercPredicate.get() == null
|
||||
currentGruppoMercPredicate.get() == null &&
|
||||
currentCommessaPredicate.get() == null
|
||||
) {
|
||||
return getAllNumOrds();
|
||||
} else {
|
||||
@@ -365,7 +386,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||
)
|
||||
.map(OrdineUscitaInevasoDTO::getNumOrd)
|
||||
.distinct()
|
||||
@@ -395,7 +417,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
currentDepositoPredicate.get() == null &&
|
||||
currentAgentePredicate.get() == null &&
|
||||
currentPaesePredicate.get() == null &&
|
||||
currentGruppoMercPredicate.get() == null
|
||||
currentGruppoMercPredicate.get() == null &&
|
||||
currentCommessaPredicate.get() == null
|
||||
) {
|
||||
return getAllClienti();
|
||||
} else {
|
||||
@@ -410,7 +433,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||
)
|
||||
.map(OrdineUscitaInevasoDTO::getRagSocOrd)
|
||||
.distinct()
|
||||
@@ -440,7 +464,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
currentDepositoPredicate.get() == null &&
|
||||
currentAgentePredicate.get() == null &&
|
||||
currentPaesePredicate.get() == null &&
|
||||
currentGruppoMercPredicate.get() == null
|
||||
currentGruppoMercPredicate.get() == null &&
|
||||
currentCommessaPredicate.get() == null
|
||||
) {
|
||||
return getAllVettori();
|
||||
} else {
|
||||
@@ -455,7 +480,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||
)
|
||||
.map(x -> x.getCodVvet() + (!UtilityString.isNullOrEmpty(x.getCodVvet()) ? " - " + x.getDescrizioneVettore() : ""))
|
||||
.distinct()
|
||||
@@ -485,7 +511,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
currentDepositoPredicate.get() == null &&
|
||||
currentAgentePredicate.get() == null &&
|
||||
currentPaesePredicate.get() == null &&
|
||||
currentGruppoMercPredicate.get() == null
|
||||
currentGruppoMercPredicate.get() == null &&
|
||||
currentCommessaPredicate.get() == null
|
||||
) {
|
||||
return getAllAutomezzi();
|
||||
} else {
|
||||
@@ -500,7 +527,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||
)
|
||||
.map(OrdineUscitaInevasoDTO::getDescrizioneAuto)
|
||||
.distinct()
|
||||
@@ -530,7 +558,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
currentDepositoPredicate.get() == null &&
|
||||
currentAgentePredicate.get() == null &&
|
||||
currentAutomezzoPredicate.get() == null &&
|
||||
currentGruppoMercPredicate.get() == null
|
||||
currentGruppoMercPredicate.get() == null &&
|
||||
currentCommessaPredicate.get() == null
|
||||
) {
|
||||
List<String> all = getAllPaesi();
|
||||
return all;
|
||||
@@ -546,7 +575,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||
)
|
||||
.map(OrdineUscitaInevasoDTO::getCitta)
|
||||
.distinct()
|
||||
@@ -576,7 +606,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
currentDepositoPredicate.get() == null &&
|
||||
currentPaesePredicate.get() == null &&
|
||||
currentAutomezzoPredicate.get() == null &&
|
||||
currentGruppoMercPredicate.get() == null
|
||||
currentGruppoMercPredicate.get() == null &&
|
||||
currentCommessaPredicate.get() == null
|
||||
) {
|
||||
List<String> all = getAllAgenti();
|
||||
return all;
|
||||
@@ -592,7 +623,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||
)
|
||||
.map(OrdineUscitaInevasoDTO::getNomeAgente)
|
||||
.distinct()
|
||||
@@ -622,7 +654,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
currentDepositoPredicate.get() == null &&
|
||||
currentPaesePredicate.get() == null &&
|
||||
currentAutomezzoPredicate.get() == null &&
|
||||
currentGruppoMercPredicate.get() == null
|
||||
currentGruppoMercPredicate.get() == null &&
|
||||
currentCommessaPredicate.get() == null
|
||||
) {
|
||||
return getAllTermCons();
|
||||
} else {
|
||||
@@ -637,7 +670,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x)))
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||
)
|
||||
.map(OrdineUscitaInevasoDTO::getTermCons)
|
||||
.distinct()
|
||||
@@ -646,6 +680,62 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
}
|
||||
|
||||
|
||||
public List<JtbComt> getAllCommesse(List<JtbComt> commesseFullList) {
|
||||
List<String> codJcom = Stream.of(initialOrderList)
|
||||
.map(OrdiniUscitaElencoDTO::getCodJcom)
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
return Stream.of(Objects.requireNonNull(commesseFullList))
|
||||
.filter(x -> codJcom.contains(x.getCodJcom()))
|
||||
.distinct()
|
||||
.withoutNulls()
|
||||
.sortBy(JtbComt::getCodJcom)
|
||||
.toList();
|
||||
}
|
||||
public List<JtbComt> getAvailableCommesse(List<JtbComt> commesseFullList) {
|
||||
|
||||
if (currentIdViaggioPredicate.get() == null &&
|
||||
currentNumOrdsPredicate.get() == null &&
|
||||
currentDataConsPredicate.get() == null &&
|
||||
currentAgentePredicate.get() == null &&
|
||||
currentClientePredicate.get() == null &&
|
||||
currentVettorePredicate.get() == null &&
|
||||
currentDepositoPredicate.get() == null &&
|
||||
currentPaesePredicate.get() == null &&
|
||||
currentAutomezzoPredicate.get() == null &&
|
||||
currentGruppoMercPredicate.get() == null &&
|
||||
currentTermConsPredicate.get() == null) {
|
||||
return getAllCommesse(commesseFullList);
|
||||
} else {
|
||||
List<String> availableCommesse = Stream.of(this.initialOrderList)
|
||||
.filter(x ->
|
||||
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||
(currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) &&
|
||||
(currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) &&
|
||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||
(currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) &&
|
||||
(currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) &&
|
||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||
(currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) &&
|
||||
(currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) &&
|
||||
(currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x)))
|
||||
)
|
||||
.map(OrdineUscitaInevasoDTO::getCodJcom)
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
return Stream.of(Objects.requireNonNull(commesseFullList))
|
||||
.filter(x -> availableCommesse.contains(x.getCodJcom()))
|
||||
.distinct()
|
||||
.withoutNulls()
|
||||
.sortBy(JtbComt::getCodJcom)
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<MtbGrup> getAllGruppoMerc(List<MtbGrup> mtbGrupFullList) {
|
||||
var codMgrp = Stream.of(initialOrderList)
|
||||
.flatMap(ordiniUscitaElencoDTO ->
|
||||
@@ -676,7 +766,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
currentIdViaggioPredicate.get() == null &&
|
||||
currentAgentePredicate.get() == null &&
|
||||
currentPaesePredicate.get() == null &&
|
||||
currentDepositoPredicate.get() == null
|
||||
currentDepositoPredicate.get() == null &&
|
||||
currentCommessaPredicate.get() == null
|
||||
) {
|
||||
return getAllGruppoMerc(mtbGrupFullList);
|
||||
} else {
|
||||
@@ -691,7 +782,8 @@ public class VenditaFiltroOrdiniViewModel {
|
||||
(currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) &&
|
||||
(currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) &&
|
||||
(currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) &&
|
||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x)))
|
||||
(currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) &&
|
||||
(currentCommessaPredicate.get() == null || (currentCommessaPredicate.get().test(x)))
|
||||
)
|
||||
.flatMap(x -> Stream.of(x.getAvailableClassMerc()))
|
||||
.map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp)
|
||||
|
||||
@@ -55,7 +55,7 @@ import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditModalView;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArts;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrList;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
|
||||
@@ -288,7 +288,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
|
||||
@Override
|
||||
public void onArtSelectionRequest(List<MtbColr> mtbColrsToPick, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||
DialogChooseArtsFromListaArts
|
||||
DialogChooseArtsFromMtbColrList
|
||||
.newInstance(mtbColrsToPick, mtbAart, onComplete, () -> {
|
||||
onAbort.run();
|
||||
BarcodeManager.enable();
|
||||
|
||||
@@ -7,6 +7,8 @@ import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
|
||||
@Module(subcomponents = {PickingLiberoComponent.class})
|
||||
@@ -17,8 +19,10 @@ public class PickingLiberoModule {
|
||||
PickingLiberoViewModel providesPickingLiberoViewModel(ArticoloRESTConsumer articoloRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
PosizioniRESTConsumer posizioniRESTConsumer
|
||||
PosizioniRESTConsumer posizioniRESTConsumer,
|
||||
GiacenzaRESTConsumer giacenzaRESTConsumer,
|
||||
MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer
|
||||
) {
|
||||
return new PickingLiberoViewModel(articoloRESTConsumer, colliMagazzinoRESTConsumer, barcodeRESTConsumer, posizioniRESTConsumer);
|
||||
return new PickingLiberoViewModel(articoloRESTConsumer, colliMagazzinoRESTConsumer, barcodeRESTConsumer, posizioniRESTConsumer, giacenzaRESTConsumer, magazzinoAutomaticoRESTConsumer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import javax.inject.Inject;
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
import it.integry.integrywmsnative.core.exception.ScannedPositionNotExistException;
|
||||
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
||||
@@ -25,15 +26,20 @@ import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.MvwSitArtUdcDetInventario;
|
||||
import it.integry.integrywmsnative.core.model.VtbDest;
|
||||
import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
@@ -53,6 +59,8 @@ public class PickingLiberoViewModel {
|
||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
||||
private final GiacenzaRESTConsumer mGiacenzaRESTConsumer;
|
||||
private final MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer;
|
||||
|
||||
|
||||
private boolean mFlagAskCliente;
|
||||
@@ -66,12 +74,15 @@ public class PickingLiberoViewModel {
|
||||
public PickingLiberoViewModel(ArticoloRESTConsumer articoloRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
PosizioniRESTConsumer posizioniRESTConsumer
|
||||
) {
|
||||
PosizioniRESTConsumer posizioniRESTConsumer,
|
||||
GiacenzaRESTConsumer giacenzaRESTConsumer,
|
||||
MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer) {
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
this.mPosizioniRESTConsumer = posizioniRESTConsumer;
|
||||
this.mGiacenzaRESTConsumer = giacenzaRESTConsumer;
|
||||
this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +131,52 @@ public class PickingLiberoViewModel {
|
||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||
.single();
|
||||
this.executePosizione(foundPosizione, null, onComplete);
|
||||
|
||||
if (foundPosizione == null) {
|
||||
//Nessuna posizione trovata con questo barcode
|
||||
this.sendError(new ScannedPositionNotExistException());
|
||||
return;
|
||||
}
|
||||
|
||||
if (foundPosizione.isMagazzinoAutomatico()) {
|
||||
//Eseguo picking da magazzino automatico
|
||||
this.executeMagazzinoAutomatico(foundPosizione, onComplete);
|
||||
} else {
|
||||
this.executePosizione(foundPosizione, null, onComplete);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void executeMagazzinoAutomatico(MtbDepoPosizione mtbDepoPosizione, Runnable onComplete) {
|
||||
mGiacenzaRESTConsumer.getGiacenzeInPosizione(mtbDepoPosizione, availableItems -> {
|
||||
|
||||
var mtbColrs = Stream.of(availableItems)
|
||||
.map(MvwSitArtUdcDetInventario::toMtbColr)
|
||||
.toList();
|
||||
|
||||
this.sendArtSelectionRequest(mtbColrs, null, selectedMtbColrs -> {
|
||||
|
||||
final List<MagazzinoAutomaticoPickItemRequestDTO> magazzinoAutomaticoPickItemRequestDTOList = new ArrayList<>();
|
||||
for (MtbColr selectedArt : selectedMtbColrs) {
|
||||
MagazzinoAutomaticoPickItemRequestDTO itemDto = new MagazzinoAutomaticoPickItemRequestDTO(selectedArt.getCodMart())
|
||||
.setQtaTot(selectedArt.getQtaCol())
|
||||
.setNumCnf(selectedArt.getNumCnf())
|
||||
.setUntMis(selectedArt.getUntMis());
|
||||
|
||||
magazzinoAutomaticoPickItemRequestDTOList.add(itemDto);
|
||||
}
|
||||
|
||||
var magazzinoAutomaticoPickRequest = new MagazzinoAutomaticoPickItemsRequestDTO()
|
||||
.setShouldCreateUDS(true)
|
||||
.setDefaultGestioneOfNewUDS(mDefaultGestione.getText())
|
||||
.setItemsToPick(magazzinoAutomaticoPickItemRequestDTOList);
|
||||
|
||||
mMagazzinoAutomaticoRESTConsumer.pickItems(mtbDepoPosizione,
|
||||
magazzinoAutomaticoPickRequest, onComplete, this::sendError);
|
||||
}, this::sendOnLoadingEnded);
|
||||
|
||||
}, this::sendError);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -159,15 +159,9 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
||||
|
||||
DialogAskActionView.newInstance(articoloOrdine.getDescrizione(),
|
||||
articoloOrdine.getQtaOrd() + " " + articoloOrdine.getUntMis(),
|
||||
() -> {
|
||||
this.mViewModel.checkArticolo(articoloOrdine.getCodMart(),
|
||||
artOrd -> {
|
||||
this.onItemDispatched(artOrd);
|
||||
BarcodeManager.enable();
|
||||
},
|
||||
this::onError);
|
||||
BarcodeManager.enable();
|
||||
},
|
||||
() -> this.onItemDispatched(articoloOrdine, () -> {
|
||||
|
||||
}),
|
||||
() -> {
|
||||
this.deleteArticolo(articoloOrdine);
|
||||
BarcodeManager.enable();
|
||||
@@ -186,24 +180,17 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
||||
}
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
mBinding.closeActivityFab.close(false);
|
||||
this.onLoadingStarted();
|
||||
BarcodeManager.disable();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, this::onLoadingEnded);
|
||||
|
||||
this.mViewModel.processBarcode(data.getStringValue());
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onItemDispatched(ArticoloOrdine articoloOrdine) {
|
||||
public void onItemDispatched(ArticoloOrdine articoloOrdine, Runnable onSuccess) {
|
||||
DialogEditArticoloView
|
||||
.newInstance(articoloOrdine, articolo -> {
|
||||
runOnUiThread(() -> {
|
||||
if (articolo != null) {
|
||||
Toast.makeText(this, "Articolo aggiunto all'ordine!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
this.mViewModel.refreshListArticoli();
|
||||
});
|
||||
if (articolo != null) {
|
||||
Toast.makeText(this, "Articolo aggiunto all'ordine!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
this.mViewModel.refreshListArticoli(onSuccess);
|
||||
}, null).show(this.getSupportFragmentManager(), "DialogEditArticoloView");
|
||||
}
|
||||
|
||||
@@ -214,10 +201,8 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
||||
|
||||
public void exportOrdine() {
|
||||
this.mViewModel.exportOrdine(() -> {
|
||||
runOnUiThread(() -> {
|
||||
Toast.makeText(this, "Ordine salvato con successo", Toast.LENGTH_SHORT).show();
|
||||
close();
|
||||
});
|
||||
Toast.makeText(this, "Ordine salvato con successo", Toast.LENGTH_SHORT).show();
|
||||
close();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -233,16 +218,9 @@ public class PVOrdineAcquistoEditActivity extends BaseActivity implements PVOrdi
|
||||
|
||||
public void manualSearch() {
|
||||
BarcodeManager.disable();
|
||||
DialogSimpleInputHelper.makeInputDialog(this, "Inserisci il codice a barre/codice articolo da cercare", codice -> {
|
||||
DialogSimpleInputHelper.makeInputDialog(this, "Inserisci il codice a barre/codice articolo da cercare", barcode -> {
|
||||
this.onLoadingStarted();
|
||||
this.mViewModel.checkArticolo(codice,
|
||||
articoloOrdine -> {
|
||||
this.onItemDispatched(articoloOrdine);
|
||||
this.onLoadingEnded();
|
||||
BarcodeManager.enable();
|
||||
},
|
||||
this::onError
|
||||
);
|
||||
this.mViewModel.processBarcode(barcode);
|
||||
}, BarcodeManager::enable).show();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,12 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;
|
||||
import it.integry.integrywmsnative.core.data_store.db.repository.ArticoliOrdineRepository;
|
||||
@@ -69,19 +70,23 @@ public class PVOrdineAcquistoEditViewModel {
|
||||
|
||||
public void init(Ordine ordine, List<ArticoloDTO> articoliGriglia) {
|
||||
this.mCurrentOrdine = ordine;
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
mArticoliGriglia.clear();
|
||||
mArticoliGriglia.addAll(articoliGriglia);
|
||||
this.refreshListArticoli();
|
||||
}
|
||||
|
||||
public void refreshListArticoli() {
|
||||
refreshListArticoli(null);
|
||||
}
|
||||
|
||||
public void refreshListArticoli(Runnable onSuccess) {
|
||||
this.sendOnLoadingStarted();
|
||||
this.loadArticoli(mCurrentOrdine, articoli -> {
|
||||
articoli = Stream.of(articoli).map(this::completeDataArticoli).toList();
|
||||
articoli = Stream.of(articoli).map(this::completeDataArticoli).sorted((a, b) -> a.getDataIns().after(b.getDataIns()) ? -1 : 1).toList();
|
||||
this.mArticoli.postValue(articoli);
|
||||
this.sendOnLoadingEnded();
|
||||
if (onSuccess != null)
|
||||
onSuccess.run();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -92,6 +97,12 @@ public class PVOrdineAcquistoEditViewModel {
|
||||
art.setQtaProposta(BigDecimal.valueOf(artGrid.getQtaProposta()));
|
||||
art.setQtaPrevistaVendita(BigDecimal.valueOf(artGrid.getQtaPrevistaVendita()));
|
||||
art.setBgTint(getBgTint(art));
|
||||
art.setMediaSett(artGrid.getMediaSett());
|
||||
art.setQtaMinOrdinabile(artGrid.getQtaMinOrdinabile());
|
||||
art.setMerceDaRic(artGrid.getMerceDaRic());
|
||||
art.setNewNoPromo(artGrid.isNewNoPromo());
|
||||
art.setFlagQtaMultipla(artGrid.getFlagQtaMultipla());
|
||||
art.setSystemNote(artGrid.generateSystemNote());
|
||||
return art;
|
||||
}
|
||||
|
||||
@@ -111,15 +122,24 @@ public class PVOrdineAcquistoEditViewModel {
|
||||
return mArticoli;
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
this.checkArticolo(
|
||||
barcodeScanDTO.getStringValue(),
|
||||
articoloOrdine -> {
|
||||
this.sendOnItemDispatched(articoloOrdine);
|
||||
onComplete.run();
|
||||
},
|
||||
this::sendError
|
||||
);
|
||||
public void processBarcode(String barcode) {
|
||||
try {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
ArticoloDTO articoloDTO = getArticoloFromBarcode(barcode);
|
||||
if (articoloDTO == null) {
|
||||
throw new NoResultFromBarcodeException(barcode);
|
||||
}
|
||||
this.addArticoloToOrdine(
|
||||
articoloDTO,
|
||||
this::sendOnLoadingEnded,
|
||||
this::sendError
|
||||
);
|
||||
} catch (Exception e) {
|
||||
this.sendError(e);
|
||||
BarcodeManager.enable();
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
|
||||
private void loadArticoli(Ordine ordine, RunnableArgs<List<ArticoloOrdine>> onLoad) {
|
||||
@@ -130,54 +150,21 @@ public class PVOrdineAcquistoEditViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
public void checkArticolo(String barcode, RunnableArgs<ArticoloOrdine> onSuccess, RunnableArgs<Exception> onFail) {
|
||||
public void addArticoloToOrdine(ArticoloDTO art, Runnable onSuccess, RunnableArgs<Exception> onFail) {
|
||||
try {
|
||||
if (mArticoliGriglia == null || mArticoliGriglia.isEmpty()) {
|
||||
onFail.run(new NoArtsInGridException());
|
||||
return;
|
||||
}
|
||||
ArticoloDTO art = Stream.of(mArticoliGriglia).filter(articolo ->
|
||||
articolo.getCodMart().equalsIgnoreCase(barcode) ||
|
||||
articolo.getBarcode().equalsIgnoreCase(barcode) ||
|
||||
articolo.getBarcode().equalsIgnoreCase(StringUtils.leftPad(barcode, 13, "0"))
|
||||
).sortBy(x -> x.getSortByBarcodeCondition(barcode)).findFirst().orElse(null);
|
||||
|
||||
if (art == null) {
|
||||
onFail.run(new NoResultFromBarcodeException(barcode));
|
||||
return;
|
||||
}
|
||||
|
||||
mArticoliOrdineRepository.findArticoloByScanAndOrdine(mCurrentOrdine, art.codMart, (articolo) -> {
|
||||
|
||||
if (articolo != null) {
|
||||
if (isAutoOrderOnScan()) {
|
||||
articolo.setQtaOrd(articolo.getQtaOrd() + articolo.getQtaCnf());
|
||||
mArticoliOrdineRepository.saveArticoloToOrdine(articolo, this::refreshListArticoli, this::sendError);
|
||||
} else {
|
||||
articolo
|
||||
.setQtaPrevistaVendita(BigDecimal.valueOf(art.getQtaPrevistaVendita()))
|
||||
.setQtaProposta(BigDecimal.valueOf(art.getQtaProposta()))
|
||||
.setGiacenza(BigDecimal.valueOf(art.getGiacenza()))
|
||||
.setMediaSett(art.getMediaSett());
|
||||
|
||||
articolo.setQtaMinOrdinabile(art.getQtaMinOrdinabile());
|
||||
articolo.setMerceDaRic(art.getMerceDaRic());
|
||||
articolo.setNewNoPromo(art.isNewNoPromo());
|
||||
articolo.setFlagQtaMultipla(art.getFlagQtaMultipla());
|
||||
articolo.setSystemNote(art.generateSystemNote());
|
||||
onSuccess.run(articolo);
|
||||
}
|
||||
mArticoliOrdineRepository.findArticoloByScanAndOrdine(mCurrentOrdine, art.codMart, foundArt -> {
|
||||
|
||||
var articolo = foundArt != null ? foundArt : art.convertToArticoloOrdine(mCurrentOrdine);
|
||||
|
||||
if (isAutoOrderOnScan()) {
|
||||
articolo.setQtaOrd(articolo.getQtaOrd() + articolo.getQtaCnf());
|
||||
mArticoliOrdineRepository.saveArticoloToOrdine(articolo, () -> this.refreshListArticoli(onSuccess), onFail);
|
||||
} else {
|
||||
articolo = art.convertToArticoloOrdine(mCurrentOrdine);
|
||||
if (isAutoOrderOnScan()) {
|
||||
articolo.setQtaOrd(articolo.getQtaCnf());
|
||||
mArticoliOrdineRepository.saveArticoloToOrdine(articolo, this::refreshListArticoli, this::sendError);
|
||||
} else {
|
||||
onSuccess.run(articolo);
|
||||
}
|
||||
this.sendOnItemDispatched(articolo, onSuccess);
|
||||
}
|
||||
|
||||
|
||||
}, onFail);
|
||||
|
||||
|
||||
@@ -186,17 +173,30 @@ public class PVOrdineAcquistoEditViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
public ArticoloDTO getArticoloFromBarcode(String barcode) throws NoArtsInGridException {
|
||||
if (mArticoliGriglia == null || mArticoliGriglia.isEmpty()) {
|
||||
throw new NoArtsInGridException();
|
||||
}
|
||||
|
||||
return Stream.of(mArticoliGriglia).filter(articolo ->
|
||||
articolo.getCodMart().equalsIgnoreCase(barcode) ||
|
||||
articolo.getBarcode().equalsIgnoreCase(barcode) ||
|
||||
articolo.getBarcode().equalsIgnoreCase(StringUtils.leftPad(barcode, 13, "0"))
|
||||
).sortBy(x -> x.getSortByBarcodeCondition(barcode)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
|
||||
private boolean isAutoOrderOnScan() {
|
||||
return SettingsManager.iDB().isFlagOrdinaArticoliOnScan();
|
||||
}
|
||||
|
||||
private List<ArticoloDTO> getNewArticoli() {
|
||||
return Stream.of(mArticoliGriglia).filter(x -> x.getQtaOrd() > 0f).toList();
|
||||
return mArticoliGriglia.stream()
|
||||
.filter(x -> x.getQtaOrd() > 0f)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public void orderNewProducts() {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
List<ArticoloDTO> newArts = getNewArticoli();
|
||||
if (!newArts.isEmpty()) {
|
||||
List<ArticoloOrdine> articoliToSave = new ArrayList<>();
|
||||
@@ -243,8 +243,8 @@ public class PVOrdineAcquistoEditViewModel {
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void sendOnItemDispatched(ArticoloOrdine articoloOrdine) {
|
||||
if (this.mListener != null) mListener.onItemDispatched(articoloOrdine);
|
||||
private void sendOnItemDispatched(ArticoloOrdine articoloOrdine, Runnable onSuccess) {
|
||||
if (this.mListener != null) mListener.onItemDispatched(articoloOrdine, onSuccess);
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
@@ -260,7 +260,7 @@ public class PVOrdineAcquistoEditViewModel {
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
void onItemDispatched(ArticoloOrdine articoloOrdine);
|
||||
void onItemDispatched(ArticoloOrdine articoloOrdine, Runnable onSuccess);
|
||||
|
||||
int getColorFromResource(int resId);
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ public class DialogScanGrigliaAcquistoView extends BaseDialogFragment {
|
||||
|
||||
var alertDialog = alertDialogBuilder.create();
|
||||
alertDialog.setCanceledOnTouchOutside(true);
|
||||
alertDialog.setOnShowListener(this);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBigDecimal;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
@@ -105,6 +106,10 @@ public class RettificaGiacenzeViewModel {
|
||||
//Cerco tramite etichetta ean 128 (che può indicarmi un articolo o una UL)
|
||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||
|
||||
} else if (UtilityBarcode.isEanPeso(barcodeScanDTO)) {
|
||||
//Cerco tramite articolo ean peso
|
||||
this.executeEtichettaEanPeso(barcodeScanDTO, onComplete);
|
||||
|
||||
} else if (UtilityBarcode.isEtichettaArt(barcodeScanDTO)) {
|
||||
this.searchArtInt(barcodeScanDTO.getStringValue(), onComplete);
|
||||
|
||||
@@ -141,6 +146,15 @@ public class RettificaGiacenzeViewModel {
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void executeEtichettaEanPeso(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
try {
|
||||
Ean13PesoModel ean13PesoModel = Ean13PesoModel.fromBarcode(barcodeScanDTO.getStringValue());
|
||||
this.loadArticolo(ean13PesoModel.getPrecode(), PickDataDTO.fromEan128(ean13PesoModel.toEan128()), onComplete);
|
||||
} catch (Exception ex) {
|
||||
this.sendError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadArticolo(String barcodeProd, PickDataDTO pickData, Runnable onComplete) {
|
||||
this.mArticoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
|
||||
if (onComplete != null) onComplete.run();
|
||||
|
||||
@@ -73,6 +73,7 @@ import it.integry.integrywmsnative.view.dialogs.ask_should_print.DialogAskShould
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_art_from_lista_arts.DialogChooseArtFromListaArtsView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromMtbAartListView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotView;
|
||||
import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.DialogInfoAggiuntiveLU;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_peso_lu.DialogInputPesoLUView;
|
||||
@@ -248,7 +249,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
} else if (!noLUPresent.get()) {
|
||||
this.mShouldCloseActivity = true;
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
this.mViewmodel.closeLU(true);
|
||||
this.mViewmodel.requestCloseLU(true);
|
||||
} else {
|
||||
BarcodeManager.removeCallback(barcodeScannerIstanceID);
|
||||
super.onBackPressed();
|
||||
@@ -409,7 +410,8 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
y.getRefMtbColr().getGestioneEnum().equals(mtbColrToDispatch.getGestioneEnum()) &&
|
||||
UtilityString.equalsIgnoreCase(y.getRefMtbColr().getCodMart(), mtbColrToDispatch.getCodMart()) &&
|
||||
UtilityString.equalsIgnoreCase(y.getRefMtbColr().getCodTagl(), mtbColrToDispatch.getCodTagl()) &&
|
||||
UtilityString.equalsIgnoreCase(y.getRefMtbColr().getCodCol(), mtbColrToDispatch.getCodCol())*/ y.getRefMtbColr().equals(mtbColrToDispatch))
|
||||
UtilityString.equalsIgnoreCase(y.getRefMtbColr().getCodCol(), mtbColrToDispatch.getCodCol())*/
|
||||
y.getRefMtbColr().equals(mtbColrToDispatch))
|
||||
.map(MtbColr::getNumCnf)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
@@ -654,6 +656,9 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
if (status == DialogConsts.Results.YES) {
|
||||
this.mViewmodel.dispatchExtraItem(mtbAart, ean128Model, mtbColr);
|
||||
}
|
||||
}, pickMagazzinoAutomaticoPosizione -> {
|
||||
this.onLoadingStarted();
|
||||
this.mViewmodel.executeEmptyMagazzinoAutomaticoRequest(pickMagazzinoAutomaticoPosizione, this::onLoadingEnded);
|
||||
})
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
@@ -925,7 +930,16 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
@Override
|
||||
public void onCreateDocsRequest() {
|
||||
DialogYesNoView.newInstance("Chiusura ordine", "Vuoi creare i documenti per gli ordini selezionati?", result -> {
|
||||
this.mViewmodel.onCreateDocsAnswered(result);
|
||||
|
||||
switch (result) {
|
||||
case YES:
|
||||
this.mViewmodel.createDocs();
|
||||
break;
|
||||
case NO:
|
||||
this.onOrderClosed();
|
||||
break;
|
||||
}
|
||||
|
||||
}).show(this.getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@@ -935,6 +949,12 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChooseArtsRequest(List<MtbAart> artsList, RunnableArgs<List<MtbAart>> onComplete) {
|
||||
DialogChooseArtsFromMtbAartListView.newInstance(artsList, onComplete, this::onLoadingEnded)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrderClosed() {
|
||||
this.onLoadingEnded();
|
||||
@@ -948,7 +968,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
|
||||
@Override
|
||||
public void onBottomSheetLUClose() {
|
||||
this.mViewmodel.closeLU(true);
|
||||
this.mViewmodel.requestCloseLU(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -958,7 +978,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
|
||||
@Override
|
||||
public void onMtbColrDelete(MtbColr mtbColr) {
|
||||
this.mViewmodel.deleteRow(mtbColr);
|
||||
this.mViewmodel.requestDeleteRow(mtbColr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,8 +5,11 @@ import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.data_recover.ColliDataRecoverService;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.DocumentiRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PrinterRESTConsumer;
|
||||
@@ -21,8 +24,28 @@ public class SpedizioneModule {
|
||||
}
|
||||
|
||||
@Provides
|
||||
SpedizioneViewModel providesSpedizioneViewModel(ArticoloRESTConsumer articoloRESTConsumer, ColliDataRecoverService colliDataRecoverService, OrdiniRESTConsumer ordiniRESTConsumer, ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, PrinterRESTConsumer printerRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer, DocumentiRESTConsumer documentiRESTConsumer) {
|
||||
return new SpedizioneViewModel(articoloRESTConsumer, barcodeRESTConsumer, colliDataRecoverService, ordiniRESTConsumer, colliMagazzinoRESTConsumer, printerRESTConsumer, posizioniRESTConsumer, documentiRESTConsumer);
|
||||
SpedizioneViewModel providesSpedizioneViewModel(ArticoloRESTConsumer articoloRESTConsumer,
|
||||
ColliDataRecoverService colliDataRecoverService,
|
||||
OrdiniRESTConsumer ordiniRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
PrinterRESTConsumer printerRESTConsumer,
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
PosizioniRESTConsumer posizioniRESTConsumer,
|
||||
DocumentiRESTConsumer documentiRESTConsumer,
|
||||
ColliSpedizioneRESTConsumer colliSpedizioneRESTConsumer,
|
||||
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
|
||||
MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer) {
|
||||
return new SpedizioneViewModel(articoloRESTConsumer,
|
||||
barcodeRESTConsumer,
|
||||
colliDataRecoverService,
|
||||
ordiniRESTConsumer,
|
||||
colliMagazzinoRESTConsumer,
|
||||
printerRESTConsumer,
|
||||
posizioniRESTConsumer,
|
||||
documentiRESTConsumer,
|
||||
colliSpedizioneRESTConsumer,
|
||||
colliLavorazioneRESTConsumer,
|
||||
magazzinoAutomaticoRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
package it.integry.integrywmsnative.gest.spedizione.exceptions;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
|
||||
public class InvalidMagazzinoAutomaticoMovementException extends Exception {
|
||||
public InvalidMagazzinoAutomaticoMovementException(MtbDepoPosizione mtbDepoPosizione) {
|
||||
super(String.format("Non è possibile movimentare una posizione legata ad un magazzino automatico (%s)", mtbDepoPosizione.getPosizione()));
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ import it.integry.integrywmsnative.gest.picking_resi.PickingResiActivity;
|
||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.ui.UltimiArriviFornitoreListAdapter;
|
||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.dialog.DialogUltimiArriviFornitoreFiltroAvanzato;
|
||||
import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArts;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrList;
|
||||
|
||||
/**
|
||||
* A simple {@link BaseFragment} subclass.
|
||||
@@ -255,15 +255,17 @@ public class UltimiArriviFornitoreFragment extends BaseFragment implements ITitl
|
||||
@Override
|
||||
public void onMtbColtScanned(MtbColt scannedMtbColt) {
|
||||
|
||||
DialogChooseArtsFromListaArts
|
||||
DialogChooseArtsFromMtbColrList
|
||||
.newInstance(scannedMtbColt.getMtbColr(), items -> {
|
||||
List<MtbAart> mtbAarts = new ArrayList<>();
|
||||
|
||||
List<MtbAart> mtbAarts = Stream.of(items)
|
||||
.map(MtbColr::getMtbAart)
|
||||
.toList();
|
||||
if(items != null && !items.isEmpty()) {
|
||||
mtbAarts = Stream.of(items)
|
||||
.map(MtbColr::getMtbAart)
|
||||
.toList();
|
||||
}
|
||||
|
||||
filterItems(mtbAarts);
|
||||
|
||||
}, null)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogAskLivelloPosizione;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArts;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrList;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUView;
|
||||
@@ -170,8 +170,12 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
@Override
|
||||
public void onArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||
this.requireActivity().runOnUiThread(() -> {
|
||||
DialogChooseArtsFromListaArts
|
||||
.newInstance(mtbColrList, onComplete, onAbort)
|
||||
DialogChooseArtsFromMtbColrList
|
||||
.newInstance(mtbColrList, data -> {
|
||||
if(data == null || data.isEmpty()) {
|
||||
onAbort.run();
|
||||
} else onComplete.run(data);
|
||||
}, onAbort)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,14 +4,18 @@ import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
|
||||
@Module(subcomponents = VersamentoMerceComponent.class)
|
||||
public class VersamentoMerceModule {
|
||||
|
||||
@Provides
|
||||
VersamentoMerceViewModel providesVersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||
return new VersamentoMerceViewModel(colliMagazzinoRESTConsumer, barcodeRESTConsumer, posizioniRESTConsumer);
|
||||
VersamentoMerceViewModel providesVersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
PosizioniRESTConsumer posizioniRESTConsumer,
|
||||
MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer) {
|
||||
return new VersamentoMerceViewModel(colliMagazzinoRESTConsumer, barcodeRESTConsumer, posizioniRESTConsumer, magazzinoAutomaticoRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
|
||||
import it.integry.integrywmsnative.core.exception.NoArtsInLUException;
|
||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.ScannedPositionNotExistException;
|
||||
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
@@ -27,7 +28,9 @@ import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPutItemsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
@@ -44,12 +47,14 @@ public class VersamentoMerceViewModel {
|
||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
||||
private final MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer;
|
||||
|
||||
@Inject
|
||||
public VersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||
public VersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer, MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer) {
|
||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
this.mPosizioniRESTConsumer = posizioniRESTConsumer;
|
||||
this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,22 +76,19 @@ public class VersamentoMerceViewModel {
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||
.single();
|
||||
|
||||
if (foundPosizione.isFlagMonoCollo()) {
|
||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> {
|
||||
|
||||
if (mtbColtList == null || mtbColtList.size() == 0) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
||||
if (foundPosizione == null) {
|
||||
//Nessuna posizione trovata con questo barcode
|
||||
this.sendError(new ScannedPositionNotExistException());
|
||||
return;
|
||||
}
|
||||
|
||||
//TAKE HERE
|
||||
pickMerceULtoUL(mtbColt, onComplete);
|
||||
if (foundPosizione.isMagazzinoAutomatico()) {
|
||||
//La posizione è di un magazzino automatico
|
||||
this.executePosizioneMagazzinoAutomatico(foundPosizione, onComplete);
|
||||
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||
}
|
||||
}, this::sendError);
|
||||
} else if (foundPosizione.isFlagMonoCollo()) {
|
||||
this.executePosizioneMonocollo(onComplete, foundPosizione);
|
||||
} else {
|
||||
|
||||
if (!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) {
|
||||
@@ -113,6 +115,36 @@ public class VersamentoMerceViewModel {
|
||||
}
|
||||
|
||||
|
||||
private void executePosizioneMagazzinoAutomatico(MtbDepoPosizione mtbDepoPosizione, Runnable onComplete) {
|
||||
var magazzinoAutomaticoPickRequest = new MagazzinoAutomaticoPutItemsRequestDTO()
|
||||
.setInputMtbColt(this.mCurrentMtbColt.getValue());
|
||||
|
||||
mMagazzinoAutomaticoRESTConsumer.putItems(mtbDepoPosizione,
|
||||
magazzinoAutomaticoPickRequest, () -> {
|
||||
onComplete.run();
|
||||
this.sendOnDataSaved();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
private void executePosizioneMonocollo(Runnable onComplete, MtbDepoPosizione foundPosizione) {
|
||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> {
|
||||
|
||||
if (mtbColtList == null || mtbColtList.size() == 0) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
||||
|
||||
//TAKE HERE
|
||||
pickMerceULtoUL(mtbColt, onComplete);
|
||||
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Runnable onBarcodeScanComplete) {
|
||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public class DialogBasketLUView extends BaseDialogFragment {
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(false);
|
||||
alertDialog.setOnShowListener(this);
|
||||
this.initViewPager(alertDialog);
|
||||
|
||||
return alertDialog;
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.view.LayoutInflater;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
@@ -15,12 +14,13 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.databinding.DialogChooseArtFromListaArtBinding;
|
||||
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||
|
||||
public class DialogChooseArtFromListaArtsView extends DialogFragment {
|
||||
public class DialogChooseArtFromListaArtsView extends BaseDialogFragment {
|
||||
|
||||
|
||||
private final List<MtbAart> mListaArts;
|
||||
@@ -47,6 +47,7 @@ public class DialogChooseArtFromListaArtsView extends DialogFragment {
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(false);
|
||||
alertDialog.setOnShowListener(this);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,368 +0,0 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogChooseArtsFromListaArtsLayoutBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
|
||||
public class DialogChooseArtsFromListaArts extends BaseDialogFragment {
|
||||
|
||||
@Inject
|
||||
BarcodeRESTConsumer barcodeRESTConsumer;
|
||||
|
||||
@Inject
|
||||
ArticoloRESTConsumer articoloRESTConsumer;
|
||||
|
||||
private Context context;
|
||||
|
||||
private DialogChooseArtsFromListaArtsLayoutBinding mBindings;
|
||||
private DialogChooseArtsFromListaArtsAdapter currentAdapter;
|
||||
|
||||
private final RunnableArgs<List<MtbColr>> mOnItemsChoosed;
|
||||
private final Runnable mOnAbort;
|
||||
|
||||
private final List<DialogChooseArtsFromListaArtsItemModel> mDataset;
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
private MtbAart selectedArt;
|
||||
|
||||
public static DialogChooseArtsFromListaArts newInstance(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
return new DialogChooseArtsFromListaArts(listaMtbColr, onItemsChoosed, onAbort);
|
||||
}
|
||||
|
||||
public static DialogChooseArtsFromListaArts newInstance(List<MtbColr> listaMtbColr, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
DialogChooseArtsFromListaArts dialog = newInstance(listaMtbColr, onItemsChoosed, onAbort);
|
||||
dialog.setSelectedArt(mtbAart);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public void setSelectedArt(MtbAart mtbAart) {
|
||||
this.selectedArt = mtbAart;
|
||||
}
|
||||
|
||||
private DialogChooseArtsFromListaArts(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
super();
|
||||
|
||||
mOnItemsChoosed = onItemsChoosed;
|
||||
mOnAbort = onAbort;
|
||||
|
||||
mDataset = new ArrayList<>();
|
||||
|
||||
if (listaMtbColr != null) {
|
||||
for (MtbColr mtbColr : listaMtbColr) {
|
||||
if (UtilityString.isNullOrEmpty(mtbColr.getUntMis()) && mtbColr.getMtbAart() != null) {
|
||||
mtbColr.setUntMis(mtbColr.getMtbAart().getUntMis());
|
||||
}
|
||||
|
||||
mDataset.add(new DialogChooseArtsFromListaArtsItemModel().setMtbColr(mtbColr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
this.context = getActivity();
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_choose_arts_from_lista_arts_layout, null, false);
|
||||
mBindings.setLifecycleOwner(getViewLifecycleOwner());
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogChooseArtsFromListaArtsComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
UtilityDialog.setTo90PercentWidth(context, this);
|
||||
|
||||
mBindings.emptyView.setVisibility(mDataset != null && mDataset.size() > 0 ? View.GONE : View.VISIBLE);
|
||||
|
||||
|
||||
initRecyclerView();
|
||||
initFilter();
|
||||
setupBarcode();
|
||||
|
||||
mBindings.positiveButton.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
onPositiveClick();
|
||||
});
|
||||
|
||||
mBindings.negativeButton.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
onNegativeClick();
|
||||
});
|
||||
|
||||
getDialog().setCanceledOnTouchOutside(false);
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
if (selectedArt != null) {
|
||||
this.loadArticolo(selectedArt.getBarCode(), null);
|
||||
}
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
mBindings.listaArts.setNestedScrollingEnabled(false);
|
||||
mBindings.listaArts.setHasFixedSize(true);
|
||||
mBindings.listaArts.setLayoutManager(new LinearLayoutManager(context));
|
||||
|
||||
currentAdapter = new DialogChooseArtsFromListaArtsAdapter(context, mDataset);
|
||||
mBindings.listaArts.setAdapter(currentAdapter);
|
||||
}
|
||||
|
||||
|
||||
private void initFilter() {
|
||||
mBindings.mainSearch.setOnCloseListener(() -> {
|
||||
this.removeListFilter();
|
||||
return true;
|
||||
});
|
||||
|
||||
mBindings.mainSearch.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
// removeListFilter();
|
||||
//
|
||||
// if (!UtilityString.isNullOrEmpty(query) && query.trim().length() > 3) {
|
||||
// List<DialogChooseArtsFromListaArtsItemModel> foundRowsList = Stream.of(mDataset)
|
||||
// .filter(x -> {
|
||||
// String codMart = x.getMtbColr().getMtbAart().getCodMart();
|
||||
// String descrizioneArt = x.getMtbColr().getMtbAart().getDescrizioneEstesa();
|
||||
// String diacod = x.getMtbColr().getMtbAart().getDiacod();
|
||||
//
|
||||
// return ((codMart.startsWith(query) ||
|
||||
// codMart.endsWith(query) ||
|
||||
// codMart.contains(query) ||
|
||||
// codMart.equalsIgnoreCase(query)) ||
|
||||
// (descrizioneArt.startsWith(query) ||
|
||||
// descrizioneArt.endsWith(query) ||
|
||||
// descrizioneArt.contains(query) ||
|
||||
// descrizioneArt.equalsIgnoreCase(query)) ||
|
||||
// (diacod.startsWith(query) ||
|
||||
// diacod.endsWith(query) ||
|
||||
// diacod.contains(query) ||
|
||||
// diacod.equalsIgnoreCase(query))) &&
|
||||
// !x.isHidden();
|
||||
// })
|
||||
// .toList();
|
||||
//
|
||||
// for (int i = 0; i < mDataset.size(); i++) {
|
||||
// mDataset.get(i).setHidden(!foundRowsList.contains(mDataset.get(i)));
|
||||
// }
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
removeListFilter();
|
||||
|
||||
newText = newText.toLowerCase();
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(newText) && newText.trim().length() > 2) {
|
||||
String finalNewText = newText;
|
||||
List<DialogChooseArtsFromListaArtsItemModel> foundRowsList = Stream.of(mDataset)
|
||||
.filter(x -> {
|
||||
String codMart = x.getMtbColr().getMtbAart().getCodMart().toLowerCase();
|
||||
String descrizioneArt = x.getMtbColr().getMtbAart().getDescrizioneEstesa().toLowerCase();
|
||||
String diacod = x.getMtbColr().getMtbAart().getDiacod();
|
||||
if (!UtilityString.isNullOrEmpty(diacod)) {
|
||||
diacod = diacod.toLowerCase();
|
||||
}
|
||||
|
||||
return ((codMart.startsWith(finalNewText) ||
|
||||
codMart.endsWith(finalNewText) ||
|
||||
codMart.contains(finalNewText) ||
|
||||
codMart.equalsIgnoreCase(finalNewText)) ||
|
||||
(descrizioneArt.startsWith(finalNewText) ||
|
||||
descrizioneArt.endsWith(finalNewText) ||
|
||||
descrizioneArt.contains(finalNewText) ||
|
||||
descrizioneArt.equalsIgnoreCase(finalNewText)) ||
|
||||
(!UtilityString.isNullOrEmpty(diacod) && (diacod.startsWith(finalNewText) ||
|
||||
diacod.endsWith(finalNewText) ||
|
||||
diacod.contains(finalNewText) ||
|
||||
diacod.equalsIgnoreCase(finalNewText)))) &&
|
||||
!x.isHidden();
|
||||
})
|
||||
.toList();
|
||||
|
||||
for (int i = 0; i < mDataset.size(); i++) {
|
||||
mDataset.get(i).setHidden(!foundRowsList.contains(mDataset.get(i)));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupBarcode() {
|
||||
BarcodeManager.enable();
|
||||
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(onScanSuccessfull)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(context, ex, false)));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||
this.mOnAbort.run();
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||
onLoadingStarted();
|
||||
|
||||
|
||||
if (UtilityBarcode.isEan13(data)) {
|
||||
this.loadArticolo(data.getStringValue(), null);
|
||||
} else if (UtilityBarcode.isEtichetta128(data)) {
|
||||
this.executeEtichettaEan128(data);
|
||||
} else {
|
||||
onLoadingEnded();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) {
|
||||
this.barcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
String barcodeProd = null;
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||
barcodeProd = ean128Model.Content;
|
||||
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin) || !UtilityString.isNullOrEmpty(ean128Model.Content)) {
|
||||
this.loadArticolo(barcodeProd, ean128Model);
|
||||
} else {
|
||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||
onLoadingEnded();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||
onLoadingEnded();
|
||||
});
|
||||
|
||||
}
|
||||
}, this::onError);
|
||||
}
|
||||
|
||||
|
||||
private void loadArticolo(String barcodeProd, Ean128Model ean128Model) {
|
||||
this.articoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
|
||||
|
||||
if (mtbAartList != null && mtbAartList.size() > 0) {
|
||||
this.mBindings.mainSearch.setQuery(barcodeProd, false);
|
||||
|
||||
this.searchArtInList(mtbAartList.get(0), ean128Model);
|
||||
|
||||
onLoadingEnded();
|
||||
|
||||
} else {
|
||||
|
||||
DialogCommon.showNoArtFoundDialog(context, () -> {
|
||||
onLoadingEnded();
|
||||
});
|
||||
}
|
||||
|
||||
}, this::onError);
|
||||
}
|
||||
|
||||
|
||||
private void searchArtInList(MtbAart mtbAart, Ean128Model ean128Model) {
|
||||
removeListFilter();
|
||||
|
||||
List<DialogChooseArtsFromListaArtsItemModel> foundRowsList = Stream.of(mDataset)
|
||||
.filter(x -> x.getMtbColr().getMtbAart().getCodMart().equalsIgnoreCase(mtbAart.getCodMart()) &&
|
||||
!x.isHidden())
|
||||
.toList();
|
||||
|
||||
if (foundRowsList.size() == 0) {
|
||||
DialogCommon.showNoArtFoundDialog(context, null);
|
||||
} else {
|
||||
|
||||
for (int i = 0; i < mDataset.size(); i++) {
|
||||
mDataset.get(i).setHidden(!foundRowsList.contains(mDataset.get(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void removeListFilter() {
|
||||
for (DialogChooseArtsFromListaArtsItemModel itemModel : mDataset) {
|
||||
itemModel.setHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onPositiveClick() {
|
||||
if (mOnItemsChoosed != null) {
|
||||
mOnItemsChoosed.run(currentAdapter.getSelectedItems());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onNegativeClick() {
|
||||
this.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.Observable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.model.CheckableMtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogChooseArtsFromListaArtsItemModelBinding;
|
||||
|
||||
public class DialogChooseArtsFromListaArtsAdapter extends RecyclerView.Adapter<DialogChooseArtsFromListaArtsAdapter.ViewHolder> {
|
||||
|
||||
protected Context mContext;
|
||||
|
||||
private List<CheckableMtbColr> mDataset;
|
||||
private HashMap<CheckableMtbColr, Integer> mDatasetPositions = new HashMap<>();
|
||||
|
||||
|
||||
public DialogChooseArtsFromListaArtsAdapter(Context context, List<DialogChooseArtsFromListaArtsItemModel> myDataset) {
|
||||
mContext = context;
|
||||
|
||||
if(myDataset != null) {
|
||||
mDataset = Stream.of(myDataset)
|
||||
.withoutNulls()
|
||||
.map(CheckableMtbColr::new).toList();
|
||||
|
||||
for(int i = 0; i < mDataset.size(); i++) {
|
||||
final CheckableMtbColr itemModel = mDataset.get(i);
|
||||
|
||||
mDatasetPositions.put(itemModel, i);
|
||||
|
||||
itemModel.getHidden().addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
|
||||
@Override
|
||||
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||
onItemHidden(itemModel);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onItemHidden(CheckableMtbColr itemModel) {
|
||||
if(itemModel.isHidden()) {
|
||||
mDataset.remove(itemModel);
|
||||
} else {
|
||||
mDataset.add(mDatasetPositions.get(itemModel) , itemModel);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private DialogChooseArtsFromListaArtsItemModelBinding mViewDataBinding;
|
||||
|
||||
|
||||
public ViewHolder(DialogChooseArtsFromListaArtsItemModelBinding v) {
|
||||
super(v.getRoot());
|
||||
mViewDataBinding = v;
|
||||
}
|
||||
|
||||
public void bind(CheckableMtbColr checkableMtbColr) {
|
||||
mViewDataBinding.setCheckableMtbColr(checkableMtbColr);
|
||||
|
||||
MtbColr mtbColr = checkableMtbColr.getItem().getMtbColr();
|
||||
|
||||
//Setting qty with unt_mis
|
||||
if(!SettingsManager.iDB().isFlagForceAllToColli() && (mtbColr.getMtbAart() == null || mtbColr.getMtbAart().isFlagQtaCnfFissaBoolean())){
|
||||
String text = UtilityNumber.decimalToString(mtbColr.getQtaCol());
|
||||
|
||||
|
||||
if(mtbColr.getMtbAart() != null) {
|
||||
text += !UtilityString.isNullOrEmpty(mtbColr.getMtbAart().getUntMis()) ? "\n" + mtbColr.getMtbAart().getUntMis() : "";
|
||||
}
|
||||
|
||||
mViewDataBinding.qtaTextview.setText(text);
|
||||
|
||||
|
||||
} else {
|
||||
mViewDataBinding.qtaTextview.setText(UtilityNumber.decimalToString(mtbColr.getNumCnf()) + "\n" + UtilityResources.getString(R.string.unt_mis_col));
|
||||
}
|
||||
|
||||
mViewDataBinding.executePendingBindings();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialogChooseArtsFromListaArtsAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
// create a new view
|
||||
DialogChooseArtsFromListaArtsItemModelBinding viewDataBinding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.dialog_choose_arts_from_lista_arts__item_model, parent, false);
|
||||
|
||||
return new ViewHolder(viewDataBinding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(DialogChooseArtsFromListaArtsAdapter.ViewHolder holder, int position) {
|
||||
CheckableMtbColr item = mDataset.get(position);
|
||||
holder.bind(item);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(DialogChooseArtsFromListaArtsAdapter.ViewHolder holder) {
|
||||
super.onViewRecycled(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mDataset.size();
|
||||
}
|
||||
|
||||
public List<MtbColr> getSelectedItems() {
|
||||
return Stream.of(mDataset)
|
||||
.filter(y -> y.getChecked().get())
|
||||
.map(x -> x.getItem().getMtbColr()).toList();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogChooseArtsFromListaArtsComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogChooseArtsFromListaArtsComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogChooseArtsFromListaArts dialogChooseArtsFromListaArts);
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
||||
|
||||
import dagger.Module;
|
||||
|
||||
@Module(subcomponents = DialogChooseArtsFromListaArtsComponent.class)
|
||||
public class DialogChooseArtsFromListaArtsModule {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogChooseArtsFromMtbAartListComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogChooseArtsFromMtbAartListComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogChooseArtsFromMtbAartListView dialogChooseArtsFromMtbAartListView);
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
|
||||
public class DialogChooseArtsFromMtbAartListItemModel {
|
||||
|
||||
private BindableBoolean selected = new BindableBoolean(false);
|
||||
private String codMart;
|
||||
private String diacod;
|
||||
private String descrizione;
|
||||
private BigDecimal peso;
|
||||
private String pesoUntMis;
|
||||
private BigDecimal qta;
|
||||
private String qtaUntMis;
|
||||
|
||||
private MtbAart originalModel;
|
||||
|
||||
|
||||
|
||||
public BindableBoolean getSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
public DialogChooseArtsFromMtbAartListItemModel setSelected(BindableBoolean selected) {
|
||||
this.selected = selected;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public DialogChooseArtsFromMtbAartListItemModel setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDiacod() {
|
||||
return diacod;
|
||||
}
|
||||
|
||||
public DialogChooseArtsFromMtbAartListItemModel setDiacod(String diacod) {
|
||||
this.diacod = diacod;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public DialogChooseArtsFromMtbAartListItemModel setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getPeso() {
|
||||
return peso;
|
||||
}
|
||||
|
||||
public DialogChooseArtsFromMtbAartListItemModel setPeso(BigDecimal peso) {
|
||||
this.peso = peso;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPesoUntMis() {
|
||||
return pesoUntMis;
|
||||
}
|
||||
|
||||
public DialogChooseArtsFromMtbAartListItemModel setPesoUntMis(String pesoUntMis) {
|
||||
this.pesoUntMis = pesoUntMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQta() {
|
||||
return qta;
|
||||
}
|
||||
|
||||
public DialogChooseArtsFromMtbAartListItemModel setQta(BigDecimal qta) {
|
||||
this.qta = qta;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getQtaUntMis() {
|
||||
return qtaUntMis;
|
||||
}
|
||||
|
||||
public DialogChooseArtsFromMtbAartListItemModel setQtaUntMis(String qtaUntMis) {
|
||||
this.qtaUntMis = qtaUntMis;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbAart getOriginalModel() {
|
||||
return originalModel;
|
||||
}
|
||||
|
||||
public DialogChooseArtsFromMtbAartListItemModel setOriginalModel(MtbAart originalModel) {
|
||||
this.originalModel = originalModel;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
@Module(subcomponents = DialogChooseArtsFromMtbAartListComponent.class)
|
||||
public class DialogChooseArtsFromMtbAartListModule {
|
||||
|
||||
@Provides
|
||||
DialogChooseArtsFromMtbAartListViewModel providesDialogDialogDialogChooseArtsFromMtbAartListViewViewModel() {
|
||||
return new DialogChooseArtsFromMtbAartListViewModel();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
||||
|
||||
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 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.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.databinding.DialogChooseArtsFromMtbAartListLayoutBinding;
|
||||
|
||||
public class DialogChooseArtsFromMtbAartListView extends BaseDialogFragment implements DialogInterface.OnShowListener {
|
||||
|
||||
|
||||
@Inject
|
||||
DialogChooseArtsFromMtbAartListViewModel mViewModel;
|
||||
|
||||
private DialogChooseArtsFromMtbAartListLayoutBinding mBindings;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private final List<MtbAart> mtbAarts;
|
||||
private List<DialogChooseArtsFromMtbAartListItemModel> artsItemModels = null;
|
||||
private final RunnableArgs<List<MtbAart>> onConfirmed;
|
||||
private final Runnable onAbort;
|
||||
|
||||
//Pass here all external parameters
|
||||
public static DialogChooseArtsFromMtbAartListView newInstance(List<MtbAart> mtbAarts, RunnableArgs<List<MtbAart>> onConfirmed, Runnable onAbort) {
|
||||
return new DialogChooseArtsFromMtbAartListView(mtbAarts, onConfirmed, onAbort);
|
||||
}
|
||||
|
||||
private DialogChooseArtsFromMtbAartListView(List<MtbAart> mtbAarts, RunnableArgs<List<MtbAart>> onConfirmed, Runnable onAbort) {
|
||||
super();
|
||||
|
||||
this.mtbAarts = mtbAarts;
|
||||
this.onConfirmed = onConfirmed;
|
||||
this.onAbort = onAbort;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
this.mContext = requireContext();
|
||||
|
||||
mBindings = DialogChooseArtsFromMtbAartListLayoutBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogDialogDialogChooseArtsFromMtbAartListViewComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
|
||||
var cancelable = false;
|
||||
|
||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(cancelable)
|
||||
.setPositiveButton(R.string.ok, (dialog, which) -> {
|
||||
var selectedArts = Stream.of(this.artsItemModels)
|
||||
.filter(x -> x.getSelected().get())
|
||||
.map(DialogChooseArtsFromMtbAartListItemModel::getOriginalModel)
|
||||
.toList();
|
||||
|
||||
if(selectedArts.isEmpty()) {
|
||||
if (this.onAbort != null) this.onAbort.run();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.onConfirmed != null)
|
||||
this.onConfirmed.run(selectedArts);
|
||||
})
|
||||
.setNegativeButton(R.string.abort, (dialog, which) -> {
|
||||
if (this.onAbort != null) this.onAbort.run();
|
||||
})
|
||||
.create();
|
||||
|
||||
|
||||
|
||||
|
||||
alertDialog.setOnShowListener(this);
|
||||
alertDialog.setCanceledOnTouchOutside(cancelable);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
super.onShow(dialogInterface);
|
||||
this.initList();
|
||||
}
|
||||
|
||||
private void initList() {
|
||||
this.artsItemModels = Stream.of(this.mtbAarts)
|
||||
.map(x -> new DialogChooseArtsFromMtbAartListItemModel()
|
||||
.setCodMart(x.getCodMart())
|
||||
.setDescrizione(x.getDescrizioneEstesa())
|
||||
.setDiacod(x.getDiacod())
|
||||
.setOriginalModel(x))
|
||||
.toList();
|
||||
|
||||
new LiveAdapter(this.artsItemModels, BR.item)
|
||||
.map(DialogChooseArtsFromMtbAartListItemModel.class, R.layout.dialog_choose_arts_from_mtb_aart_list__item_model)
|
||||
.into(this.mBindings.listaArts);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
||||
|
||||
public class DialogChooseArtsFromMtbAartListViewModel {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,331 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.ravikoradiya.liveadapter.LiveAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.BR;
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogChooseArtsFromMtbColrListLayoutBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
import kotlin.Unit;
|
||||
|
||||
public class DialogChooseArtsFromMtbColrList extends BaseDialogFragment implements DialogInterface.OnShowListener {
|
||||
|
||||
@Inject
|
||||
DialogChooseArtsFromMtbColrListViewModel mViewModel;
|
||||
@Inject
|
||||
BarcodeRESTConsumer barcodeRESTConsumer;
|
||||
@Inject
|
||||
ArticoloRESTConsumer articoloRESTConsumer;
|
||||
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
private final List<MtbColr> inputMtbColrList;
|
||||
private MtbAart selectedArt;
|
||||
private final RunnableArgs<List<MtbColr>> onConfirmed;
|
||||
private final Runnable onAbort;
|
||||
|
||||
|
||||
private DialogChooseArtsFromMtbColrListLayoutBinding mBindings;
|
||||
|
||||
private List<DialogChooseArtsFromMtbColrListItemModel> mtbColrItemModels;
|
||||
private final MutableLiveData<List<DialogChooseArtsFromMtbColrListItemModel>> hiddenMtbColrItemModels = new MutableLiveData<>();
|
||||
private Context mContext;
|
||||
|
||||
public static DialogChooseArtsFromMtbColrList newInstance(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
return new DialogChooseArtsFromMtbColrList(listaMtbColr, onItemsChoosed, onAbort);
|
||||
}
|
||||
|
||||
public static DialogChooseArtsFromMtbColrList newInstance(List<MtbColr> listaMtbColr, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onItemsChoosed, Runnable onAbort) {
|
||||
DialogChooseArtsFromMtbColrList dialog = newInstance(listaMtbColr, onItemsChoosed, onAbort);
|
||||
dialog.setSelectedArt(mtbAart);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public void setSelectedArt(MtbAart mtbAart) {
|
||||
this.selectedArt = mtbAart;
|
||||
}
|
||||
|
||||
private DialogChooseArtsFromMtbColrList(List<MtbColr> listaMtbColr, RunnableArgs<List<MtbColr>> onConfirmed, Runnable onAbort) {
|
||||
super();
|
||||
|
||||
this.inputMtbColrList = listaMtbColr;
|
||||
|
||||
this.onConfirmed = onConfirmed;
|
||||
this.onAbort = onAbort;
|
||||
|
||||
// mDataset = new ArrayList<>();
|
||||
|
||||
// if (listaMtbColr != null) {
|
||||
// for (MtbColr mtbColr : listaMtbColr) {
|
||||
// if (UtilityString.isNullOrEmpty(mtbColr.getUntMis()) && mtbColr.getMtbAart() != null) {
|
||||
// mtbColr.setUntMis(mtbColr.getMtbAart().getUntMis());
|
||||
// }
|
||||
//
|
||||
// mDataset.add(new DialogChooseArtsFromMtbColrListItemModel().setMtbColr(mtbColr));
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
this.mContext = requireContext();
|
||||
|
||||
mBindings = DialogChooseArtsFromMtbColrListLayoutBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogChooseArtsFromListaArtsComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
var cancelable = false;
|
||||
|
||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(cancelable)
|
||||
.setPositiveButton(R.string.ok, (dialog, which) -> {
|
||||
var selectedArts = Stream.of(this.mtbColrItemModels)
|
||||
.filter(x -> x.getChecked().get())
|
||||
.map(DialogChooseArtsFromMtbColrListItemModel::getMtbColr)
|
||||
.toList();
|
||||
|
||||
// if (selectedArts.isEmpty()) {
|
||||
// if (this.onAbort != null) this.onAbort.run();
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (this.onConfirmed != null)
|
||||
this.onConfirmed.run(selectedArts);
|
||||
})
|
||||
.setNegativeButton(R.string.abort, (dialog, which) -> {
|
||||
if (this.onAbort != null) this.onAbort.run();
|
||||
})
|
||||
.create();
|
||||
|
||||
|
||||
alertDialog.setOnShowListener(this);
|
||||
alertDialog.setCanceledOnTouchOutside(cancelable);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
super.onShow(dialogInterface);
|
||||
this.initList();
|
||||
this.initFilter();
|
||||
this.setupBarcode();
|
||||
|
||||
if (selectedArt != null) {
|
||||
this.loadArticolo(selectedArt.getBarCode(), null);
|
||||
}
|
||||
}
|
||||
|
||||
private void initList() {
|
||||
mBindings.listaArts.setHasFixedSize(true);
|
||||
|
||||
this.mtbColrItemModels = Stream.of(this.inputMtbColrList)
|
||||
.map(x -> new DialogChooseArtsFromMtbColrListItemModel()
|
||||
.setMtbColr(x))
|
||||
.toList();
|
||||
|
||||
this.hiddenMtbColrItemModels.setValue(this.mtbColrItemModels);
|
||||
|
||||
new LiveAdapter(this.hiddenMtbColrItemModels, this, BR.item)
|
||||
.map(DialogChooseArtsFromMtbColrListItemModel.class, R.layout.dialog_choose_arts_from_mtb_colr_list__item_model)
|
||||
.onNoData(noData -> {
|
||||
mBindings.emptyView.setVisibility(noData ? View.VISIBLE : View.GONE);
|
||||
return Unit.INSTANCE;
|
||||
})
|
||||
.into(this.mBindings.listaArts);
|
||||
}
|
||||
|
||||
|
||||
private void initFilter() {
|
||||
mBindings.mainSearch.setOnCloseListener(() -> {
|
||||
this.removeListFilter();
|
||||
return true;
|
||||
});
|
||||
|
||||
mBindings.mainSearch.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
newText = newText.toLowerCase();
|
||||
|
||||
String finalNewText = newText;
|
||||
final List<DialogChooseArtsFromMtbColrListItemModel> filtered = Stream.of(mtbColrItemModels)
|
||||
.filter(x -> {
|
||||
String codMart = x.getMtbColr().getMtbAart().getCodMart().toLowerCase();
|
||||
String descrizioneArt = x.getMtbColr().getMtbAart().getDescrizioneEstesa().toLowerCase();
|
||||
String diacod = x.getMtbColr().getMtbAart().getDiacod();
|
||||
if (!UtilityString.isNullOrEmpty(diacod)) {
|
||||
diacod = diacod.toLowerCase();
|
||||
}
|
||||
|
||||
return ((codMart.startsWith(finalNewText) ||
|
||||
codMart.endsWith(finalNewText) ||
|
||||
codMart.contains(finalNewText) ||
|
||||
codMart.equalsIgnoreCase(finalNewText)) ||
|
||||
(descrizioneArt.startsWith(finalNewText) ||
|
||||
descrizioneArt.endsWith(finalNewText) ||
|
||||
descrizioneArt.contains(finalNewText) ||
|
||||
descrizioneArt.equalsIgnoreCase(finalNewText)) ||
|
||||
(!UtilityString.isNullOrEmpty(diacod) && (diacod.startsWith(finalNewText) ||
|
||||
diacod.endsWith(finalNewText) ||
|
||||
diacod.contains(finalNewText) ||
|
||||
diacod.equalsIgnoreCase(finalNewText))));
|
||||
})
|
||||
.toList();
|
||||
|
||||
hiddenMtbColrItemModels.postValue(filtered);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void removeListFilter() {
|
||||
for (DialogChooseArtsFromMtbColrListItemModel itemModel : mtbColrItemModels) {
|
||||
itemModel.setHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupBarcode() {
|
||||
BarcodeManager.enable();
|
||||
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(onScanSuccessfull)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(mContext, ex, false)));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
BarcodeManager.removeCallback(mBarcodeScannerIstanceID);
|
||||
this.onAbort.run();
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||
onLoadingStarted();
|
||||
|
||||
|
||||
if (UtilityBarcode.isEan13(data)) {
|
||||
this.loadArticolo(data.getStringValue(), null);
|
||||
} else if (UtilityBarcode.isEtichetta128(data)) {
|
||||
this.executeEtichettaEan128(data);
|
||||
} else {
|
||||
onLoadingEnded();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO) {
|
||||
this.barcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
String barcodeProd = null;
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||
barcodeProd = ean128Model.Content;
|
||||
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin) || !UtilityString.isNullOrEmpty(ean128Model.Content)) {
|
||||
this.loadArticolo(barcodeProd, ean128Model);
|
||||
} else {
|
||||
DialogCommon.showNoArtFoundDialog(mContext, this::onLoadingEnded);
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
DialogCommon.showNoArtFoundDialog(mContext, this::onLoadingEnded);
|
||||
|
||||
}
|
||||
}, this::onError);
|
||||
}
|
||||
|
||||
|
||||
private void loadArticolo(String barcodeProd, Ean128Model ean128Model) {
|
||||
this.articoloRESTConsumer.getByBarcodeProd(barcodeProd, mtbAartList -> {
|
||||
|
||||
if (mtbAartList != null && mtbAartList.size() > 0) {
|
||||
this.mBindings.mainSearch.setQuery(barcodeProd, false);
|
||||
|
||||
this.searchArtInList(mtbAartList.get(0), ean128Model);
|
||||
|
||||
onLoadingEnded();
|
||||
|
||||
} else {
|
||||
|
||||
DialogCommon.showNoArtFoundDialog(mContext, this::onLoadingEnded);
|
||||
}
|
||||
|
||||
}, this::onError);
|
||||
}
|
||||
|
||||
|
||||
private void searchArtInList(MtbAart mtbAart, Ean128Model ean128Model) {
|
||||
removeListFilter();
|
||||
|
||||
List<DialogChooseArtsFromMtbColrListItemModel> foundRowsList = Stream.of(mtbColrItemModels)
|
||||
.filter(x -> x.getMtbColr().getMtbAart().getCodMart().equalsIgnoreCase(mtbAart.getCodMart()) &&
|
||||
!x.isHidden())
|
||||
.toList();
|
||||
|
||||
if (foundRowsList.size() == 0) {
|
||||
DialogCommon.showNoArtFoundDialog(mContext, null);
|
||||
} else {
|
||||
|
||||
for (int i = 0; i < mtbColrItemModels.size(); i++) {
|
||||
mtbColrItemModels.get(i).setHidden(!foundRowsList.contains(mtbColrItemModels.get(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogChooseArtsFromMtbColrListComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogChooseArtsFromMtbColrListComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogChooseArtsFromMtbColrList dialogChooseArtsFromMtbColrList);
|
||||
|
||||
}
|
||||
@@ -1,27 +1,32 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts;
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list;
|
||||
|
||||
import it.integry.integrywmsnative.core.di.BindableBoolean;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
|
||||
public class DialogChooseArtsFromListaArtsItemModel {
|
||||
public class DialogChooseArtsFromMtbColrListItemModel {
|
||||
|
||||
private MtbColr mtbColr;
|
||||
private BindableBoolean hidden = new BindableBoolean(false);
|
||||
private final BindableBoolean checked = new BindableBoolean(false);
|
||||
private final BindableBoolean hidden = new BindableBoolean(false);
|
||||
|
||||
public MtbColr getMtbColr() {
|
||||
return mtbColr;
|
||||
}
|
||||
|
||||
public DialogChooseArtsFromListaArtsItemModel setMtbColr(MtbColr mtbColr) {
|
||||
public DialogChooseArtsFromMtbColrListItemModel setMtbColr(MtbColr mtbColr) {
|
||||
this.mtbColr = mtbColr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BindableBoolean getChecked() {
|
||||
return checked;
|
||||
}
|
||||
|
||||
public boolean isHidden() {
|
||||
return hidden.get();
|
||||
}
|
||||
|
||||
public DialogChooseArtsFromListaArtsItemModel setHidden(boolean hidden) {
|
||||
public DialogChooseArtsFromMtbColrListItemModel setHidden(boolean hidden) {
|
||||
this.hidden.set(hidden);
|
||||
return this;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
@Module(subcomponents = DialogChooseArtsFromMtbColrListComponent.class)
|
||||
public class DialogChooseArtsFromMtbColrListModule {
|
||||
@Provides
|
||||
DialogChooseArtsFromMtbColrListViewModel providesDialogChooseArtsFromMtbColrListViewModel() {
|
||||
return new DialogChooseArtsFromMtbColrListViewModel();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list;
|
||||
|
||||
public class DialogChooseArtsFromMtbColrListViewModel {
|
||||
}
|
||||
@@ -90,6 +90,7 @@ public class DialogInputPesoLUView extends BaseDialogFragment {
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(cancelable);
|
||||
alertDialog.setOnShowListener(this);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
|
||||
@Module(subcomponents = DialogScanArtComponent.class)
|
||||
@@ -14,8 +16,15 @@ public class DialogScanArtModule {
|
||||
DialogScanArtViewModel providesDialogScanArtViewModel(BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||
return new DialogScanArtViewModel(barcodeRESTConsumer, colliMagazzinoRESTConsumer, articoloRESTConsumer, posizioniRESTConsumer);
|
||||
PosizioniRESTConsumer posizioniRESTConsumer,
|
||||
MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer,
|
||||
GiacenzaRESTConsumer giacenzaRESTConsumer) {
|
||||
return new DialogScanArtViewModel(barcodeRESTConsumer,
|
||||
colliMagazzinoRESTConsumer,
|
||||
articoloRESTConsumer,
|
||||
posizioniRESTConsumer,
|
||||
magazzinoAutomaticoRESTConsumer,
|
||||
giacenzaRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgssss;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.databinding.DialogScanArtBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||
@@ -42,17 +43,19 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
|
||||
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> mOnItemChoosed = null;
|
||||
private RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onPickingCompleted = null;
|
||||
private RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest = null;
|
||||
|
||||
|
||||
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onComplete) {
|
||||
return new DialogScanArtView(forceOnlyUL, onComplete);
|
||||
public static DialogScanArtView newInstance(boolean forceOnlyUL, @NotNull RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||
return new DialogScanArtView(forceOnlyUL, onPickingCompleted, onMagazzinoAutomaticoPickingRequest);
|
||||
}
|
||||
|
||||
private DialogScanArtView(boolean forceOnlyUL, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onItemChoosed) {
|
||||
private DialogScanArtView(boolean forceOnlyUL, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, MtbColr> onItemChoosed, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||
super();
|
||||
mForceOnlyUL = forceOnlyUL;
|
||||
mOnItemChoosed = onItemChoosed;
|
||||
onPickingCompleted = onItemChoosed;
|
||||
this.onMagazzinoAutomaticoPickingRequest = onMagazzinoAutomaticoPickingRequest;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -76,7 +79,7 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
mBindings.buttonNo.setOnClickListener(v -> {
|
||||
mOnItemChoosed.run(DialogConsts.Results.ABORT, null, null, null);
|
||||
onPickingCompleted.run(DialogConsts.Results.ABORT, null, null, null);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
@@ -116,19 +119,24 @@ public class DialogScanArtView extends BaseDialogFragment implements DialogScanA
|
||||
|
||||
if (filteredMtbColrList != null && filteredMtbColrList.size() > 1) {
|
||||
DialogChooseArtFromListaMtbColrView.make(getActivity(), filteredMtbColrList, mtbColrChose -> {
|
||||
mOnItemChoosed.run(status, mtbAart, ean128Model, mtbColrChose);
|
||||
onPickingCompleted.run(status, mtbAart, ean128Model, mtbColrChose);
|
||||
}).show();
|
||||
|
||||
} else if (filteredMtbColrList != null && filteredMtbColrList.size() == 1) {
|
||||
mOnItemChoosed.run(status, mtbAart, ean128Model, filteredMtbColrList.get(0));
|
||||
onPickingCompleted.run(status, mtbAart, ean128Model, filteredMtbColrList.get(0));
|
||||
|
||||
} else {
|
||||
mOnItemChoosed.run(status, mtbAart, ean128Model, null);
|
||||
onPickingCompleted.run(status, mtbAart, ean128Model, null);
|
||||
}
|
||||
|
||||
|
||||
this.onLoadingEnded();
|
||||
|
||||
dismiss();
|
||||
}, pickMagazzinoAutomaticoPosizione -> {
|
||||
this.onMagazzinoAutomaticoPickingRequest.run(pickMagazzinoAutomaticoPosizione);
|
||||
|
||||
this.onLoadingEnded();
|
||||
dismiss();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.scan_art;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
@@ -9,7 +11,9 @@ import it.integry.integrywmsnative.core.exception.EmptyLUException;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUException;
|
||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
import it.integry.integrywmsnative.core.exception.ScannedPositionNotExistException;
|
||||
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgssss;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
@@ -17,9 +21,12 @@ import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
@@ -31,6 +38,8 @@ public class DialogScanArtViewModel {
|
||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||
private final ArticoloRESTConsumer mArticoloRESTConsumer;
|
||||
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
||||
private final MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer;
|
||||
private final GiacenzaRESTConsumer mGiacenzaRESTConsumer;
|
||||
|
||||
private boolean mForceOnlyUL;
|
||||
|
||||
@@ -39,11 +48,13 @@ public class DialogScanArtViewModel {
|
||||
public DialogScanArtViewModel(BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer,
|
||||
ArticoloRESTConsumer articoloRESTConsumer,
|
||||
PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||
PosizioniRESTConsumer posizioniRESTConsumer, MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer, GiacenzaRESTConsumer mGiacenzaRESTConsumer) {
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
this.mPosizioniRESTConsumer = posizioniRESTConsumer;
|
||||
this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer;
|
||||
this.mGiacenzaRESTConsumer = mGiacenzaRESTConsumer;
|
||||
}
|
||||
|
||||
public DialogScanArtViewModel setForceOnlyUL(boolean forceOnlyUL) {
|
||||
@@ -51,23 +62,23 @@ public class DialogScanArtViewModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onPickingCompleted, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||
if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||
//Cerco gli articoli presenti nell'ul dell'etichetta anonima
|
||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onComplete);
|
||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onPickingCompleted);
|
||||
|
||||
} else if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO)) {
|
||||
//Cerco l'UL presente all'interno della posizione
|
||||
// this.executeEtichettaPosizione(barcodeScanDTO.getStringValue(), onComplete);
|
||||
this.executeEtichettaPosizione(barcodeScanDTO.getStringValue(), onPickingCompleted, onMagazzinoAutomaticoPickingRequest);
|
||||
|
||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||
this.executeEtichettaEan128(barcodeScanDTO, onPickingCompleted);
|
||||
|
||||
} else if (UtilityBarcode.isEanPeso(barcodeScanDTO) && !mForceOnlyUL) {
|
||||
this.executeEtichettaEanPeso(barcodeScanDTO, onComplete);
|
||||
this.executeEtichettaEanPeso(barcodeScanDTO, onPickingCompleted);
|
||||
|
||||
} else {
|
||||
this.loadArticolo(barcodeScanDTO.getStringValue(), null, onComplete);
|
||||
this.loadArticolo(barcodeScanDTO.getStringValue(), null, onPickingCompleted);
|
||||
|
||||
}
|
||||
// else {
|
||||
@@ -76,6 +87,7 @@ public class DialogScanArtViewModel {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
@@ -128,6 +140,27 @@ public class DialogScanArtViewModel {
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void executeEtichettaPosizione(String stringValue, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete, RunnableArgs<MtbDepoPosizione> onMagazzinoAutomaticoPickingRequest) {
|
||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(stringValue))
|
||||
.single();
|
||||
|
||||
if (foundPosizione == null) {
|
||||
//Nessuna posizione trovata con questo barcode
|
||||
this.sendError(new ScannedPositionNotExistException());
|
||||
return;
|
||||
}
|
||||
|
||||
if (foundPosizione.isMagazzinoAutomatico()) {
|
||||
//Eseguo picking da magazzino automatico
|
||||
onMagazzinoAutomaticoPickingRequest.run(foundPosizione);
|
||||
} else {
|
||||
this.executePosizione(foundPosizione, null, onComplete);
|
||||
}
|
||||
}
|
||||
|
||||
private void executePosizione(MtbDepoPosizione posizione, MtbAart articolo, RunnableArgssss<DialogConsts.Results, MtbAart, Ean128Model, List<MtbColr>> onComplete) {
|
||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(posizione, mtbColtList -> {
|
||||
|
||||
|
||||
@@ -103,11 +103,12 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
|
||||
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
});
|
||||
|
||||
var alertDialog = new MaterialAlertDialogBuilder(requireContext())
|
||||
var alertDialog = new MaterialAlertDialogBuilder(requireContext())
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(false)
|
||||
.create();
|
||||
alertDialog.setCanceledOnTouchOutside(false);
|
||||
alertDialog.setOnShowListener(this);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,5 @@
|
||||
android:top="4dp" />
|
||||
|
||||
<corners
|
||||
android:topLeftRadius="16dp"
|
||||
android:bottomLeftRadius="16dp"
|
||||
android:topRightRadius="8dp"
|
||||
android:bottomRightRadius="8dp" />
|
||||
android:radius="12dp" />
|
||||
</shape>
|
||||
@@ -42,7 +42,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toStartOf="@id/qta_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<data>
|
||||
<import type="it.integry.integrywmsnative.R" />
|
||||
<import type="android.view.View" />
|
||||
<import type="it.integry.integrywmsnative.core.utility.UtilityString" />
|
||||
<import type="it.integry.integrywmsnative.core.utility.UtilityNumber" />
|
||||
<variable
|
||||
name="checkableMtbColr"
|
||||
type="it.integry.integrywmsnative.core.model.CheckableMtbColr"/>
|
||||
</data>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/bg_checked_layout"
|
||||
app:backgroundTintResID="@{checkableMtbColr.checked.get() ? R.color.bg_checked_layout : android.R.color.transparent}"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:onClick="@{() -> checkableMtbColr.toggleCheck()}">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatCheckBox
|
||||
android:id="@+id/checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_centerVertical="true"
|
||||
app:checked="@{checkableMtbColr.checked}"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_toEndOf="@id/checkbox"
|
||||
android:layout_toStartOf="@id/qta_box">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{checkableMtbColr.item.mtbColr.mtbAart.getCodMart()}"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="COD MART" />
|
||||
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{UtilityNumber.decimalToString(checkableMtbColr.item.mtbColr.qtaCol) + checkableMtbColr.item.mtbColr.mtbAart.untMis}"
|
||||
android:visibility="@{checkableMtbColr.item.mtbColr.mtbAart != null && !checkableMtbColr.item.mtbColr.mtbAart.flagQtaCnfFissaBoolean ? View.VISIBLE : View.GONE}"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="6dp"
|
||||
android:background="@drawable/badge_round_corner"
|
||||
android:backgroundTint="@color/orange_600"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_alignParentEnd="true"
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
tools:text="PESO KG" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{checkableMtbColr.item.mtbColr.mtbAart.getDiacod()}"
|
||||
android:textColor="@color/red_600"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="@{UtilityString.isNullOrEmpty(checkableMtbColr.item.mtbColr.mtbAart.diacod) ? View.GONE : View.VISIBLE}"
|
||||
tools:text="DIACOD" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:text="@{checkableMtbColr.item.mtbColr.mtbAart.descrizioneEstesa}"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="16sp"
|
||||
tools:text="Descrizione lunga articolo" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/qta_box"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="12dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/qta_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/badge_round_corner"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="6dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textStyle="bold"
|
||||
android:textAllCaps="true"
|
||||
tools:text="280.45\nCONF" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</layout>
|
||||
@@ -1,171 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
<import type="android.view.View" />
|
||||
|
||||
</data>
|
||||
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/base_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="24dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/buttons"
|
||||
android:layout_below="@id/title_container"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/empty_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:gravity="center"
|
||||
android:padding="16dp">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/no_item_to_pick_text"
|
||||
android:textColor="@color/empty_view_gray"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/lista_arts"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/title_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/TextViewMaterial.Dialog.HeadlineText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/dialog_choose_arts_from_lista_art" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center">
|
||||
|
||||
|
||||
|
||||
<androidx.appcompat.widget.SearchView
|
||||
android:id="@+id/main_search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:iconifiedByDefault="true"
|
||||
app:defaultQueryHint="@string/search"
|
||||
app:iconifiedByDefault="false"
|
||||
android:layout_gravity="end"
|
||||
android:tint="@android:color/black"/>
|
||||
|
||||
<!-- <com.google.android.material.button.MaterialButton-->
|
||||
<!-- android:id="@+id/button_remove_filter"-->
|
||||
<!-- style="@style/Button.DangerOutline"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_gravity="center_horizontal"-->
|
||||
<!-- android:layout_marginTop="8dp"-->
|
||||
<!-- android:text="@string/remove_filter_button"-->
|
||||
<!-- android:visibility="@{filterStatus.get() ? View.VISIBLE : View.GONE}"-->
|
||||
<!-- app:icon="@drawable/ic_clear_24dp"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="parent"-->
|
||||
<!-- app:strokeColor="@color/red_400" />-->
|
||||
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/buttons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/center_guideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/negative_button"
|
||||
style="@style/Button.PrimaryOutline"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:text="@string/abort"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/positive_button"
|
||||
style="@style/Button.PrimaryFull"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:text="@string/confirm"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/center_guideline"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</layout>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user