Aggiunta possibilità di cancellare le righe nel Picking Libero
This commit is contained in:
@@ -178,10 +178,10 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer{
|
||||
|
||||
}
|
||||
|
||||
public static void distribuisciCollo(MtbColt mtbColtToDistribute, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static void distribuisciCollo(MtbColt mtbColtToDistribute, DistribuzioneColloDTO.CriterioDistribuzione criterioDistribuzione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
DistribuzioneColloDTO distribuzioneColloDTO = new DistribuzioneColloDTO()
|
||||
.setCriterioDistribuzione(DistribuzioneColloDTO.CriterioDistribuzione.UPDATE)
|
||||
.setCriterioDistribuzione(criterioDistribuzione)
|
||||
.setDataCollo(mtbColtToDistribute.getDataColloS())
|
||||
.setNumCollo(mtbColtToDistribute.getNumCollo())
|
||||
.setGestione(mtbColtToDistribute.getGestione())
|
||||
|
||||
@@ -63,7 +63,8 @@ public class DistribuzioneColloDTO {
|
||||
}
|
||||
|
||||
public enum CriterioDistribuzione {
|
||||
UPDATE("U"); //UPDATE COLLO GIA' ESISTENTE
|
||||
UPDATE("U"), //UPDATE COLLO GIA' ESISTENTE
|
||||
SPLIT_ORDINE("O"); //UPDATE COLLO GIA' ESISTENTE
|
||||
|
||||
private String text;
|
||||
CriterioDistribuzione(String text) {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package it.integry.integrywmsnative.core.context;
|
||||
|
||||
public class AppContext {
|
||||
|
||||
public AppContext() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import android.util.Log;
|
||||
import com.crashlytics.android.Crashlytics;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import it.integry.integrywmsnative.BuildConfig;
|
||||
import it.integry.integrywmsnative.core.REST.CommonRESTException;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
||||
|
||||
@@ -30,9 +31,12 @@ public class UtilityExceptions {
|
||||
if(errorMessage == null) errorMessage = ex.getMessage();
|
||||
DialogSimpleMessageHelper.makeErrorDialog(context, new SpannableString(errorMessage), null, null).show();
|
||||
|
||||
if(sendEmail) UtilityLogger.errorMe(ex);
|
||||
|
||||
Crashlytics.logException(ex.getCause());
|
||||
if(!BuildConfig.DEBUG) {
|
||||
if(sendEmail) UtilityLogger.errorMe(ex);
|
||||
|
||||
Crashlytics.logException(ex.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@ package it.integry.integrywmsnative.gest.picking_libero.viewmodel;
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.text.SpannableString;
|
||||
import android.view.View;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
@@ -12,6 +14,7 @@ import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.databinding.Observable;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
@@ -38,6 +41,7 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.ActivityPickingLiberoBinding;
|
||||
@@ -61,6 +65,8 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
public BindableBoolean thereIsAnyRowInUL = new BindableBoolean();
|
||||
public BindableBoolean thereIsAnOpenULWithoutRows = new BindableBoolean();
|
||||
|
||||
private BottomSheetBehavior mBottomSheetBehavior;
|
||||
|
||||
private PickingLiberoActivity mContext;
|
||||
private ActivityPickingLiberoBinding mBinding;
|
||||
private PickingLiberoHelper mHelper;
|
||||
@@ -75,6 +81,8 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
initObservable();
|
||||
|
||||
initRecyclerView();
|
||||
|
||||
initBottomSheetActions();
|
||||
}
|
||||
|
||||
|
||||
@@ -178,6 +186,26 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
mBinding.pickingLiberoMainList.setAdapter(null);
|
||||
}
|
||||
|
||||
private void initBottomSheetActions() {
|
||||
mBinding.bg.setOnClickListener(v -> mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED));
|
||||
|
||||
mBottomSheetBehavior = BottomSheetBehavior.from(mBinding.bottomSheetActions);
|
||||
|
||||
mBottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
|
||||
@Override
|
||||
public void onStateChanged(@NonNull View bottomSheet, int newState) {
|
||||
if (newState == BottomSheetBehavior.STATE_COLLAPSED)
|
||||
mBinding.bg.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
|
||||
mBinding.bg.setVisibility(View.VISIBLE);
|
||||
mBinding.bg.setAlpha(slideOffset);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void onBackPressed() {
|
||||
if(thereIsAnOpenedUL.get()) {
|
||||
@@ -505,6 +533,40 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
||||
|
||||
@Override
|
||||
public void onItemClick(MtbColr item, int position) {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
|
||||
MtbColr clickedItem = mtbColt.get().getMtbColr().get(position);
|
||||
|
||||
mBinding.bottomSheetActionsTitle.setText(clickedItem.getDescrizione());
|
||||
mBinding.bottomSheetActionsSubtitle.setText(clickedItem.getCodMart());
|
||||
|
||||
mBinding.bottomSheetActionsDeleteBtn.setOnClickListener(v -> onItemDelete(item));
|
||||
|
||||
mBinding.bottomSheetActionsQuantity.setText(UtilityNumber.decimalToString(clickedItem.getQtaCol()) + " " + clickedItem.getMtbAart().getUntMis());
|
||||
}
|
||||
|
||||
|
||||
private void onItemDelete(MtbColr mtbColrToDelete) {
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
|
||||
MtbColr mtbColrToDeleteClone = (MtbColr) mtbColrToDelete.clone();
|
||||
|
||||
mtbColrToDeleteClone
|
||||
.setRiga(null)
|
||||
.setDatetimeRow(new Date())
|
||||
.setQtaCol(mtbColrToDeleteClone.getQtaCol().multiply(new BigDecimal(-1)))
|
||||
.setOperation(CommonModelConsts.OPERATION.DELETE);
|
||||
|
||||
MtbColt mtbColtClone = (MtbColt) mtbColt.get().clone();
|
||||
mtbColtClone.setMtbColr(new ObservableArrayList<>());
|
||||
mtbColtClone.getMtbColr().add(mtbColrToDeleteClone);
|
||||
mtbColtClone.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
|
||||
ProgressDialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
|
||||
ColliMagazzinoRESTConsumer.saveCollo(mtbColtClone, value -> {
|
||||
progressDialog.dismiss();
|
||||
mtbColt.get().getMtbColr().remove(mtbColrToDelete);
|
||||
}, ex -> UtilityExceptions.defaultException(mContext, ex, progressDialog));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,16 +519,6 @@ public class RettificaGiacenzeViewModel implements IRecyclerItemClicked<MtbColr>
|
||||
|
||||
}).show();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void onItemDelete(MtbColr mtbColrToDelete) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import it.integry.integrywmsnative.core.REST.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.REST.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.REST.consumers.ISimpleOperationCallback;
|
||||
import it.integry.integrywmsnative.core.REST.consumers.PrinterRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.REST.model.DistribuzioneColloDTO;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
||||
@@ -688,7 +689,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
||||
|
||||
MtbColt cloneMtbColt = (MtbColt) mArticoliInColloBottomSheetViewModel.mtbColt.get().clone();
|
||||
|
||||
ColliMagazzinoRESTConsumer.distribuisciCollo(cloneMtbColt, onComplete,
|
||||
ColliMagazzinoRESTConsumer.distribuisciCollo(cloneMtbColt, DistribuzioneColloDTO.CriterioDistribuzione.UPDATE, onComplete,
|
||||
ex -> UtilityExceptions.defaultException(mActivity, ex, progress));
|
||||
}
|
||||
|
||||
|
||||
@@ -192,6 +192,109 @@
|
||||
|
||||
|
||||
|
||||
<View
|
||||
android:visibility="gone"
|
||||
android:id="@+id/bg"
|
||||
android:background="#99000000"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_sheet_actions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#fff"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:layout_gravity="bottom"
|
||||
app:behavior_hideable="true"
|
||||
app:behavior_peekHeight="0dp"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center_vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/bottom_sheet_actions_quantity"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/bottom_sheet_actions_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Descrizione articolo"
|
||||
android:textColor="#444"
|
||||
android:textSize="18dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:paddingRight="8dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/bottom_sheet_actions_subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="ABF52IL"
|
||||
android:textSize="14dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bottom_sheet_actions_quantity"
|
||||
android:layout_width="wrap_content"
|
||||
android:gravity="right"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:textSize="15dp"
|
||||
tools:text="250 PZ"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:gravity="center">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageButton
|
||||
android:id="@+id/bottom_sheet_actions_delete_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:background="@android:color/white"
|
||||
android:scaleX="1.5"
|
||||
android:scaleY="1.5"
|
||||
android:src="@drawable/ic_delete_24dp"
|
||||
android:tint="@color/red_600" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Cancella"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user