Implementato il recupero delle righe dell'ordine nel momento in cui recupero un collo.
This commit is contained in:
parent
3c638c2640
commit
c806ca00be
@ -58,4 +58,22 @@ public class ColliMagazzinoRESTConsumer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void updateRiga(MtbColr mtbColrToUpdate, Runnable onComplete, RunnableArgs<Exception> onFailed){
|
||||||
|
|
||||||
|
mtbColrToUpdate.setOperation(CommonModelConsts.OPERATION.UPDATE);
|
||||||
|
|
||||||
|
EntityRESTConsumer.processEntity(mtbColrToUpdate, new ISimpleOperationCallback<MtbColr>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(MtbColr value) {
|
||||||
|
if(onComplete != null) onComplete.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailed(Exception ex) {
|
||||||
|
if(onFailed != null) onFailed.run(ex);
|
||||||
|
}
|
||||||
|
}, MtbColr.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,11 @@ public class BindableFloat extends BaseObservable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Float get(boolean defaultIfNull) {
|
public Float get(boolean defaultIfNull) {
|
||||||
return value == null && defaultIfNull ? 0 : value;
|
|
||||||
|
if(value == null){
|
||||||
|
if(defaultIfNull) return 0f;
|
||||||
|
else return null;
|
||||||
|
} else return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(Float value) {
|
public void set(Float value) {
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package it.integry.integrywmsnative.core.di;
|
|||||||
|
|
||||||
import android.databinding.BindingAdapter;
|
import android.databinding.BindingAdapter;
|
||||||
import android.databinding.BindingConversion;
|
import android.databinding.BindingConversion;
|
||||||
|
import android.support.constraint.Guideline;
|
||||||
import android.support.design.widget.TextInputEditText;
|
import android.support.design.widget.TextInputEditText;
|
||||||
import android.support.v4.util.Pair;
|
import android.support.v4.util.Pair;
|
||||||
import android.support.v7.widget.AppCompatTextView;
|
import android.support.v7.widget.AppCompatTextView;
|
||||||
@ -138,11 +139,7 @@ public class Converters {
|
|||||||
public static void bindRadioGroup(RadioGroup view, final BindableBoolean bindableBoolean) {
|
public static void bindRadioGroup(RadioGroup view, final BindableBoolean bindableBoolean) {
|
||||||
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
||||||
view.setTag(R.id.bound_observable, bindableBoolean);
|
view.setTag(R.id.bound_observable, bindableBoolean);
|
||||||
view.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
view.setOnCheckedChangeListener((group, checkedId) -> bindableBoolean.set(checkedId == group.getChildAt(1).getId()));
|
||||||
@Override public void onCheckedChanged(RadioGroup group, int checkedId) {
|
|
||||||
bindableBoolean.set(checkedId == group.getChildAt(1).getId());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
Boolean newValue = bindableBoolean.get();
|
Boolean newValue = bindableBoolean.get();
|
||||||
((RadioButton) view.getChildAt(newValue ? 1 : 0)).setChecked(true);
|
((RadioButton) view.getChildAt(newValue ? 1 : 0)).setChecked(true);
|
||||||
@ -152,12 +149,7 @@ public class Converters {
|
|||||||
public static void bindCheckbox(CheckBox view, final BindableBoolean bindableBoolean) {
|
public static void bindCheckbox(CheckBox view, final BindableBoolean bindableBoolean) {
|
||||||
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
if (view.getTag(R.id.bound_observable) != bindableBoolean) {
|
||||||
view.setTag(R.id.bound_observable, bindableBoolean);
|
view.setTag(R.id.bound_observable, bindableBoolean);
|
||||||
view.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {
|
view.setOnCheckedChangeListener((compoundButton, b) -> bindableBoolean.set(b));
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
|
||||||
bindableBoolean.set(b);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
Boolean newValue = bindableBoolean.get();
|
Boolean newValue = bindableBoolean.get();
|
||||||
view.setChecked(newValue);
|
view.setChecked(newValue);
|
||||||
@ -165,10 +157,11 @@ public class Converters {
|
|||||||
|
|
||||||
@BindingAdapter({"app:onClick"})
|
@BindingAdapter({"app:onClick"})
|
||||||
public static void bindOnClick(View view, final Runnable runnable) {
|
public static void bindOnClick(View view, final Runnable runnable) {
|
||||||
view.setOnClickListener(new View.OnClickListener() {
|
view.setOnClickListener(v -> runnable.run());
|
||||||
@Override public void onClick(View v) {
|
|
||||||
runnable.run();
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
@BindingAdapter({"app:layout_constraintGuide_percent"})
|
||||||
|
public static void bindFloatPercetageOnGuideline(View view, final float percentage) {
|
||||||
|
((Guideline)view).setGuidelinePercent(percentage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,6 +43,8 @@ public class MtbColr extends EntityBase implements Parcelable {
|
|||||||
private String descrizione;
|
private String descrizione;
|
||||||
private String untMis;
|
private String untMis;
|
||||||
|
|
||||||
|
private MtbAart mtbAart;
|
||||||
|
|
||||||
public MtbColr() {
|
public MtbColr() {
|
||||||
type = "mtb_colr";
|
type = "mtb_colr";
|
||||||
}
|
}
|
||||||
@ -118,6 +120,8 @@ public class MtbColr extends EntityBase implements Parcelable {
|
|||||||
} else {
|
} else {
|
||||||
numCnf = new BigDecimal(in.readFloat());
|
numCnf = new BigDecimal(in.readFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
in.readParcelable(MtbAart.class.getClassLoader());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -199,6 +203,8 @@ public class MtbColr extends EntityBase implements Parcelable {
|
|||||||
dest.writeByte((byte) 1);
|
dest.writeByte((byte) 1);
|
||||||
dest.writeFloat(numCnf.floatValue());
|
dest.writeFloat(numCnf.floatValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dest.writeParcelable(mtbAart, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -546,4 +552,14 @@ public class MtbColr extends EntityBase implements Parcelable {
|
|||||||
this.untMis = untMis;
|
this.untMis = untMis;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public MtbAart getMtbAart() {
|
||||||
|
return mtbAart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbColr setMtbAart(MtbAart mtbAart) {
|
||||||
|
this.mtbAart = mtbAart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ public class OrdineAccettazioneDTO implements Parcelable {
|
|||||||
public String descrizioneCommessa;
|
public String descrizioneCommessa;
|
||||||
public MtbAart mtbAart;
|
public MtbAart mtbAart;
|
||||||
public PickingObjectDTO[] colliAssociati;
|
public PickingObjectDTO[] colliAssociati;
|
||||||
public boolean hidden = false;
|
public Boolean hidden = null;
|
||||||
public String partitaMag;
|
public String partitaMag;
|
||||||
public String codArtFor;
|
public String codArtFor;
|
||||||
public String descrizioneEstesa;
|
public String descrizioneEstesa;
|
||||||
@ -96,7 +96,7 @@ public class OrdineAccettazioneDTO implements Parcelable {
|
|||||||
return colliAssociati;
|
return colliAssociati;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHidden() {
|
public Boolean isHidden() {
|
||||||
return hidden;
|
return hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ public class OrdineAccettazioneDTO implements Parcelable {
|
|||||||
ragSocCom = in.readString();
|
ragSocCom = in.readString();
|
||||||
descrizioneCommessa = in.readString();
|
descrizioneCommessa = in.readString();
|
||||||
mtbAart = (MtbAart) in.readValue(MtbAart.class.getClassLoader());
|
mtbAart = (MtbAart) in.readValue(MtbAart.class.getClassLoader());
|
||||||
hidden = in.readByte() != 0x00;
|
hidden = in.readByte() == 0x00 ? null : in.readByte() != 0x00;
|
||||||
partitaMag = in.readString();
|
partitaMag = in.readString();
|
||||||
codArtFor = in.readString();
|
codArtFor = in.readString();
|
||||||
descrizioneEstesa = in.readString();
|
descrizioneEstesa = in.readString();
|
||||||
@ -272,7 +272,12 @@ public class OrdineAccettazioneDTO implements Parcelable {
|
|||||||
dest.writeString(ragSocCom);
|
dest.writeString(ragSocCom);
|
||||||
dest.writeString(descrizioneCommessa);
|
dest.writeString(descrizioneCommessa);
|
||||||
dest.writeValue(mtbAart);
|
dest.writeValue(mtbAart);
|
||||||
|
if (hidden == null) {
|
||||||
|
dest.writeByte((byte) (0x00));
|
||||||
|
} else {
|
||||||
|
dest.writeByte((byte) (0x01));
|
||||||
dest.writeByte((byte) (hidden ? 0x01 : 0x00));
|
dest.writeByte((byte) (hidden ? 0x01 : 0x00));
|
||||||
|
}
|
||||||
dest.writeString(partitaMag);
|
dest.writeString(partitaMag);
|
||||||
dest.writeString(codArtFor);
|
dest.writeString(codArtFor);
|
||||||
dest.writeString(descrizioneEstesa);
|
dest.writeString(descrizioneEstesa);
|
||||||
|
|||||||
@ -61,7 +61,7 @@ public class AccettazioneOrdineInevasoHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<List<OrdineAccettazioneDTO.Riga>> getOrdiniRaggruppatiPerCodArtForn(List<OrdineAccettazioneDTO.Riga> mDataset){
|
public List<List<OrdineAccettazioneDTO.Riga>> getOrdiniRaggruppatiPerCodArtForn(List<OrdineAccettazioneDTO.Riga> mDataset, boolean forceHiddenCheck){
|
||||||
List<String> codArtForns = new ArrayList<>();
|
List<String> codArtForns = new ArrayList<>();
|
||||||
|
|
||||||
for(int i = 0; i < mDataset.size(); i++){
|
for(int i = 0; i < mDataset.size(); i++){
|
||||||
@ -86,9 +86,12 @@ public class AccettazioneOrdineInevasoHelper {
|
|||||||
List<OrdineAccettazioneDTO.Riga> tmpList = Stream.of(mDataset).filter(x -> x.getCodArtFor() != null && x.getCodArtFor().equalsIgnoreCase(codArtForn)).toList();
|
List<OrdineAccettazioneDTO.Riga> tmpList = Stream.of(mDataset).filter(x -> x.getCodArtFor() != null && x.getCodArtFor().equalsIgnoreCase(codArtForn)).toList();
|
||||||
|
|
||||||
for(int i = 0; i < tmpList.size(); i++){
|
for(int i = 0; i < tmpList.size(); i++){
|
||||||
|
if(tmpList.get(i).isHidden() == null || forceHiddenCheck) {
|
||||||
if (tmpList.get(i).getQtaDaEvadere().floatValue() <= 0) {
|
if (tmpList.get(i).getQtaDaEvadere().floatValue() <= 0) {
|
||||||
tmpList.remove(i);
|
tmpList.get(i).setHidden(true);
|
||||||
i--;
|
//tmpList.remove(i);
|
||||||
|
//i--;
|
||||||
|
} else tmpList.get(i).setHidden(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +104,7 @@ public class AccettazioneOrdineInevasoHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<List<OrdineAccettazioneDTO.Riga>> getOrdiniRaggruppatiPerDescrArt(List<OrdineAccettazioneDTO.Riga> mDataset){
|
public List<List<OrdineAccettazioneDTO.Riga>> getOrdiniRaggruppatiPerDescrArt(List<OrdineAccettazioneDTO.Riga> mDataset, boolean forceHiddenCheck){
|
||||||
List<String> descrArtForns = new ArrayList<>();
|
List<String> descrArtForns = new ArrayList<>();
|
||||||
|
|
||||||
for(int i = 0; i < mDataset.size(); i++){
|
for(int i = 0; i < mDataset.size(); i++){
|
||||||
@ -120,9 +123,12 @@ public class AccettazioneOrdineInevasoHelper {
|
|||||||
List<OrdineAccettazioneDTO.Riga> tmpList = Stream.of(mDataset).filter(x -> x.getDescrizioneEstesa() != null && x.getDescrizioneEstesa().equalsIgnoreCase(descrArtForn)).toList();
|
List<OrdineAccettazioneDTO.Riga> tmpList = Stream.of(mDataset).filter(x -> x.getDescrizioneEstesa() != null && x.getDescrizioneEstesa().equalsIgnoreCase(descrArtForn)).toList();
|
||||||
|
|
||||||
for(int i = 0; i < tmpList.size(); i++){
|
for(int i = 0; i < tmpList.size(); i++){
|
||||||
|
if(tmpList.get(i).isHidden() == null || forceHiddenCheck) {
|
||||||
if (tmpList.get(i).getQtaDaEvadere().floatValue() <= 0) {
|
if (tmpList.get(i).getQtaDaEvadere().floatValue() <= 0) {
|
||||||
tmpList.remove(i);
|
tmpList.get(i).setHidden(true);
|
||||||
i--;
|
//tmpList.remove(i);
|
||||||
|
//i--;
|
||||||
|
} else tmpList.get(i).setHidden(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +146,7 @@ public class AccettazioneOrdineInevasoHelper {
|
|||||||
public String ragSocCom = "";
|
public String ragSocCom = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<List<OrdineAccettazioneDTO.Riga>> getOrdiniRaggruppatiPerRagSocCommessa(List<OrdineAccettazioneDTO.Riga> mDataset) {
|
public List<List<OrdineAccettazioneDTO.Riga>> getOrdiniRaggruppatiPerRagSocCommessa(List<OrdineAccettazioneDTO.Riga> mDataset, boolean forceHiddenCheck) {
|
||||||
List<RaggruppaPerCommessaUtilDTO> commessaList = new ArrayList<>();
|
List<RaggruppaPerCommessaUtilDTO> commessaList = new ArrayList<>();
|
||||||
|
|
||||||
commessaList.add(new RaggruppaPerCommessaUtilDTO());
|
commessaList.add(new RaggruppaPerCommessaUtilDTO());
|
||||||
@ -180,9 +186,12 @@ public class AccettazioneOrdineInevasoHelper {
|
|||||||
List<OrdineAccettazioneDTO.Riga> tmpList = Stream.of(mDataset).filter(x -> x.getCodJcom().equalsIgnoreCase(dto.codJcom)).toList();
|
List<OrdineAccettazioneDTO.Riga> tmpList = Stream.of(mDataset).filter(x -> x.getCodJcom().equalsIgnoreCase(dto.codJcom)).toList();
|
||||||
|
|
||||||
for(int i = 0; i < tmpList.size(); i++){
|
for(int i = 0; i < tmpList.size(); i++){
|
||||||
|
if(tmpList.get(i).isHidden() == null || forceHiddenCheck) {
|
||||||
if (tmpList.get(i).getQtaDaEvadere().floatValue() <= 0) {
|
if (tmpList.get(i).getQtaDaEvadere().floatValue() <= 0) {
|
||||||
tmpList.remove(i);
|
tmpList.get(i).setHidden(true);
|
||||||
i--;
|
//tmpList.remove(i);
|
||||||
|
//i--;
|
||||||
|
} else tmpList.get(i).setHidden(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,8 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -28,7 +30,8 @@ import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.dto.Accettaz
|
|||||||
public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<MainListOrdineAccettazioneAdapter.ViewHolder> {
|
public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<MainListOrdineAccettazioneAdapter.ViewHolder> {
|
||||||
|
|
||||||
protected Context mContext;
|
protected Context mContext;
|
||||||
protected ObservableArrayList<AccettazioneOrdineInevasoListViewModel> mDataset;
|
protected List<AccettazioneOrdineInevasoListViewModel> mDataset;
|
||||||
|
protected ObservableArrayList<AccettazioneOrdineInevasoListViewModel> mObservableDataset;
|
||||||
protected IOnOrdineRowDispatchCallback mOrdineRowDispatch;
|
protected IOnOrdineRowDispatchCallback mOrdineRowDispatch;
|
||||||
|
|
||||||
private static final Pools.SynchronizedPool sPool = new Pools.SynchronizedPool(200);
|
private static final Pools.SynchronizedPool sPool = new Pools.SynchronizedPool(200);
|
||||||
@ -48,9 +51,11 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
|
|||||||
|
|
||||||
public MainListOrdineAccettazioneAdapter(Context context, ObservableArrayList<AccettazioneOrdineInevasoListViewModel> myDataset) {
|
public MainListOrdineAccettazioneAdapter(Context context, ObservableArrayList<AccettazioneOrdineInevasoListViewModel> myDataset) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mDataset = myDataset;
|
mObservableDataset = myDataset;
|
||||||
|
|
||||||
myDataset.addOnListChangedCallback(onListChangedCallback);
|
|
||||||
|
mDataset = Stream.of(mObservableDataset).filter(x -> !x.isHidden()).toList();
|
||||||
|
mObservableDataset.addOnListChangedCallback(onListChangedCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnOrdineRowDispatchCallback(IOnOrdineRowDispatchCallback ordineRowDispatch) {
|
public void setOnOrdineRowDispatchCallback(IOnOrdineRowDispatchCallback ordineRowDispatch) {
|
||||||
@ -60,28 +65,37 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
|
|||||||
private ObservableList.OnListChangedCallback onListChangedCallback = new ObservableList.OnListChangedCallback<ObservableList<AccettazioneOrdineInevasoListViewModel>>() {
|
private ObservableList.OnListChangedCallback onListChangedCallback = new ObservableList.OnListChangedCallback<ObservableList<AccettazioneOrdineInevasoListViewModel>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(ObservableList<AccettazioneOrdineInevasoListViewModel> sender) {
|
public void onChanged(ObservableList<AccettazioneOrdineInevasoListViewModel> sender) {
|
||||||
|
refreshNotHiddenElements();
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemRangeChanged(ObservableList<AccettazioneOrdineInevasoListViewModel> sender, int positionStart, int itemCount) {
|
public void onItemRangeChanged(ObservableList<AccettazioneOrdineInevasoListViewModel> sender, int positionStart, int itemCount) {
|
||||||
|
refreshNotHiddenElements();
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemRangeInserted(ObservableList<AccettazioneOrdineInevasoListViewModel> sender, int positionStart, int itemCount) {
|
public void onItemRangeInserted(ObservableList<AccettazioneOrdineInevasoListViewModel> sender, int positionStart, int itemCount) {
|
||||||
|
refreshNotHiddenElements();
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemRangeMoved(ObservableList<AccettazioneOrdineInevasoListViewModel> sender, int fromPosition, int toPosition, int itemCount) {
|
public void onItemRangeMoved(ObservableList<AccettazioneOrdineInevasoListViewModel> sender, int fromPosition, int toPosition, int itemCount) {
|
||||||
|
refreshNotHiddenElements();
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemRangeRemoved(ObservableList<AccettazioneOrdineInevasoListViewModel> sender, int positionStart, int itemCount) {
|
public void onItemRangeRemoved(ObservableList<AccettazioneOrdineInevasoListViewModel> sender, int positionStart, int itemCount) {
|
||||||
|
refreshNotHiddenElements();
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void refreshNotHiddenElements() {
|
||||||
|
mDataset = Stream.of(mObservableDataset).filter(x -> !x.isHidden()).toList();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -115,10 +129,14 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
|
|||||||
|
|
||||||
List<AccettazioneOrdineInevasoListViewModel.SubItem> subset = mDataset.get(position).rows;
|
List<AccettazioneOrdineInevasoListViewModel.SubItem> subset = mDataset.get(position).rows;
|
||||||
|
|
||||||
|
int visibleElementsCounter = 0;
|
||||||
|
|
||||||
for(int i = 0; i < subset.size(); i++) {
|
for(int i = 0; i < subset.size(); i++) {
|
||||||
|
|
||||||
final AccettazioneOrdineInevasoListViewModel.SubItem rowItem = subset.get(i);
|
final AccettazioneOrdineInevasoListViewModel.SubItem rowItem = subset.get(i);
|
||||||
|
|
||||||
|
if(!rowItem.getOriginalModel().isHidden()) {
|
||||||
|
visibleElementsCounter++;
|
||||||
|
|
||||||
View groupModelViewPool = (View) sPool.acquire();
|
View groupModelViewPool = (View) sPool.acquire();
|
||||||
if (groupModelViewPool == null) {
|
if (groupModelViewPool == null) {
|
||||||
@ -130,11 +148,11 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
|
|||||||
View groupModelView = groupModelViewPool;
|
View groupModelView = groupModelViewPool;
|
||||||
holder.pool.add(groupModelView);
|
holder.pool.add(groupModelView);
|
||||||
|
|
||||||
if(rowItem.getQtaRiservata().equals(rowItem.getQtaOrdinata())) {
|
if (rowItem.getQtaRiservata().subtract(rowItem.getQtaOrdinata()).floatValue() >= 0 ) {
|
||||||
groupModelView.setBackgroundColor(mContext.getResources().getColor(R.color.green_500_with_alpha));
|
groupModelView.setBackgroundColor(mContext.getResources().getColor(R.color.green_500_with_alpha));
|
||||||
} else if (rowItem.getQtaRiservata().floatValue() > 0) {
|
} else if (rowItem.getQtaRiservata().floatValue() > 0) {
|
||||||
groupModelView.setBackgroundColor(mContext.getResources().getColor(R.color.orange_600_with_alpha));
|
groupModelView.setBackgroundColor(mContext.getResources().getColor(R.color.orange_600_with_alpha));
|
||||||
} else if(i % 2 == 1) {
|
} else if (visibleElementsCounter % 2 == 1) {
|
||||||
groupModelView.setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
groupModelView.setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
|
||||||
} else {
|
} else {
|
||||||
groupModelView.setBackgroundColor(Color.WHITE);
|
groupModelView.setBackgroundColor(Color.WHITE);
|
||||||
@ -177,7 +195,7 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
|
|||||||
});
|
});
|
||||||
|
|
||||||
holder.mLinearLayoutGroupItemContainer.addView(groupModelView);
|
holder.mLinearLayoutGroupItemContainer.addView(groupModelView);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.dto;
|
package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.dto;
|
||||||
|
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -14,6 +16,11 @@ public class AccettazioneOrdineInevasoListViewModel {
|
|||||||
public String descrizioneGroup;
|
public String descrizioneGroup;
|
||||||
public List<SubItem> rows;
|
public List<SubItem> rows;
|
||||||
|
|
||||||
|
public boolean isHidden(){
|
||||||
|
if(rows == null || rows.size() == 0) return true;
|
||||||
|
return Stream.of(rows).filter(x -> x.originalModel.isHidden() != null && !x.originalModel.isHidden()).count() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
public static class SubItem {
|
public static class SubItem {
|
||||||
|
|
||||||
private String badge1;
|
private String badge1;
|
||||||
|
|||||||
@ -1,14 +1,11 @@
|
|||||||
package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.viewmodel;
|
package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.viewmodel;
|
||||||
|
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.databinding.ObservableArrayList;
|
import android.databinding.ObservableArrayList;
|
||||||
import android.databinding.ObservableField;
|
import android.databinding.ObservableField;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
|
||||||
@ -17,16 +14,12 @@ import java.util.ArrayList;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import br.com.zbra.androidlinq.delegate.Selector;
|
|
||||||
import it.integry.integrywmsnative.BR;
|
import it.integry.integrywmsnative.BR;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.REST.CommonRESTException;
|
|
||||||
import it.integry.integrywmsnative.core.REST.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.REST.consumers.ColliMagazzinoRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.REST.consumers.GestSetupRESTConsumer;
|
import it.integry.integrywmsnative.core.REST.consumers.GestSetupRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.REST.consumers.ISimpleOperationCallback;
|
import it.integry.integrywmsnative.core.REST.consumers.ISimpleOperationCallback;
|
||||||
import it.integry.integrywmsnative.core.REST.consumers.ISingleValueOperationCallback;
|
|
||||||
import it.integry.integrywmsnative.core.REST.consumers.PrinterRESTConsumer;
|
import it.integry.integrywmsnative.core.REST.consumers.PrinterRESTConsumer;
|
||||||
import it.integry.integrywmsnative.core.coollection.Coollection;
|
|
||||||
import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
@ -34,7 +27,6 @@ import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
|||||||
import it.integry.integrywmsnative.core.report.ReportManager;
|
import it.integry.integrywmsnative.core.report.ReportManager;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
|
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.AccettazioneOrdineInevasoActivity;
|
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.AccettazioneOrdineInevasoActivity;
|
||||||
@ -44,8 +36,6 @@ import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core.MainLis
|
|||||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.dto.AccettazioneOrdineInevasoOrderBy;
|
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.dto.AccettazioneOrdineInevasoOrderBy;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.rest.OrdineAccettazioneInevasoRESTConsumerService;
|
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.rest.OrdineAccettazioneInevasoRESTConsumerService;
|
||||||
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.views.NoteAggiuntiveNuovaULDialog;
|
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.views.NoteAggiuntiveNuovaULDialog;
|
||||||
import it.integry.integrywmsnative.gest.lista_bancali.ListaBancaliActivity;
|
|
||||||
import it.integry.integrywmsnative.gest.login.LoginActivity;
|
|
||||||
import it.integry.integrywmsnative.ui.StatusBarAlert;
|
import it.integry.integrywmsnative.ui.StatusBarAlert;
|
||||||
import it.integry.integrywmsnative.view.bottomsheet.interfaces.IOnColloClosedCallback;
|
import it.integry.integrywmsnative.view.bottomsheet.interfaces.IOnColloClosedCallback;
|
||||||
import it.integry.integrywmsnative.view.bottomsheet.viewmodel.ArticoliInColloBottomSheetViewModel;
|
import it.integry.integrywmsnative.view.bottomsheet.viewmodel.ArticoliInColloBottomSheetViewModel;
|
||||||
@ -85,8 +75,8 @@ public class AccettazioneOnOrdineInevasoViewModel implements IOnColloClosedCallb
|
|||||||
|
|
||||||
private void init(){
|
private void init(){
|
||||||
mArticoliInColloBottomSheetViewModel.setOnCloseColloCallbackListener(this);
|
mArticoliInColloBottomSheetViewModel.setOnCloseColloCallbackListener(this);
|
||||||
mArticoliInColloBottomSheetViewModel.setOnItemDeletedCallback(this::refreshOrderBy);
|
mArticoliInColloBottomSheetViewModel.setOnItemDeletedCallback(() -> this.refreshOrderBy(false));
|
||||||
mArticoliInColloBottomSheetViewModel.setOnItemEditedCallback(this::refreshOrderBy);
|
mArticoliInColloBottomSheetViewModel.setOnItemEditedCallback(() -> this.refreshOrderBy(false));
|
||||||
|
|
||||||
groupedOrdini = new ArrayList<>();
|
groupedOrdini = new ArrayList<>();
|
||||||
for (OrdineAccettazioneDTO ordine : mOrders){
|
for (OrdineAccettazioneDTO ordine : mOrders){
|
||||||
@ -95,7 +85,7 @@ public class AccettazioneOnOrdineInevasoViewModel implements IOnColloClosedCallb
|
|||||||
|
|
||||||
helper = new AccettazioneOrdineInevasoHelper(mActivity);
|
helper = new AccettazioneOrdineInevasoHelper(mActivity);
|
||||||
|
|
||||||
groupedRighe = helper.getOrdiniRaggruppatiPerCodArtForn(groupedOrdini);
|
groupedRighe = helper.getOrdiniRaggruppatiPerCodArtForn(groupedOrdini, true);
|
||||||
|
|
||||||
initRecyclerView(groupedRighe);
|
initRecyclerView(groupedRighe);
|
||||||
}
|
}
|
||||||
@ -119,17 +109,17 @@ public class AccettazioneOnOrdineInevasoViewModel implements IOnColloClosedCallb
|
|||||||
mActivity.bindings.accettazioneOrdineMainList.setAdapter(mAdapter);
|
mActivity.bindings.accettazioneOrdineMainList.setAdapter(mAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshOrderBy(){
|
public void refreshOrderBy(boolean forceHiddenCheck){
|
||||||
switch (currentOrderBy){
|
switch (currentOrderBy){
|
||||||
case COD_ART_FOR:
|
case COD_ART_FOR:
|
||||||
groupedRighe = helper.getOrdiniRaggruppatiPerCodArtForn(groupedOrdini);
|
groupedRighe = helper.getOrdiniRaggruppatiPerCodArtForn(groupedOrdini, forceHiddenCheck);
|
||||||
break;
|
break;
|
||||||
case DESCR_ART:
|
case DESCR_ART:
|
||||||
groupedRighe = helper.getOrdiniRaggruppatiPerDescrArt(groupedOrdini);
|
groupedRighe = helper.getOrdiniRaggruppatiPerDescrArt(groupedOrdini, forceHiddenCheck);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RAG_SOC_COM:
|
case RAG_SOC_COM:
|
||||||
groupedRighe = helper.getOrdiniRaggruppatiPerRagSocCommessa(groupedOrdini);
|
groupedRighe = helper.getOrdiniRaggruppatiPerRagSocCommessa(groupedOrdini, forceHiddenCheck);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -146,7 +136,28 @@ public class AccettazioneOnOrdineInevasoViewModel implements IOnColloClosedCallb
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void recoverUL(MtbColt recoveredMtbColt){
|
public void recoverUL(MtbColt recoveredMtbColt){
|
||||||
|
|
||||||
|
for(int i = 0; i < recoveredMtbColt.getMtbColr().size(); i++){
|
||||||
|
|
||||||
|
MtbColr currentMtbColr = recoveredMtbColt.getMtbColr().get(i);
|
||||||
|
|
||||||
|
List<OrdineAccettazioneDTO.Riga> foundRows = Stream.of(groupedOrdini)
|
||||||
|
.filter(x -> x.getNumOrd() == currentMtbColr.getNumOrd() &&
|
||||||
|
x.getRigaOrd() == currentMtbColr.getRigaOrd()&&
|
||||||
|
x.getDataOrd().equals(currentMtbColr.getDataOrdD()))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
if(foundRows != null && foundRows.size() > 0){
|
||||||
|
OrdineAccettazioneDTO.Riga currentRow = foundRows.get(0);
|
||||||
|
|
||||||
|
currentRow.setHidden(false);
|
||||||
|
currentRow.setQtaRiservate(currentRow.getQtaRiservate().subtract(currentMtbColr.getQtaCol()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
setULToCurrentContext(recoveredMtbColt);
|
setULToCurrentContext(recoveredMtbColt);
|
||||||
|
refreshOrderBy(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -155,7 +166,7 @@ public class AccettazioneOnOrdineInevasoViewModel implements IOnColloClosedCallb
|
|||||||
AlertDialog dialog = new AlertDialog.Builder(mActivity)
|
AlertDialog dialog = new AlertDialog.Builder(mActivity)
|
||||||
.setTitle(mActivity.getText(R.string.action_orderBy))
|
.setTitle(mActivity.getText(R.string.action_orderBy))
|
||||||
.setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, currentOrderBy.getVal(), (dialog12, which) -> currentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.fromInt(which))
|
.setSingleChoiceItems(AccettazioneOrdineInevasoOrderBy.descriptions, currentOrderBy.getVal(), (dialog12, which) -> currentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.fromInt(which))
|
||||||
.setPositiveButton("Ok", (dialog1, which) -> refreshOrderBy())
|
.setPositiveButton("Ok", (dialog1, which) -> refreshOrderBy(true))
|
||||||
.create();
|
.create();
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
@ -434,7 +445,7 @@ public class AccettazioneOnOrdineInevasoViewModel implements IOnColloClosedCallb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshOrderBy();
|
refreshOrderBy(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,7 +468,18 @@ public class AccettazioneOnOrdineInevasoViewModel implements IOnColloClosedCallb
|
|||||||
|
|
||||||
float qtaEvasa = item.qtaRiservate + qtaEvasaInMtbColr;
|
float qtaEvasa = item.qtaRiservate + qtaEvasaInMtbColr;
|
||||||
|
|
||||||
DialogInputQuantity.makeBase(mActivity, item, qtaEvasa, true, value -> onOrdineRowDispatched(item, value)).show();
|
BigDecimal qtaDaEvadere = item.getQtaOrd().subtract(new BigDecimal(qtaEvasa)).subtract(item.getQtaEvasa());
|
||||||
|
|
||||||
|
DialogInputQuantity.DTO dto = new DialogInputQuantity.DTO()
|
||||||
|
.setBatchLot(item.getPartitaMag())
|
||||||
|
.setCodArtFor(item.getCodArtFor())
|
||||||
|
.setMtbAart(item.getMtbAart())
|
||||||
|
.setQtaOrd(item.getQtaOrd())
|
||||||
|
.setQtaDaEvadere(qtaDaEvadere)
|
||||||
|
.setQtaEvasa(new BigDecimal(qtaEvasa))
|
||||||
|
.setCanPartitaMagBeChanged(true);
|
||||||
|
|
||||||
|
DialogInputQuantity.makeBase(mActivity, dto, true, value -> onOrdineRowDispatched(item, value)).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,10 +517,13 @@ public class AccettazioneOnOrdineInevasoViewModel implements IOnColloClosedCallb
|
|||||||
.setGestione(value.getGestione())
|
.setGestione(value.getGestione())
|
||||||
.setSerCollo(value.getSerCollo())
|
.setSerCollo(value.getSerCollo())
|
||||||
.setRiga(value.getMtbColr().get(0).getRiga())
|
.setRiga(value.getMtbColr().get(0).getRiga())
|
||||||
.setUntMis(item.getMtbAart().untMis);
|
.setUntMis(item.getMtbAart().untMis)
|
||||||
|
.setMtbAart(item.getMtbAart());
|
||||||
|
|
||||||
|
//item.setQtaRiservate(item.getQtaRiservate().add(mtbColr.getQtaCol()));
|
||||||
|
|
||||||
mArticoliInColloBottomSheetViewModel.mtbColt.get().getMtbColr().add(mtbColr);
|
mArticoliInColloBottomSheetViewModel.mtbColt.get().getMtbColr().add(mtbColr);
|
||||||
refreshOrderBy();
|
refreshOrderBy(false);
|
||||||
|
|
||||||
new StatusBarAlert.Builder(mActivity)
|
new StatusBarAlert.Builder(mActivity)
|
||||||
.autoHide(true)
|
.autoHide(true)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import android.app.ProgressDialog;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.databinding.DataBindingUtil;
|
import android.databinding.DataBindingUtil;
|
||||||
import android.databinding.Observable;
|
import android.databinding.Observable;
|
||||||
|
import android.databinding.ObservableArrayList;
|
||||||
import android.databinding.ObservableField;
|
import android.databinding.ObservableField;
|
||||||
import android.databinding.ObservableList;
|
import android.databinding.ObservableList;
|
||||||
import android.databinding.ViewDataBinding;
|
import android.databinding.ViewDataBinding;
|
||||||
@ -15,25 +16,26 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.linearlistview.LinearListView;
|
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.BR;
|
import it.integry.integrywmsnative.BR;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.REST.consumers.ColliMagazzinoRESTConsumer;
|
import it.integry.integrywmsnative.core.REST.consumers.ColliMagazzinoRESTConsumer;
|
||||||
|
import it.integry.integrywmsnative.core.REST.consumers.ISimpleOperationCallback;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
|
import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentArticoliInColloBottomSheetBinding;
|
import it.integry.integrywmsnative.databinding.FragmentArticoliInColloBottomSheetBinding;
|
||||||
|
import it.integry.integrywmsnative.ui.StatusBarAlert;
|
||||||
import it.integry.integrywmsnative.view.bottomsheet.ArticoliInColloBottomSheetHelper;
|
import it.integry.integrywmsnative.view.bottomsheet.ArticoliInColloBottomSheetHelper;
|
||||||
import it.integry.integrywmsnative.view.bottomsheet.interfaces.IOnColloClosedCallback;
|
import it.integry.integrywmsnative.view.bottomsheet.interfaces.IOnColloClosedCallback;
|
||||||
import it.integry.integrywmsnative.view.bottomsheet.interfaces.IOnSimpleListChangedCallback;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.input_quantity.DialogInputQuantity;
|
||||||
|
|
||||||
public class ArticoliInColloBottomSheetViewModel {
|
public class ArticoliInColloBottomSheetViewModel {
|
||||||
|
|
||||||
@ -157,9 +159,35 @@ public class ArticoliInColloBottomSheetViewModel {
|
|||||||
|
|
||||||
MtbColr itemToEdit = mtbColt.get().getMtbColr().get(position);
|
MtbColr itemToEdit = mtbColt.get().getMtbColr().get(position);
|
||||||
|
|
||||||
|
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||||
|
|
||||||
|
DialogInputQuantity.DTO dto = new DialogInputQuantity.DTO()
|
||||||
|
.setBatchLot(itemToEdit.getPartitaMag())
|
||||||
|
.setQtaDaEvadere(null)
|
||||||
|
.setQtaOrd(null)
|
||||||
|
.setMtbAart(itemToEdit.getMtbAart())
|
||||||
|
.setCanPartitaMagBeChanged(false)
|
||||||
|
.setQtaTot(itemToEdit.getQtaCol())
|
||||||
|
.setMaxQta(itemToEdit.getQtaCol());
|
||||||
|
|
||||||
if(this.mOnItemEditedCallback != null) this.mOnItemEditedCallback.run();
|
DialogInputQuantity.makeBase(mContext, dto, false, quantityDTO -> {
|
||||||
|
|
||||||
|
final ProgressDialog progress = ProgressDialog.show(mContext, mContext.getText(R.string.waiting),
|
||||||
|
mContext.getText(R.string.loading) + " ...", true);
|
||||||
|
|
||||||
|
itemToEdit.setQtaCol(new BigDecimal(quantityDTO.qtaTot.get()));
|
||||||
|
|
||||||
|
ColliMagazzinoRESTConsumer.updateRiga(itemToEdit, () ->{
|
||||||
|
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||||
|
|
||||||
|
progress.dismiss();
|
||||||
|
mtbColt.get().getMtbColr().set(position, itemToEdit);
|
||||||
|
|
||||||
|
if(mOnItemEditedCallback != null) mOnItemEditedCallback.run();
|
||||||
|
},
|
||||||
|
ex -> UtilityExceptions.defaultException(mContext, ex, progress));
|
||||||
|
|
||||||
|
}).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onItemDelete(int position) {
|
private void onItemDelete(int position) {
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import android.view.inputmethod.InputMethodManager;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
@ -26,19 +27,112 @@ import it.integry.integrywmsnative.BR;
|
|||||||
import it.integry.integrywmsnative.MainApplication;
|
import it.integry.integrywmsnative.MainApplication;
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.REST.consumers.ISingleValueOperationCallback;
|
import it.integry.integrywmsnative.core.REST.consumers.ISingleValueOperationCallback;
|
||||||
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
|
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
|
||||||
|
|
||||||
public class DialogInputQuantity {
|
public class DialogInputQuantity {
|
||||||
|
|
||||||
|
public static class DTO {
|
||||||
|
public MtbAart mtbAart;
|
||||||
|
public String batchLot;
|
||||||
|
public BigDecimal qtaDaEvadere;
|
||||||
|
public BigDecimal qtaOrd;
|
||||||
|
public BigDecimal qtaTot;
|
||||||
|
public BigDecimal qtaEvasa;
|
||||||
|
public BigDecimal maxQta;
|
||||||
|
public String codArtFor;
|
||||||
|
public boolean canPartitaMagBeChanged;
|
||||||
|
|
||||||
|
public MtbAart getMtbAart() {
|
||||||
|
return mtbAart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DTO setMtbAart(MtbAart mtbAart) {
|
||||||
|
this.mtbAart = mtbAart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBatchLot() {
|
||||||
|
return batchLot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DTO setBatchLot(String batchLot) {
|
||||||
|
this.batchLot = batchLot;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaDaEvadere() {
|
||||||
|
return qtaDaEvadere;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DTO setQtaDaEvadere(BigDecimal qtaDaEvadere) {
|
||||||
|
this.qtaDaEvadere = qtaDaEvadere;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaOrd() {
|
||||||
|
return qtaOrd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DTO setQtaOrd(BigDecimal qtaOrd) {
|
||||||
|
this.qtaOrd = qtaOrd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaTot() {
|
||||||
|
return qtaTot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DTO setQtaTot(BigDecimal qtaTot) {
|
||||||
|
this.qtaTot = qtaTot;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaEvasa() {
|
||||||
|
return qtaEvasa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DTO setQtaEvasa(BigDecimal qtaEvasa) {
|
||||||
|
this.qtaEvasa = qtaEvasa;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getMaxQta() {
|
||||||
|
return maxQta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DTO setMaxQta(BigDecimal maxQta) {
|
||||||
|
this.maxQta = maxQta;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodArtFor() {
|
||||||
|
return codArtFor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DTO setCodArtFor(String codArtFor) {
|
||||||
|
this.codArtFor = codArtFor;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getCanPartitaMagBeChanged() {
|
||||||
|
return canPartitaMagBeChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DTO setCanPartitaMagBeChanged(boolean canPartitaMagBeChanged) {
|
||||||
|
this.canPartitaMagBeChanged = canPartitaMagBeChanged;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static ColorStateList originalColorStateList = null;
|
private static ColorStateList originalColorStateList = null;
|
||||||
|
|
||||||
private static String scadenzaString = "Scadenza";
|
private static String scadenzaString = "Scadenza";
|
||||||
|
|
||||||
private static AlertDialog currentAlert;
|
private static AlertDialog currentAlert;
|
||||||
|
|
||||||
public static AlertDialog makeBase(final Context context, OrdineAccettazioneDTO.Riga articoloItem, final float qtaEvasa, boolean canOverflowQuantity, final ISingleValueOperationCallback<QuantityDTO> dialogCallback) {
|
public static AlertDialog makeBase(final Context context, final DTO dto, boolean canOverflowQuantity, final ISingleValueOperationCallback<QuantityDTO> dialogCallback) {
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||||
|
|
||||||
@ -60,11 +154,11 @@ public class DialogInputQuantity {
|
|||||||
final QuantityDTO quantityDTO = new QuantityDTO();
|
final QuantityDTO quantityDTO = new QuantityDTO();
|
||||||
quantityDTO.canOverflowQuantity = canOverflowQuantity;
|
quantityDTO.canOverflowQuantity = canOverflowQuantity;
|
||||||
|
|
||||||
setupQuantities(articoloItem, quantityDTO, qtaEvasa);
|
setupQuantities(dto, quantityDTO);
|
||||||
|
|
||||||
setupQuantityListener(quantityDTO, txlInputNumDiCnf, txlInputQtaPerCnf, txlInputQtaTot);
|
setupQuantityListener(quantityDTO, txlInputNumDiCnf, txlInputQtaPerCnf, txlInputQtaTot);
|
||||||
|
|
||||||
contentView.setVariable(BR.viewmodel, articoloItem);
|
contentView.setVariable(BR.viewmodel, dto);
|
||||||
contentView.setVariable(BR.quantityViewModel, quantityDTO);
|
contentView.setVariable(BR.quantityViewModel, quantityDTO);
|
||||||
|
|
||||||
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
|
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
|
||||||
@ -105,23 +199,34 @@ public class DialogInputQuantity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setupQuantities(OrdineAccettazioneDTO.Riga articoloItem, QuantityDTO quantityDTO, float qtaEvasa){
|
private static void setupQuantities(DTO dto, QuantityDTO quantityDTO){
|
||||||
float qtaDaEvadere = articoloItem.getQtaDaEvadere().floatValue();
|
if(dto.getQtaTot() != null) quantityDTO.qtaTot.set(dto.getQtaTot().floatValue());
|
||||||
|
if(dto.getMaxQta() != null) quantityDTO.maxQta = dto.getMaxQta().floatValue();
|
||||||
|
|
||||||
|
float qtaDaEvadere = dto.qtaDaEvadere != null ? dto.qtaDaEvadere.floatValue() : 0f;
|
||||||
if (qtaDaEvadere < 0) qtaDaEvadere = 0;
|
if (qtaDaEvadere < 0) qtaDaEvadere = 0;
|
||||||
|
|
||||||
quantityDTO.qtaEvasa.set(qtaEvasa);
|
quantityDTO.qtaEvasa.set(dto.qtaEvasa != null ? dto.qtaEvasa.floatValue() : null);
|
||||||
quantityDTO.qtaDaEvadere.set(qtaDaEvadere);
|
if(qtaDaEvadere > 0) quantityDTO.qtaDaEvadere.set(qtaDaEvadere);
|
||||||
|
|
||||||
quantityDTO.batchLot.set(articoloItem.partitaMag);
|
quantityDTO.batchLot.set(dto.batchLot);
|
||||||
quantityDTO.qtaCnf.set(articoloItem.mtbAart.qtaCnf.floatValue());
|
if(quantityDTO.qtaCnf.get(false) == null) {
|
||||||
|
quantityDTO.qtaCnf.set(dto.mtbAart.qtaCnf.floatValue());
|
||||||
|
}
|
||||||
|
if(quantityDTO.qtaTot.get(false) == null) {
|
||||||
quantityDTO.qtaTot.set(qtaDaEvadere);
|
quantityDTO.qtaTot.set(qtaDaEvadere);
|
||||||
quantityDTO.numCnf.set(qtaDaEvadere / quantityDTO.qtaCnf.get());
|
}
|
||||||
|
if(quantityDTO.numCnf.get(false) == null) {
|
||||||
|
quantityDTO.numCnf.set(quantityDTO.qtaTot.get() / quantityDTO.qtaCnf.get());
|
||||||
|
}
|
||||||
|
|
||||||
quantityDTO.shouldAskDataScad.set(articoloItem.mtbAart.isFlagTracciabilita() && articoloItem.mtbAart.getGgScadPartita() != null && articoloItem.mtbAart.getGgScadPartita() > 0);
|
quantityDTO.canPartitaMagBeChanged.set(dto.getCanPartitaMagBeChanged());
|
||||||
|
|
||||||
if(quantityDTO.expireDate == null && articoloItem.mtbAart.getGgScadPartita() != null && articoloItem.mtbAart.getGgScadPartita() > 0) {
|
quantityDTO.shouldAskDataScad.set(dto.mtbAart.isFlagTracciabilita() && dto.mtbAart.getGgScadPartita() != null && dto.mtbAart.getGgScadPartita() > 0);
|
||||||
|
|
||||||
|
if(quantityDTO.expireDate == null && dto.mtbAart.getGgScadPartita() != null && dto.mtbAart.getGgScadPartita() > 0) {
|
||||||
Calendar c = Calendar.getInstance();
|
Calendar c = Calendar.getInstance();
|
||||||
c.add(Calendar.DATE, articoloItem.mtbAart.getGgScadPartita()); // number of days to add
|
c.add(Calendar.DATE, dto.mtbAart.getGgScadPartita()); // number of days to add
|
||||||
|
|
||||||
quantityDTO.expireDate = c.getTime();
|
quantityDTO.expireDate = c.getTime();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<variable
|
<variable
|
||||||
name="viewmodel"
|
name="viewmodel"
|
||||||
type="it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO.Riga"/>
|
type="it.integry.integrywmsnative.view.dialogs.input_quantity.DialogInputQuantity.DTO"/>
|
||||||
<variable
|
<variable
|
||||||
name="quantityViewModel"
|
name="quantityViewModel"
|
||||||
type="it.integry.integrywmsnative.view.dialogs.input_quantity.QuantityDTO"/>
|
type="it.integry.integrywmsnative.view.dialogs.input_quantity.QuantityDTO"/>
|
||||||
@ -43,7 +43,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:text='@{(viewmodel.codArtFor != null ? viewmodel.codArtFor : viewmodel.mtbAart.codMart) + (viewmodel.partitaMag != null ? " (" + viewmodel.partitaMag + ")" : "") }'
|
android:text='@{(viewmodel.codArtFor != null ? viewmodel.codArtFor : viewmodel.mtbAart.codMart) + (viewmodel.batchLot != null ? " (" + viewmodel.batchLot + ")" : "") }'
|
||||||
android:textColor="#000"
|
android:textColor="#000"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
@ -99,6 +99,7 @@
|
|||||||
<android.support.v7.widget.AppCompatTextView
|
<android.support.v7.widget.AppCompatTextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="@{viewmodel.qtaOrd == null ? View.GONE : View.VISIBLE}"
|
||||||
android:text="@string/ordered"
|
android:text="@string/ordered"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
tools:text="Ordinati" />
|
tools:text="Ordinati" />
|
||||||
@ -106,6 +107,7 @@
|
|||||||
<android.support.v7.widget.AppCompatTextView
|
<android.support.v7.widget.AppCompatTextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="@{viewmodel.qtaOrd == null ? View.GONE : View.VISIBLE}"
|
||||||
android:text='@{String.format("%.2f", viewmodel.qtaOrd)}'
|
android:text='@{String.format("%.2f", viewmodel.qtaOrd)}'
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
@ -165,7 +167,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintGuide_percent="0.50"/>
|
app:layout_constraintGuide_percent='@{quantityViewModel.shouldAskDataScad.get() == false ? 1.0f : 0.5f}'/>
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
<android.support.design.widget.TextInputLayout
|
||||||
android:id="@+id/input_partita_mag"
|
android:id="@+id/input_partita_mag"
|
||||||
@ -194,7 +196,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:text="11 nov 2018"
|
tools:text="11 nov 2018"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:enabled="@{quantityViewModel.shouldAskDataScad.get()}"
|
android:visibility="@{quantityViewModel.shouldAskDataScad.get() == false ? View.GONE : View.VISIBLE}"
|
||||||
app:binding="@{quantityViewModel.expireDateString}"
|
app:binding="@{quantityViewModel.expireDateString}"
|
||||||
app:layout_constraintStart_toEndOf="@id/guideline_partita_data"
|
app:layout_constraintStart_toEndOf="@id/guideline_partita_data"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user