Compare commits

...

38 Commits

Author SHA1 Message Date
ac446d953c Finish v1.16.28(210) 2021-04-16 18:33:53 +02:00
407ff0b264 -> v1.16.28 (210) 2021-04-16 18:33:49 +02:00
10e748b9d4 Fix su getValue nel caso di integer in gest setup 2021-04-16 18:33:16 +02:00
e30273fe42 Finish v1.16.27(209) 2021-04-15 12:10:26 +02:00
44564245a7 Finish v1.16.27(209) 2021-04-15 12:10:25 +02:00
920f306907 -> v1.16.27 (209) 2021-04-15 12:10:20 +02:00
90aa52ab55 Fix versamento merce 2021-04-15 12:09:43 +02:00
93f3eb65f0 Finish v1.16.26(208) 2021-04-14 12:25:51 +02:00
eb94944928 Finish v1.16.26(208) 2021-04-14 12:25:50 +02:00
28698ba306 -> v1.16.26 (208) 2021-04-14 12:25:45 +02:00
c713bbebbc Fix su creazione collo involontaria in DialogScanOrCreateUL 2021-04-14 12:25:09 +02:00
38e2a02766 Finish v1.16.25(207) 2021-04-14 11:41:26 +02:00
dd8bf264a4 Finish v1.16.25(207) 2021-04-14 11:41:25 +02:00
9488c1994d -> v1.16.25 (207) 2021-04-14 11:41:20 +02:00
16099cdaf6 Fix su mtbPartitaMag in servizio spostaArtsTraUL 2021-04-14 11:40:06 +02:00
f061f2bfc9 Finish v1.16.24(206)#2 2021-04-12 15:34:42 +02:00
f7253fd44c Finish v1.16.24(206)#2 2021-04-12 15:34:42 +02:00
e12d371567 Finish v1.16.24(206) 2021-04-12 13:44:17 +02:00
5596f71c03 Merge branch 'master' into develop 2021-04-12 13:44:17 +02:00
8669b812f5 -> v1.16.24 (206) 2021-04-12 13:44:10 +02:00
3243484dd0 Ripristinato stato del filtro nell'elenco di ordini in uscita 2021-04-12 13:43:39 +02:00
37114dc4d1 Finish v1.16.23(205) 2021-04-12 12:48:26 +02:00
d5af79abba Finish v1.16.23(205) 2021-04-12 12:48:25 +02:00
b50aa7a9d2 -> v1.16.23 (205) 2021-04-12 12:48:19 +02:00
cc333c3147 Mini refactoring DialogAskCliente 2021-04-12 12:47:28 +02:00
fc5044134c Finish v1.16.22(204) 2021-04-12 09:39:10 +02:00
93a3e39332 Merge branch 'master' into develop 2021-04-12 09:39:10 +02:00
3eaf187136 -> v1.16.22 (204) 2021-04-12 09:39:03 +02:00
36f9fa1e36 Fix su null in ColliDataRecover 2021-04-12 09:37:45 +02:00
0f89913609 Finish v1.16.21(203) 2021-04-09 16:51:41 +02:00
4cda247ddc Finish v1.16.21(203) 2021-04-09 16:51:41 +02:00
e88ea0a45c -> v1.16.21 (203) 2021-04-09 16:51:36 +02:00
726cf80dc0 Implementata setup per ricalcolo qta 2021-04-09 16:51:02 +02:00
a779d8b94d Finish v1.16.20(202) 2021-04-08 18:18:32 +02:00
f41e1f3a02 Finish v1.16.20(202) 2021-04-08 18:18:31 +02:00
aa75a77913 -> v1.16.20 (202) 2021-04-08 18:18:24 +02:00
639be21ab5 Revert su ricalcolo qta_cnf in caso di peso variabile 2021-04-08 18:17:17 +02:00
dfc241e7f6 Finish v1.16.19(201) 2021-04-06 13:36:15 +02:00
19 changed files with 261 additions and 202 deletions

View File

