Finish v1_10_11(114)
This commit is contained in:
commit
c7f0957f9b
@ -17,8 +17,8 @@ apply plugin: 'com.google.gms.google-services'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
||||||
def appVersionCode = 112
|
def appVersionCode = 114
|
||||||
def appVersionName = '1.10.9'
|
def appVersionName = '1.10.11'
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
@ -97,14 +97,14 @@ dependencies {
|
|||||||
implementation 'com.orhanobut:logger:2.2.0'
|
implementation 'com.orhanobut:logger:2.2.0'
|
||||||
implementation 'com.google.firebase:firebase-core:17.2.1'
|
implementation 'com.google.firebase:firebase-core:17.2.1'
|
||||||
implementation 'com.google.firebase:firebase-crash:16.2.1'
|
implementation 'com.google.firebase:firebase-crash:16.2.1'
|
||||||
implementation 'com.google.firebase:firebase-perf:19.0.1'
|
implementation 'com.google.firebase:firebase-perf:19.0.3'
|
||||||
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
|
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
|
||||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'com.google.android.material:material:1.1.0-beta01'
|
implementation 'com.google.android.material:material:1.1.0-beta01'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta3'
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
|
||||||
implementation 'androidx.cardview:cardview:1.0.0'
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.1.0-rc01'
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||||
implementation 'androidx.preference:preference:1.1.0'
|
implementation 'androidx.preference:preference:1.1.0'
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
|
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
|
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
|
||||||
|
|||||||
@ -81,7 +81,6 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Throwable t) {
|
||||||
Log.e("PrintCollo", t.toString());
|
|
||||||
UtilityLogger.errorMe(new Exception(t));
|
UtilityLogger.errorMe(new Exception(t));
|
||||||
if(onFailed != null) onFailed.run(new Exception(t));
|
if(onFailed != null) onFailed.run(new Exception(t));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.orhanobut.logger.Logger;
|
|||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
import java.net.SocketException;
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
|
|
||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
@ -38,7 +39,8 @@ public class UtilityLogger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void errorMe(Exception ex, String additionalText, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
public static void errorMe(Exception ex, String additionalText, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
if(!(ex instanceof SocketTimeoutException) && !(ex.getCause() instanceof SocketTimeoutException)) {
|
if((!(ex instanceof SocketTimeoutException) && !(ex.getCause() instanceof SocketTimeoutException)) ||
|
||||||
|
(!(ex instanceof SocketException) && !(ex.getCause() instanceof SocketException)) ) {
|
||||||
|
|
||||||
String message = UtilityResources.readRawTextFile(R.raw.error_mail);
|
String message = UtilityResources.readRawTextFile(R.raw.error_mail);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package it.integry.integrywmsnative.gest.accettazione;
|
|||||||
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.ProgressDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
@ -30,11 +29,11 @@ import it.integry.integrywmsnative.core.rest.CommonRESTException;
|
|||||||
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
import it.integry.integrywmsnative.core.data_cache.DataCache;
|
||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ISearcableFragment;
|
import it.integry.integrywmsnative.core.interfaces.ISearcableFragment;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||||
import it.integry.integrywmsnative.databinding.FragmentMainAccettazioneBinding;
|
import it.integry.integrywmsnative.databinding.FragmentMainAccettazioneBinding;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.core.AccettazioneHelper;
|
import it.integry.integrywmsnative.gest.accettazione.core.AccettazioneHelper;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.core.MainListAccettazioneAdapter;
|
import it.integry.integrywmsnative.gest.accettazione.core.MainListAccettazioneAdapter;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.core.interfaces.ILoadOrdiniCallback;
|
|
||||||
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
import it.integry.integrywmsnative.core.interfaces.IScrollableFragment;
|
||||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
|
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
|
||||||
@ -84,10 +83,6 @@ public class MainAccettazioneFragment extends Fragment implements ISearcableFrag
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
if (getArguments() != null) {
|
|
||||||
// mParam1 = getArguments().getString(ARG_PARAM1);
|
|
||||||
// mParam2 = getArguments().getString(ARG_PARAM2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
@ -126,28 +121,19 @@ public class MainAccettazioneFragment extends Fragment implements ISearcableFrag
|
|||||||
|
|
||||||
mHelper = new AccettazioneHelper(getActivity());
|
mHelper = new AccettazioneHelper(getActivity());
|
||||||
|
|
||||||
mHelper.loadOrdini(new ILoadOrdiniCallback() {
|
mHelper.loadOrdini(ordini -> {
|
||||||
@Override
|
if(ordini != null) {
|
||||||
public void onLoadSuccess(List<OrdineAccettazioneInevasoDTO> ordini) {
|
Toast.makeText(getActivity(), "Caricati " + ordini.size() + " ordini", Toast.LENGTH_LONG).show();
|
||||||
if(ordini != null) {
|
mOriginalOrderList = ordini;
|
||||||
Toast.makeText(getActivity(), "Caricati " + ordini.size() + " ordini", Toast.LENGTH_LONG).show();
|
|
||||||
mOriginalOrderList = ordini;
|
|
||||||
}
|
|
||||||
|
|
||||||
mBinding.ordiniAccettazioneEmptyView.setVisibility(ordini != null && ordini.size() > 0 ? View.GONE : View.VISIBLE);
|
|
||||||
refreshRenderedOrdini(ordini);
|
|
||||||
initRecyclerView();
|
|
||||||
progress.dismiss();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
mBinding.ordiniAccettazioneEmptyView.setVisibility(ordini != null && ordini.size() > 0 ? View.GONE : View.VISIBLE);
|
||||||
public void onLoadFail(Exception ex) {
|
refreshRenderedOrdini(ordini);
|
||||||
progress.dismiss();
|
initRecyclerView();
|
||||||
|
progress.dismiss();
|
||||||
|
|
||||||
String errorMessage = CommonRESTException.tryRecognizeThenGetMessage(ex);
|
}, ex -> {
|
||||||
if(errorMessage == null) errorMessage = ex.getMessage();
|
UtilityExceptions.defaultException(getActivity(), ex, progress);
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(getActivity(), new SpannableString(errorMessage), null, null).show();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -164,10 +150,6 @@ public class MainAccettazioneFragment extends Fragment implements ISearcableFrag
|
|||||||
if(ordini != null) mRenderedOrderList.addAll(ordini);
|
if(ordini != null) mRenderedOrderList.addAll(ordini);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshRecyclerView() {
|
|
||||||
mAdapter.updateItems(mRenderedOrderList);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private RunnableArgs<OrdineAccettazioneInevasoDTO> onSingleSelectionChanged = dto -> {
|
private RunnableArgs<OrdineAccettazioneInevasoDTO> onSingleSelectionChanged = dto -> {
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
|||||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
import it.integry.integrywmsnative.core.utility.UtilityLogger;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.core.interfaces.ILoadOrdiniCallback;
|
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
|
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
||||||
import it.integry.integrywmsnative.gest.accettazione.rest.OrdiniAccettazioneRESTConsumerService;
|
import it.integry.integrywmsnative.gest.accettazione.rest.OrdiniAccettazioneRESTConsumerService;
|
||||||
@ -35,7 +34,7 @@ public class AccettazioneHelper {
|
|||||||
mContext = context;
|
mContext = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadOrdini(final ILoadOrdiniCallback callback){
|
public void loadOrdini(RunnableArgs<List<OrdineAccettazioneInevasoDTO>> onComplete, RunnableArgs<Exception> onFailed){
|
||||||
String codMdep = SettingsManager.i().userSession.depo.getCodMdep();
|
String codMdep = SettingsManager.i().userSession.depo.getCodMdep();
|
||||||
|
|
||||||
OrdiniAccettazioneRESTConsumerService service = RESTBuilder.getService(OrdiniAccettazioneRESTConsumerService.class);
|
OrdiniAccettazioneRESTConsumerService service = RESTBuilder.getService(OrdiniAccettazioneRESTConsumerService.class);
|
||||||
@ -47,25 +46,21 @@ public class AccettazioneHelper {
|
|||||||
|
|
||||||
if(response.body() != null) {
|
if(response.body() != null) {
|
||||||
if(response.body().getEsito() == EsitoType.OK) {
|
if(response.body().getEsito() == EsitoType.OK) {
|
||||||
callback.onLoadSuccess(response.body().getDto());
|
onComplete.run(response.body().getDto());
|
||||||
} else {
|
} else {
|
||||||
Log.e("Accettazione", response.body().getErrorMessage());
|
onFailed.run(new Exception(response.body().getErrorMessage()));
|
||||||
callback.onLoadFail(new Exception(response.body().getErrorMessage()));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("Accettazione", response.message());
|
onFailed.run(new Exception(response.message()));
|
||||||
callback.onLoadFail(new Exception(response.message()));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("Accettazione", "Status " + response.code() + ": " + response.message());
|
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||||
callback.onLoadFail(new Exception("Status " + response.code() + ": " + response.message()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<List<OrdineAccettazioneInevasoDTO>>> call, Throwable t) {
|
||||||
Log.e("Accettazione", t.toString());
|
onFailed.run(new Exception(t));
|
||||||
callback.onLoadFail(new Exception(t));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -96,23 +91,18 @@ public class AccettazioneHelper {
|
|||||||
|
|
||||||
onComplete.run(dto);
|
onComplete.run(dto);
|
||||||
} else {
|
} else {
|
||||||
Log.e("Accettazione", response.body().getErrorMessage());
|
|
||||||
onFailed.run(new Exception(response.body().getErrorMessage()));
|
onFailed.run(new Exception(response.body().getErrorMessage()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("Accettazione", response.message());
|
|
||||||
onFailed.run(new Exception(response.message()));
|
onFailed.run(new Exception(response.message()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("Accettazione", "Status " + response.code() + ": " + response.message());
|
|
||||||
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<OrdineAccettazioneDTO>>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<List<OrdineAccettazioneDTO>>> call, Throwable t) {
|
||||||
Log.e("Accettazione", t.toString());
|
|
||||||
UtilityLogger.errorMe(new Exception(t));
|
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(new Exception(t));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.gest.accettazione.core.interfaces;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by GiuseppeS on 06/03/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface ILoadOrdiniCallback {
|
|
||||||
|
|
||||||
|
|
||||||
void onLoadSuccess(List<OrdineAccettazioneInevasoDTO> ordini);
|
|
||||||
|
|
||||||
void onLoadFail(Exception ex);
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
package it.integry.integrywmsnative.gest.accettazione.core.interfaces;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneDTO;
|
|
||||||
import it.integry.integrywmsnative.gest.accettazione.dto.OrdineAccettazioneInevasoDTO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by GiuseppeS on 22/03/2018.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface ILoadPickingListCallback {
|
|
||||||
|
|
||||||
void onLoadSuccess(List<OrdineAccettazioneDTO> ordini);
|
|
||||||
|
|
||||||
void onLoadFail(Exception ex);
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -130,8 +130,6 @@ public class AccettazioneOrdineInevasoHelper {
|
|||||||
if(tmpList.get(i).isHidden() == null || forceHiddenCheck) {
|
if(tmpList.get(i).isHidden() == null || forceHiddenCheck) {
|
||||||
if (tmpList.get(i).getQtaDaEvadere().floatValue() <= 0) {
|
if (tmpList.get(i).getQtaDaEvadere().floatValue() <= 0) {
|
||||||
tmpList.get(i).setHidden(true);
|
tmpList.get(i).setHidden(true);
|
||||||
//tmpList.remove(i);
|
|
||||||
//i--;
|
|
||||||
} else tmpList.get(i).setHidden(false);
|
} else tmpList.get(i).setHidden(false);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -76,8 +76,6 @@ public class AccettazioneOrdineAccettazioneInevasoViewModel implements IOnColloC
|
|||||||
|
|
||||||
private GestioneEnum defaultGestioneOfUL = null;
|
private GestioneEnum defaultGestioneOfUL = null;
|
||||||
|
|
||||||
// private MtbColt mtbColtOfAccettazione = null;
|
|
||||||
|
|
||||||
public AccettazioneOrdineAccettazioneInevasoViewModel(AccettazioneOrdineInevasoActivity activity, ArticoliInColloBottomSheetViewModel articoliInColloBottomSheetViewModel, List<OrdineAccettazioneDTO> orders) {
|
public AccettazioneOrdineAccettazioneInevasoViewModel(AccettazioneOrdineInevasoActivity activity, ArticoliInColloBottomSheetViewModel articoliInColloBottomSheetViewModel, List<OrdineAccettazioneDTO> orders) {
|
||||||
this.mActivity = activity;
|
this.mActivity = activity;
|
||||||
this.mArticoliInColloBottomSheetViewModel = articoliInColloBottomSheetViewModel;
|
this.mArticoliInColloBottomSheetViewModel = articoliInColloBottomSheetViewModel;
|
||||||
|
|||||||
@ -593,6 +593,8 @@ public class PickingLiberoViewModel implements IRecyclerItemClicked<MtbColr> {
|
|||||||
DialogAskCliente.makeBase(mContext, (status, result) -> {
|
DialogAskCliente.makeBase(mContext, (status, result) -> {
|
||||||
if(status == DialogConsts.Results.YES) {
|
if(status == DialogConsts.Results.YES) {
|
||||||
createNewLUInternal(customNumCollo, customSerCollo, result, progressDialog, onComplete, onFailed);
|
createNewLUInternal(customNumCollo, customSerCollo, result, progressDialog, onComplete, onFailed);
|
||||||
|
} else {
|
||||||
|
onFailed.run();
|
||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -12,6 +12,8 @@ import android.view.ViewGroup;
|
|||||||
import it.integry.integrywmsnative.R;
|
import it.integry.integrywmsnative.R;
|
||||||
import it.integry.integrywmsnative.core.interfaces.IRecyclerItemClicked;
|
import it.integry.integrywmsnative.core.interfaces.IRecyclerItemClicked;
|
||||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||||
import it.integry.integrywmsnative.databinding.ListaRettificaGiacenzeModelBinding;
|
import it.integry.integrywmsnative.databinding.ListaRettificaGiacenzeModelBinding;
|
||||||
|
|
||||||
public class RettificaGiacenzeMainListAdapter extends RecyclerView.Adapter<RettificaGiacenzeMainListAdapter.ViewHolder> {
|
public class RettificaGiacenzeMainListAdapter extends RecyclerView.Adapter<RettificaGiacenzeMainListAdapter.ViewHolder> {
|
||||||
@ -58,12 +60,23 @@ public class RettificaGiacenzeMainListAdapter extends RecyclerView.Adapter<Retti
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(RettificaGiacenzeMainListAdapter.ViewHolder holder, int position) {
|
public void onBindViewHolder(RettificaGiacenzeMainListAdapter.ViewHolder holder, int position) {
|
||||||
MtbColr item = mDataset.get(position);
|
MtbColr mtbColr = mDataset.get(position);
|
||||||
holder.bind(item);
|
holder.bind(mtbColr);
|
||||||
|
|
||||||
|
//Setting qty with unt_mis
|
||||||
|
if(mtbColr.getMtbAart() != null) {
|
||||||
|
if (mtbColr.getMtbAart().isFlagQtaCnfFissa()) {
|
||||||
|
holder.mViewDataBinding.qtaTextview.setText(UtilityNumber.decimalToString(mtbColr.getQtaCol()) + (!UtilityString.isNullOrEmpty(mtbColr.getMtbAart().getUntMis()) ? "\n" + mtbColr.getMtbAart().getUntMis() : ""));
|
||||||
|
} else {
|
||||||
|
holder.mViewDataBinding.qtaTextview.setText(UtilityNumber.decimalToString(mtbColr.getNumCnf()) + "\n" + mContext.getString(R.string.unt_mis_col));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
holder.mViewDataBinding.qtaTextview.setText(UtilityNumber.decimalToString(mtbColr.getQtaCol()));
|
||||||
|
}
|
||||||
|
|
||||||
holder.mViewDataBinding.getRoot().setOnClickListener(x -> {
|
holder.mViewDataBinding.getRoot().setOnClickListener(x -> {
|
||||||
if(mOnItemClickListener != null) {
|
if(mOnItemClickListener != null) {
|
||||||
mOnItemClickListener.onItemClick(item, position);
|
mOnItemClickListener.onItemClick(mtbColr, position);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -112,7 +125,7 @@ public class RettificaGiacenzeMainListAdapter extends RecyclerView.Adapter<Retti
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void checkIfEmpty() {
|
private void checkIfEmpty() {
|
||||||
if (mEmptyView != null) {
|
if (mEmptyView != null) {
|
||||||
final boolean emptyViewVisible = getItemCount() == 0;
|
final boolean emptyViewVisible = getItemCount() == 0;
|
||||||
mEmptyView.setVisibility(emptyViewVisible ? View.VISIBLE : View.GONE);
|
mEmptyView.setVisibility(emptyViewVisible ? View.VISIBLE : View.GONE);
|
||||||
|
|||||||
@ -56,6 +56,7 @@ import it.integry.integrywmsnative.gest.rettifica_giacenze.core.RettificaGiacenz
|
|||||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.core.adapter.AutoCompleteFornitoreAdapter;
|
import it.integry.integrywmsnative.gest.rettifica_giacenze.core.adapter.AutoCompleteFornitoreAdapter;
|
||||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.core.adapter.RettificaGiacenzeMainListAdapter;
|
import it.integry.integrywmsnative.gest.rettifica_giacenze.core.adapter.RettificaGiacenzeMainListAdapter;
|
||||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.dto.FornitoreDTO;
|
import it.integry.integrywmsnative.gest.rettifica_giacenze.dto.FornitoreDTO;
|
||||||
|
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageHelper;
|
||||||
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLU;
|
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLU;
|
||||||
@ -505,26 +506,19 @@ public class RettificaGiacenzeViewModel implements IRecyclerItemClicked<MtbColr>
|
|||||||
if (thereIsAnyRowInUL()) {
|
if (thereIsAnyRowInUL()) {
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(SettingsManager.iDB().getDefaultCausaleRettificaGiacenze()) && saveCausale) {
|
if (!UtilityString.isNullOrEmpty(SettingsManager.iDB().getDefaultCausaleRettificaGiacenze()) && saveCausale) {
|
||||||
posizionaCollo(() ->
|
saveCausaleRettificaGiacenze(progress, () -> {
|
||||||
saveCausaleRettificaGiacenze(progress, () -> {
|
posizionaCollo(() -> postSaveOperations(openNewOne, progress),
|
||||||
if (!mtbColt.get().getDisablePrint()) {
|
() -> {
|
||||||
printCollo(progress);
|
progress.dismiss();
|
||||||
} else {
|
resetMtbColt(openNewOne);
|
||||||
progress.dismiss();
|
},
|
||||||
resetMtbColt(openNewOne);
|
ex -> UtilityExceptions.defaultException(mContext, ex, progress));
|
||||||
}
|
});
|
||||||
}), progress::dismiss, ex ->
|
|
||||||
UtilityExceptions.defaultException(mContext, ex, progress)
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
posizionaCollo(() -> {
|
posizionaCollo(() -> {
|
||||||
if (!mtbColt.get().getDisablePrint()) {
|
postSaveOperations(openNewOne, progress);
|
||||||
printCollo(progress);
|
|
||||||
} else {
|
|
||||||
progress.dismiss();
|
|
||||||
resetMtbColt(openNewOne);
|
|
||||||
}
|
|
||||||
}, () -> {
|
}, () -> {
|
||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
resetMtbColt(openNewOne);
|
resetMtbColt(openNewOne);
|
||||||
@ -541,6 +535,16 @@ public class RettificaGiacenzeViewModel implements IRecyclerItemClicked<MtbColr>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void postSaveOperations(boolean openNewOne, Dialog progressDialog) {
|
||||||
|
if (!mtbColt.get().getDisablePrint()) {
|
||||||
|
printCollo(progressDialog);
|
||||||
|
} else {
|
||||||
|
progressDialog.dismiss();
|
||||||
|
resetMtbColt(openNewOne);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void saveCausaleRettificaGiacenze(Dialog progress, Runnable onComplete) {
|
private void saveCausaleRettificaGiacenze(Dialog progress, Runnable onComplete) {
|
||||||
|
|
||||||
final MtbCols mtbCols = new MtbCols()
|
final MtbCols mtbCols = new MtbCols()
|
||||||
@ -562,6 +566,7 @@ public class RettificaGiacenzeViewModel implements IRecyclerItemClicked<MtbColr>
|
|||||||
@Override
|
@Override
|
||||||
public void onFailed(Exception ex) {
|
public void onFailed(Exception ex) {
|
||||||
UtilityExceptions.defaultException(mContext, ex, progress);
|
UtilityExceptions.defaultException(mContext, ex, progress);
|
||||||
|
DialogCommon.showRestError(mContext, ex, onComplete::run);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,9 +90,6 @@ public class MainVenditaFragment extends Fragment implements ITitledFragment, IS
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
if (getArguments() != null) {
|
|
||||||
}
|
|
||||||
|
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
init();
|
init();
|
||||||
@ -218,7 +215,6 @@ public class MainVenditaFragment extends Fragment implements ITitledFragment, IS
|
|||||||
final String finalDataCons = dataCons;
|
final String finalDataCons = dataCons;
|
||||||
checkSelectedOrders(selectedOrders, () -> {
|
checkSelectedOrders(selectedOrders, () -> {
|
||||||
|
|
||||||
|
|
||||||
RunnableArgs<List<PickingObjectDTO>> onPostGetPickingList = ordini -> {
|
RunnableArgs<List<PickingObjectDTO>> onPostGetPickingList = ordini -> {
|
||||||
|
|
||||||
mHelper.getBancaliVenditaGiaRegistrati(selectedOrders, mtbColtList -> {
|
mHelper.getBancaliVenditaGiaRegistrati(selectedOrders, mtbColtList -> {
|
||||||
|
|||||||
@ -61,17 +61,14 @@ public class VenditaHelper {
|
|||||||
onComplete.run(response.body().getDto());
|
onComplete.run(response.body().getDto());
|
||||||
} else {
|
} else {
|
||||||
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
||||||
Log.e("Vendita", response.body().getErrorMessage());
|
|
||||||
onFailed.run(new Exception(response.body().getErrorMessage()));
|
onFailed.run(new Exception(response.body().getErrorMessage()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
||||||
Log.e("Vendita", response.message());
|
|
||||||
onFailed.run(new Exception(response.message()));
|
onFailed.run(new Exception(response.message()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
||||||
Log.e("Vendita", "Status " + response.code() + ": " + response.message());
|
|
||||||
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,18 +108,15 @@ public class VenditaHelper {
|
|||||||
onComplete.run(response.body().getDto());
|
onComplete.run(response.body().getDto());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.e("Vendita", response.body().getErrorMessage());
|
|
||||||
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
||||||
onFailed.run(new Exception(response.body().getErrorMessage()));
|
onFailed.run(new Exception(response.body().getErrorMessage()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("Vendita", response.message());
|
|
||||||
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
||||||
onFailed.run(new Exception(response.message()));
|
onFailed.run(new Exception(response.message()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
||||||
Log.e("Vendita", "Status " + response.code() + ": " + response.message());
|
|
||||||
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,8 +124,6 @@ public class VenditaHelper {
|
|||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<PickingObjectDTO>>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<List<PickingObjectDTO>>> call, Throwable t) {
|
||||||
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
||||||
Log.e("Vendita", t.toString());
|
|
||||||
UtilityLogger.errorMe(new Exception(t));
|
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(new Exception(t));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -167,18 +159,15 @@ public class VenditaHelper {
|
|||||||
onComplete.run(response.body().getDto());
|
onComplete.run(response.body().getDto());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.e("Vendita", response.body().getErrorMessage());
|
|
||||||
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
||||||
onFailed.run(new Exception(response.body().getErrorMessage()));
|
onFailed.run(new Exception(response.body().getErrorMessage()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("Vendita", response.message());
|
|
||||||
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
||||||
onFailed.run(new Exception(response.message()));
|
onFailed.run(new Exception(response.message()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
||||||
Log.e("Vendita", "Status " + response.code() + ": " + response.message());
|
|
||||||
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,8 +175,6 @@ public class VenditaHelper {
|
|||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<PickingObjectDTO>>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<List<PickingObjectDTO>>> call, Throwable t) {
|
||||||
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
UtilityFirebase.stopPerformanceTrace(perfTrace, true);
|
||||||
Log.e("Vendita", t.toString());
|
|
||||||
UtilityLogger.errorMe(new Exception(t));
|
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(new Exception(t));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -246,9 +233,6 @@ public class VenditaHelper {
|
|||||||
|
|
||||||
|
|
||||||
public void getOrdiniInCommessaCollo(MtbColt testataCollo, RunnableArgs<List<DtbOrdt>> onComplete, RunnableArgs<Exception> onFailed) {
|
public void getOrdiniInCommessaCollo(MtbColt testataCollo, RunnableArgs<List<DtbOrdt>> onComplete, RunnableArgs<Exception> onFailed) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OrdiniVenditaRESTConsumerService service = RESTBuilder.getService(OrdiniVenditaRESTConsumerService.class);
|
OrdiniVenditaRESTConsumerService service = RESTBuilder.getService(OrdiniVenditaRESTConsumerService.class);
|
||||||
service.getOrdiniInCommessaCollo(
|
service.getOrdiniInCommessaCollo(
|
||||||
testataCollo.getDataColloS(),
|
testataCollo.getDataColloS(),
|
||||||
@ -267,15 +251,12 @@ public class VenditaHelper {
|
|||||||
if(response.body().getEsito() == EsitoType.OK) {
|
if(response.body().getEsito() == EsitoType.OK) {
|
||||||
onComplete.run(response.body().getDto());
|
onComplete.run(response.body().getDto());
|
||||||
} else {
|
} else {
|
||||||
Log.e("getOrdiniInCommCollo", response.body().getErrorMessage());
|
|
||||||
onFailed.run(new Exception(response.body().getErrorMessage()));
|
onFailed.run(new Exception(response.body().getErrorMessage()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("getOrdiniInCommCollo", response.message());
|
|
||||||
onFailed.run(new Exception(response.message()));
|
onFailed.run(new Exception(response.message()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e("getOrdiniInCommCollo", "Status " + response.code() + ": " + response.message());
|
|
||||||
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
onFailed.run(new Exception("Status " + response.code() + ": " + response.message()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,8 +264,6 @@ public class VenditaHelper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call<ServiceRESTResponse<List<DtbOrdt>>> call, Throwable t) {
|
public void onFailure(Call<ServiceRESTResponse<List<DtbOrdt>>> call, Throwable t) {
|
||||||
Log.e("getOrdiniInCommCollo", t.toString());
|
|
||||||
UtilityLogger.errorMe(new Exception(t));
|
|
||||||
onFailed.run(new Exception(t));
|
onFailed.run(new Exception(t));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1166,7 +1166,7 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dto.setQtaTot(tmpPickData.getQtaTot());
|
dto.setQtaTot(qtaDaEvadere.floatValue() < tmpPickData.getQtaTot().floatValue() ? qtaDaEvadere : tmpPickData.getQtaTot());
|
||||||
dto.setMaxQta(tmpPickData.getQtaTot());
|
dto.setMaxQta(tmpPickData.getQtaTot());
|
||||||
|
|
||||||
if(tmpPickData.getNumCnf() != null) {
|
if(tmpPickData.getNumCnf() != null) {
|
||||||
@ -1200,6 +1200,12 @@ public class VenditaOrdineInevasoViewModel implements IOnColloClosedCallback, IO
|
|||||||
dto.setCanPartitaMagBeChanged(false);
|
dto.setCanPartitaMagBeChanged(false);
|
||||||
dto.setCanDataScadBeChanged(false);
|
dto.setCanDataScadBeChanged(false);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
dto.setNumCnf(item.getNumCnfCollo() != null ? item.getNumCnfCollo().intValue() : item.getNumCnfOrd().intValue());
|
||||||
|
|
||||||
|
if(dto.getNumCnf() != null && dto.getQtaTot() != null && dto.getNumCnf() > 0 && dto.getQtaTot().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
dto.setQtaCnf(dto.getQtaTot().divide(new BigDecimal(dto.getNumCnf()), 3, RoundingMode.HALF_EVEN));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean canOverflowQuantity = SettingsManager.iDB().isFlagCanAddExtraQuantitySpedizione();
|
boolean canOverflowQuantity = SettingsManager.iDB().isFlagCanAddExtraQuantitySpedizione();
|
||||||
|
|||||||
@ -278,7 +278,7 @@ public class VersamentoMerceViewModel {
|
|||||||
//Se le gestioni sono uguali faccio uno storno sulla sorgente e non lavoro con
|
//Se le gestioni sono uguali faccio uno storno sulla sorgente e non lavoro con
|
||||||
//i riferimenti
|
//i riferimenti
|
||||||
if(sourceMtbColt.getGestioneEnum() == destMtbColt.getGestioneEnum() &&
|
if(sourceMtbColt.getGestioneEnum() == destMtbColt.getGestioneEnum() &&
|
||||||
(sourceMtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || sourceMtbColt.getGestioneEnum() == GestioneEnum.VENDITA)){
|
(/*sourceMtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO ||*/ sourceMtbColt.getGestioneEnum() == GestioneEnum.VENDITA)){
|
||||||
destroyMtbColrReferences = true;
|
destroyMtbColrReferences = true;
|
||||||
|
|
||||||
MtbColr stornoSourceMtbColr = (MtbColr) destNewMtbColr.get(i).clone();
|
MtbColr stornoSourceMtbColr = (MtbColr) destNewMtbColr.get(i).clone();
|
||||||
|
|||||||
@ -41,4 +41,10 @@ public class DialogCommon {
|
|||||||
null, onPositiveClick).show();
|
null, onPositiveClick).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void showRestError(@NotNull Context context, Exception ex, @Nullable Runnable onPositiveClick) {
|
||||||
|
DialogSimpleMessageHelper.makeErrorDialog(context,
|
||||||
|
new SpannableString(ex.getMessage()), null, onPositiveClick).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,8 @@ import android.content.res.ColorStateList;
|
|||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.databinding.Observable;
|
import androidx.databinding.Observable;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import com.google.android.material.textfield.TextInputLayout;
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
@ -26,6 +28,7 @@ import android.widget.EditText;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
@ -40,6 +43,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgss;
|
|||||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||||
|
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||||
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.UtilityLogger;
|
||||||
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
import it.integry.integrywmsnative.core.utility.UtilityNumber;
|
||||||
@ -208,7 +212,7 @@ public class DialogInputQuantity {
|
|||||||
|
|
||||||
private String scadenzaString = "Scadenza";
|
private String scadenzaString = "Scadenza";
|
||||||
|
|
||||||
private AlertDialog currentAlert;
|
private Dialog currentDialog;
|
||||||
private Context currentContext;
|
private Context currentContext;
|
||||||
|
|
||||||
private DialogInputQuantityArticoloBinding currentBinding;
|
private DialogInputQuantityArticoloBinding currentBinding;
|
||||||
@ -217,14 +221,14 @@ public class DialogInputQuantity {
|
|||||||
private QuantityDTO currentQuantityDto;
|
private QuantityDTO currentQuantityDto;
|
||||||
private DTO currentDTO;
|
private DTO currentDTO;
|
||||||
|
|
||||||
public static AlertDialog makeBase(final Context context, final DTO dto, boolean canOverflowQuantity, final RunnableArgs<QuantityDTO> dialogCallback, final Runnable onAbort) {
|
public static Dialog makeBase(final Context context, final DTO dto, boolean canOverflowQuantity, final RunnableArgs<QuantityDTO> dialogCallback, final Runnable onAbort) {
|
||||||
return new DialogInputQuantity(context, dto, canOverflowQuantity, false, (quantityDto, closeUL) -> {
|
return new DialogInputQuantity(context, dto, canOverflowQuantity, false, (quantityDto, closeUL) -> {
|
||||||
dialogCallback.run(quantityDto);
|
dialogCallback.run(quantityDto);
|
||||||
}, onAbort).currentAlert;
|
}, onAbort).currentDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AlertDialog makeBase(final Context context, final DTO dto, boolean canOverflowQuantity, final RunnableArgss<QuantityDTO, Boolean> dialogCallback, final Runnable onAbort) {
|
public static Dialog makeBase(final Context context, final DTO dto, boolean canOverflowQuantity, final RunnableArgss<QuantityDTO, Boolean> dialogCallback, final Runnable onAbort) {
|
||||||
return new DialogInputQuantity(context, dto, canOverflowQuantity, true, dialogCallback, onAbort).currentAlert;
|
return new DialogInputQuantity(context, dto, canOverflowQuantity, true, dialogCallback, onAbort).currentDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DialogInputQuantity(@NotNull Context context, @NotNull final DTO dto, boolean canOverflowQuantity, boolean showCloseUL, final RunnableArgss<QuantityDTO, Boolean> dialogCallback, final Runnable onAbort) {
|
public DialogInputQuantity(@NotNull Context context, @NotNull final DTO dto, boolean canOverflowQuantity, boolean showCloseUL, final RunnableArgss<QuantityDTO, Boolean> dialogCallback, final Runnable onAbort) {
|
||||||
@ -258,19 +262,17 @@ public class DialogInputQuantity {
|
|||||||
currentBinding.setViewmodel(dto);
|
currentBinding.setViewmodel(dto);
|
||||||
currentBinding.setQuantityViewModel(currentQuantityDto);
|
currentBinding.setQuantityViewModel(currentQuantityDto);
|
||||||
|
|
||||||
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
|
|
||||||
.setView(currentBinding.getRoot())
|
|
||||||
.setPositiveButton(context.getText(R.string.confirm), null)
|
|
||||||
.setNegativeButton(context.getText(R.string.abort), (dialog, which) -> {
|
|
||||||
if(onAbort != null) onAbort.run();
|
|
||||||
});
|
|
||||||
|
|
||||||
if(showCloseUL) alertDialog.setNeutralButton("Chiudi UL", null);
|
currentDialog = new Dialog(context);
|
||||||
|
currentDialog.setContentView(currentBinding.getRoot());
|
||||||
|
|
||||||
currentAlert = alertDialog.create();
|
currentDialog.setCanceledOnTouchOutside(false);
|
||||||
currentAlert.setCanceledOnTouchOutside(false);
|
currentDialog.setCancelable(false);
|
||||||
|
currentDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
currentAlert.setOnShowListener(dialogInterface -> {
|
currentDialog.setCanceledOnTouchOutside(false);
|
||||||
|
|
||||||
|
currentDialog.setOnShowListener(dialogInterface -> {
|
||||||
|
|
||||||
final Handler handler = new Handler();
|
final Handler handler = new Handler();
|
||||||
handler.postDelayed(() -> {
|
handler.postDelayed(() -> {
|
||||||
@ -286,18 +288,25 @@ public class DialogInputQuantity {
|
|||||||
|
|
||||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.showSoftInput(editTextToFocus, InputMethodManager.SHOW_IMPLICIT);
|
imm.showSoftInput(editTextToFocus, InputMethodManager.SHOW_IMPLICIT);
|
||||||
|
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
Button positiveButton = currentAlert.getButton(AlertDialog.BUTTON_POSITIVE);
|
|
||||||
positiveButton.setOnClickListener(view -> onConfirm(context, currentQuantityDto, dialogCallback, false));
|
|
||||||
|
|
||||||
if(showCloseUL) {
|
|
||||||
Button neutralButton = currentAlert.getButton(AlertDialog.BUTTON_NEUTRAL);
|
|
||||||
neutralButton.setOnClickListener(view -> onConfirm(context, currentQuantityDto, dialogCallback, true));
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
currentBinding.saveBtn.setOnClickListener(view -> {
|
||||||
|
onConfirm(context, currentQuantityDto, dialogCallback, false);
|
||||||
|
currentDialog.dismiss();
|
||||||
|
});
|
||||||
|
currentBinding.abortBtn.setOnClickListener(view -> {
|
||||||
|
if(onAbort != null) onAbort.run();
|
||||||
|
currentDialog.dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
|
currentBinding.closeLuBtn.setVisibility(showCloseUL ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
currentBinding.closeLuBtn.setOnClickListener(view -> {
|
||||||
|
onConfirm(context, currentQuantityDto, dialogCallback, true);
|
||||||
|
currentDialog.dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
initDatePicker(context, currentQuantityDto, currentBinding.getRoot().findViewById(R.id.input_data_scad));
|
initDatePicker(context, currentQuantityDto, currentBinding.getRoot().findViewById(R.id.input_data_scad));
|
||||||
|
|
||||||
@ -327,8 +336,18 @@ public class DialogInputQuantity {
|
|||||||
quantityDTO.batchLot.set(dto.batchLot);
|
quantityDTO.batchLot.set(dto.batchLot);
|
||||||
if(quantityDTO.qtaCnf.get(false) == null) {
|
if(quantityDTO.qtaCnf.get(false) == null) {
|
||||||
if(dto.getQtaCnf() != null) {
|
if(dto.getQtaCnf() != null) {
|
||||||
|
|
||||||
quantityDTO.qtaCnf.set(dto.getQtaCnf().floatValue());
|
quantityDTO.qtaCnf.set(dto.getQtaCnf().floatValue());
|
||||||
|
|
||||||
|
} else if(dto.numCnf != null && dto.qtaTot != null &&
|
||||||
|
dto.numCnf > 0 && dto.qtaTot.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
|
||||||
|
quantityDTO.qtaCnfNotificationEnabled = false;
|
||||||
|
quantityDTO.qtaCnf.set(dto.qtaTot.divide(new BigDecimal(dto.numCnf), RoundingMode.HALF_EVEN).floatValue());
|
||||||
|
quantityDTO.qtaCnfNotificationEnabled = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
quantityDTO.qtaCnf.set(dto.mtbAart.getQtaCnf().floatValue());
|
quantityDTO.qtaCnf.set(dto.mtbAart.getQtaCnf().floatValue());
|
||||||
|
|
||||||
if(dto.getMtbAart().isFlagQtaCnfFissa()) {
|
if(dto.getMtbAart().isFlagQtaCnfFissa()) {
|
||||||
@ -385,7 +404,7 @@ public class DialogInputQuantity {
|
|||||||
.setOnScanSuccessfull(onScanSuccessfull)
|
.setOnScanSuccessfull(onScanSuccessfull)
|
||||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(context, ex, false)));
|
.setOnScanFailed(ex -> UtilityExceptions.defaultException(context, ex, false)));
|
||||||
|
|
||||||
currentAlert.setOnDismissListener(dialog -> {
|
currentDialog.setOnDismissListener(dialog -> {
|
||||||
BarcodeManager.removeCallback(barcodeIstanceID);
|
BarcodeManager.removeCallback(barcodeIstanceID);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -525,7 +544,9 @@ public class DialogInputQuantity {
|
|||||||
if (!quantityDTO.blockedQtaTot.get()) {
|
if (!quantityDTO.blockedQtaTot.get()) {
|
||||||
|
|
||||||
quantityDTO.qtaTotNotificationEnabled = false;
|
quantityDTO.qtaTotNotificationEnabled = false;
|
||||||
quantityDTO.qtaTot.set((float) Math.round(quantityDTO.qtaCnf.get(true) * quantityDTO.numCnf.get(true) * 1000) / 1000);
|
float qtaTot = (float) Math.round(quantityDTO.qtaCnf.get(true) * quantityDTO.numCnf.get(true) * 1000) / 1000;
|
||||||
|
if(qtaTot > quantityDTO.maxQta.get() && !quantityDTO.canOverflowQuantity) qtaTot = quantityDTO.maxQta.get();
|
||||||
|
quantityDTO.qtaTot.set(qtaTot);
|
||||||
quantityDTO.qtaTotNotificationEnabled = true;
|
quantityDTO.qtaTotNotificationEnabled = true;
|
||||||
|
|
||||||
} else if (!quantityDTO.blockedNumDiCnf.get()) {
|
} else if (!quantityDTO.blockedNumDiCnf.get()) {
|
||||||
@ -662,9 +683,6 @@ public class DialogInputQuantity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
text += "</b>";
|
text += "</b>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentBinding.qtaDescriptionText.setText(Html.fromHtml(text));
|
currentBinding.qtaDescriptionText.setText(Html.fromHtml(text));
|
||||||
@ -701,7 +719,7 @@ public class DialogInputQuantity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dialogCallback.run(quantityDTO, closeUL);
|
dialogCallback.run(quantityDTO, closeUL);
|
||||||
currentAlert.dismiss();
|
currentDialog.dismiss();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -734,7 +752,6 @@ public class DialogInputQuantity {
|
|||||||
private void showBatchLotErrorPrompt(Context mContext){
|
private void showBatchLotErrorPrompt(Context mContext){
|
||||||
|
|
||||||
String errorMessage = mContext.getText(R.string.batch_lot_error_message).toString();
|
String errorMessage = mContext.getText(R.string.batch_lot_error_message).toString();
|
||||||
|
|
||||||
DialogSimpleMessageHelper.makeErrorDialog(mContext, new SpannableString(Html.fromHtml(errorMessage)), null, null).show();
|
DialogSimpleMessageHelper.makeErrorDialog(mContext, new SpannableString(Html.fromHtml(errorMessage)), null, null).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
|
|
||||||
</vector>
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
|
|
||||||
</vector>
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
<vector android:height="24dp" android:tint="@color/red_600"
|
|
||||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<path android:fillColor="#FFFFFF" android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
|
|
||||||
</vector>
|
|
||||||
@ -29,12 +29,15 @@
|
|||||||
|
|
||||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="12dp"
|
||||||
|
app:cardElevation="0dp">
|
||||||
|
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="16dp">
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/dialog_title"
|
android:id="@+id/dialog_title"
|
||||||
@ -48,8 +51,8 @@
|
|||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:text='@{viewmodel.mtbAart.codMart + (!UtilityString.isNullOrEmpty(viewmodel.batchLot) ? " (" + viewmodel.batchLot + ")" : "") }'
|
android:text='@{viewmodel.mtbAart.codMart + (!UtilityString.isNullOrEmpty(viewmodel.batchLot) ? " (" + viewmodel.batchLot + ")" : "") }'
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="18sp"
|
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
|
style="@style/AppTheme.NewMaterial.Text.Medium"
|
||||||
tools:text="AV25D200010B"/>
|
tools:text="AV25D200010B"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
@ -59,21 +62,22 @@
|
|||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:text='@{!UtilityString.isNullOrEmpty(viewmodel.mtbAart.diacod) ? viewmodel.mtbAart.diacod : ""}'
|
android:text='@{!UtilityString.isNullOrEmpty(viewmodel.mtbAart.diacod) ? viewmodel.mtbAart.diacod : ""}'
|
||||||
android:textColor="@color/red_600"
|
android:textColor="@color/red_600"
|
||||||
android:textSize="16sp"
|
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:visibility="@{UtilityString.isNullOrEmpty(viewmodel.mtbAart.diacod) ? View.GONE : View.VISIBLE}"
|
android:visibility="@{UtilityString.isNullOrEmpty(viewmodel.mtbAart.diacod) ? View.GONE : View.VISIBLE}"
|
||||||
|
style="@style/AppTheme.NewMaterial.Text.Medium"
|
||||||
tools:text="DIACOD HERE"/>
|
tools:text="DIACOD HERE"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:paddingLeft="8dp"
|
android:paddingStart="8dp"
|
||||||
|
android:paddingEnd="0dp"
|
||||||
android:text='@{viewmodel.mtbAart.untMis != null ? "(" + viewmodel.mtbAart.untMis + ")" : ""}'
|
android:text='@{viewmodel.mtbAart.untMis != null ? "(" + viewmodel.mtbAart.untMis + ")" : ""}'
|
||||||
android:textColor="#000"
|
android:textColor="#000"
|
||||||
android:textSize="18sp"
|
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
tools:text="(PZ)"
|
tools:text="(PZ)"
|
||||||
|
style="@style/AppTheme.NewMaterial.Text.Medium"
|
||||||
app:layout_constraintRight_toRightOf="parent" />
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@ -101,8 +105,8 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{viewmodel.mtbAart.descrizioneEstesa}"
|
android:text="@{viewmodel.mtbAart.descrizioneEstesa}"
|
||||||
android:textSize="16sp"
|
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
|
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||||
tools:text="RAD 25 D H/L 200 - 10 EL B BIANCO" />
|
tools:text="RAD 25 D H/L 200 - 10 EL B BIANCO" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -355,7 +359,62 @@
|
|||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:weightSum="1">
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/close_lu_btn"
|
||||||
|
android:layout_weight="0.4"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/Button.PrimaryOutline"
|
||||||
|
android:layout_marginStart="0dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/left_buttons_guideline"
|
||||||
|
app:strokeColor="@color/colorPrimary"
|
||||||
|
android:text="@string/action_close_ul"/>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/abort_btn"
|
||||||
|
android:layout_weight="0.3"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/Button.DangerFull"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:paddingEnd="3dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/left_buttons_guideline"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/right_buttons_guideline"
|
||||||
|
app:icon="@drawable/ic_close_24dp"
|
||||||
|
app:iconGravity="textStart"/>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/save_btn"
|
||||||
|
android:layout_weight="0.3"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/Button.PrimaryFull"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:layout_marginEnd="0dp"
|
||||||
|
android:paddingEnd="3dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/right_buttons_guideline"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:icon="@drawable/ic_save_24"
|
||||||
|
app:iconGravity="textStart"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|||||||
@ -23,16 +23,18 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/qta_box"
|
app:layout_constraintEnd_toStartOf="@+id/qta_box"
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/cod_mart"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{mtbColr.codMart}"
|
android:text="@{mtbColr.codMart}"
|
||||||
@ -42,6 +44,7 @@
|
|||||||
tools:text="COD MART" />
|
tools:text="COD MART" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/diacod"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{`(` + mtbColr.mtbAart.diacod + `)`}"
|
android:text="@{`(` + mtbColr.mtbAart.diacod + `)`}"
|
||||||
@ -49,10 +52,28 @@
|
|||||||
android:textSize="13sp"
|
android:textSize="13sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_toEndOf="@id/cod_mart"
|
||||||
android:visibility="@{(mtbColr.mtbAart != null && !UtilityString.isNullOrEmpty(mtbColr.mtbAart.diacod)) ? View.VISIBLE : View.GONE}"
|
android:visibility="@{(mtbColr.mtbAart != null && !UtilityString.isNullOrEmpty(mtbColr.mtbAart.diacod)) ? View.VISIBLE : View.GONE}"
|
||||||
tools:text="(12345)" />
|
tools:text="(12345)" />
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@{UtilityNumber.decimalToString(mtbColr.qtaCol) + mtbColr.mtbAart.untMis}"
|
||||||
|
android:visibility="@{mtbColr.mtbAart != null && !mtbColr.mtbAart.isFlagQtaCnfFissa() ? View.VISIBLE : View.GONE}"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:paddingStart="6dp"
|
||||||
|
android:paddingEnd="6dp"
|
||||||
|
android:background="@drawable/badge2_round_corner"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
style="@style/AppTheme.NewMaterial.Text.Small"
|
||||||
|
tools:text="PESO KG" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -90,6 +111,7 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent">
|
app:layout_constraintBottom_toBottomOf="parent">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/qta_textview"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/badge1_round_corner"
|
android:background="@drawable/badge1_round_corner"
|
||||||
@ -98,10 +120,10 @@
|
|||||||
android:paddingTop="2dp"
|
android:paddingTop="2dp"
|
||||||
android:paddingRight="6dp"
|
android:paddingRight="6dp"
|
||||||
android:paddingBottom="2dp"
|
android:paddingBottom="2dp"
|
||||||
android:text="@{UtilityNumber.decimalToString(mtbColr.getQtaCol()) + (mtbColr.mtbAart != null && !UtilityString.isNullOrEmpty(mtbColr.mtbAart.untMis) ? `\n` + mtbColr.mtbAart.untMis : ``)}"
|
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
|
android:textAllCaps="true"
|
||||||
tools:text="280.45\nCONF" />
|
tools:text="280.45\nCONF" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
@ -55,28 +55,28 @@ public class KeyboardEmulatorBarcodeReader implements BarcodeReaderInterface {
|
|||||||
@Override
|
@Override
|
||||||
public void onKeyEvent(KeyEvent keyEvent) {
|
public void onKeyEvent(KeyEvent keyEvent) {
|
||||||
|
|
||||||
if (keyEvent.getEventTime() - mLastCharInsertTime > 500){
|
if (keyEvent.getEventTime() - mLastCharInsertTime > 500) {
|
||||||
mLastCharInsertTime =keyEvent.getEventTime();
|
mLastCharInsertTime = keyEvent.getEventTime();
|
||||||
mTextBarcode = "";
|
mTextBarcode = "";
|
||||||
}
|
}
|
||||||
if (keyEvent.getKeyCode() != KeyEvent.KEYCODE_ENTER){
|
if (keyEvent.getKeyCode() != KeyEvent.KEYCODE_ENTER) {
|
||||||
if (keyEvent.getKeyCode() != KeyEvent.KEYCODE_SHIFT_LEFT){
|
if (keyEvent.getKeyCode() != KeyEvent.KEYCODE_SHIFT_LEFT) {
|
||||||
mLastCharInsertTime =keyEvent.getEventTime();
|
mLastCharInsertTime = keyEvent.getEventTime();
|
||||||
if (keyEvent.getUnicodeChar() > 0){
|
if (keyEvent.getUnicodeChar() > 0) {
|
||||||
mTextBarcode+= (char) keyEvent.getUnicodeChar();
|
mTextBarcode += (char) keyEvent.getUnicodeChar();
|
||||||
}else if (keyEvent.getCharacters() != null){
|
} else if (keyEvent.getCharacters() != null) {
|
||||||
mTextBarcode = keyEvent.getCharacters();
|
mTextBarcode = keyEvent.getCharacters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
if (mTextBarcode.length() > 0){
|
if (mTextBarcode.length() > 0) {
|
||||||
|
|
||||||
BarcodeType barcodeType = decodeBarcode(mTextBarcode);
|
BarcodeType barcodeType = decodeBarcode(mTextBarcode);
|
||||||
BarcodeScanDTO barcodeScanDTO = new BarcodeScanDTO()
|
BarcodeScanDTO barcodeScanDTO = new BarcodeScanDTO()
|
||||||
.setByteValue(mTextBarcode.getBytes())
|
.setByteValue(mTextBarcode.getBytes())
|
||||||
.setStringValue(mTextBarcode)
|
.setStringValue(mTextBarcode)
|
||||||
.setType(barcodeType)
|
.setType(barcodeType)
|
||||||
.setName(barcodeType != null ? barcodeType.toString():"");
|
.setName(barcodeType != null ? barcodeType.toString() : "");
|
||||||
|
|
||||||
mOnScanSuccessfull.run(barcodeScanDTO);
|
mOnScanSuccessfull.run(barcodeScanDTO);
|
||||||
}
|
}
|
||||||
@ -84,32 +84,52 @@ public class KeyboardEmulatorBarcodeReader implements BarcodeReaderInterface {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BarcodeType decodeBarcode(String barcode){
|
public BarcodeType decodeBarcode(String barcode) {
|
||||||
/*
|
/*Pattern patternUPCA = Pattern.compile("^[0-9]{12}$");
|
||||||
Pattern patternUPCA = Pattern.compile("^[0-9]{12}$");
|
|
||||||
Pattern patternUPCE = Pattern.compile("^[0-1][0-9]{7}$");
|
Pattern patternUPCE = Pattern.compile("^[0-1][0-9]{7}$");
|
||||||
Pattern patternUPCE1 = Pattern.compile("");
|
Pattern patternUPCE1 = Pattern.compile("");
|
||||||
Pattern patternEAN8 = Pattern.compile("^[0-9]{8}$");
|
Pattern patternEAN8 = Pattern.compile("^[0-9]{8}$");
|
||||||
Pattern patternEAN13 = Pattern.compile("^[0-9]{13}$");
|
Pattern patternEAN13 = Pattern.compile("^[0-9]{13}$");
|
||||||
Pattern patternCODE11 = Pattern.compile("");
|
Pattern patternCODE11 = Pattern.compile("");
|
||||||
Pattern patternCODE39 = Pattern.compile("");
|
Pattern patternCODE39 = Pattern.compile("");*/
|
||||||
if(){
|
if (barcode.length() == 8) {
|
||||||
return BarcodeType.CODE11;
|
try {
|
||||||
}else if(){
|
int checksum = getEanChecksum(barcode);
|
||||||
return BarcodeType.CODE39;
|
if (checksum == Integer.parseInt(barcode.substring(7))){
|
||||||
}else if(){
|
return BarcodeType.EAN8;
|
||||||
return BarcodeType.EAN13;
|
}
|
||||||
}else if(){
|
} catch (WrongFormatException e) {
|
||||||
return BarcodeType.EAN8;
|
return BarcodeType.CODE128;
|
||||||
}else if(){
|
}
|
||||||
return BarcodeType.UPCA;
|
} else if (barcode.length() == 13) {
|
||||||
}else if(){
|
try {
|
||||||
return BarcodeType.UPCE;
|
int checksum = getEanChecksum(barcode);
|
||||||
}else if(false){
|
if (checksum == Integer.parseInt(barcode.substring(12))){
|
||||||
return BarcodeType.UPCE1;
|
return BarcodeType.EAN13;
|
||||||
}else{
|
}
|
||||||
return BarcodeType.CODE128;
|
} catch (WrongFormatException e) {
|
||||||
}*/
|
return BarcodeType.CODE128;
|
||||||
|
}
|
||||||
|
}
|
||||||
return BarcodeType.CODE128;
|
return BarcodeType.CODE128;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int getEanChecksum(String barcode) throws WrongFormatException {
|
||||||
|
int odds = 0;
|
||||||
|
int evens = 0;
|
||||||
|
barcode = barcode.substring(0,barcode.length()-1);
|
||||||
|
int pos = 0;
|
||||||
|
for (int i = barcode.length() -1; i >=0 ; i--) {
|
||||||
|
pos++;
|
||||||
|
if (!Character.isDigit(barcode.charAt(i))) {
|
||||||
|
throw new WrongFormatException();
|
||||||
|
}
|
||||||
|
if (pos % 2 == 0) {
|
||||||
|
evens += Integer.parseInt(barcode.charAt(i)+"");
|
||||||
|
} else {
|
||||||
|
odds += Integer.parseInt(barcode.charAt(i)+"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ((10 - (((3 * odds) + evens) % 10)) % 10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,4 @@
|
|||||||
|
package it.integry.keyobardemulatorscannerlibrary;
|
||||||
|
|
||||||
|
public class WrongFormatException extends Exception {
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user