This commit is contained in:
2018-07-23 18:16:32 +02:00
parent 5bcbfaf206
commit d1f2b808c7
52 changed files with 1643 additions and 152 deletions

View File

@@ -1,7 +1,9 @@
package it.integry.integrywmsnative;
import android.app.Application;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.text.SpannableString;
import it.integry.integrywmsnative.core.settings.SettingsManager;
@@ -10,6 +12,9 @@ import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
public class MainApplication extends Application {
public static Resources res;
public static Context Context;
// Called when the application is starting, before any other application objects have been created.
// Overriding this method is totally optional!
@Override
@@ -19,6 +24,9 @@ public class MainApplication extends Application {
SettingsManager.init(this);
res = getResources();
Context = this;
}
// Called by the system when the device configuration changes while your component is running.

View File

@@ -8,6 +8,12 @@ import org.parceler.Parcel;
public class BindableBoolean extends BaseObservable {
boolean mValue;
public BindableBoolean() {}
public BindableBoolean(boolean startValue) {
this.mValue = startValue;
}
public boolean get() {
return mValue;
}

View File

@@ -0,0 +1,30 @@
package it.integry.integrywmsnative.core.di;
import android.databinding.BaseObservable;
import org.parceler.Parcel;
@Parcel
public class BindableFloat extends BaseObservable {
Float value;
public Float get() {
return value == null ? 0 : value;
}
public Float get(boolean defaultIfNull) {
return value == null && defaultIfNull ? 0 : value;
}
public void set(Float value) {
if (!Objects.equals(this.value, value)) {
this.value = value;
notifyChange();
}
}
public boolean isEmpty() {
return value == null;
}
}

View File

@@ -4,12 +4,18 @@ import android.databinding.BindingAdapter;
import android.databinding.BindingConversion;
import android.support.design.widget.TextInputEditText;
import android.support.v4.util.Pair;
import android.util.Log;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
import it.integry.integrywmsnative.R;
@@ -67,6 +73,45 @@ public class Converters {
}
}
@BindingAdapter("app:binding")
public static void bindTextInputEditText(TextInputEditText view, final BindableFloat bindableFloat) {
DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.getDefault());
otherSymbols.setDecimalSeparator('.');
otherSymbols.setGroupingSeparator(',');
final DecimalFormat decimalFormat = new DecimalFormat();
decimalFormat.setMaximumFractionDigits(2);
decimalFormat.setDecimalFormatSymbols(otherSymbols);
Pair<BindableFloat, TextWatcherAdapter> pair = (Pair) view.getTag(R.id.bound_observable);
if (pair == null || pair.first != bindableFloat) {
if (pair != null) {
view.removeTextChangedListener(pair.second);
}
TextWatcherAdapter watcher = new TextWatcherAdapter() {
@Override public void onTextChanged(CharSequence s, int start, int before, int count) {
try {
if(s.toString().trim().isEmpty()){
bindableFloat.set(null);
} else bindableFloat.set(decimalFormat.parse(s.toString()).floatValue());
} catch (Exception ex){
Log.e("FloatFormat", ex.getMessage());
}
}
};
view.setTag(R.id.bound_observable, new Pair<>(bindableFloat, watcher));
view.addTextChangedListener(watcher);
}
Float newValue = bindableFloat.get();
if (!view.getText().toString().equals(decimalFormat.format(newValue))) {
view.setText(decimalFormat.format(newValue));
view.setSelection(view.getText().toString().length());
}
}
@BindingAdapter("app:binding")
public static void bindRadioGroup(RadioGroup view, final BindableBoolean bindableBoolean) {
if (view.getTag(R.id.bound_observable) != bindableBoolean) {

View File

@@ -9,6 +9,7 @@ public class CommonModelConsts {
public static String SELECT = "SELECT";
public static String SELECT_OBJECT = "SELECT_OBJECT";
public static String SUBSTITUTE = "SUBSTITUTE";
public static String NO_OP = "NO_OP";
}
}

View File

@@ -1,6 +1,8 @@
package it.integry.integrywmsnative.core.model;
public abstract class EntityBase {
import android.util.Log;
public abstract class EntityBase implements Cloneable{
public String operation;
public String type;
@@ -23,4 +25,17 @@ public abstract class EntityBase {
this.onlyPkMaster = onlyPkMaster;
return this;
}
@Override
public EntityBase clone(){
EntityBase clone = null;
try {
clone = (EntityBase) super.clone();
} catch (CloneNotSupportedException ex){
Log.e("CloneError", ex.getMessage());
}
return clone;
}
}

View File

@@ -92,6 +92,16 @@ public class MtbAart implements Parcelable{
public MtbAart(){}
public boolean isFlagTracciabilita() {
return flagTracciabilita != null && flagTracciabilita.equalsIgnoreCase("S");
}
protected MtbAart(Parcel in) {
codMart = in.readString();
descrizione = in.readString();

View File

@@ -1,12 +1,13 @@
package it.integry.integrywmsnative.core.model;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class MtbColr extends EntityBase{
private Date dataCollo;
private String gestione;
private String serCollo;
private Integer numCollo;
@@ -20,19 +21,19 @@ public class MtbColr extends EntityBase{
private String gestioneRif;
private String serColloRif;
private String note;
private Date dataOrd;
private Date dataColloRif;
private String dataOrd;
private String dataColloRif;
private BigDecimal qtaCnf;
private BigDecimal qtaCol;
private Integer numOrd;
private Integer numEtich;
private Integer numColloRif;
private Date datetimeRow;
private String datetimeRow;
private String codJcom;
private BigDecimal numCnf;
private String insPartitaMag;
private String mtbPartitaMag_descrizione;
private Date dataScadPartita;
private String dataScadPartita;
private String descrizione;
@@ -40,14 +41,6 @@ public class MtbColr extends EntityBase{
type = "mtb_colr";
}
public Date getDataCollo() {
return dataCollo;
}
public MtbColr setDataCollo(Date dataCollo) {
this.dataCollo = dataCollo;
return this;
}
public String getGestione() {
return gestione;
@@ -166,24 +159,46 @@ public class MtbColr extends EntityBase{
return this;
}
public Date getDataOrd() {
public String getDataOrdS() {
return dataOrd;
}
public MtbColr setDataOrd(Date dataOrd) {
public Date getDataOrdD() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
return sdf.parse(getDataOrdS());
}
public MtbColr setDataOrd(String dataOrd) {
this.dataOrd = dataOrd;
return this;
}
public Date getDataColloRif() {
public MtbColr setDataOrd(Date dataOrd) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
this.dataOrd = sdf.format(dataOrd);
return this;
}
public String getDataColloRifS() {
return dataColloRif;
}
public MtbColr setDataColloRif(Date dataColloRif) {
public Date getDataColloRifD() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
return sdf.parse(getDataColloRifS());
}
public MtbColr setDataColloRif(String dataColloRif) {
this.dataColloRif = dataColloRif;
return this;
}
public MtbColr setDataColloRif(Date dataColloRif) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
this.dataColloRif = sdf.format(dataColloRif);
return this;
}
public BigDecimal getQtaCnf() {
return qtaCnf;
}
@@ -229,15 +244,35 @@ public class MtbColr extends EntityBase{
return this;
}
public Date getDatetimeRow() {
public String getDatetimeRowS() {
return datetimeRow;
}
public MtbColr setDatetimeRow(Date datetimeRow) {
public Date getDatetimeRowD() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
return sdf.parse(getDatetimeRowS());
}
public MtbColr setDatetimeRow(String datetimeRow) {
this.datetimeRow = datetimeRow;
return this;
}
public MtbColr setDatetimeRow(Date datetimeRow) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
this.datetimeRow = sdf.format(datetimeRow);
return this;
}
public String getCodJcom() {
return codJcom;
}
@@ -274,15 +309,33 @@ public class MtbColr extends EntityBase{
return this;
}
public Date getDataScadPartita() {
public String getDataScadPartitaS() {
return dataScadPartita;
}
public MtbColr setDataScadPartita(Date dataScadPartita) {
public Date getDataScadPartitaD() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
return sdf.parse(getDataScadPartitaS());
}
public MtbColr setDataScadPartita(String dataScadPartita) {
this.dataScadPartita = dataScadPartita;
return this;
}
public MtbColr setDataScadPartita(Date dataScadPartita) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
this.dataScadPartita = sdf.format(dataScadPartita);
return this;
}
public String getDescrizione() {
return descrizione;
}

View File

@@ -1,6 +1,7 @@
package it.integry.integrywmsnative.gest.accettazione.core;
import android.content.Context;
import android.support.v4.util.Pools;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.view.LayoutInflater;
@@ -17,6 +18,7 @@ import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.interfaces.ICheckBoxCallback;
import it.integry.integrywmsnative.core.utility.UtilityDate;
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneGroupedInevasoDTO;
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core.MainListOrdineAccettazioneAdapter;
/**
* Created by GiuseppeS on 06/03/2018.
@@ -28,6 +30,9 @@ public class MainListAccettazioneAdapter extends RecyclerView.Adapter<MainListAc
private List<OrdineAccettazioneGroupedInevasoDTO> mDataset;
private ICheckBoxCallback mCheckBoxCallback;
private Pools.SynchronizedPool sPool = new Pools.SynchronizedPool(2000);
private Pools.SynchronizedPool sPoolClienti = new Pools.SynchronizedPool(3000);
public static class ViewHolder extends RecyclerView.ViewHolder {
// each data item is just a string in this case
private TextView mTextViewGroupHeader;
@@ -95,20 +100,17 @@ public class MainListAccettazioneAdapter extends RecyclerView.Adapter<MainListAc
for (int i = 0; i < subGroup.size(); i++) {
final OrdineAccettazioneGroupedInevasoDTO.Ordine ordine = subGroup.get(i);
//if(i == 0) {
ordine.checkBoxCallback = new ArrayList<>();
//}
ordine.checkBoxCallback = new ArrayList<>();
boolean isCreatedNew = false;
if(holder.views.size() <= i){
holder.views.add(LayoutInflater.from(mContext)
.inflate(R.layout.accettazione_main_list_group_model, holder.mLinearLayoutGroupItemContainer, false));
isCreatedNew = true;
View groupModelViewPool = (View) sPool.acquire();
if(groupModelViewPool == null){
groupModelViewPool = LayoutInflater.from(mContext)
.inflate(R.layout.accettazione_main_list_group_model, holder.mLinearLayoutGroupItemContainer, false);
}
View groupModelView = groupModelViewPool;
holder.views.add(groupModelView);
View groupModelView = holder.views.get(i);
groupModelView.setVisibility(View.VISIBLE);
@@ -145,8 +147,16 @@ public class MainListAccettazioneAdapter extends RecyclerView.Adapter<MainListAc
clientLinearLayout.removeAllViews();
for (int k = 0; k < subGroupClienti.size(); k++) {
View groupClienteModelView = LayoutInflater.from(mContext)
.inflate(R.layout.accettazione_main_list_group_clienti, clientLinearLayout, false);
View groupClienteModelViewPool = (View) sPoolClienti.acquire();
if(groupClienteModelViewPool == null){
groupClienteModelViewPool = LayoutInflater.from(mContext)
.inflate(R.layout.accettazione_main_list_group_clienti, clientLinearLayout, false);
}
View groupClienteModelView = groupClienteModelViewPool;
TextView clienteComm = groupClienteModelView.findViewById(R.id.accettazione_main_list_group_clienti_comm);
String clienteText;
@@ -164,15 +174,35 @@ public class MainListAccettazioneAdapter extends RecyclerView.Adapter<MainListAc
clientLinearLayout.addView(groupClienteModelView);
}
if(isCreatedNew) {
holder.mLinearLayoutGroupItemContainer.addView(groupModelView);
}
}
@Override
public void onViewRecycled(ViewHolder holder){
if(holder != null){
for(int i = 0; i < holder.views.size(); i++){
View groupModelView = holder.views.get(i);
LinearLayout clientLinearLayout = groupModelView.findViewById(R.id.accettazione_main_list_group_item_container_clienti_ord);
for(int k = 0; k < clientLinearLayout.getChildCount(); k++){
View cliente = clientLinearLayout.getChildAt(k);
((ViewGroup) cliente.getParent()).removeView(cliente);
sPoolClienti.release(cliente);
}
((ViewGroup) groupModelView.getParent()).removeView(groupModelView);
sPool.release(groupModelView);
}
holder.views.clear();
}
for(int i = subGroup.size(); i < holder.views.size(); i++){
holder.views.get(i).setVisibility(View.GONE);
}
super.onViewRecycled(holder);
}
// Return the size of your dataset (invoked by the layout manager)

View File

@@ -2,8 +2,11 @@ package it.integry.integrywmsnative.gest.accettazione.dto;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import it.integry.integrywmsnative.core.model.MtbAart;
@@ -34,6 +37,7 @@ public class OrdineAccettazioneDTO implements Parcelable {
public int rigaOrd;
public String codJcom;
public String ragSocCom;
public String descrizioneCommessa;
public MtbAart mtbAart;
public PickingObjectDTO[] colliAssociati;
public boolean hidden = false;
@@ -52,6 +56,21 @@ public class OrdineAccettazioneDTO implements Parcelable {
return this.qtaOrd - this.qtaRiservate;
}
public Date getDataOrd() {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date dataOrd = null;
try{
dataOrd = sdf.parse(this.dataOrd);
} catch (Exception ex) {
Log.e("Parsing date", ex.getMessage());
}
return dataOrd;
}
public Riga(){}
protected Riga(Parcel in) {
@@ -60,6 +79,7 @@ public class OrdineAccettazioneDTO implements Parcelable {
rigaOrd = in.readInt();
codJcom = in.readString();
ragSocCom = in.readString();
descrizioneCommessa = in.readString();
mtbAart = (MtbAart) in.readValue(MtbAart.class.getClassLoader());
hidden = in.readByte() != 0x00;
partitaMag = in.readString();
@@ -94,6 +114,7 @@ public class OrdineAccettazioneDTO implements Parcelable {
dest.writeInt(rigaOrd);
dest.writeString(codJcom);
dest.writeString(ragSocCom);
dest.writeString(descrizioneCommessa);
dest.writeValue(mtbAart);
dest.writeByte((byte) (hidden ? 0x01 : 0x00));
dest.writeString(partitaMag);

View File

@@ -13,13 +13,13 @@ import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.databinding.ActivityAccettazioneOrdineInevasoBinding;
import it.integry.integrywmsnative.databinding.FragmentArticoliInColloBottomSheetBinding;
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.viewmodel.AccettazioneOrdineInevasoViewModel;
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.viewmodel.AccettazioneOnOrdineInevasoViewModel;
import it.integry.integrywmsnative.view.bottomsheet.viewmodel.ArticoliInColloBottomSheetViewModel;
public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
public ActivityAccettazioneOrdineInevasoBinding bindings;
private AccettazioneOrdineInevasoViewModel mAccettazioneOrdineInevasoViewModel;
private AccettazioneOnOrdineInevasoViewModel mAccettazioneOrdineInevasoViewModel;
@Override
@@ -31,7 +31,7 @@ public class AccettazioneOrdineInevasoActivity extends AppCompatActivity {
ArticoliInColloBottomSheetViewModel mArticoliInColloBottomSheetViewModel = new ArticoliInColloBottomSheetViewModel(this, bindings);
List<OrdineAccettazioneDTO> orders = (ArrayList<OrdineAccettazioneDTO>)getIntent().getSerializableExtra("key");
mAccettazioneOrdineInevasoViewModel = new AccettazioneOrdineInevasoViewModel(
mAccettazioneOrdineInevasoViewModel = new AccettazioneOnOrdineInevasoViewModel(
this, mArticoliInColloBottomSheetViewModel, orders);
setSupportActionBar(this.bindings.toolbar);

View File

@@ -6,6 +6,7 @@ import android.databinding.ObservableArrayList;
import android.util.Log;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -16,6 +17,7 @@ import java.util.TreeSet;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.coollection.Coollection;
import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.dto.AccettazioneOrdineInevasoListViewModel;
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.dto.AccettazioneOrdineInevasoOrderBy;
@@ -38,18 +40,18 @@ public class AccettazioneOrdineInevasoHelper {
return new MainListOrdineAccettazioneAdapter(mContext, mListViewModels);
}
public void updateListModel(AccettazioneOrdineInevasoOrderBy.Enum orderByEnum, List<List<OrdineAccettazioneDTO.Riga>> mDataset) throws Exception {
public void updateListModel(AccettazioneOrdineInevasoOrderBy.Enum orderByEnum, List<List<OrdineAccettazioneDTO.Riga>> mDataset, List<MtbColr> mtbColrs) throws Exception {
mListViewModels.clear();
switch (orderByEnum){
case COD_ART_FOR:
case DESCR_ART:
mListViewModels.addAll(getListViewModelPerArtForn(mDataset));
mListViewModels.addAll(getListViewModelPerArtForn(mDataset, mtbColrs));
break;
case RAG_SOC_COM:
mListViewModels.addAll(getListViewModelPerRagSocCommessa(mDataset));
mListViewModels.addAll(getListViewModelPerRagSocCommessa(mDataset, mtbColrs));
break;
default:
@@ -70,7 +72,10 @@ public class AccettazioneOrdineInevasoHelper {
Collections.sort(codArtForns, new Comparator<String>() {
public int compare(String str1, String str2) {
return str1.compareToIgnoreCase(str2);
if(str1 != null && str2 != null) {
return str1.compareToIgnoreCase(str2);
}
return 0;
}
});
@@ -145,7 +150,7 @@ public class AccettazioneOrdineInevasoHelper {
boolean alreadyExists = false;
if(mDataset.get(i).codJcom == null) mDataset.get(i).codJcom = "N/A";
if(mDataset.get(i).ragSocCom == null) mDataset.get(i).ragSocCom = mContext.getText(R.string.stock).toString().toUpperCase();
if(mDataset.get(i).descrizioneCommessa == null) mDataset.get(i).descrizioneCommessa = mContext.getText(R.string.stock).toString().toUpperCase();
for(int k = 0; k < commessaList.size(); k++){
@@ -157,7 +162,7 @@ public class AccettazioneOrdineInevasoHelper {
if(mDataset.get(i).codJcom != null && !alreadyExists){
RaggruppaPerCommessaUtilDTO dto = new RaggruppaPerCommessaUtilDTO();
dto.codJcom = mDataset.get(i).codJcom;
dto.ragSocCom = mDataset.get(i).ragSocCom;
dto.ragSocCom = mDataset.get(i).descrizioneCommessa;
commessaList.add(dto);
}
}
@@ -201,7 +206,7 @@ public class AccettazioneOrdineInevasoHelper {
}
public List<AccettazioneOrdineInevasoListViewModel> getListViewModelPerArtForn(List<List<OrdineAccettazioneDTO.Riga>> groupedRighe){
public List<AccettazioneOrdineInevasoListViewModel> getListViewModelPerArtForn(List<List<OrdineAccettazioneDTO.Riga>> groupedRighe, List<MtbColr> mtbColrs){
List<AccettazioneOrdineInevasoListViewModel> listModel = new ArrayList<>();
@@ -220,11 +225,15 @@ public class AccettazioneOrdineInevasoHelper {
rowModel.badge1 = rowItem.codJcom != null ? rowItem.codJcom : "MAG";
rowModel.badge2 = String.valueOf(rowItem.numOrd);
rowModel.descrizione = rowItem.ragSocCom;
// rowModel.descrizione = rowItem.ragSocCom;
rowModel.descrizione = rowItem.descrizioneCommessa;
rowModel.qtaRiservata = decimalFormat.format(rowItem.qtaRiservate);
rowModel.qtaRiservata = decimalFormat.format(getRigaQuantityEvasa(rowItem, mtbColrs));
// rowModel.qtaRiservata = decimalFormat.format(rowItem.qtaRiservate);
rowModel.qtaOrdinata = decimalFormat.format(rowItem.qtaOrd);
rowModel.originalModel = rowItem;
itemModel.rows.add(rowModel);
}
listModel.add(itemModel);
@@ -234,7 +243,7 @@ public class AccettazioneOrdineInevasoHelper {
}
public List<AccettazioneOrdineInevasoListViewModel> getListViewModelPerRagSocCommessa(List<List<OrdineAccettazioneDTO.Riga>> groupedRighe) {
public List<AccettazioneOrdineInevasoListViewModel> getListViewModelPerRagSocCommessa(List<List<OrdineAccettazioneDTO.Riga>> groupedRighe, List<MtbColr> mtbColrs) {
List<AccettazioneOrdineInevasoListViewModel> listModel = new ArrayList<>();
DecimalFormat decimalFormat = new DecimalFormat("#.#");
@@ -258,9 +267,12 @@ public class AccettazioneOrdineInevasoHelper {
rowModel.descrizione = rowItem.mtbAart.descrizioneEstesa;
rowModel.qtaRiservata = decimalFormat.format(rowItem.qtaRiservate);
rowModel.qtaRiservata = decimalFormat.format(getRigaQuantityEvasa(rowItem, mtbColrs));
// rowModel.qtaRiservata = decimalFormat.format(rowItem.qtaRiservate);
rowModel.qtaOrdinata = decimalFormat.format(rowItem.qtaOrd);
rowModel.originalModel = rowItem;
itemModel.rows.add(rowModel);
}
listModel.add(itemModel);
@@ -268,4 +280,29 @@ public class AccettazioneOrdineInevasoHelper {
return listModel;
}
private float getRigaQuantityEvasa(OrdineAccettazioneDTO.Riga item, List<MtbColr> mtbColrs){
float currentQtaEvasa = item.qtaRiservate;
if(mtbColrs != null) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
List<MtbColr> filteredMtbColrs = Coollection.from(mtbColrs)
.where("codMart", Coollection.eqIgnoreCase(item.mtbAart.codMart))
.and("codJcom", Coollection.eqIgnoreCase(item.codJcom))
.and("rigaOrd", Coollection.eq(item.rigaOrd))
.and("numOrd", Coollection.eq(item.numOrd))
.and("dataOrd", Coollection.eq(sdf.format(item.getDataOrd())))
.all();
for (MtbColr mtbColr : filteredMtbColrs) {
currentQtaEvasa += mtbColr.getQtaCol().floatValue();
}
}
return currentQtaEvasa;
}
}

View File

@@ -0,0 +1,9 @@
package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core;
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
public interface IOnOrdineRowDispatchCallback {
void onOrdineRowDispatch(OrdineAccettazioneDTO.Riga item);
}

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.databinding.ObservableArrayList;
import android.databinding.ObservableList;
import android.graphics.Color;
import android.support.v4.util.Pools;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
@@ -11,12 +12,10 @@ import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneGroupedInevasoDTO;
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.dto.AccettazioneOrdineInevasoListViewModel;
/**
@@ -27,16 +26,24 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
protected Context mContext;
protected ObservableArrayList<AccettazioneOrdineInevasoListViewModel> mDataset;
protected IOnOrdineRowDispatchCallback mOrdineRowDispatch;
private static final Pools.SynchronizedPool sPool =
new Pools.SynchronizedPool(200);
public static class ViewHolder extends RecyclerView.ViewHolder {
// each data item is just a string in this case
protected View mGroupTitle;
protected LinearLayout mLinearLayoutGroupItemContainer;
protected List<View> pool = new ArrayList<>();
public ViewHolder(View v) {
super(v);
}
}
public MainListOrdineAccettazioneAdapter(Context context, ObservableArrayList<AccettazioneOrdineInevasoListViewModel> myDataset) {
mContext = context;
mDataset = myDataset;
@@ -44,6 +51,10 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
myDataset.addOnListChangedCallback(onListChangedCallback);
}
public void setOnOrdineRowDispatchCallback(IOnOrdineRowDispatchCallback ordineRowDispatch) {
mOrdineRowDispatch = ordineRowDispatch;
}
private ObservableList.OnListChangedCallback onListChangedCallback = new ObservableList.OnListChangedCallback<ObservableList<AccettazioneOrdineInevasoListViewModel>>() {
@Override
public void onChanged(ObservableList<AccettazioneOrdineInevasoListViewModel> sender) {
@@ -78,7 +89,7 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.accettazione_ordine_inevaso_main_list___cod_art_for, parent, false);
v.setHasTransientState(true);
//v.setHasTransientState(true);
ViewHolder vh = new ViewHolder(v);
@@ -106,10 +117,22 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
final AccettazioneOrdineInevasoListViewModel.SubItem rowItem = subset.get(i);
View groupModelView = LayoutInflater.from(mContext)
.inflate(R.layout.accettazione_ordine_inevaso_main_list___cod_art_for_group_model, holder.mLinearLayoutGroupItemContainer, false);
if(i % 2 == 1){
View groupModelViewPool = (View) sPool.acquire();
if(groupModelViewPool == null){
groupModelViewPool = LayoutInflater.from(mContext)
.inflate(R.layout.accettazione_ordine_inevaso_main_list___cod_art_for_group_model, holder.mLinearLayoutGroupItemContainer, false);
}
View groupModelView = groupModelViewPool;
holder.pool.add(groupModelView);
if(Float.parseFloat(rowItem.qtaRiservata) == Float.parseFloat(rowItem.qtaOrdinata)) {
groupModelView.setBackgroundColor(mContext.getResources().getColor(R.color.green_500_with_alpha));
} else if(Float.parseFloat(rowItem.qtaRiservata) > 0) {
groupModelView.setBackgroundColor(mContext.getResources().getColor(R.color.orange_600_with_alpha));
} else if(i % 2 == 1) {
groupModelView.setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));
} else {
groupModelView.setBackgroundColor(Color.WHITE);
@@ -145,12 +168,35 @@ public class MainListOrdineAccettazioneAdapter extends RecyclerView.Adapter<Main
qtaTot.setText(rowItem.qtaOrdinata);
groupModelView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mOrdineRowDispatch != null){
mOrdineRowDispatch.onOrdineRowDispatch(rowItem.originalModel);
}
}
});
holder.mLinearLayoutGroupItemContainer.addView(groupModelView);
}
}
@Override
public void onViewRecycled(MainListOrdineAccettazioneAdapter.ViewHolder holder){
if(holder != null){
for(int i = 0; i < holder.pool.size(); i++){
((ViewGroup) holder.pool.get(i).getParent()).removeView(holder.pool.get(i));
sPool.release(holder.pool.get(i));
}
holder.pool.clear();
}
super.onViewRecycled(holder);
}
// Return the size of your dataset (invoked by the layout manager)

View File

@@ -2,6 +2,8 @@ package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.dto;
import java.util.List;
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
/**
* Created by GiuseppeS on 27/03/2018.
*/
@@ -20,6 +22,8 @@ public class AccettazioneOrdineInevasoListViewModel {
public String qtaRiservata;
public String qtaOrdinata;
public OrdineAccettazioneDTO.Riga originalModel;
}
}

View File

@@ -1,13 +1,18 @@
package it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.viewmodel;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.databinding.ObservableArrayList;
import android.databinding.ObservableField;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.text.SpannableString;
import android.widget.Toast;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -17,7 +22,8 @@ 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.ISimpleOperationCallback;
import it.integry.integrywmsnative.core.di.BindableBoolean;
import it.integry.integrywmsnative.core.REST.consumers.ISingleValueOperationCallback;
import it.integry.integrywmsnative.core.coollection.Coollection;
import it.integry.integrywmsnative.core.model.CommonModelConsts;
import it.integry.integrywmsnative.core.model.MtbColr;
import it.integry.integrywmsnative.core.model.MtbColt;
@@ -26,14 +32,18 @@ import it.integry.integrywmsnative.core.settings.SettingsManager;
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.core.AccettazioneOrdineInevasoHelper;
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core.IOnOrdineRowDispatchCallback;
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.core.MainListOrdineAccettazioneAdapter;
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.dto.AccettazioneOrdineInevasoOrderBy;
import it.integry.integrywmsnative.gest.accettazione_ordine_inevaso.views.NoteAggiuntiveNuovaULDialog;
import it.integry.integrywmsnative.ui.StatusBarAlert;
import it.integry.integrywmsnative.view.bottomsheet.interfaces.IOnColloClosedCallback;
import it.integry.integrywmsnative.view.bottomsheet.viewmodel.ArticoliInColloBottomSheetViewModel;
import it.integry.integrywmsnative.view.dialogs.DialogSimpleMessageHelper;
import it.integry.integrywmsnative.view.dialogs.input_quantity.DialogInputQuantity;
import it.integry.integrywmsnative.view.dialogs.input_quantity.QuantityDTO;
public class AccettazioneOrdineInevasoViewModel implements IOnColloClosedCallback {
public class AccettazioneOnOrdineInevasoViewModel implements IOnColloClosedCallback, IOnOrdineRowDispatchCallback {
public ObservableField<Boolean> isFabVisible = new ObservableField<>();
@@ -49,7 +59,7 @@ public class AccettazioneOrdineInevasoViewModel implements IOnColloClosedCallbac
private AccettazioneOrdineInevasoOrderBy.Enum currentOrderBy = AccettazioneOrdineInevasoOrderBy.Enum.COD_ART_FOR;
private MainListOrdineAccettazioneAdapter mAdapter;
public AccettazioneOrdineInevasoViewModel(AccettazioneOrdineInevasoActivity activity, ArticoliInColloBottomSheetViewModel articoliInColloBottomSheetViewModel, List<OrdineAccettazioneDTO> orders) {
public AccettazioneOnOrdineInevasoViewModel(AccettazioneOrdineInevasoActivity activity, ArticoliInColloBottomSheetViewModel articoliInColloBottomSheetViewModel, List<OrdineAccettazioneDTO> orders) {
this.mActivity = activity;
this.mArticoliInColloBottomSheetViewModel = articoliInColloBottomSheetViewModel;
this.mOrders = orders;
@@ -84,13 +94,16 @@ public class AccettazioneOrdineInevasoViewModel implements IOnColloClosedCallbac
mActivity.bindings.accettazioneOrdineMainList.setLayoutManager(new LinearLayoutManager(mActivity));
mAdapter = helper.getRightListAdapter();
try {
mAdapter = helper.getRightListAdapter();
helper.updateListModel(AccettazioneOrdineInevasoOrderBy.Enum.COD_ART_FOR, groupedRighe);
helper.updateListModel(AccettazioneOrdineInevasoOrderBy.Enum.COD_ART_FOR, groupedRighe, null);
} catch (Exception e) {
e.printStackTrace();
DialogSimpleMessageHelper.makeErrorDialog(mActivity, new SpannableString(e.toString()), null, null).show();
}
mAdapter.setOnOrdineRowDispatchCallback(this);
mActivity.bindings.accettazioneOrdineMainList.setAdapter(mAdapter);
}
@@ -112,13 +125,16 @@ public class AccettazioneOrdineInevasoViewModel implements IOnColloClosedCallbac
}
try {
helper.updateListModel(currentOrderBy, groupedRighe);
List<MtbColr> mtbColrs = mArticoliInColloBottomSheetViewModel.mtbColt.get() != null ? mArticoliInColloBottomSheetViewModel.mtbColt.get().getMtbColr() : null;
helper.updateListModel(currentOrderBy, groupedRighe, mtbColrs);
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(mActivity, e.getMessage().toString(), Toast.LENGTH_LONG).show();
}
}
public void showOrderDialog() {
AlertDialog dialog = new AlertDialog.Builder(mActivity)
@@ -144,10 +160,16 @@ public class AccettazioneOrdineInevasoViewModel implements IOnColloClosedCallbac
mActivity.bindings.accettazioneOrdineInevasoFab.close(true);
final ProgressDialog progress = ProgressDialog.show(mActivity, mActivity.getText(R.string.waiting),
mActivity.getText(R.string.loading) + " ...", true);
NoteAggiuntiveNuovaULDialog.show(mActivity, new NoteAggiuntiveNuovaULDialog.Callback() {
@Override
public void onSuccess(String noteString) {
//Add loading dialog here
progress.show();
MtbColt mtbColt = new MtbColt();
mtbColt .setDataCollo(new Date())
.setGestione(GestioneEnum.ACQUISTO)
@@ -163,23 +185,33 @@ public class AccettazioneOrdineInevasoViewModel implements IOnColloClosedCallbac
ColliMagazzinoRESTConsumer.saveCollo(mtbColt, new ISimpleOperationCallback<MtbColt>() {
@Override
public void onSuccess(MtbColt value) {
// mArticoliInColloBottomSheetHelper.initCollo(value);
value.setMtbColr(new ObservableArrayList<MtbColr>());
isFabVisible.set(false);
value.setMtbColr(new ObservableArrayList<MtbColr>());
mArticoliInColloBottomSheetViewModel.mtbColt.set(value);
progress.dismiss();
for(int i = 0; i < 10; i++){
value.getMtbColr().add(new MtbColr().setCodMart("ABCICCIO").setDescrizione("DESCRCICCIO"));
}
new StatusBarAlert.Builder(mActivity)
.autoHide(true)
.withDuration(2500)
.showProgress(false)
.withText(R.string.data_saved)
.withAlertColor(R.color.mainGreen)
.build();
DialogSimpleMessageHelper.makeInfoDialog(mActivity, "Creazione UL",new SpannableString("Salvataggio collo avvenuto con successo"), null, null).show();
/*DialogSimpleMessageHelper.makeInfoDialog(mActivity,
mActivity.getString(R.string.lu_creation),
new SpannableString(mActivity.getString(R.string.data_saved)),
null,
null).show();
*/
}
@Override
public void onFailed(Exception ex) {
progress.dismiss();
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
if(errorMessage == null) errorMessage = ex.getMessage();
@@ -188,6 +220,11 @@ public class AccettazioneOrdineInevasoViewModel implements IOnColloClosedCallbac
});
}
@Override
public void onAbort() {
progress.dismiss();
}
});
@@ -202,5 +239,95 @@ public class AccettazioneOrdineInevasoViewModel implements IOnColloClosedCallbac
@Override
public void onColloClosed() {
mArticoliInColloBottomSheetViewModel.mtbColt.set(null);
isFabVisible.set(true);
}
@Override
public void onOrdineRowDispatch(final OrdineAccettazioneDTO.Riga item) {
if(mArticoliInColloBottomSheetViewModel.mtbColt.get() != null){
List<MtbColr> currentMtbColrs = mArticoliInColloBottomSheetViewModel.mtbColt.get().getMtbColr();
List<MtbColr> filteredMtbColrs = Coollection.from(currentMtbColrs)
.where("codMart", Coollection.eqIgnoreCase(item.mtbAart.codMart))
.and("numOrd", Coollection.eq(item.numOrd))
.and("codJcom", Coollection.eq(item.codJcom))
.and("rigaOrd", Coollection.eq(item.rigaOrd))
.all();
float qtaEvasaInMtbColr = 0;
for (MtbColr mtbColr : filteredMtbColrs) {
qtaEvasaInMtbColr += mtbColr.getQtaCol().floatValue();
}
float qtaEvasa = item.qtaRiservate + qtaEvasaInMtbColr;
DialogInputQuantity.makeBase(mActivity, item, qtaEvasa, new ISingleValueOperationCallback<QuantityDTO>() {
@Override
public void onResult(QuantityDTO value) {
onOrdineRowDispatched(item, value);
}
}).show();
// Toast.makeText(mActivity, item.descrizioneEstesa, Toast.LENGTH_LONG).show();
}
}
private void onOrdineRowDispatched(OrdineAccettazioneDTO.Riga item, QuantityDTO quantityDTO){
final ProgressDialog progress = ProgressDialog.show(mActivity, mActivity.getText(R.string.waiting),
mActivity.getText(R.string.loading) + " ...", true);
final MtbColr mtbColr = new MtbColr()
.setCodMart(item.mtbAart.codMart)
.setPartitaMag(quantityDTO.batchLot.get())
.setQtaCol(new BigDecimal(quantityDTO.qtaTot.get()))
.setDescrizione(item.descrizioneEstesa)
.setNumOrd(item.numOrd)
.setDataOrd(item.getDataOrd())
.setCodJcom(item.codJcom)
.setRigaOrd(item.rigaOrd);
mtbColr.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
MtbColt cloneMtbColt = (MtbColt) mArticoliInColloBottomSheetViewModel.mtbColt.get().clone();
cloneMtbColt.setOperation(CommonModelConsts.OPERATION.NO_OP);
cloneMtbColt.setMtbColr(new ObservableArrayList<MtbColr>());
cloneMtbColt.getMtbColr().add(mtbColr);
ColliMagazzinoRESTConsumer.saveCollo(cloneMtbColt, new ISimpleOperationCallback<MtbColt>() {
@Override
public void onSuccess(MtbColt value) {
mArticoliInColloBottomSheetViewModel.mtbColt.get().getMtbColr().add(mtbColr);
refreshOrderBy();
new StatusBarAlert.Builder(mActivity)
.autoHide(true)
.withDuration(2500)
.showProgress(false)
.withText(R.string.data_saved)
.withAlertColor(R.color.mainGreen)
.build();
progress.dismiss();
}
@Override
public void onFailed(Exception ex) {
progress.dismiss();
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
if(errorMessage == null) errorMessage = ex.getMessage();
DialogSimpleMessageHelper.makeErrorDialog(mActivity, new SpannableString(errorMessage), null, null).show();
}
});
}
}

View File

@@ -15,6 +15,7 @@ public class NoteAggiuntiveNuovaULDialog {
public interface Callback {
void onSuccess(String noteString);
void onAbort();
}
@@ -55,7 +56,12 @@ public class NoteAggiuntiveNuovaULDialog {
callback.onSuccess(mTextInputEditText.getText().toString());
}
})
.setNegativeButton(R.string.abort, null)
.setNegativeButton(R.string.abort, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
callback.onAbort();
}
})
.create();
dialog.show();
}

View File

@@ -0,0 +1,369 @@
package it.integry.integrywmsnative.ui;
import android.animation.Animator;
import android.animation.TimeInterpolator;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.os.Build;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import android.view.Window;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.fede987.statusbaralert.utils.ScreenUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.TypeCastException;
import kotlin.jvm.internal.Intrinsics;
public class StatusBarAlert {
private static final Map allAlerts = (Map)(new LinkedHashMap());
private static int statusBarColorOringinal;
private static boolean hasOriginalStatusBarTranslucent;
public static final StatusBarAlert.Companion Companion = new StatusBarAlert.Companion();
public static final class Builder {
private int text;
private String stringText;
private int alertColor;
private boolean showProgress;
private long duration;
private boolean autoHide;
private Activity context;
@Nullable
public final View build() {
return StatusBarAlert.Companion.addStatusBarTextAndProgress(this.context, this.text, this.stringText, this.alertColor, this.showProgress, this.autoHide, this.duration);
}
@NotNull
public final StatusBarAlert.Builder withAlertColor(int alertColor) {
this.alertColor = alertColor;
return this;
}
@NotNull
public final StatusBarAlert.Builder withText(int text) {
this.text = text;
return this;
}
@NotNull
public final StatusBarAlert.Builder withText(@NotNull String text) {
Intrinsics.checkParameterIsNotNull(text, "text");
this.stringText = text;
return this;
}
@NotNull
public final StatusBarAlert.Builder showProgress(boolean showProgress) {
this.showProgress = showProgress;
return this;
}
@NotNull
public final StatusBarAlert.Builder autoHide(boolean autoHide) {
this.autoHide = autoHide;
return this;
}
@NotNull
public final StatusBarAlert.Builder withDuration(long millis) {
this.duration = millis;
return this;
}
public Builder(@NotNull Activity context) {
super();
Intrinsics.checkParameterIsNotNull(context, "context");
this.context = context;
this.stringText = "";
this.duration = 2000L;
this.autoHide = true;
}
}
public static final class Companion {
@Nullable
public final View addStatusBarTextAndProgress(@NotNull final Activity any, @Nullable Integer text, @Nullable String stringText, int alertColor, boolean showProgress, boolean autoHide, long duration) {
this.hide(any, null);
Window var10000 = any.getWindow();
View var18 = var10000.getDecorView();
if (var18 == null) {
throw new TypeCastException("null cannot be cast to non-null type android.view.ViewGroup");
} else {
ViewGroup decor = (ViewGroup)var18;
final LinearLayout statusBarAlert = new LinearLayout(any);
statusBarAlert.setLayoutParams(new ViewGroup.LayoutParams(-1, ScreenUtils.Companion.getStatusBarHeight(any)));
statusBarAlert.setGravity(1);
if (alertColor > 0) {
statusBarAlert.setBackgroundColor(ContextCompat.getColor(any, alertColor));
}
LinearLayout ll2;
TextView t;
CharSequence var19;
label58: {
ll2 = new LinearLayout(any);
ll2.setOrientation(LinearLayout.HORIZONTAL);
ll2.setGravity(16);
ll2.setLayoutParams(new ViewGroup.LayoutParams(-2, ScreenUtils.Companion.getStatusBarHeight(any)));
t = new TextView(any);
t.setLayoutParams(new ViewGroup.LayoutParams(-2, ScreenUtils.Companion.getStatusBarHeight(any)));
t.setTextSize(12.0F);
t.setTextColor(-1);
t.setGravity(17);
if (text != null) {
if (text == 0) {
var19 = (Intrinsics.areEqual(stringText, "") ^ true ? "" + stringText + ' ' : "");
break label58;
}
}
StringBuilder var10001 = new StringBuilder();
Resources var10002 = any.getResources();
if (text == null) {
Intrinsics.throwNpe();
}
var19 = var10001.append(var10002.getString(text)).append(" ").toString();
}
t.setText(var19);
t.setIncludeFontPadding(false);
ll2.addView(t);
if (showProgress) {
ProgressBar p = new ProgressBar(any);
p.setIndeterminate(true);
p.getIndeterminateDrawable().setColorFilter(-1, PorterDuff.Mode.SRC_IN);
p.setLayoutParams(new ViewGroup.LayoutParams(ScreenUtils.Companion.convertDpToPixel(11.0F, any), ScreenUtils.Companion.convertDpToPixel(11.0F, (Context)any)));
ll2.addView(p);
}
statusBarAlert.addView(ll2);
var10000 = any.getWindow();
Intrinsics.checkExpressionValueIsNotNull(var10000, "any.window");
var18 = var10000.getDecorView();
Intrinsics.checkExpressionValueIsNotNull(var18, "any.window.decorView");
View decorView = var18.getRootView();
Intrinsics.checkExpressionValueIsNotNull(decorView, "decorView");
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
StatusBarAlert.hasOriginalStatusBarTranslucent = this.isTranslucentStatusBar(any);
if (Build.VERSION.SDK_INT >= 21) {
any.getWindow().clearFlags(67108864);
var10000 = any.getWindow();
Intrinsics.checkExpressionValueIsNotNull(var10000, "any.window");
StatusBarAlert.statusBarColorOringinal = var10000.getStatusBarColor();
var10000 = any.getWindow();
Intrinsics.checkExpressionValueIsNotNull(var10000, "any.window");
var10000.setStatusBarColor(0);
}
decor.addView(statusBarAlert);
ll2.setTranslationY(-((float)ScreenUtils.Companion.convertDpToPixel(25.0F, any)));
ViewPropertyAnimator var20 = ll2.animate();
if (var20 == null) {
Intrinsics.throwNpe();
}
var20.translationY(0.0F).setDuration(150L).setStartDelay(350L).setInterpolator((new AccelerateDecelerateInterpolator())).start();
if (autoHide) {
statusBarAlert.postDelayed((new Runnable() {
public final void run() {
if (!any.isFinishing() && statusBarAlert.getParent() != null) {
StatusBarAlert.Companion.hideInternal(any, statusBarAlert, null);
}
Map var10000 = StatusBarAlert.allAlerts;
ComponentName var10001 = any.getComponentName();
Intrinsics.checkExpressionValueIsNotNull(var10001, "any.componentName");
var10000.remove(var10001.getClassName());
}
}), duration + (long)500);
}
Map var21 = StatusBarAlert.allAlerts;
ComponentName var22 = any.getComponentName();
Intrinsics.checkExpressionValueIsNotNull(var22, "any.componentName");
if (var21.get(var22.getClassName()) == null) {
Map var14 = StatusBarAlert.allAlerts;
ComponentName var23 = any.getComponentName();
Intrinsics.checkExpressionValueIsNotNull(var23, "any.componentName");
String var24 = var23.getClassName();
Intrinsics.checkExpressionValueIsNotNull(var24, "any.componentName.className");
String var15 = var24;
List var16 = new ArrayList();
var14.put(var15, var16);
}
var21 = StatusBarAlert.allAlerts;
var22 = any.getComponentName();
Intrinsics.checkExpressionValueIsNotNull(var22, "any.componentName");
List var25 = (List)var21.get(var22.getClassName());
if (var25 != null) {
var25.add(statusBarAlert);
}
return statusBarAlert;
}
}
public final void hide(@NotNull Activity any, @Nullable Runnable onHidden) {
Map var10000;
ComponentName var10001;
List var9;
label48: {
var10000 = StatusBarAlert.allAlerts;
var10001 = any.getComponentName();
if (var10000.get(var10001.getClassName()) != null) {
var10000 = StatusBarAlert.allAlerts;
var10001 = any.getComponentName();
var9 = (List)var10000.get(var10001.getClassName());
if (var9 == null) {
break label48;
}
if (var9.size() != 0) {
break label48;
}
}
if (onHidden != null) {
onHidden.run();
}
return;
}
var10000 = StatusBarAlert.allAlerts;
var10001 = any.getComponentName();
var9 = (List)var10000.get(var10001.getClassName());
if (var9 != null) {
Iterable $receiver$iv = var9;
Iterator var4 = $receiver$iv.iterator();
while(var4.hasNext()) {
Object element$iv = var4.next();
LinearLayout it = (LinearLayout)element$iv;
StatusBarAlert.Companion.hideInternal(any, it, onHidden);
}
}
var10000 = StatusBarAlert.allAlerts;
var10001 = any.getComponentName();
var9 = (List)var10000.get(var10001.getClassName());
if (var9 != null) {
var9.clear();
}
}
private final void hideInternal(Activity any, final LinearLayout it, final Runnable onHidden) {
if (it.getParent() != null) {
Window var10000 = any.getWindow();
View var5 = var10000.getDecorView();
var5 = var5.getRootView();
var5.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
if (Build.VERSION.SDK_INT >= 21) {
var10000 = any.getWindow();
var10000.setStatusBarColor(StatusBarAlert.statusBarColorOringinal);
if (StatusBarAlert.hasOriginalStatusBarTranslucent) {
any.getWindow().addFlags(67108864);
}
}
var10000 = any.getWindow();
var5 = var10000.getDecorView();
if (var5 == null) {
throw new TypeCastException("null cannot be cast to non-null type android.view.ViewGroup");
}
final ViewGroup decor = (ViewGroup)var5;
ViewPropertyAnimator var6 = it.animate();
if (var6 != null) {
var6 = var6.translationY(-((float)ScreenUtils.Companion.convertDpToPixel(25.0F, (Context)any)));
if (var6 != null) {
var6 = var6.setDuration(150L);
if (var6 != null) {
var6 = var6.setStartDelay(500L);
if (var6 != null) {
var6 = var6.setInterpolator(new AccelerateInterpolator());
if (var6 != null) {
var6 = var6.setListener((new Animator.AnimatorListener() {
public void onAnimationRepeat(@Nullable Animator animation) {
}
public void onAnimationEnd(@Nullable Animator animation) {
decor.removeView((View)it);
Runnable var10000 = onHidden;
if (onHidden != null) {
var10000.run();
}
}
public void onAnimationStart(@Nullable Animator animation) {
}
public void onAnimationCancel(@Nullable Animator animation) {
}
}));
if (var6 != null) {
var6.start();
}
}
}
}
}
}
}
}
private final boolean isTranslucentStatusBar(Context any) {
if (any == null) {
throw new TypeCastException("null cannot be cast to non-null type android.app.Activity");
} else {
Window w = ((Activity)any).getWindow();
android.view.WindowManager.LayoutParams lp = w.getAttributes();
int flags = lp.flags;
if (Build.VERSION.SDK_INT >= 19) {
return (flags & 67108864) == 67108864;
} else {
return false;
}
}
}
private Companion() {
}
}
}

View File

@@ -4,8 +4,6 @@ import android.support.annotation.NonNull;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.BottomSheetBehavior;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.AppCompatButton;
import android.support.v7.widget.AppCompatTextView;
import android.support.v7.widget.Toolbar;
import android.text.SpannableString;
import android.view.View;
@@ -46,6 +44,8 @@ public class ArticoliInColloBottomSheetHelper extends BottomSheetBehavior.Bottom
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
mBottomSheetBehavior.setBottomSheetCallback(this);
appBarLayoutBottomSheet.setVisibility(View.INVISIBLE);
toolbarBottomSheet.setNavigationIcon(R.drawable.ic_close_24dp);
toolbarBottomSheet.setNavigationOnClickListener(new View.OnClickListener() {
@Override
@@ -66,9 +66,20 @@ public class ArticoliInColloBottomSheetHelper extends BottomSheetBehavior.Bottom
});
mBinding.articoliInColloCloseCollo.setText(mActivity.getText(R.string.action_close_ul) + " ");
mBinding.articoliInColloCloseCollo.setText(mActivity.getText(R.string.action_close_ul));
updateRigheNumber(0);
mBinding.articoliInColloSheetButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mBottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
} else {
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
}
});
}
public void initCollo(MtbColt mtbColt){
@@ -88,17 +99,9 @@ public class ArticoliInColloBottomSheetHelper extends BottomSheetBehavior.Bottom
}
public void updateRigheNumber(int newRigheNumber){
mBinding.articoliInColloSheetButton.setText(" " + newRigheNumber + " " + mActivity.getResources().getQuantityString(R.plurals.articles, newRigheNumber));
mBinding.articoliInColloSheetButton.setText(newRigheNumber + " " + mActivity.getResources().getQuantityString(R.plurals.articles, newRigheNumber));
}
@OnClick(R.id.articoli_in_collo_sheet_button)
public void onClick(View view) {
if (mBottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
} else {
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
}
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
@@ -107,14 +110,24 @@ public class ArticoliInColloBottomSheetHelper extends BottomSheetBehavior.Bottom
// mRootView.scrollTo(0, 0);
break;
case BottomSheetBehavior.STATE_EXPANDED:
appBarLayoutBottomSheet.setClickable(true);
appBarLayoutBottomSheet.setFocusable(true);
tapActionLayout.setClickable(false);
tapActionLayout.setFocusable(false);
break;
case BottomSheetBehavior.STATE_COLLAPSED:
// mRootView.scrollTo(0, 0);
appBarLayoutBottomSheet.setVisibility(View.INVISIBLE);
appBarLayoutBottomSheet.setClickable(false);
appBarLayoutBottomSheet.setFocusable(false);
tapActionLayout.setClickable(true);
tapActionLayout.setFocusable(true);
break;
case BottomSheetBehavior.STATE_DRAGGING:
appBarLayoutBottomSheet.setVisibility(View.VISIBLE);
// mRootView.scrollTo(0, 0);
break;
case BottomSheetBehavior.STATE_SETTLING:
appBarLayoutBottomSheet.setVisibility(View.VISIBLE);
// mRootView.scrollTo(0, 0);
break;
}