@@ -6,8 +6,8 @@ apply plugin: 'com.google.gms.google-services'
android {
def appVersionCode = 201
def appVersionName = '1.16.19'
def appVersionCode = 210
def appVersionName = '1.16.28'
signingConfigs {
release {
@@ -101,7 +101,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.3.0-rc01'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'

View File

@@ -6,7 +6,6 @@ import androidx.appcompat.app.AppCompatActivity;
import com.annimon.stream.Optional;
import com.annimon.stream.Stream;
import com.google.android.gms.common.util.IOUtils;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@@ -122,7 +121,7 @@ public class ColliDataRecover {
}
public static boolean thereIsAnExistantSession() {
return mtbColtsSessions.size() > 0;
return mtbColtsSessions != null && mtbColtsSessions.size() > 0;
}
public static List<Integer> getAllSessionIDs() {
@@ -193,13 +192,16 @@ public class ColliDataRecover {
try {
inputStream = mContext.openFileInput(CommonConst.Files.RECOVER_COLLO_FILE);
byte[] bytes = IOUtils.readInputStreamFully(inputStream);
byte[] bytes = new byte[inputStream.available()];
inputStream.read(bytes);
inputStream.close();
String jsonString = new String(bytes);
Type listType = new TypeToken<ArrayList<RecoverDTO>>(){}.getType();
mtbColtsSessions = gson.fromJson(jsonString, listType);
inputStream.close();
if(mtbColtsSessions == null) mtbColtsSessions = new ArrayList<>();
} catch (Exception e) {
e.printStackTrace();
UtilityExceptions.defaultException(mContext, e);

View File

@@ -12,19 +12,24 @@ public class BaseFragment extends Fragment {
protected void openProgress() {
if (this.mCurrentProgress == null) {
new Thread(() -> {
getActivity().runOnUiThread(() -> {
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
if (this.mCurrentProgress == null) {
this.mCurrentProgress = UtilityProgress.createDefaultProgressDialog(getActivity());
}
});
}
}).start();
}
protected void closeProgress() {
if (mCurrentProgress != null) {
new Thread(() -> {
getActivity().runOnUiThread(() -> {
mCurrentProgress.dismiss();
mCurrentProgress = null;
if (mCurrentProgress != null) {
mCurrentProgress.dismiss();
mCurrentProgress = null;
}
});
}
}).start();
}
}

View File

@@ -660,9 +660,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
).enqueue(new Callback<ServiceRESTResponse<MtbColr>>() {
@Override
public void onResponse(Call<ServiceRESTResponse<MtbColr>> call, Response<ServiceRESTResponse<MtbColr>> response) {
analyzeAnswer(response, "creaRettificaCollo", data -> {
onComplete.run(data);
}, onFailed);
analyzeAnswer(response, "creaRettificaCollo", onComplete, onFailed);
}
@Override
@@ -674,6 +672,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
MtbColt mtbColtDestClone = (MtbColt) destMtbColt.clone();
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
mtbColtToMoveClone.getMtbColr().get(i)
@@ -681,9 +680,11 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
.setMtbPartitaMag(null);
}
mtbColtDestClone.setMtbColr(null);
SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO()
.setSourceMtbColt(sourceMtbColt)
.setDestinationMtbColt(destMtbColt);
.setSourceMtbColt(mtbColtToMoveClone)
.setDestinationMtbColt(mtbColtDestClone);
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
colliMagazzinoRESTConsumerService.spostaArtsTraUL(

View File

@@ -36,6 +36,7 @@ public class DBSettingsModel {
private boolean flagSpedizioneUseQtaOrd;
private String produzioneDefaultCodAnag;
private String reportNameSpedizionChiudiOrdine;
private int onNumCnfInputChanged = 1;
public boolean isFlagSpedizioneEnableFakeGiacenza() {
return flagSpedizioneEnableFakeGiacenza;
@@ -261,4 +262,13 @@ public class DBSettingsModel {
this.reportNameSpedizionChiudiOrdine = reportNameSpedizionChiudiOrdine;
return this;
}
public int getOnNumCnfInputChanged() {
return onNumCnfInputChanged;
}
public DBSettingsModel setOnNumCnfInputChanged(int onNumCnfInputChanged) {
this.onNumCnfInputChanged = onNumCnfInputChanged;
return this;
}
}

View File

@@ -262,6 +262,10 @@ public class SettingsManager {
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_USE_QTA_ORD"));
stbGestSetupList.add(new StbGestSetup()
.setGestName("PICKING")
.setSection("SETUP")
.setKeySection("ON_NUM_CNF_INPUT_CHANGED"));
GestSetupRESTConsumer.getValues(stbGestSetupList, list -> {
@@ -287,6 +291,11 @@ public class SettingsManager {
dbSettingsModelIstance.setReportNameSpedizionChiudiOrdine(getValueFromList(list, "SPEDIZIONE", "REPORT_PACKING_LIST", String.class));
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
Integer onNumCnfInputChanged = getValueFromList(list, "SETUP", "ON_NUM_CNF_INPUT_CHANGED", Integer.class);
if(onNumCnfInputChanged != null) {
dbSettingsModelIstance.setOnNumCnfInputChanged(onNumCnfInputChanged);
}
if(onComplete != null) onComplete.run();
}, onFailed);
@@ -303,6 +312,8 @@ public class SettingsManager {
return clazz.cast(value.getValue());
} else if(clazz == Boolean.class) {
return clazz.cast("S".equalsIgnoreCase(value.getValue()));
} else if(clazz == Integer.class) {
return clazz.cast(Integer.parseInt(value.getValue()));
} else return null;
}

View File

@@ -1,11 +1,8 @@
package it.integry.integrywmsnative.core.utility;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.widget.ProgressBar;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.view.dialogs.DialogProgress;
public class UtilityProgress {
@@ -26,27 +23,4 @@ public class UtilityProgress {
return progress;
}
public static Thread makeProgressBarIndeterminate(ProgressBar progressBar) {
progressBar.setMax(100);
Thread updateProgressThread = new Thread(() -> {
try {
while (true) {
for (int i = 0; i < 100; i++) {
progressBar.setProgress(i);
Thread.sleep(10);
}
}
} catch (Exception ex) {
// String message = ex.toString();
}
});
updateProgressThread.start();
return updateProgressThread;
}
}

View File

@@ -125,6 +125,9 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
this.initRecyclerView();
this.initBarcodeReader();
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
mViewModel.init(codMdep, mCurrentGestioneOrd, mCurrentGestioneCol, mCurrentSegnoCol);
return mBindings.getRoot();
}
@@ -132,8 +135,9 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF
public void onStart() {
super.onStart();
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
mViewModel.init(codMdep, mCurrentGestioneOrd, mCurrentGestioneCol, mCurrentSegnoCol);
if(mAppliedFilterViewModel != null) {
}
}
@Override

View File

@@ -53,8 +53,7 @@ import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
import it.integry.integrywmsnative.gest.spedizione.model.PickingObjectDTO;
import it.integry.integrywmsnative.ui.ElevatedToolbar;
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditView;
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskCliente;
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteView;
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArts;
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
@@ -290,13 +289,8 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
@Override
public void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort) {
DialogAskCliente.makeBase(getActivity(), (status, result, codJcom) -> {
if (status == DialogConsts.Results.YES) {
onComplete.run(result, codJcom);
} else {
onAbort.run();
}
}).show();
DialogAskClienteView.newInstance(onComplete, onAbort)
.show(getActivity().getSupportFragmentManager(), "tag");
}
@Override
@@ -305,7 +299,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
onAbort.run();
BarcodeManager.enable();
})
.show();
.show();
}
@Override
@@ -368,7 +362,6 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
}
@Override
public void onMtbColrEdit(MtbColr mtbColr) {
this.mViewModel.dispatchRowEdit(mtbColr);
@@ -382,7 +375,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
@Override
public void onPreDestroy(Runnable onComplete) {
BarcodeManager.removeCallback(barcodeScannerIstanceID);
if(thereIsAnOpenedUL.get()) mViewModel.closeLU(onComplete);
if (thereIsAnOpenedUL.get()) mViewModel.closeLU(onComplete);
else onComplete.run();
}

View File

@@ -179,7 +179,9 @@ public class PickingLiberoViewModel {
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
if (this.mFlagAskCliente) {
this.sendOnLoadingEnded();
this.sendLUClienteRequired((vtbDest, codJcom) -> {
this.sendOnLoadingStarted();
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, vtbDest, codJcom, onComplete);
}, onComplete);
} else {

View File

@@ -93,9 +93,9 @@ public class VersamentoMerceViewModel {
}, this::sendError);
} else {
if(!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) {
if (!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) {
this.sendOnSpostamentoTraDepConfirmRequired(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep(), canContinue -> {
if(canContinue) {
if (canContinue) {
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione));
} else {
onComplete.run();
@@ -165,7 +165,7 @@ public class VersamentoMerceViewModel {
private void pickMerceULtoUL(MtbColt destMtbColt) {
MtbColt sourceMtbColt = mCurrentMtbColt.getValue();
if(!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep())) {
if (!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep())) {
this.sendError(new Exception("Impossibile spostare la merce tra UL di due depositi differenti"));
return;
}
@@ -174,7 +174,7 @@ public class VersamentoMerceViewModel {
.filter(x -> x.getQtaCol().floatValue() > 0)
.toList();
if(mtbColrsToPick.size() == 0) {
if (mtbColrsToPick.size() == 0) {
this.sendError(new NoArtsInLUException());
return;
}
@@ -191,7 +191,7 @@ public class VersamentoMerceViewModel {
this.sendOnLoadingStarted();
this.mColliMagazzinoRESTConsumer.spostaArtsTraUL(
sourceMtbColt,
clonedSourceTestata,
destMtbColt,
this::sendOnDataSaved,
this::sendError

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.text.SpannableString;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -17,7 +18,7 @@ public class DialogCommon {
public static void showNoArtFoundDialog(@NotNull Context context, @Nullable Runnable onPositiveClick) {
DialogSimpleMessageView
.makeWarningDialog(new SpannableString(context.getResources().getText(R.string.no_result_from_barcode)),
null, onPositiveClick)
null, onPositiveClick)
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
}
@@ -31,17 +32,19 @@ public class DialogCommon {
public static void showNoOrderFound(@NotNull Context context, @Nullable Runnable onPositiveClick) {
DialogSimpleMessageView.makeWarningDialog(new SpannableString(context.getResources().getText(R.string.no_orders_found_message)),
null, onPositiveClick)
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");;
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
;
}
public static void showDataSaved(@NotNull Context context, @Nullable Runnable onPositiveClick) {
DialogSimpleMessageView.makeSuccessDialog(
context.getResources().getString(R.string.completed),
new SpannableString(context.getResources().getString(R.string.data_saved)),
null, onPositiveClick)
.show(((AppCompatActivity) context).getSupportFragmentManager(), "tag");
public static void showDataSaved(@NotNull FragmentActivity context, @Nullable Runnable onPositiveClick) {
context.runOnUiThread(() -> {
DialogSimpleMessageView.makeSuccessDialog(
context.getResources().getString(R.string.completed),
new SpannableString(context.getResources().getString(R.string.data_saved)),
null, onPositiveClick)
.show(context.getSupportFragmentManager(), "tag");
});
}

View File

@@ -1,109 +0,0 @@
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.WindowManager;
import androidx.databinding.DataBindingUtil;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.expansion.RunnableArgsss;
import it.integry.integrywmsnative.core.model.VtbDest;
import it.integry.integrywmsnative.core.utility.UtilityDialog;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.databinding.DialogAskClienteBinding;
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteDestinatarioDTO;
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page1ViewModel;
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page2ViewModel;
public class DialogAskCliente {
private Context mContext;
private Dialog mDialog;
private DialogAskClienteBinding mBinding;
public static Dialog makeBase(final Context context, RunnableArgsss<DialogConsts.Results, VtbDest, String> onComplete) {
return new DialogAskCliente(context, onComplete).mDialog;
}
public DialogAskCliente(Context context, RunnableArgsss<DialogConsts.Results, VtbDest, String> onComplete) {
mContext = context;
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_ask_cliente, null, false);
List<Map.Entry<Integer, Class>> views = new ArrayList<>();
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page1, DialogAskCliente_Page1ViewModel.class));
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page2, DialogAskCliente_Page2ViewModel.class));
DialogAskClienteAdapter adapter = new DialogAskClienteAdapter(mContext, views);
mBinding.viewpager.setAdapter(adapter);
mBinding.viewpager.beginFakeDrag();
mBinding.viewpager.addOnPageChangeListener(adapter);
mDialog = new Dialog(mContext);
mDialog.setContentView(mBinding.getRoot());
mDialog.setCanceledOnTouchOutside(false);
// mDialog.setCancelable(false);
UtilityDialog.setTo90PercentWidth(mContext, mDialog);
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
mDialog.setOnShowListener(dialog -> {
DialogAskCliente_Page1ViewModel viewModel1 = (DialogAskCliente_Page1ViewModel) adapter.getViewModel(R.layout.dialog_ask_cliente__page1);
DialogAskCliente_Page2ViewModel viewModel2 = (DialogAskCliente_Page2ViewModel) adapter.getViewModel(R.layout.dialog_ask_cliente__page2);
viewModel1
.setOnConfirmClickListener(() -> {
String codAnag = viewModel1.getCurrentCliente();
if(UtilityString.isNullOrEmpty(codAnag)) {
mDialog.dismiss();
onComplete.run(DialogConsts.Results.YES, null, null);
}
viewModel2.setCodAnag(codAnag);
mBinding.viewpager.setCurrentItem(mBinding.viewpager.getCurrentItem() + 1, true);
});
viewModel1.setOnAbortClickListener(() -> {
mDialog.dismiss();
onComplete.run(DialogConsts.Results.ABORT, null, null);
});
viewModel2.setOnConfirmClickListener(() -> {
DialogAskClienteDestinatarioDTO cliente = viewModel2.getCurrentDestinatario();
onComplete.run(DialogConsts.Results.YES, cliente != null ? cliente.toVtbDestModel() : null, viewModel1.getCurrentCommessa());
mDialog.dismiss();
});
viewModel2.setOnAbortClickListener(() -> {
mDialog.dismiss();
onComplete.run(DialogConsts.Results.ABORT, null, null);
});
});
}
}

View File

@@ -1,7 +1,6 @@
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -15,13 +14,10 @@ import androidx.viewpager.widget.ViewPager;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import it.integry.integrywmsnative.BR;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.ui.DeactivatableViewPager;
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.IDialogAskClienteViewModel;
@@ -58,9 +54,7 @@ public class DialogAskClienteAdapter extends PagerAdapter implements ViewPager.O
viewModel = (IDialogAskClienteViewModel) viewModelClass.newInstance();
viewModel.setBinding(mBinding);
viewModel.setContext(mContext);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
} catch (IllegalAccessException | InstantiationException e) {
e.printStackTrace();
}

View File

@@ -0,0 +1,142 @@
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.FragmentActivity;
import org.jetbrains.annotations.NotNull;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
import it.integry.integrywmsnative.core.model.VtbDest;
import it.integry.integrywmsnative.core.utility.UtilityDialog;
import it.integry.integrywmsnative.core.utility.UtilityString;
import it.integry.integrywmsnative.databinding.DialogAskClienteBinding;
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteDestinatarioDTO;
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page1ViewModel;
import it.integry.integrywmsnative.view.dialogs.ask_cliente.viewmodel.DialogAskCliente_Page2ViewModel;
public class DialogAskClienteView extends BaseDialogFragment {
private final RunnableArgss<VtbDest, String> mOnComplete;
private final Runnable mOnAbort;
private DialogAskClienteAdapter mAdapter;
private FragmentActivity mContext;
private DialogAskClienteBinding mBindings;
private boolean mIsClienteSelected = false;
public static DialogAskClienteView newInstance(@NotNull RunnableArgss<VtbDest, String> onComplete, @NotNull Runnable onAbort) {
return new DialogAskClienteView( onComplete, onAbort);
}
private DialogAskClienteView(@NotNull RunnableArgss<VtbDest, String> onComplete, @NotNull Runnable onAbort) {
super();
this.mOnComplete = onComplete;
this.mOnAbort = onAbort;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
this.mContext = getActivity();
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_ask_cliente, container, false);
mBindings.setLifecycleOwner(this);
getDialog().setCanceledOnTouchOutside(false);
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
List<Map.Entry<Integer, Class>> views = new ArrayList<>();
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page1, DialogAskCliente_Page1ViewModel.class));
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page2, DialogAskCliente_Page2ViewModel.class));
mAdapter = new DialogAskClienteAdapter(mContext, views);
mBindings.viewpager.setAdapter(mAdapter);
mBindings.viewpager.beginFakeDrag();
mBindings.viewpager.addOnPageChangeListener(mAdapter);
mBindings.viewpager.setCurrentItem(0, false);
getDialog().setOnShowListener(d -> {
this.initView();
});
return mBindings.getRoot();
}
@Override
public void onStart() {
super.onStart();
UtilityDialog.setTo90PercentWidth(this.mContext, this);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
private void initView() {
DialogAskCliente_Page1ViewModel viewModel1 = (DialogAskCliente_Page1ViewModel) mAdapter.getViewModel(R.layout.dialog_ask_cliente__page1);
DialogAskCliente_Page2ViewModel viewModel2 = (DialogAskCliente_Page2ViewModel) mAdapter.getViewModel(R.layout.dialog_ask_cliente__page2);
viewModel1
.setOnConfirmClickListener(() -> {
String codAnag = viewModel1.getCurrentCliente();
if(UtilityString.isNullOrEmpty(codAnag)) {
this.mIsClienteSelected = true;
dismiss();
mOnComplete.run(null, null);
}
viewModel2.setCodAnag(codAnag);
mBindings.viewpager.setCurrentItem(mBindings.viewpager.getCurrentItem() + 1, true);
});
viewModel2.setOnConfirmClickListener(() -> {
DialogAskClienteDestinatarioDTO cliente = viewModel2.getCurrentDestinatario();
this.mIsClienteSelected = true;
dismiss();
mOnComplete.run(cliente != null ? cliente.toVtbDestModel() : null, viewModel1.getCurrentCommessa());
});
viewModel1.setOnAbortClickListener(this::dismiss);
viewModel2.setOnAbortClickListener(this::dismiss);
}
@Override
public void onDismiss(@NonNull DialogInterface dialog) {
if(!mIsClienteSelected) {
this.mOnAbort.run();
}
super.onDismiss(dialog);
}
}

View File

@@ -38,6 +38,7 @@ import it.integry.integrywmsnative.core.expansion.BaseDialogFragment;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.expansion.RunnableArgss;
import it.integry.integrywmsnative.core.model.MtbUntMis;
import it.integry.integrywmsnative.core.settings.SettingsManager;
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
import it.integry.integrywmsnative.core.utility.UtilityObservable;
import it.integry.integrywmsnative.databinding.DialogInputQuantityV2Binding;
@@ -179,8 +180,10 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
super.onStart();
this.init();
int onNumCnfInputChanged = SettingsManager.iDB().getOnNumCnfInputChanged();
this.mViewModel.setListener(this);
this.mViewModel.init();
this.mViewModel.init(onNumCnfInputChanged);
}
private void init() {

View File

@@ -26,6 +26,9 @@ import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.exception.Over
public class DialogInputQuantityV2ViewModel {
private final int UPDATE_QTA_CNF = 1;
private final int UPDATE_QTA_TOT = 2;
public ObservableField<MtbAart> mtbAart = new ObservableField<>();
public ObservableField<Boolean> blockedNumCnf = new ObservableField<>();
@@ -60,6 +63,7 @@ public class DialogInputQuantityV2ViewModel {
private boolean canOverflowOrderQuantity;
private boolean canPartitaMagBeChanged;
private int onNumCnfInputChanged;
private Listener mListener;
@@ -70,7 +74,9 @@ public class DialogInputQuantityV2ViewModel {
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
}
public void init() {
public void init(int onNumCnfInputChanged) {
this.onNumCnfInputChanged = onNumCnfInputChanged;
if (this.initialNumCnf != null && this.initialQtaTot != null && this.initialQtaCnf != null) {
this.internalNumCnf = this.initialNumCnf;
this.internalQtaCnf = this.initialQtaCnf;
@@ -304,10 +310,21 @@ public class DialogInputQuantityV2ViewModel {
// return;
}
if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
this.internalQtaCnf = UtilityBigDecimal.divide(internalQtaTot, newValue);
else if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
switch (onNumCnfInputChanged) {
case UPDATE_QTA_CNF:
if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
this.internalQtaCnf = UtilityBigDecimal.divide(internalQtaTot, newValue);
else if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
break;
case UPDATE_QTA_TOT:if (!this.blockedQtaTot.get() && this.internalQtaCnf != null)
this.internalQtaTot = UtilityBigDecimal.multiply(newValue, this.internalQtaCnf);
else if (!this.blockedQtaCnf.get() && !this.mtbAart.get().isFlagQtaCnfFissaBoolean() && this.internalQtaTot != null)
this.internalQtaCnf = UtilityBigDecimal.divide(internalQtaTot, newValue);
break;
}
this.mListener.onDataChanged();
}

View File

@@ -46,6 +46,7 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
private boolean mShouldCheckResiduo;
private boolean mShouldCheckIfExistDoc;
private boolean mEnableCreation;
private final BindableBoolean basketEnabled = new BindableBoolean();
private final BindableBoolean creationEnabled = new BindableBoolean();
@@ -71,6 +72,7 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
this.basketEnabled.set(enableBasket);
this.creationEnabled.set(enableCreation);
mEnableCreation = enableCreation;
mOnComplete = onComplete;
}
@@ -95,7 +97,7 @@ public class DialogScanOrCreateLUView extends BaseDialogFragment implements Dial
getDialog().setCanceledOnTouchOutside(false);
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
this.mViewModel.init(mShouldCheckResiduo, mShouldCheckIfExistDoc);
this.mViewModel.init(mShouldCheckResiduo, mShouldCheckIfExistDoc, mEnableCreation);
mBindings.createNewLuButton.setOnClickListener(v -> {
this.mViewModel.createNewLU();

View File

@@ -29,6 +29,7 @@ public class DialogScanOrCreateLUViewModel {
private boolean mShouldCheckResiduo = false;
private boolean mShouldCheckIfExistDoc = true;
private boolean mEnableCreation = false;
private Listener mListener;
@@ -40,9 +41,10 @@ public class DialogScanOrCreateLUViewModel {
}
public void init(boolean checkResiduo, boolean shouldCheckIfExistDoc) {
public void init(boolean checkResiduo, boolean shouldCheckIfExistDoc, boolean enableCreation) {
this.mShouldCheckResiduo = checkResiduo;
this.mShouldCheckIfExistDoc = shouldCheckIfExistDoc;
this.mEnableCreation = enableCreation;
}
public void createNewLU() {
@@ -94,11 +96,14 @@ public class DialogScanOrCreateLUViewModel {
this.mColliMagazzinoRESTConsumer.getBySSCC(barcodeScanDTO.getStringValue(), mShouldCheckResiduo, false, mtbColt -> {
if (mtbColt == null) {
this.mColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(barcodeScanDTO, GestioneEnum.LAVORAZIONE, createdMtbColt -> {
onComplete.run();
this.sendOnLUOpened(createdMtbColt, true);
}, this::sendError);
if(mEnableCreation) {
this.mColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(barcodeScanDTO, GestioneEnum.LAVORAZIONE, createdMtbColt -> {
onComplete.run();
this.sendOnLUOpened(createdMtbColt, true);
}, this::sendError);
} else {
this.sendError(new NoLUFoundException());
}
} else {
if (mtbColt.getCodDtip() != null && mShouldCheckIfExistDoc) {
this.sendError(new AlreadyAttachedDocumentToLUException());