GRAMM visualizzato peso articolo
This commit is contained in:
parent
ecfb8faf01
commit
52092e7e9c
@ -57,6 +57,7 @@ public class MtbColt extends EntityBase {
|
||||
private String codJcom;
|
||||
|
||||
private List<MtbCols> mtbCols;
|
||||
private MtbTCol mtbTCol;
|
||||
|
||||
private Boolean disablePrint;
|
||||
private String ragSocCliente;
|
||||
@ -83,7 +84,6 @@ public class MtbColt extends EntityBase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private ObservableArrayList<MtbColr> mtbColr = new ObservableArrayList<>();
|
||||
|
||||
public ObservableArrayList<MtbColr> getMtbColr() {
|
||||
@ -95,12 +95,12 @@ public class MtbColt extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbColt(){
|
||||
public MtbColt() {
|
||||
type = "mtb_colt";
|
||||
setDataCollo(UtilityDate.getDateInstance());
|
||||
setSerCollo("/");
|
||||
|
||||
if(SettingsManager.i().isUserLoggedIn()) {
|
||||
if (SettingsManager.i().isUserLoggedIn()) {
|
||||
setPreparatoDa(SettingsManager.i().getUser().getFullname());
|
||||
}
|
||||
}
|
||||
@ -137,11 +137,11 @@ public class MtbColt extends EntityBase {
|
||||
Date dataColloD = null;
|
||||
try {
|
||||
dataColloD = getDataColloD();
|
||||
} catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
UtilityLogger.errorMe(ex);
|
||||
}
|
||||
|
||||
if(dataColloD != null){
|
||||
if (dataColloD != null) {
|
||||
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN_LONG);
|
||||
} else return null;
|
||||
}
|
||||
@ -392,7 +392,7 @@ public class MtbColt extends EntityBase {
|
||||
public String getTimeVers() {
|
||||
Date dataColloD = getDataVersD();
|
||||
|
||||
if(dataColloD != null){
|
||||
if (dataColloD != null) {
|
||||
return UtilityDate.formatDate(dataColloD, UtilityDate.COMMONS_DATE_FORMATS.TIME);
|
||||
} else return null;
|
||||
}
|
||||
@ -526,6 +526,15 @@ public class MtbColt extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbTCol getMtbTCol() {
|
||||
return mtbTCol;
|
||||
}
|
||||
|
||||
public MtbColt setMtbTCol(MtbTCol mtbTCol) {
|
||||
this.mtbTCol = mtbTCol;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void generaFiltroOrdineFromDTO(List<FiltroOrdineDTO> filtroOrdineDtos) {
|
||||
|
||||
String xmlPrefix = "{\"whereCond\": \"";
|
||||
@ -533,9 +542,9 @@ public class MtbColt extends EntityBase {
|
||||
|
||||
StringBuilder whereCond = new StringBuilder();
|
||||
|
||||
if(filtroOrdineDtos != null && filtroOrdineDtos.size() > 0) {
|
||||
if (filtroOrdineDtos != null && filtroOrdineDtos.size() > 0) {
|
||||
|
||||
for(int i = 0; i < filtroOrdineDtos.size(); i++){
|
||||
for (int i = 0; i < filtroOrdineDtos.size(); i++) {
|
||||
FiltroOrdineDTO x = filtroOrdineDtos.get(i);
|
||||
|
||||
try {
|
||||
@ -545,13 +554,13 @@ public class MtbColt extends EntityBase {
|
||||
UtilityDB.valueToString(UtilityDate.formatDate(x.getDataOrdD(), UtilityDate.COMMONS_DATE_FORMATS.YMD_SLASH)),
|
||||
UtilityDB.valueToString(x.getNumOrd())));
|
||||
|
||||
if(!UtilityString.isNullOrEmpty(x.getDataConsS())) {
|
||||
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) {
|
||||
if (i < filtroOrdineDtos.size() - 1) {
|
||||
whereCond.append(" OR ");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -378,6 +378,7 @@ public class AccettazionePickingViewModel {
|
||||
|
||||
if (tCol != null) {
|
||||
mtbColt.setCodTcol(tCol.getCodTcol());
|
||||
mtbColt.setMtbTCol(tCol);
|
||||
}
|
||||
|
||||
if (customNumCollo != null) {
|
||||
|
||||
@ -169,6 +169,8 @@ public class PickingResiViewModel {
|
||||
}
|
||||
if (tCol != null) {
|
||||
this.mCurrentMtbColt.setCodTcol(tCol.getCodTcol());
|
||||
this.mCurrentMtbColt.setMtbTCol(tCol);
|
||||
|
||||
}
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.updateDataFine(mCurrentMtbColt, () -> {
|
||||
|
||||
@ -79,7 +79,7 @@ public class BottomSheetFragmentLUContentView extends BottomSheetFragmentBaseVie
|
||||
public void onPropertyChanged(Observable sender, int propertyId) {
|
||||
var mtbColt = mViewModel.getObservableMtbColt().get();
|
||||
|
||||
if(mtbColt != null) {
|
||||
if (mtbColt != null) {
|
||||
initAdapter();
|
||||
|
||||
onMtbColrItemChanged();
|
||||
@ -101,6 +101,7 @@ public class BottomSheetFragmentLUContentView extends BottomSheetFragmentBaseVie
|
||||
List<MtbColr> mtbColrs = mViewModel.getObservableMtbColt().get().getMtbColr();
|
||||
mBinding.textviewArtCounter.setText(String.valueOf(mtbColrs.size()));
|
||||
mBinding.textviewArtDescription.setText(mContext.getResources().getQuantityString(R.plurals.articles, mtbColrs.size()));
|
||||
mViewModel.calcPesi();
|
||||
}
|
||||
|
||||
public BottomSheetFragmentLUContentView setListener(Listener listener) {
|
||||
@ -131,12 +132,12 @@ public class BottomSheetFragmentLUContentView extends BottomSheetFragmentBaseVie
|
||||
|
||||
@Override
|
||||
public void onMtbColrEdit(MtbColr mtbColr) {
|
||||
if(mListener != null) this.mListener.onMtbColrEdit(mtbColr);
|
||||
if (mListener != null) this.mListener.onMtbColrEdit(mtbColr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMtbColrDelete(MtbColr mtbColr) {
|
||||
if(mListener != null) this.mListener.onMtbColrDelete(mtbColr);
|
||||
if (mListener != null) this.mListener.onMtbColrDelete(mtbColr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,16 +2,24 @@ package it.integry.integrywmsnative.view.bottom_sheet__lu_content;
|
||||
|
||||
import androidx.databinding.ObservableField;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbTCol;
|
||||
|
||||
public class BottomSheetFragmentLUContentViewModel {
|
||||
|
||||
public ObservableField<MtbColt> mtbColt = new ObservableField<>();
|
||||
public ObservableField<String> pesoKg = new ObservableField<>();
|
||||
public ObservableField<String> pesoNettoKg = new ObservableField<>();
|
||||
private Listener mListener;
|
||||
private MtbColrListener mMtbColrListener;
|
||||
|
||||
public void closeCurrentLU() {
|
||||
if(this.mListener != null) this.mListener.onBottomSheetLUClose();
|
||||
if (this.mListener != null) this.mListener.onBottomSheetLUClose();
|
||||
}
|
||||
|
||||
public BottomSheetFragmentLUContentViewModel setMtbColt(MtbColt mtbColt) {
|
||||
@ -33,6 +41,26 @@ public class BottomSheetFragmentLUContentViewModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void calcPesi() {
|
||||
MtbColt collo = this.mtbColt.get();
|
||||
if (collo != null) {
|
||||
MtbTCol tipoPedana = collo.getMtbTCol();
|
||||
BigDecimal taraPedana = tipoPedana != null ? tipoPedana.getTaraKg() : BigDecimal.ZERO;
|
||||
BigDecimal pesoNetto = BigDecimal.ZERO;
|
||||
for (MtbColr mtbColr : collo.getMtbColr()) {
|
||||
MtbAart articolo = mtbColr.getMtbAart();
|
||||
if (articolo != null) {
|
||||
BigDecimal pesoRiga = articolo.isFlagQtaCnfFissaBoolean() ? mtbColr.getNumCnf().multiply(articolo.getPesoKg()) : mtbColr.getQtaCol();
|
||||
BigDecimal pesoTara = articolo.getTaraKg().multiply(mtbColr.getNumCnf());
|
||||
pesoRiga = pesoRiga.add(pesoTara);
|
||||
pesoNetto = pesoNetto.add(pesoRiga);
|
||||
}
|
||||
}
|
||||
this.pesoNettoKg.set(pesoNetto.setScale(2, RoundingMode.CEILING).toString());
|
||||
this.pesoKg.set(pesoNetto.add(taraPedana).setScale(2, RoundingMode.CEILING).toString());
|
||||
}
|
||||
}
|
||||
|
||||
public interface Listener {
|
||||
void onBottomSheetLUClose();
|
||||
}
|
||||
|
||||
@ -7,6 +7,11 @@
|
||||
|
||||
<import type="android.view.View" />
|
||||
|
||||
<import type="java.math.BigDecimal" />
|
||||
|
||||
<import type="it.integry.integrywmsnative.core.utility.UtilityString" />
|
||||
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="it.integry.integrywmsnative.view.bottom_sheet__lu_content.BottomSheetFragmentLUContentViewModel" />
|
||||
@ -262,7 +267,8 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="@{UtilityString.isNullOrEmpty(viewModel.mtbColt.posizione) ? View.GONE : View.VISIBLE}">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline2"
|
||||
@ -331,7 +337,10 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="@{UtilityString.isNullOrEmpty(viewModel.mtbColt.ragSocCliente) ? View.GONE : View.VISIBLE}"
|
||||
|
||||
>
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline4"
|
||||
@ -365,7 +374,8 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="@{UtilityString.isNullOrEmpty(viewModel.pesoNettoKg) ? View.GONE : View.VISIBLE}">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline5"
|
||||
@ -388,7 +398,7 @@
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:text="@{viewModel.mtbColt.pesoNettoKg.toString()}"
|
||||
android:text="@{viewModel.pesoNettoKg}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline5"
|
||||
@ -399,7 +409,8 @@
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="@{UtilityString.isNullOrEmpty(viewModel.pesoKg)? View.GONE : View.VISIBLE}">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline6"
|
||||
@ -422,7 +433,7 @@
|
||||
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:text="@{viewModel.mtbColt.pesoKg.toString()}"
|
||||
app:binding="@{viewModel.pesoKg}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline6"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user