Completato refactoring del dialog ask cliente
This commit is contained in:
parent
90985b899b
commit
9765fe1807
@ -65,6 +65,8 @@ import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviForn
|
||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreModule;
|
||||
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceComponent;
|
||||
import it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_lista_arts.DialogChooseArtsFromListaArtsModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotComponent;
|
||||
@ -119,7 +121,8 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
DocInterniModule.class,
|
||||
DialogSelectDocInfoModule.class,
|
||||
DocInterniEditFormModule.class,
|
||||
DialogSelectDocRowsModule.class
|
||||
DialogSelectDocRowsModule.class,
|
||||
DialogAskClienteModule.class
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
@ -161,6 +164,8 @@ public interface MainApplicationComponent {
|
||||
|
||||
OrdiniUscitaElencoComponent.Factory prodOrdineLavorazioneElencoComponent();
|
||||
|
||||
DialogAskClienteComponent.Factory dialogAskClienteComponent();
|
||||
|
||||
DialogInputQuantityV2Component.Factory dialogInputQuantityV2Component();
|
||||
|
||||
DialogInputLUProdComponent.Factory dialogInputLUProdComponent();
|
||||
|
||||
@ -31,6 +31,7 @@ import it.integry.integrywmsnative.core.update.UpdatesManager;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.rest.DocInterniRESTConsumer;
|
||||
import it.integry.integrywmsnative.gest.prod_fabbisogno_linee_prod.rest.ProdFabbisognoLineeProdRESTConsumer;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
|
||||
@Module
|
||||
public class MainApplicationModule {
|
||||
@ -85,6 +86,12 @@ public class MainApplicationModule {
|
||||
return DialogProgressView.newInstance();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
DialogInputQuantityV2View providesDialogInputQuantityV2View() {
|
||||
return new DialogInputQuantityV2View();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
OrdiniRESTConsumer provideOrdiniRESTConsumer(SystemRESTConsumer systemRESTConsumer, EntityRESTConsumer entityRESTConsumer) {
|
||||
|
||||
@ -85,6 +85,9 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
@Inject
|
||||
AccettazionePickingViewModel mViewModel;
|
||||
|
||||
@Inject
|
||||
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||
|
||||
private final AccettazionePickingFiltroOrdineViewModel mAppliedFilterViewModel = new AccettazionePickingFiltroOrdineViewModel();
|
||||
|
||||
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
||||
@ -833,8 +836,9 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
.setCanLUBeClosed(true)
|
||||
.setCanOverflowOrderQuantity(canOverflowQuantity);
|
||||
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
@ -842,9 +846,8 @@ public class AccettazionePickingActivity extends BaseActivity implements Accetta
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
}, () -> {
|
||||
this.mViewModel.resetMatchedRows();
|
||||
})
|
||||
.setOnAbort(() -> this.mViewModel.resetMatchedRows())
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
|
||||
@ -55,9 +55,13 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
|
||||
@Inject
|
||||
MtbColrRepository documentRowsRepository;
|
||||
|
||||
@Inject
|
||||
DocInterniEditFormViewModel viewModel;
|
||||
|
||||
@Inject
|
||||
DialogInputQuantityV2View dialogInputQuantityV2View;
|
||||
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
private ActivityContabDocInterniEditBinding binding;
|
||||
@ -245,11 +249,12 @@ public class DocInterniEditFormActivity extends BaseActivity implements DocInter
|
||||
}
|
||||
return partitaMag;
|
||||
});
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
dialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
this.onLoadingStarted();
|
||||
this.viewModel.saveRow(row, resultDTO);
|
||||
}, this::onLoadingEnded)
|
||||
})
|
||||
.setOnAbort(this::onLoadingEnded)
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
|
||||
@ -69,6 +69,9 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
@Inject
|
||||
PickingLiberoViewModel mViewModel;
|
||||
|
||||
@Inject
|
||||
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||
|
||||
public BindableBoolean thereIsAnOpenedUL = new BindableBoolean(false);
|
||||
public BindableBoolean thereIsntAnOpenedUL = new BindableBoolean(true);
|
||||
public BindableBoolean thereIsAnyRowInUL = new BindableBoolean(false);
|
||||
@ -334,8 +337,8 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
|
||||
.setCanLUBeClosed(canLUBeClosed);
|
||||
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
mDialogInputQuantityV2View.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
@ -345,15 +348,14 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
|
||||
this.openProgress();
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
}, () -> {
|
||||
this.closeProgress();
|
||||
})
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
.setOnAbort(this::closeProgress)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRowSaved() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
FBToast.successToast(getActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||
});
|
||||
}
|
||||
|
||||
@ -64,6 +64,9 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
@Inject
|
||||
PickingResiViewModel mViewmodel;
|
||||
|
||||
@Inject
|
||||
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||
|
||||
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
||||
|
||||
private ObservableArrayList<PickingResiListModel> mPickingResiMutableData = new ObservableArrayList<>();
|
||||
@ -319,8 +322,9 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
.setCanLUBeClosed(false)
|
||||
.setCanPartitaMagBeChanged(false);
|
||||
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
@ -330,7 +334,8 @@ public class PickingResiActivity extends BaseActivity implements BottomSheetFrag
|
||||
|
||||
this.openProgress();
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
}, () -> {
|
||||
})
|
||||
.setOnAbort(() -> {
|
||||
this.mViewmodel.resetMatchedRows();
|
||||
})
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
|
||||
@ -53,6 +53,9 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
||||
@Inject
|
||||
ProdRecuperoMaterialeViewModel mViewModel;
|
||||
|
||||
@Inject
|
||||
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||
|
||||
private FragmentProdRecuperoMaterialeBinding mBinding;
|
||||
|
||||
private int barcodeScannerIstanceID = -1;
|
||||
@ -200,8 +203,9 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
||||
.setCanOverflowOrderQuantity(canOverflowOrderQuantity)
|
||||
.setCanLUBeClosed(canLUBeClosed);
|
||||
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
@ -210,7 +214,8 @@ public class ProdRecuperoMaterialeFragment extends BaseFragment implements ITitl
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
|
||||
this.mViewModel.onItemDispatched(item, pickedQuantityDTO, sourceMtbColt);
|
||||
}, this::onLoadingEnded)
|
||||
})
|
||||
.setOnAbort(this::onLoadingEnded)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
|
||||
@ -73,6 +73,9 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
@Inject
|
||||
RettificaGiacenzeViewModel mViewModel;
|
||||
|
||||
@Inject
|
||||
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||
|
||||
public BindableBoolean thereIsAnOpenedUL = new BindableBoolean(false);
|
||||
public BindableBoolean thereIsntAnOpenedUL = new BindableBoolean(false);
|
||||
|
||||
@ -320,7 +323,7 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
thereIsAnOpenedUL.set(false);
|
||||
|
||||
|
||||
if(getActivity() != null) ((IPoppableActivity) getActivity()).pop();
|
||||
if (getActivity() != null) ((IPoppableActivity) getActivity()).pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -378,8 +381,9 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
.setCanPartitaMagBeChanged(canPartitaMagBeChanged)
|
||||
.setCanLUBeClosed(canLUBeClosed);
|
||||
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
@ -389,15 +393,16 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
|
||||
this.openProgress();
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
}, () -> {
|
||||
})
|
||||
.setOnAbort(() -> {
|
||||
this.closeProgress();
|
||||
})
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRowSaved() {
|
||||
FBToast.successToast(getActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||
FBToast.successToast(requireActivity(), getResources().getString(R.string.data_saved), FBToast.LENGTH_SHORT);
|
||||
}
|
||||
|
||||
|
||||
@ -450,7 +455,8 @@ public class RettificaGiacenzeFragment extends BaseFragment implements ITitledFr
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false))
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");;
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -83,6 +83,9 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
@Inject
|
||||
SpedizioneViewModel mViewmodel;
|
||||
|
||||
@Inject
|
||||
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||
|
||||
private BottomSheetFragmentLUContentViewModel mBottomSheetFragmentLUContentViewModel;
|
||||
|
||||
private final ObservableArrayList<SpedizioneListModel> mSpedizioneMutableData = new ObservableArrayList<>();
|
||||
@ -821,8 +824,9 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
.setCanLUBeClosed(true)
|
||||
.setCanPartitaMagBeChanged(canPartitaMagBeChanged);
|
||||
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
@ -832,7 +836,8 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo
|
||||
|
||||
this.openProgress();
|
||||
onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
}, () -> {
|
||||
})
|
||||
.setOnAbort(() -> {
|
||||
this.mViewmodel.resetMatchedRows();
|
||||
})
|
||||
.show(getSupportFragmentManager(), "tag");
|
||||
|
||||
@ -48,6 +48,9 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
@Inject
|
||||
VersamentoMerceViewModel mViewModel;
|
||||
|
||||
@Inject
|
||||
DialogInputQuantityV2View mDialogInputQuantityV2View;
|
||||
|
||||
private FragmentMainVersamentoMerceBinding mBindings = null;
|
||||
|
||||
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||
@ -202,9 +205,10 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
.setCanPartitaMagBeChanged(canBatchLotBeChanged)
|
||||
.setCanLUBeClosed(false);
|
||||
|
||||
this.getActivity().runOnUiThread(() -> {
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
this.requireActivity().runOnUiThread(() -> {
|
||||
mDialogInputQuantityV2View
|
||||
.setDialogInputQuantityV2DTO(dialogInputQuantityV2DTO)
|
||||
.setOnComplete((resultDTO, shouldCloseLU) -> {
|
||||
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
@ -215,8 +219,9 @@ public class VersamentoMerceFragment extends BaseFragment implements ITitledFrag
|
||||
|
||||
onComplete.run(pickedQuantityDTO);
|
||||
|
||||
}, this::onLoadingEnded)
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
})
|
||||
.setOnAbort(this::onLoadingEnded)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ public class DialogProgressView extends DialogFragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.dialog_progress, container, false);
|
||||
|
||||
getDialog().setCanceledOnTouchOutside(false);
|
||||
setCancelable(false);
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
mBindings.setTitle(UtilityString.isNullOrEmpty(title) ? requireActivity().getString(R.string.loading) : title);
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogAskClienteComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogAskClienteComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogAskClienteView dialogAskClienteView);
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.ask_cliente;
|
||||
|
||||
import dagger.Module;
|
||||
|
||||
@Module(subcomponents = DialogAskClienteComponent.class)
|
||||
public class DialogAskClienteModule {
|
||||
}
|
||||
@ -14,20 +14,32 @@ import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
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.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDialog;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityHashMap;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.DialogAskClienteBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogProgressView;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteClienteDTO;
|
||||
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;
|
||||
@ -45,6 +57,12 @@ public class DialogAskClienteView extends BaseDialogFragment {
|
||||
|
||||
private boolean mIsClienteSelected = false;
|
||||
|
||||
@Inject
|
||||
SystemRESTConsumer systemRESTConsumer;
|
||||
|
||||
@Inject
|
||||
DialogProgressView dialogProgressView;
|
||||
|
||||
public static DialogAskClienteView newInstance(@NotNull RunnableArgss<VtbDest, String> onComplete, @NotNull Runnable onAbort) {
|
||||
return new DialogAskClienteView(onComplete, onAbort);
|
||||
}
|
||||
@ -69,6 +87,11 @@ public class DialogAskClienteView extends BaseDialogFragment {
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogAskClienteComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
|
||||
List<Map.Entry<Integer, Class<? extends IDialogAskClienteViewModel>>> views = new ArrayList<>();
|
||||
views.add(new AbstractMap.SimpleEntry<>(R.layout.dialog_ask_cliente__page1, DialogAskCliente_Page1ViewModel.class));
|
||||
@ -96,8 +119,7 @@ public class DialogAskClienteView extends BaseDialogFragment {
|
||||
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(() -> {
|
||||
viewModel1.setOnConfirmClickListener(() -> {
|
||||
String codAnag = viewModel1.getCurrentCliente();
|
||||
|
||||
if (UtilityString.isNullOrEmpty(codAnag)) {
|
||||
@ -110,7 +132,6 @@ public class DialogAskClienteView extends BaseDialogFragment {
|
||||
|
||||
mBindings.viewpager.setCurrentItem(mBindings.viewpager.getCurrentItem() + 1, true);
|
||||
});
|
||||
|
||||
viewModel2.setOnConfirmClickListener(() -> {
|
||||
DialogAskClienteDestinatarioDTO cliente = viewModel2.getCurrentDestinatario();
|
||||
|
||||
@ -122,9 +143,84 @@ public class DialogAskClienteView extends BaseDialogFragment {
|
||||
|
||||
viewModel1.setOnAbortClickListener(this::dismiss);
|
||||
viewModel2.setOnAbortClickListener(this::dismiss);
|
||||
|
||||
|
||||
this.dialogProgressView.show(this.getParentFragmentManager(), "tag");
|
||||
|
||||
this.initClienti(viewModel1, () -> {
|
||||
this.initDestinatari(viewModel2, () -> {
|
||||
this.dialogProgressView.dismiss();
|
||||
}, () -> {
|
||||
this.dialogProgressView.dismiss();
|
||||
});
|
||||
}, () -> {
|
||||
this.dialogProgressView.dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void initClienti(DialogAskCliente_Page1ViewModel viewModel, Runnable onComplete, Runnable onAbort) {
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<HashMap<String, Object>>>() {
|
||||
}.getType();
|
||||
|
||||
String sqlClienti = "SELECT gtb_anag.cod_anag, rag_soc, jtb_comt.cod_jcom " +
|
||||
"FROM gtb_anag " +
|
||||
"LEFT OUTER JOIN jtb_comt ON gtb_anag.cod_anag = jtb_comt.cod_anag " +
|
||||
"INNER JOIN vtb_clie ON gtb_anag.cod_anag = vtb_clie.cod_anag " +
|
||||
"WHERE vtb_clie.flag_stato = 'A' " +
|
||||
"ORDER BY rag_soc";
|
||||
|
||||
this.systemRESTConsumer.<ArrayList<HashMap<String, Object>>>processSql(sqlClienti, typeOfObjectsList, value -> {
|
||||
var availableClienti = new ArrayList<DialogAskClienteClienteDTO>();
|
||||
|
||||
Stream.of(value)
|
||||
.groupBy(x -> x.get("codAnag").toString() + " " + x.get("ragSoc").toString())
|
||||
.forEach(x -> {
|
||||
DialogAskClienteClienteDTO dialogAskClienteClienteDTO = new DialogAskClienteClienteDTO();
|
||||
dialogAskClienteClienteDTO.setCodAnag(UtilityHashMap.getValueIfExists(x.getValue().get(0), "codAnag"));
|
||||
dialogAskClienteClienteDTO.setRagSoc(UtilityHashMap.getValueIfExists(x.getValue().get(0), "ragSoc"));
|
||||
|
||||
for (HashMap<String, Object> group : x.getValue()) {
|
||||
if (group.containsKey("codJcom")) {
|
||||
dialogAskClienteClienteDTO.getCodJcoms().add(UtilityHashMap.getValueIfExists(group, "codJcom"));
|
||||
}
|
||||
}
|
||||
|
||||
availableClienti.add(dialogAskClienteClienteDTO);
|
||||
});
|
||||
|
||||
viewModel.setAvailableClienti(availableClienti);
|
||||
onComplete.run();
|
||||
}, ex -> {
|
||||
onAbort.run();
|
||||
});
|
||||
}
|
||||
|
||||
private void initDestinatari(DialogAskCliente_Page2ViewModel viewModel, Runnable onComplete, Runnable onAbort) {
|
||||
String sql = "SELECT vtb_dest.cod_anag,\n" +
|
||||
" cod_vdes,\n" +
|
||||
" destinatario,\n" +
|
||||
" indirizzo,\n" +
|
||||
" cap,\n" +
|
||||
" citta,\n" +
|
||||
" prov,\n" +
|
||||
" nazione\n" +
|
||||
"FROM vtb_dest\n" +
|
||||
"INNER JOIN vtb_clie ON vtb_clie.cod_anag = vtb_dest.cod_anag\n" +
|
||||
"WHERE vtb_clie.flag_stato = 'A'";
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<DialogAskClienteDestinatarioDTO>>() {
|
||||
}.getType();
|
||||
this.systemRESTConsumer.<ArrayList<DialogAskClienteDestinatarioDTO>>processSql(sql, typeOfObjectsList, value -> {
|
||||
viewModel.setAvailableDestinatari(value);
|
||||
|
||||
onComplete.run();
|
||||
}, ex -> {
|
||||
onAbort.run();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
mAdapter.onDismiss();
|
||||
|
||||
@ -10,12 +10,9 @@ import androidx.databinding.ViewDataBinding;
|
||||
|
||||
import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.tfb.fbtoast.FBToast;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
@ -24,11 +21,8 @@ import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.expansion.OnListGeneralChangedCallback;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityHashMap;
|
||||
import it.integry.integrywmsnative.databinding.DialogAskClientePage1Binding;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteClienteDTO;
|
||||
|
||||
@ -46,7 +40,6 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
||||
private Runnable onAbortClickListener;
|
||||
|
||||
public DialogAskCliente_Page1ViewModel() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -59,53 +52,18 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
||||
this.mBinding = (DialogAskClientePage1Binding) binding;
|
||||
}
|
||||
|
||||
public void setAvailableClienti(ArrayList<DialogAskClienteClienteDTO> availableClienti) {
|
||||
this.availableClienti = availableClienti;
|
||||
initializeAdapter(availableClienti);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShow() {
|
||||
|
||||
String sql = "SELECT gtb_anag.cod_anag, rag_soc, jtb_comt.cod_jcom " +
|
||||
"FROM gtb_anag " +
|
||||
"LEFT OUTER JOIN jtb_comt ON gtb_anag.cod_anag = jtb_comt.cod_anag " +
|
||||
"INNER JOIN vtb_clie ON gtb_anag.cod_anag = vtb_clie.cod_anag " +
|
||||
"WHERE vtb_clie.flag_stato = 'A' " +
|
||||
"ORDER BY rag_soc";
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<HashMap<String, Object>>>() { }.getType();
|
||||
|
||||
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<HashMap<String, Object>>>() {
|
||||
@Override
|
||||
public void onSuccess(ArrayList<HashMap<String, Object>> value) {
|
||||
|
||||
availableClienti = new ArrayList<>();
|
||||
|
||||
Stream.of(value)
|
||||
.groupBy(x -> x.get("codAnag").toString() + " " + x.get("ragSoc").toString())
|
||||
.forEach(x -> {
|
||||
DialogAskClienteClienteDTO dialogAskClienteClienteDTO = new DialogAskClienteClienteDTO();
|
||||
dialogAskClienteClienteDTO.setCodAnag(UtilityHashMap.getValueIfExists(x.getValue().get(0), "codAnag"));
|
||||
dialogAskClienteClienteDTO.setRagSoc(UtilityHashMap.getValueIfExists(x.getValue().get(0), "ragSoc"));
|
||||
|
||||
for (HashMap<String, Object> group : x.getValue()) {
|
||||
if (group.containsKey("codJcom")) {
|
||||
dialogAskClienteClienteDTO.getCodJcoms().add(UtilityHashMap.getValueIfExists(group, "codJcom"));
|
||||
}
|
||||
}
|
||||
|
||||
availableClienti.add(dialogAskClienteClienteDTO);
|
||||
});
|
||||
|
||||
initializeAdapter(availableClienti);
|
||||
|
||||
mBarcodeScannerInstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(mContext, ex, false)));
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
this.mBinding.buttonYes.setOnClickListener(v -> {
|
||||
if (validateCliente()) {
|
||||
@ -147,7 +105,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
||||
} else {
|
||||
DialogAskClienteClienteDTO resultCodJcom = searchBarcodeInCodJcom(barcode);
|
||||
|
||||
if(resultCodJcom != null) {
|
||||
if (resultCodJcom != null) {
|
||||
mBinding.dropdownCliente.setText(resultCodJcom.toString());
|
||||
refreshCodJcoms(resultCodJcom);
|
||||
mBinding.dropdownCommessa.setText(barcode);
|
||||
@ -219,7 +177,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
||||
|
||||
|
||||
private boolean validateCliente() {
|
||||
if(SettingsManager.iDB().isFlagAllowEmptyClienteInPickingLibero() && mBinding.inputCliente.getEditText().getText().toString().trim().length() == 0) {
|
||||
if (SettingsManager.iDB().isFlagAllowEmptyClienteInPickingLibero() && mBinding.inputCliente.getEditText().getText().toString().trim().length() == 0) {
|
||||
return true;
|
||||
} else return getCurrentCliente() != null;
|
||||
}
|
||||
@ -229,7 +187,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
||||
.filter(x -> x.getRagSoc().equalsIgnoreCase(mBinding.inputCliente.getEditText().getText().toString()))
|
||||
.findFirst();
|
||||
|
||||
if(result.isPresent()) return result.get().getCodAnag();
|
||||
if (result.isPresent()) return result.get().getCodAnag();
|
||||
else return null;
|
||||
}
|
||||
|
||||
@ -240,7 +198,7 @@ public class DialogAskCliente_Page1ViewModel implements IDialogAskClienteViewMod
|
||||
.map(DialogAskClienteClienteDTO::getCodJcoms)
|
||||
.findFirst();
|
||||
|
||||
if(result.isPresent() && Stream.of(result.get()).anyMatch(x -> x.equalsIgnoreCase(mBinding.inputCommessa.getEditText().getText().toString()))) {
|
||||
if (result.isPresent() && Stream.of(result.get()).anyMatch(x -> x.equalsIgnoreCase(mBinding.inputCommessa.getEditText().getText().toString()))) {
|
||||
return mBinding.inputCommessa.getEditText().getText().toString();
|
||||
} else return null;
|
||||
}
|
||||
|
||||
@ -5,29 +5,24 @@ import android.widget.AutoCompleteTextView;
|
||||
|
||||
import androidx.databinding.ViewDataBinding;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ISimpleOperationCallback;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.SystemRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDB;
|
||||
import it.integry.integrywmsnative.databinding.DialogAskClientePage2Binding;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.dto.DialogAskClienteDestinatarioDTO;
|
||||
|
||||
public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewModel {
|
||||
|
||||
|
||||
private DialogAskClientePage2Binding mBinding;
|
||||
private Context mContext;
|
||||
|
||||
private Runnable mOnConfirm;
|
||||
private Runnable mOnAbort;
|
||||
|
||||
private List<DialogAskClienteDestinatarioDTO> availableDestinatari;
|
||||
private ArrayList<DialogAskClienteDestinatarioDTO> availableDestinatari;
|
||||
|
||||
private String mCodAnag;
|
||||
|
||||
@ -40,6 +35,10 @@ public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewMod
|
||||
this.mBinding = (DialogAskClientePage2Binding) binding;
|
||||
}
|
||||
|
||||
public void setAvailableDestinatari(ArrayList<DialogAskClienteDestinatarioDTO> availableDestinatari) {
|
||||
this.availableDestinatari = availableDestinatari;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContext(Context context) {
|
||||
this.mContext = context;
|
||||
@ -47,29 +46,18 @@ public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewMod
|
||||
|
||||
@Override
|
||||
public void onShow() {
|
||||
String sql = "SELECT cod_anag, cod_vdes, destinatario, indirizzo, cap, citta, prov, nazione " +
|
||||
"FROM vtb_dest " +
|
||||
"WHERE cod_anag = " + UtilityDB.valueToString(mCodAnag);
|
||||
var filteredDestinatari = availableDestinatari != null ? Stream.of(availableDestinatari)
|
||||
.filter(x -> x.getCodAnag().equalsIgnoreCase(mCodAnag))
|
||||
.toList()
|
||||
: null;
|
||||
|
||||
Type typeOfObjectsList = new TypeToken<ArrayList<DialogAskClienteDestinatarioDTO>>() {
|
||||
}.getType();
|
||||
SystemRESTConsumer.processSqlStatic(sql, typeOfObjectsList, new ISimpleOperationCallback<ArrayList<DialogAskClienteDestinatarioDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(ArrayList<DialogAskClienteDestinatarioDTO> value) {
|
||||
availableDestinatari = value;
|
||||
initializeAdapter(value);
|
||||
|
||||
if(value == null || value.size() == 0) {
|
||||
if (filteredDestinatari == null || filteredDestinatari.size() == 0) {
|
||||
mOnConfirm.run();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Exception ex) {
|
||||
|
||||
}
|
||||
});
|
||||
initializeAdapter(filteredDestinatari);
|
||||
|
||||
|
||||
this.mBinding.buttonYes.setOnClickListener(v -> {
|
||||
@ -106,7 +94,7 @@ public class DialogAskCliente_Page2ViewModel implements IDialogAskClienteViewMod
|
||||
}
|
||||
|
||||
|
||||
private void initializeAdapter(ArrayList<DialogAskClienteDestinatarioDTO> items) {
|
||||
private void initializeAdapter(List<DialogAskClienteDestinatarioDTO> items) {
|
||||
DialogAskCliente_Page2_ArrayAdapter adapter = new DialogAskCliente_Page2_ArrayAdapter(mContext, items);
|
||||
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ public class DialogAskCliente_Page2_ArrayAdapter extends ArrayAdapter<DialogAskC
|
||||
|
||||
private ListFilter listFilter = new ListFilter();
|
||||
|
||||
public DialogAskCliente_Page2_ArrayAdapter(@NonNull Context context, @NonNull ArrayList<DialogAskClienteDestinatarioDTO> list) {
|
||||
public DialogAskCliente_Page2_ArrayAdapter(@NonNull Context context, @NonNull List<DialogAskClienteDestinatarioDTO> list) {
|
||||
super(context, 0 , list);
|
||||
mContext = context;
|
||||
mDataset = list;
|
||||
|
||||
@ -23,13 +23,12 @@ import com.google.android.material.textfield.TextInputLayout;
|
||||
import com.pedromassango.doubleclick.DoubleClick;
|
||||
import com.pedromassango.doubleclick.DoubleClickListener;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
@ -47,14 +46,15 @@ import it.integry.integrywmsnative.core.utility.UtilityObservable;
|
||||
import it.integry.integrywmsnative.databinding.DialogInputQuantityV2Binding;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
|
||||
@Singleton
|
||||
public class DialogInputQuantityV2View extends BaseDialogFragment implements DialogInputQuantityV2ViewModel.Listener {
|
||||
|
||||
@Inject
|
||||
DialogInputQuantityV2ViewModel mViewModel;
|
||||
|
||||
private final DialogInputQuantityV2DTO mDialogInputQuantityV2DTO;
|
||||
private final RunnableArgss<DialogInputQuantityV2ResultDTO, Boolean> mOnComplete;
|
||||
private final Runnable mOnAbort;
|
||||
private DialogInputQuantityV2DTO mDialogInputQuantityV2DTO;
|
||||
private RunnableArgss<DialogInputQuantityV2ResultDTO, Boolean> mOnComplete;
|
||||
private Runnable mOnAbort;
|
||||
|
||||
public ObservableField<Integer> currentTextNumCnfToTake = new ObservableField<>(0);
|
||||
public ObservableField<Integer> currentTextNumPezziToTake = new ObservableField<>(0);
|
||||
@ -86,17 +86,22 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
||||
private boolean mEnableDataCallback = true;
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
private boolean mFirstStart = true;
|
||||
|
||||
public static DialogInputQuantityV2View newInstance(@NotNull DialogInputQuantityV2DTO dialogInputQuantityV2DTO, @NotNull RunnableArgss<DialogInputQuantityV2ResultDTO, Boolean> onComplete, @NotNull Runnable onAbort) {
|
||||
return new DialogInputQuantityV2View(dialogInputQuantityV2DTO, onComplete, onAbort);
|
||||
|
||||
public DialogInputQuantityV2View setDialogInputQuantityV2DTO(DialogInputQuantityV2DTO mDialogInputQuantityV2DTO) {
|
||||
this.mDialogInputQuantityV2DTO = mDialogInputQuantityV2DTO;
|
||||
return this;
|
||||
}
|
||||
|
||||
private DialogInputQuantityV2View(@NotNull DialogInputQuantityV2DTO dialogInputQuantityV2DTO, @NotNull RunnableArgss<DialogInputQuantityV2ResultDTO, Boolean> onComplete, @NotNull Runnable onAbort) {
|
||||
super();
|
||||
public DialogInputQuantityV2View setOnComplete(RunnableArgss<DialogInputQuantityV2ResultDTO, Boolean> mOnComplete) {
|
||||
this.mOnComplete = mOnComplete;
|
||||
return this;
|
||||
}
|
||||
|
||||
this.mDialogInputQuantityV2DTO = dialogInputQuantityV2DTO;
|
||||
this.mOnComplete = onComplete;
|
||||
this.mOnAbort = onAbort;
|
||||
public DialogInputQuantityV2View setOnAbort(Runnable mOnAbort) {
|
||||
this.mOnAbort = mOnAbort;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -203,7 +208,11 @@ public class DialogInputQuantityV2View extends BaseDialogFragment implements Dia
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
if(!mFirstStart) {
|
||||
this.init();
|
||||
mFirstStart = false;
|
||||
}
|
||||
|
||||
int onNumCnfInputChanged = SettingsManager.iDB().getOnNumCnfInputChanged();
|
||||
|
||||
|
||||
@ -46,6 +46,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/recipient"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/description_text">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user