View File

@@ -0,0 +1,7 @@
package it.integry.integrywmsnative.view.bottomsheet.interfaces;
public interface IOnSimpleListChangedCallback {
void onChange();
}

View File

@@ -21,6 +21,7 @@ import it.integry.integrywmsnative.core.model.MtbColt;
import it.integry.integrywmsnative.databinding.FragmentArticoliInColloBottomSheetBinding;
import it.integry.integrywmsnative.view.bottomsheet.ArticoliInColloBottomSheetHelper;
import it.integry.integrywmsnative.view.bottomsheet.interfaces.IOnColloClosedCallback;
import it.integry.integrywmsnative.view.bottomsheet.interfaces.IOnSimpleListChangedCallback;
public class ArticoliInColloBottomSheetViewModel {
@@ -42,6 +43,18 @@ public class ArticoliInColloBottomSheetViewModel {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
mBindings.linearListview.setAdapter(new ArticoliInColloBottomSheetMtbColrAdapter());
if(mtbColt.get() != null) {
mArticoliInColloBottomSheetHelper.updateRigheNumber(mtbColt.get().getMtbColr().size());
mArticoliInColloBottomSheetHelper.initCollo(mtbColt.get());
mtbColt.get().getMtbColr().addOnListChangedCallback(new SimpleListChangedCallback(new IOnSimpleListChangedCallback() {
@Override
public void onChange() {
mArticoliInColloBottomSheetHelper.updateRigheNumber(mtbColt.get().getMtbColr().size());
}
}));
}
}
});
@@ -76,8 +89,6 @@ public class ArticoliInColloBottomSheetViewModel {
final MtbColr item = mtbColt.get().getMtbColr().get(position);
binding.setVariable(BR.mtbColr, item);
// viewHolder.binding.getRoot().setTag(ITEM_MODEL, item);
// viewHolder.binding.getRoot().setOnClickListener(this);
binding.executePendingBindings();
if(position % 2 == 1) binding.getRoot().setBackgroundColor(mContext.getResources().getColor(R.color.letturaFacilitataBG));

View File

@@ -0,0 +1,40 @@
package it.integry.integrywmsnative.view.bottomsheet.viewmodel;
import android.databinding.ObservableList;
import it.integry.integrywmsnative.view.bottomsheet.interfaces.IOnSimpleListChangedCallback;
public class SimpleListChangedCallback extends ObservableList.OnListChangedCallback {
private IOnSimpleListChangedCallback mOnSimpleListChangedCallback;
public SimpleListChangedCallback(IOnSimpleListChangedCallback onSimpleListChangedCallback) {
mOnSimpleListChangedCallback = onSimpleListChangedCallback;
}
@Override
public void onChanged(ObservableList sender) {
mOnSimpleListChangedCallback.onChange();
}
@Override
public void onItemRangeChanged(ObservableList sender, int positionStart, int itemCount) {
mOnSimpleListChangedCallback.onChange();
}
@Override
public void onItemRangeInserted(ObservableList sender, int positionStart, int itemCount) {
mOnSimpleListChangedCallback.onChange();
}
@Override
public void onItemRangeMoved(ObservableList sender, int fromPosition, int toPosition, int itemCount) {
mOnSimpleListChangedCallback.onChange();
}
@Override
public void onItemRangeRemoved(ObservableList sender, int positionStart, int itemCount) {
mOnSimpleListChangedCallback.onChange();
mOnSimpleListChangedCallback.onChange();
}
}

View File

@@ -0,0 +1,218 @@
package it.integry.integrywmsnative.view.dialogs.input_quantity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.ColorStateList;
import android.databinding.DataBindingUtil;
import android.databinding.Observable;
import android.databinding.ViewDataBinding;
import android.graphics.Color;
import android.support.design.widget.TextInputLayout;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.LayoutInflater;
import it.integry.integrywmsnative.BR;
import it.integry.integrywmsnative.MainApplication;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.REST.consumers.ISimpleOperationCallback;
import it.integry.integrywmsnative.core.REST.consumers.ISingleValueOperationCallback;
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
import it.integry.integrywmsnative.view.dialogs.IButtonDialogAction;
public class DialogInputQuantity {
private static ColorStateList originalColorStateList = null;
public static AlertDialog makeBase(Context context, OrdineAccettazioneDTO.Riga articoloItem, final float qtaEvasa, final ISingleValueOperationCallback<QuantityDTO> dialogCallback) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
ViewDataBinding contentView = DataBindingUtil.inflate(inflater, R.layout.dialog_input_quantity_articolo, null, false);
TextInputLayout txlInputNumDiCnf = contentView.getRoot().findViewById(R.id.input_num_cnf);
TextInputLayout txlInputQtaPerCnf = contentView.getRoot().findViewById(R.id.input_qta_cnf);
TextInputLayout txlInputQtaTot = contentView.getRoot().findViewById(R.id.input_qta_tot);
txlInputNumDiCnf.getEditText().setSelectAllOnFocus(true);
txlInputQtaPerCnf.getEditText().setSelectAllOnFocus(true);
txlInputQtaTot.getEditText().setSelectAllOnFocus(true);
originalColorStateList = txlInputNumDiCnf.getEditText().getTextColors();
final QuantityDTO quantityDTO = new QuantityDTO();
setupQuantities(articoloItem, quantityDTO, qtaEvasa);
setupQuantityListener(quantityDTO, txlInputNumDiCnf, txlInputQtaPerCnf, txlInputQtaTot);
contentView.setVariable(BR.viewmodel, articoloItem);
contentView.setVariable(BR.quantityViewModel, quantityDTO);
AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
.setView(contentView.getRoot())
.setPositiveButton(context.getText(R.string.confirm), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogCallback.onResult(quantityDTO);
}
})
.setNegativeButton(context.getText(R.string.abort), null);
AlertDialog alert = alertDialog.create();
alert.setCanceledOnTouchOutside(false);
return alert;
}
private static void setupQuantities(OrdineAccettazioneDTO.Riga articoloItem, QuantityDTO quantityDTO, float qtaEvasa){
float qtaDaEvadere = articoloItem.qtaOrd - qtaEvasa;
if (qtaDaEvadere < 0) qtaDaEvadere = 0;
quantityDTO.qtaEvasa.set(qtaEvasa);
quantityDTO.qtaDaEvadere.set(qtaDaEvadere);
quantityDTO.batchLot.set(articoloItem.partitaMag);
quantityDTO.qtaCnf.set(articoloItem.mtbAart.qtaCnf.floatValue());
quantityDTO.qtaTot.set(qtaDaEvadere);
quantityDTO.numCnf.set(qtaDaEvadere / quantityDTO.qtaCnf.get());
quantityDTO.shouldAskDataScad.set(articoloItem.mtbAart.isFlagTracciabilita() && articoloItem.mtbAart.ggScadPartita != null && articoloItem.mtbAart.ggScadPartita > 0);
}
private static void setupQuantityListener(final QuantityDTO quantityDTO, final TextInputLayout txlInputNumDiCnf, final TextInputLayout txlInputQtaPerCnf, final TextInputLayout txlInputQtaTot) {
quantityDTO.numCnf.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
if(quantityDTO.numCnfNotificationEnabled) {
quantityDTO.blockedNumDiCnf.set(!(quantityDTO.numCnf.get(true) == 0 || quantityDTO.numCnf.get().toString() == ""));
Log.d("Color", txlInputNumDiCnf.getEditText().getTextColors().toString());
if(quantityDTO.blockedNumDiCnf.get()){
txlInputNumDiCnf.setErrorEnabled(true);
txlInputNumDiCnf.setError(" ");
txlInputNumDiCnf.getEditText().setTextColor(ContextCompat.getColor(MainApplication.Context, R.color.red_600));
} else {
txlInputNumDiCnf.setErrorEnabled(false);
txlInputNumDiCnf.setError(null);
txlInputNumDiCnf.getEditText().setTextColor(originalColorStateList);
}
if (!quantityDTO.blockedQtaTot.get()) {
quantityDTO.qtaTotNotificationEnabled = false;
quantityDTO.qtaTot.set((float) Math.round(quantityDTO.qtaCnf.get(true) * quantityDTO.numCnf.get(true) * 100) / 100);
quantityDTO.qtaTotNotificationEnabled = true;
} else if (!quantityDTO.blockedQtaPerCnf.get()) {
quantityDTO.qtaCnfNotificationEnabled = false;
if(quantityDTO.numCnf.get(true) != 0) {
quantityDTO.qtaCnf.set((float) Math.round(quantityDTO.qtaTot.get(true) / quantityDTO.numCnf.get(true) * 100) / 100);
} else {
quantityDTO.qtaCnf.set((float) Math.round(quantityDTO.qtaTot.get(true) / 1 * 100) / 100);
}
quantityDTO.qtaCnfNotificationEnabled = true;
} else {
Log.e("DialogInputQuantity", "Tutti i campi sono bloccati, non è possibile modificare il numero di confezioni");
}
}
}
});
quantityDTO.qtaCnf.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
if(quantityDTO.qtaCnfNotificationEnabled) {
quantityDTO.blockedQtaPerCnf.set(!(quantityDTO.qtaCnf.get(true) == 0 || quantityDTO.qtaCnf.get().toString() == ""));
if(quantityDTO.blockedQtaPerCnf.get()){
txlInputQtaPerCnf.setErrorEnabled(true);
txlInputQtaPerCnf.setError(" ");
txlInputQtaPerCnf.getEditText().setTextColor(ContextCompat.getColor(MainApplication.Context, R.color.red_600));
} else {
txlInputQtaPerCnf.setErrorEnabled(false);
txlInputQtaPerCnf.setError(null);
txlInputQtaPerCnf.getEditText().setTextColor(originalColorStateList);
}
if (!quantityDTO.blockedQtaTot.get()) {
quantityDTO.qtaTotNotificationEnabled = false;
quantityDTO.qtaTot.set((float) Math.round(quantityDTO.qtaCnf.get(true) * quantityDTO.numCnf.get(true) * 100) / 100);
quantityDTO.qtaTotNotificationEnabled = true;
} else if (!quantityDTO.blockedNumDiCnf.get()) {
quantityDTO.numCnfNotificationEnabled = false;
if(quantityDTO.qtaCnf.get(true) != 0){
quantityDTO.numCnf.set((float) Math.ceil(quantityDTO.qtaTot.get(true) / quantityDTO.qtaCnf.get(true)));
} else {
quantityDTO.numCnf.set((float) Math.ceil(quantityDTO.qtaTot.get(true)));
}
quantityDTO.numCnfNotificationEnabled = true;
} else {
Log.e("DialogInputQuantity", "Tutti i campi sono bloccati, non è possibile modificare la quantità per confezione");
}
}
}
});
quantityDTO.qtaTot.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
if (quantityDTO.qtaTotNotificationEnabled) {
quantityDTO.blockedQtaTot.set(!(quantityDTO.qtaTot.get(true) == 0 || quantityDTO.qtaTot.get().toString() == ""));
if(quantityDTO.blockedQtaTot.get()){
txlInputQtaTot.setErrorEnabled(true);
txlInputQtaTot.setError(" ");
txlInputQtaTot.getEditText().setTextColor(ContextCompat.getColor(MainApplication.Context, R.color.red_600));
} else {
txlInputQtaTot.setErrorEnabled(false);
txlInputQtaTot.setError(null);
txlInputQtaTot.getEditText().setTextColor(originalColorStateList);
}
if(!quantityDTO.blockedQtaPerCnf.get()){
quantityDTO.qtaCnfNotificationEnabled = false;
quantityDTO.qtaCnf.set((float) Math.round(quantityDTO.qtaTot.get(true) / quantityDTO.numCnf.get(true) *100)/100);
quantityDTO.qtaCnfNotificationEnabled = true;
} else if(!quantityDTO.blockedNumDiCnf.get()) {
quantityDTO.numCnfNotificationEnabled = false;
quantityDTO.numCnf.set((float) Math.ceil(quantityDTO.qtaTot.get(true) / quantityDTO.qtaCnf.get(true)));
quantityDTO.numCnfNotificationEnabled = true;
} else {
Log.e("DialogInputQuantity", "Tutti i campi sono bloccati, non è possibile modificare la quantità totale");
}
}
}
});
}
}

View File

@@ -0,0 +1,39 @@
package it.integry.integrywmsnative.view.dialogs.input_quantity;
import android.graphics.Color;
import android.support.v4.content.ContextCompat;
import it.integry.integrywmsnative.MainApplication;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.di.BindableBoolean;
import it.integry.integrywmsnative.core.di.BindableFloat;
import it.integry.integrywmsnative.core.di.BindableString;
public class QuantityDTO {
public BindableString batchLot = new BindableString();
public BindableFloat numCnf = new BindableFloat();
public BindableFloat qtaCnf = new BindableFloat();
public BindableFloat qtaTot = new BindableFloat();
public BindableFloat qtaEvasa = new BindableFloat();
public BindableFloat qtaDaEvadere = new BindableFloat();
public BindableBoolean blockedNumDiCnf = new BindableBoolean();
public BindableBoolean blockedQtaTot = new BindableBoolean();
public BindableBoolean blockedQtaPerCnf = new BindableBoolean();
public boolean numCnfNotificationEnabled = true;
public boolean qtaCnfNotificationEnabled = true;
public boolean qtaTotNotificationEnabled = true;
public BindableBoolean canPartitaMagBeChanged = new BindableBoolean(true);
public BindableBoolean canDataScadBeChanged = new BindableBoolean(true);
public BindableBoolean shouldAskDataScad = new BindableBoolean();
}