Completato refactoring Versamento Merce (+ gestione non conformi)
This commit is contained in:
parent
13cca99b09
commit
ee70faefa9
@ -31,6 +31,8 @@ import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneCl
|
||||
import it.integry.integrywmsnative.gest.ultime_consegne_cliente.UltimeConsegneClienteModule;
|
||||
import it.integry.integrywmsnative.gest.ultimi_arrivi_fornitore.UltimiArriviFornitoreComponent;
|
||||
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.input_quantity_v2.DialogInputQuantityV2Component;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2Module;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArtComponent;
|
||||
@ -55,6 +57,7 @@ import it.integry.integrywmsnative.view.dialogs.scan_art.DialogScanArtModule;
|
||||
DialogInputQuantityV2Module.class,
|
||||
DialogScanArtModule.class,
|
||||
ProdFabbisognoLineeProdModule.class,
|
||||
VersamentoMerceModule.class,
|
||||
DialogAskMagazzinoProssimitaModule.class,
|
||||
DialogRowInfoProdFabbisognoLineeProdModule.class})
|
||||
public interface MainApplicationComponent {
|
||||
@ -73,6 +76,7 @@ public interface MainApplicationComponent {
|
||||
DialogInputQuantityV2Component.Factory dialogInputQuantityV2Component();
|
||||
DialogScanArtComponent.Factory dialogScanArtComponent();
|
||||
ProdFabbisognoLineeProdComponent.Factory prodFabbisognoLineeProdComponent();
|
||||
VersamentoMerceComponent.Factory versamentoMerceComponent();
|
||||
DialogAskMagazzinoProssimitaComponent.Factory dialogAskMagazzinoProssimitaComponent();
|
||||
DialogRowInfoProdFabbisognoLineeProdComponent.Factory dialogRowInfoProdFabbisognoLineeProdComponent();
|
||||
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
public class MyExceptionHandler implements
|
||||
java.lang.Thread.UncaughtExceptionHandler {
|
||||
private final Context myContext;
|
||||
private final Class<?> myActivityClass;
|
||||
|
||||
public MyExceptionHandler(Context context, Class<?> c) {
|
||||
|
||||
myContext = context;
|
||||
myActivityClass = c;
|
||||
}
|
||||
|
||||
public void uncaughtException(Thread thread, Throwable exception) {
|
||||
|
||||
StringWriter stackTrace = new StringWriter();
|
||||
exception.printStackTrace(new PrintWriter(stackTrace));
|
||||
System.err.println(stackTrace);// You can use LogCat too
|
||||
// Intent intent = new Intent(myContext, myActivityClass);
|
||||
// String s = stackTrace.toString();
|
||||
// //you can use this String to know what caused the exception and in which Activity
|
||||
// intent.putExtra("uncaughtException",
|
||||
// "Exception is: " + stackTrace.toString());
|
||||
// intent.putExtra("stacktrace", s);
|
||||
// myContext.startActivity(intent);
|
||||
//for restarting the Activity
|
||||
// Process.killProcess(Process.myPid());
|
||||
// System.exit(0);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public class NoArtsInLUException extends Exception {
|
||||
|
||||
public NoArtsInLUException() {
|
||||
super(UtilityResources.getString(R.string.no_items_found_message));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public class TooManyLUFoundInMonoLUPositionException extends Exception {
|
||||
|
||||
public TooManyLUFoundInMonoLUPositionException() {
|
||||
super(UtilityResources.getString(R.string.too_much_lu_found_message_in_mono_lu));
|
||||
}
|
||||
}
|
||||
@ -32,6 +32,7 @@ import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
@ -291,11 +292,14 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
|
||||
public static void createColloFromEtichettaAnonima(BarcodeScanDTO barcodeScanDTO, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
createColloFromEtichettaAnonima(barcodeScanDTO.getStringValue(), gestione, onComplete, onFailed);
|
||||
createColloFromEtichettaAnonimaStatic(barcodeScanDTO.getStringValue(), gestione, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public void createColloFromEtichettaAnonima(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
createColloFromEtichettaAnonimaStatic(barcode, gestione, onComplete, onFailed);
|
||||
}
|
||||
|
||||
public static void createColloFromEtichettaAnonima(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public static void createColloFromEtichettaAnonimaStatic(String barcode, GestioneEnum gestione, RunnableArgs<MtbColt> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
MtbColt mtbColtToCreate = new MtbColt()
|
||||
.setGestione(gestione);
|
||||
@ -545,23 +549,37 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
}
|
||||
|
||||
|
||||
public static void changePosizione(MtbColt mtbColtToSave, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColtToSaveClone = (MtbColt) mtbColtToSave.clone();
|
||||
public void changePosizione(MtbColt mtbColtToMove, MtbDepoPosizione posizione, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
|
||||
mtbColtToSaveClone.setOperation(CommonModelConsts.OPERATION.UPDATE);
|
||||
mtbColtToSaveClone.setMtbColr(new ObservableArrayList<>());
|
||||
String codMdep = posizione.getCodMdep();
|
||||
String posizioneString = posizione.getPosizione();
|
||||
|
||||
if (posizione == null) mtbColtToSaveClone.setPosizione(null);
|
||||
else mtbColtToSaveClone
|
||||
.setPosizione(posizione.getPosizione())
|
||||
.setCodMdep(posizione.getCodMdep());
|
||||
MtbColt mtbColtToMoveClone = (MtbColt) mtbColtToMove.clone();
|
||||
|
||||
ColliMagazzinoRESTConsumer.saveColloStatic(mtbColtToSaveClone, mtbColt -> {
|
||||
if (onComplete != null) onComplete.run();
|
||||
}, ex -> {
|
||||
if (onFailed != null) onFailed.run(ex);
|
||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||
mtbColtToMoveClone.getMtbColr().get(i)
|
||||
.setMtbAart(null)
|
||||
.setMtbPartitaMag(null);
|
||||
}
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService
|
||||
.spostaULInPosizione(codMdep,
|
||||
posizioneString,
|
||||
mtbColtToMoveClone)
|
||||
.enqueue(new Callback<ServiceRESTResponse<Object>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "changePosizione", mtbColts -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
if (onFailed != null) onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -675,12 +693,7 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void creaRettificaColloStatic(MtbColr sourceMtbColrOriginal, BigDecimal newNumCnf, BigDecimal newQtaTot, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
public void creaRettificaCollo(MtbColr sourceMtbColrOriginal, BigDecimal newNumCnf, BigDecimal newQtaTot, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColr sourceMtbColr = (MtbColr) sourceMtbColrOriginal.clone();
|
||||
sourceMtbColr.setMtbPartitaMag(null);
|
||||
sourceMtbColr.setMtbAart(null);
|
||||
@ -709,10 +722,35 @@ public class ColliMagazzinoRESTConsumer extends _BaseRESTConsumer {
|
||||
});
|
||||
}
|
||||
|
||||
public void spostaArtsTraUL(MtbColt sourceMtbColt, MtbColt destMtbColt, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MtbColt mtbColtToMoveClone = (MtbColt) sourceMtbColt.clone();
|
||||
|
||||
for (int i = 0; i < mtbColtToMoveClone.getMtbColr().size(); i++) {
|
||||
mtbColtToMoveClone.getMtbColr().get(i)
|
||||
.setMtbAart(null)
|
||||
.setMtbPartitaMag(null);
|
||||
}
|
||||
|
||||
public void creaRettificaCollo(MtbColr sourceMtbColrOriginal, BigDecimal newNumCnf, BigDecimal newQtaTot, RunnableArgs<MtbColr> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
creaRettificaColloStatic(sourceMtbColrOriginal, newNumCnf, newQtaTot, onComplete, onFailed);
|
||||
SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO = new SpostaArtsTraULRequestDTO()
|
||||
.setSourceMtbColt(sourceMtbColt)
|
||||
.setDestinationMtbColt(destMtbColt);
|
||||
|
||||
ColliMagazzinoRESTConsumerService colliMagazzinoRESTConsumerService = RESTBuilder.getService(ColliMagazzinoRESTConsumerService.class);
|
||||
colliMagazzinoRESTConsumerService.spostaArtsTraUL(
|
||||
spostaArtsTraULRequestDTO
|
||||
).enqueue(new Callback<ServiceRESTResponse<Object>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Object>> call, Response<ServiceRESTResponse<Object>> response) {
|
||||
analyzeAnswer(response, "spostaArtsTraUL", data -> {
|
||||
onComplete.run();
|
||||
}, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Object>> call, Throwable t) {
|
||||
if (onFailed != null) onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.rest.model.DistribuzioneColloDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.RettificaULDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.SpostaArtsTraULRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
@ -29,4 +30,10 @@ public interface ColliMagazzinoRESTConsumerService {
|
||||
@POST("creaRettificaCollo")
|
||||
Call<ServiceRESTResponse<MtbColr>> creaRettificaCollo(@Query("codMdep") String codMdep, @Body RettificaULDTO rettificaULDTO);
|
||||
|
||||
@POST("wms/spostaULInPosizione")
|
||||
Call<ServiceRESTResponse<Object>> spostaULInPosizione(@Query("codMdep") String codMdep, @Query("posizione") String posizione, @Body MtbColt mtbColtToMove);
|
||||
|
||||
@POST("wms/spostaArtsTraUL")
|
||||
Call<ServiceRESTResponse<Object>> spostaArtsTraUL(@Body SpostaArtsTraULRequestDTO spostaArtsTraULRequestDTO);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
package it.integry.integrywmsnative.core.rest.model;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class SpostaArtsTraULRequestDTO {
|
||||
|
||||
|
||||
private MtbColt sourceMtbColt;
|
||||
|
||||
private MtbColt destinationMtbColt;
|
||||
|
||||
public MtbColt getSourceMtbColt() {
|
||||
return sourceMtbColt;
|
||||
}
|
||||
|
||||
public SpostaArtsTraULRequestDTO setSourceMtbColt(MtbColt sourceMtbColt) {
|
||||
this.sourceMtbColt = sourceMtbColt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MtbColt getDestinationMtbColt() {
|
||||
return destinationMtbColt;
|
||||
}
|
||||
|
||||
public SpostaArtsTraULRequestDTO setDestinationMtbColt(MtbColt destinationMtbColt) {
|
||||
this.destinationMtbColt = destinationMtbColt;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package it.integry.integrywmsnative.gest.versamento_merce;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface VersamentoMerceComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
VersamentoMerceComponent create();
|
||||
}
|
||||
|
||||
|
||||
void inject(VersamentoMerceFragment versamentoMerceFragment);
|
||||
|
||||
}
|
||||
@ -2,77 +2,92 @@ package it.integry.integrywmsnative.gest.versamento_merce;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeCallbackDTO;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
||||
import it.integry.integrywmsnative.core.interfaces.ITitledFragment;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainVersamentoMerceBinding;
|
||||
import it.integry.integrywmsnative.gest.versamento_merce.core.VersamentoMerceHelper;
|
||||
import it.integry.integrywmsnative.gest.versamento_merce.viewmodel.VersamentoMerceViewModel;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogAskLivelloPosizione;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
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;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLU;
|
||||
|
||||
public class VersamentoMerceFragment extends Fragment implements ITitledFragment {
|
||||
public class VersamentoMerceFragment extends BaseFragment implements ITitledFragment, VersamentoMerceViewModel.Listener {
|
||||
|
||||
private FragmentMainVersamentoMerceBinding mBinding;
|
||||
private VersamentoMerceViewModel mVersamentoMerceViewModel;
|
||||
private VersamentoMerceHelper mHelper;
|
||||
|
||||
@Inject
|
||||
VersamentoMerceViewModel mViewModel;
|
||||
|
||||
private FragmentMainVersamentoMerceBinding mBindings = null;
|
||||
|
||||
private final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||
|
||||
private int barcodeScannerIstanceID = -1;
|
||||
|
||||
public VersamentoMerceFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
|
||||
public static VersamentoMerceFragment newInstance() {
|
||||
VersamentoMerceFragment fragment = new VersamentoMerceFragment();
|
||||
return fragment;
|
||||
return new VersamentoMerceFragment();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mVersamentoMerceViewModel = new VersamentoMerceViewModel();
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(mVersamentoMerceViewModel.onScanSuccessfull)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_main_versamento_merce, container, false);
|
||||
|
||||
mBinding.setView(this);
|
||||
mBinding.setViewmodel(mVersamentoMerceViewModel);
|
||||
mBindings = DataBindingUtil.inflate(inflater, R.layout.fragment_main_versamento_merce, container, false);
|
||||
|
||||
init();
|
||||
return mBinding.getRoot();
|
||||
}
|
||||
MainApplication.appComponent
|
||||
.versamentoMerceComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
private void init() {
|
||||
mHelper = new VersamentoMerceHelper(getActivity());
|
||||
mVersamentoMerceViewModel.init(getActivity(), mBinding, mHelper, () -> {
|
||||
((IPoppableActivity) getActivity()).pop();
|
||||
});
|
||||
mViewModel.setListener(this);
|
||||
|
||||
mVersamentoMerceViewModel.openLU();
|
||||
mBindings.setLifecycleOwner(this);
|
||||
mBindings.setView(this);
|
||||
mBindings.setViewmodel(mViewModel);
|
||||
|
||||
this.initBarcodeReader();
|
||||
|
||||
this.openLU();
|
||||
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -82,10 +97,48 @@ public class VersamentoMerceFragment extends Fragment implements ITitledFragment
|
||||
for (Runnable onPreDestroy : mOnPreDestroyList) {
|
||||
onPreDestroy.run();
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void openLU() {
|
||||
DialogScanOrCreateLU.make(getActivity(), true, false, true, false, (mtbColt, created) -> {
|
||||
if (mtbColt == null) {
|
||||
((IPoppableActivity) getActivity()).pop();
|
||||
} else if ((mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && mtbColt.getSegno().equals(+1)) {
|
||||
this.mViewModel.getCurrentMtbColt().postValue(mtbColt);
|
||||
} else if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA) {
|
||||
this.mViewModel.getCurrentMtbColt().postValue(mtbColt);
|
||||
} else {
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString(Html.fromHtml("Sono accettate solamente UL di <b>Acquisto</b> o <b>Lavorazione</b> di <b>CARICO</b>")),
|
||||
null, this::openLU)
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");;
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
||||
|
||||
private void initBarcodeReader() {
|
||||
barcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessfull(onScanSuccessful)
|
||||
.setOnScanFailed(ex -> UtilityExceptions.defaultException(getActivity(), ex, false)));
|
||||
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
|
||||
this.mViewModel.processBarcodeDTO(data, () -> {
|
||||
BarcodeManager.enable();
|
||||
this.closeProgress();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
||||
titleText.setText(context.getText(R.string.versamento_merce_fragment_title).toString());
|
||||
@ -95,4 +148,93 @@ public class VersamentoMerceFragment extends Fragment implements ITitledFragment
|
||||
public void addOnPreDestroy(Runnable onPreDestroy) {
|
||||
this.mOnPreDestroyList.add(onPreDestroy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingStarted() {
|
||||
BarcodeManager.disable();
|
||||
this.openProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingEnded() {
|
||||
this.closeProgress();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLivelloPosizioneRequired(MtbDepoPosizione posizione, RunnableArgs<MtbDepoPosizione> onComplete) {
|
||||
DialogAskLivelloPosizione.make(getActivity(), posizione, false, onComplete, this::onError);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpostamentoTraDepConfirmRequired(String sourceCodMdep, String destinationCodMdep, RunnableArgs<Boolean> onComplete) {
|
||||
DialogSimpleMessageView.makeWarningDialog(Html.fromHtml("Stai spostando una UL dal deposito <b>" + sourceCodMdep + "</b> al deposito <b>" + destinationCodMdep + "</b>"),
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false))
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||
|
||||
DialogChooseArtsFromListaArts.make(getActivity(), mtbColrList, onComplete, onAbort).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemDispatched(MtbAart mtbAart,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
BigDecimal initialQtaTot,
|
||||
BigDecimal totalQtaAvailable,
|
||||
BigDecimal totalNumCnfAvailable,
|
||||
BigDecimal qtaCnfAvailable,
|
||||
String partitaMag,
|
||||
Date dataScad,
|
||||
boolean canOverflowOrderQuantity,
|
||||
boolean canBatchLotBeChanged,
|
||||
RunnableArgs<PickedQuantityDTO> onComplete) {
|
||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||
.setMtbAart(mtbAart)
|
||||
.setInitialNumCnf(initialNumCnf)
|
||||
.setInitialQtaCnf(initialQtaCnf)
|
||||
.setInitialQtaTot(initialQtaTot)
|
||||
.setTotalQtaAvailable(totalQtaAvailable)
|
||||
.setTotalNumCnfAvailable(totalNumCnfAvailable)
|
||||
.setQtaCnfAvailable(qtaCnfAvailable)
|
||||
.setPartitaMag(partitaMag)
|
||||
.setDataScad(dataScad)
|
||||
.setCanOverflowOrderQuantity(canOverflowOrderQuantity)
|
||||
.setCanPartitaMagBeChanged(canBatchLotBeChanged)
|
||||
.setCanLUBeClosed(false);
|
||||
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
|
||||
PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
.setQtaTot(resultDTO.getQtaTot())
|
||||
.setPartitaMag(resultDTO.getPartitaMag())
|
||||
.setDataScad(resultDTO.getDataScad());
|
||||
|
||||
onComplete.run(pickedQuantityDTO);
|
||||
|
||||
}, this::onLoadingEnded)
|
||||
.show(getActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataSaved() {
|
||||
DialogCommon.showDataSaved(getActivity(), () -> {
|
||||
((IPoppableActivity) getActivity()).pop();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
this.closeProgress();
|
||||
UtilityExceptions.defaultException(getActivity(), ex, mCurrentProgress);
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
package it.integry.integrywmsnative.gest.versamento_merce;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
|
||||
@Module(subcomponents = VersamentoMerceComponent.class)
|
||||
public class VersamentoMerceModule {
|
||||
|
||||
@Provides
|
||||
VersamentoMerceViewModel providesVersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||
return new VersamentoMerceViewModel(colliMagazzinoRESTConsumer, barcodeRESTConsumer, posizioniRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,359 @@
|
||||
package it.integry.integrywmsnative.gest.versamento_merce;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLUGestioneException;
|
||||
import it.integry.integrywmsnative.core.exception.NoArtsInLUException;
|
||||
import it.integry.integrywmsnative.core.exception.NoLUFoundException;
|
||||
import it.integry.integrywmsnative.core.exception.TooManyLUFoundInMonoLUPositionException;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.gest.spedizione.model.PickedQuantityDTO;
|
||||
|
||||
public class VersamentoMerceViewModel {
|
||||
|
||||
private final MutableLiveData<MtbColt> mCurrentMtbColt = new MutableLiveData<>();
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
private final ColliMagazzinoRESTConsumer mColliMagazzinoRESTConsumer;
|
||||
private final BarcodeRESTConsumer mBarcodeRESTConsumer;
|
||||
private final PosizioniRESTConsumer mPosizioniRESTConsumer;
|
||||
|
||||
@Inject
|
||||
public VersamentoMerceViewModel(ColliMagazzinoRESTConsumer colliMagazzinoRESTConsumer, BarcodeRESTConsumer barcodeRESTConsumer, PosizioniRESTConsumer posizioniRESTConsumer) {
|
||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
this.mPosizioniRESTConsumer = posizioniRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
|
||||
if (UtilityBarcode.isEtichettaPosizione(barcodeScanDTO, false)) {
|
||||
this.executeEtichettaPosizione(barcodeScanDTO, onComplete);
|
||||
} else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) {
|
||||
this.executeEtichettaLU(barcodeScanDTO.getStringValue(), true, onComplete);
|
||||
} else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) {
|
||||
this.executeEtichettaEan128(barcodeScanDTO, onComplete);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Runnable onComplete) {
|
||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||
.single();
|
||||
|
||||
if (foundPosizione.isFlagMonoCollo()) {
|
||||
this.mPosizioniRESTConsumer.getBancaliInPosizione(foundPosizione, mtbColtList -> {
|
||||
|
||||
if (mtbColtList == null || mtbColtList.size() == 0) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
mColliMagazzinoRESTConsumer.getByTestata(mtbColtList.get(0), true, false, mtbColt -> {
|
||||
|
||||
onComplete.run();
|
||||
//TAKE HERE
|
||||
pickMerceULtoUL(mtbColt);
|
||||
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendError(new TooManyLUFoundInMonoLUPositionException());
|
||||
}
|
||||
}, this::sendError);
|
||||
} else {
|
||||
|
||||
if(!UtilityString.equalsIgnoreCase(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep())) {
|
||||
this.sendOnSpostamentoTraDepConfirmRequired(mCurrentMtbColt.getValue().getCodMdep(), foundPosizione.getCodMdep(), canContinue -> {
|
||||
if(canContinue) {
|
||||
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione));
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Runnable onBarcodeScanComplete) {
|
||||
this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
String barcodeProd = null;
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||
barcodeProd = ean128Model.Content;
|
||||
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
this.executeEtichettaLU(ean128Model.Sscc, false, onBarcodeScanComplete);
|
||||
} else {
|
||||
this.sendError(new NoLUFoundException());
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
onBarcodeScanComplete.run();
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaLU(String sscc, boolean isAnonima, Runnable onComplete) {
|
||||
this.mColliMagazzinoRESTConsumer.getBySSCC(sscc, true, false, mtbColt -> {
|
||||
|
||||
if (mtbColt == null && !isAnonima) {
|
||||
this.sendError(new NoLUFoundException());
|
||||
} else if (mtbColt != null && (/*mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO ||*/ mtbColt.getGestioneEnum() == GestioneEnum.VENDITA)) {
|
||||
this.sendError(new InvalidLUGestioneException(GestioneEnum.VENDITA));
|
||||
} else {
|
||||
if (mtbColt == null) {
|
||||
this.mColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(sscc, GestioneEnum.LAVORAZIONE, mtbColtAnonimo -> {
|
||||
onComplete.run();
|
||||
pickMerceULtoUL(mtbColtAnonimo);
|
||||
}, this::sendError);
|
||||
|
||||
} else {
|
||||
onComplete.run();
|
||||
pickMerceULtoUL(mtbColt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
private void pickMerceULtoUL(MtbColt destMtbColt) {
|
||||
MtbColt sourceMtbColt = mCurrentMtbColt.getValue();
|
||||
|
||||
if(!UtilityString.equalsIgnoreCase(sourceMtbColt.getCodMdep(), destMtbColt.getCodMdep())) {
|
||||
this.sendError(new Exception("Impossibile spostare la merce tra UL di due depositi differenti"));
|
||||
return;
|
||||
}
|
||||
|
||||
List<MtbColr> mtbColrsToPick = Stream.of(sourceMtbColt.getMtbColr())
|
||||
.filter(x -> x.getQtaCol().floatValue() > 0)
|
||||
.toList();
|
||||
|
||||
if(mtbColrsToPick.size() == 0) {
|
||||
this.sendError(new NoArtsInLUException());
|
||||
return;
|
||||
}
|
||||
|
||||
this.sendOnArtsChooseRequired(mtbColrsToPick, pickedAarts -> {
|
||||
List<MtbColr> destNewMtbColr = new ArrayList<>();
|
||||
|
||||
askQuantities(pickedAarts.iterator(), destNewMtbColr, () -> {
|
||||
|
||||
MtbColt clonedSourceTestata = (MtbColt) sourceMtbColt.clone();
|
||||
clonedSourceTestata.setMtbColr(new ObservableArrayList<>());
|
||||
clonedSourceTestata.getMtbColr().addAll(destNewMtbColr);
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
this.mColliMagazzinoRESTConsumer.spostaArtsTraUL(
|
||||
sourceMtbColt,
|
||||
destMtbColt,
|
||||
this::sendOnDataSaved,
|
||||
this::sendError
|
||||
);
|
||||
|
||||
}, this::sendOnLoadingEnded);
|
||||
|
||||
}, this::sendOnLoadingEnded);
|
||||
}
|
||||
|
||||
|
||||
private void askQuantities(Iterator<MtbColr> sourceMtbColrs, List<MtbColr> destMtbColr, Runnable onComplete, Runnable onAbort) {
|
||||
|
||||
if (sourceMtbColrs.hasNext()) {
|
||||
askSingleQuantity(sourceMtbColrs.next(), mtbColr -> {
|
||||
destMtbColr.add(mtbColr);
|
||||
askQuantities(sourceMtbColrs, destMtbColr, onComplete, onAbort);
|
||||
}, onAbort);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
}
|
||||
|
||||
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete, Runnable onAbort) {
|
||||
this.sendOnItemDispatched(mtbColr.getMtbAart(),
|
||||
mtbColr.getNumCnf(),
|
||||
mtbColr.getQtaCnf(),
|
||||
mtbColr.getQtaCol(),
|
||||
mtbColr.getQtaCol(),
|
||||
mtbColr.getNumCnf(),
|
||||
mtbColr.getQtaCnf(),
|
||||
mtbColr.getPartitaMag(),
|
||||
mtbColr.getDataScadPartitaD(),
|
||||
false,
|
||||
false,
|
||||
pickedQuantity -> {
|
||||
mtbColr
|
||||
.setQtaCol(pickedQuantity.getQtaTot())
|
||||
.setQtaCnf(pickedQuantity.getQtaCnf())
|
||||
.setNumCnf(pickedQuantity.getNumCnf())
|
||||
.setDatetimeRow(UtilityDate.getDateInstance());
|
||||
|
||||
onComplete.run(mtbColr);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void updatePosizione(MtbDepoPosizione mtbDepoPosizione, boolean shouldAskLivello) {
|
||||
|
||||
if (shouldAskLivello) {
|
||||
this.sendOnLivelloPosizioneRequired(mtbDepoPosizione, newPosizione -> {
|
||||
|
||||
if (newPosizione == null) {
|
||||
updatePosizione(mtbDepoPosizione, shouldAskLivello);
|
||||
} else {
|
||||
updatePosizione(newPosizione, false);
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
this.sendOnLoadingStarted();
|
||||
mColliMagazzinoRESTConsumer.changePosizione(mCurrentMtbColt.getValue(), mtbDepoPosizione, () -> {
|
||||
this.sendOnLoadingEnded();
|
||||
this.sendOnDataSaved();
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public MutableLiveData<MtbColt> getCurrentMtbColt() {
|
||||
return mCurrentMtbColt;
|
||||
}
|
||||
|
||||
public VersamentoMerceViewModel setListener(Listener listener) {
|
||||
this.mListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
private void sendOnDataSaved() {
|
||||
if (this.mListener != null) mListener.onDataSaved();
|
||||
}
|
||||
|
||||
private void sendOnLivelloPosizioneRequired(MtbDepoPosizione posizione, RunnableArgs<MtbDepoPosizione> onComplete) {
|
||||
if (this.mListener != null)
|
||||
mListener.onLivelloPosizioneRequired(posizione, onComplete);
|
||||
}
|
||||
|
||||
private void sendOnArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||
if (this.mListener != null)
|
||||
mListener.onArtsChooseRequired(mtbColrList, onComplete, onAbort);
|
||||
}
|
||||
|
||||
private void sendOnSpostamentoTraDepConfirmRequired(String sourceCodMdep, String destinationCodMdep, RunnableArgs<Boolean> onComplete) {
|
||||
if (this.mListener != null)
|
||||
mListener.onSpostamentoTraDepConfirmRequired(sourceCodMdep, destinationCodMdep, onComplete);
|
||||
}
|
||||
|
||||
private void sendOnItemDispatched(MtbAart mtbAart,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
BigDecimal initialQtaTot,
|
||||
BigDecimal totalQtaAvailable,
|
||||
BigDecimal totalNumCnfAvailable,
|
||||
BigDecimal qtaCnfAvailable,
|
||||
String partitaMag,
|
||||
Date dataScad,
|
||||
boolean canOverflowOrderQuantity,
|
||||
boolean canBatchLotBeChanged,
|
||||
RunnableArgs<PickedQuantityDTO> onComplete) {
|
||||
if (this.mListener != null) mListener.onItemDispatched(
|
||||
mtbAart,
|
||||
initialNumCnf,
|
||||
initialQtaCnf,
|
||||
initialQtaTot,
|
||||
totalQtaAvailable,
|
||||
totalNumCnfAvailable,
|
||||
qtaCnfAvailable,
|
||||
partitaMag,
|
||||
dataScad,
|
||||
canOverflowOrderQuantity,
|
||||
canBatchLotBeChanged,
|
||||
onComplete);
|
||||
}
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.mListener != null) mListener.onLoadingStarted();
|
||||
}
|
||||
|
||||
private void sendOnLoadingEnded() {
|
||||
if (this.mListener != null) mListener.onLoadingEnded();
|
||||
}
|
||||
|
||||
private void sendError(Exception ex) {
|
||||
if (this.mListener != null) mListener.onError(ex);
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
|
||||
void onLivelloPosizioneRequired(MtbDepoPosizione posizione, RunnableArgs<MtbDepoPosizione> onComplete);
|
||||
|
||||
void onSpostamentoTraDepConfirmRequired(String sourceCodMdep, String destinationCodMdep, RunnableArgs<Boolean> onComplete);
|
||||
|
||||
void onArtsChooseRequired(List<MtbColr> mtbColrList, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort);
|
||||
|
||||
void onItemDispatched(MtbAart mtbAart,
|
||||
BigDecimal initialNumCnf,
|
||||
BigDecimal initialQtaCnf,
|
||||
BigDecimal initialQtaTot,
|
||||
BigDecimal totalQtaAvailable,
|
||||
BigDecimal totalNumCnfAvailable,
|
||||
BigDecimal qtaCnfAvailable,
|
||||
String partitaMag,
|
||||
Date dataScad,
|
||||
boolean canOverflowOrderQuantity,
|
||||
boolean canBatchLotBeChanged,
|
||||
RunnableArgs<PickedQuantityDTO> onComplete);
|
||||
|
||||
void onDataSaved();
|
||||
|
||||
void onError(Exception ex);
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
package it.integry.integrywmsnative.gest.versamento_merce.core;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class VersamentoMerceHelper {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public VersamentoMerceHelper(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,477 +0,0 @@
|
||||
package it.integry.integrywmsnative.gest.versamento_merce.viewmodel;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.barcode_base_android_library.model.BarcodeType;
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.IPoppableActivity;
|
||||
import it.integry.integrywmsnative.core.model.CommonModelConsts;
|
||||
import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityDate;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityProgress;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityString;
|
||||
import it.integry.integrywmsnative.databinding.FragmentMainVersamentoMerceBinding;
|
||||
import it.integry.integrywmsnative.gest.versamento_merce.core.VersamentoMerceHelper;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogAskLivelloPosizione;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogCommon;
|
||||
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.DialogInputQuantityV2View;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLU;
|
||||
|
||||
public class VersamentoMerceViewModel {
|
||||
|
||||
|
||||
private FragmentActivity mContext;
|
||||
private FragmentMainVersamentoMerceBinding mBinding;
|
||||
private VersamentoMerceHelper mHelper;
|
||||
|
||||
public ObservableField<MtbColt> mtbColt = new ObservableField<>();
|
||||
|
||||
|
||||
private Runnable mOnVersamentoCompleted;
|
||||
|
||||
public void init(FragmentActivity context, FragmentMainVersamentoMerceBinding binding, VersamentoMerceHelper helper, Runnable onVersamentoCompleted) {
|
||||
mContext = context;
|
||||
mBinding = binding;
|
||||
mHelper = helper;
|
||||
mOnVersamentoCompleted = onVersamentoCompleted;
|
||||
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
public void openLU() {
|
||||
DialogScanOrCreateLU.make(mContext, true, false, true, false, (mtbColt, created) -> {
|
||||
if (mtbColt == null) {
|
||||
((IPoppableActivity) mContext).pop();
|
||||
} else if ((mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) && mtbColt.getSegno().equals(+1)) {
|
||||
setMtbColt(mtbColt);
|
||||
} else if (mtbColt.getGestioneEnum() == GestioneEnum.VENDITA) {
|
||||
setMtbColt(mtbColt);
|
||||
} else {
|
||||
DialogSimpleMessageView
|
||||
.makeWarningDialog(new SpannableString(Html.fromHtml("Sono accettate solamente UL di <b>Acquisto</b> o <b>Lavorazione</b> di <b>CARICO</b>")),
|
||||
null, this::openLU)
|
||||
.show(mContext.getSupportFragmentManager(), "tag");;
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
||||
public void setMtbColt(MtbColt mtbColt) {
|
||||
this.mtbColt.set(mtbColt);
|
||||
}
|
||||
|
||||
public void resetMtbColt() {
|
||||
this.mtbColt.set(null);
|
||||
openLU();
|
||||
}
|
||||
|
||||
public RunnableArgs<BarcodeScanDTO> onScanSuccessfull = data -> {
|
||||
BarcodeManager.disable();
|
||||
Dialog progressDialog = UtilityProgress.createDefaultProgressDialog(mContext);
|
||||
|
||||
if (UtilityBarcode.isEtichettaPosizione(data, false)) {
|
||||
progressDialog.show();
|
||||
this.executeEtichettaPosizione(data, progressDialog);
|
||||
} else if (data.getType() == BarcodeType.EAN8 || data.getType() == BarcodeType.EAN13 || data.getType() == BarcodeType.UPCA) {
|
||||
//searchArtInt(data.getStringValue());
|
||||
} else if (UtilityBarcode.isEtichettaAnonima(data)) {
|
||||
this.executeEtichettaLU(data.getStringValue(), true, progressDialog);
|
||||
} else if (UtilityBarcode.isEtichetta128(data)) {
|
||||
this.executeEtichettaEan128(data, progressDialog);
|
||||
} else {
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
private void executeEtichettaPosizione(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
||||
MtbDepoPosizione foundPosizione = Stream.of(SettingsManager.iDB().getAvailablePosizioni())
|
||||
.filter(x -> x.getPosizione().equalsIgnoreCase(barcodeScanDTO.getStringValue()))
|
||||
.single();
|
||||
|
||||
if (foundPosizione.isFlagMonoCollo()) {
|
||||
|
||||
PosizioniRESTConsumer.getBancaliInPosizioneStatic(foundPosizione, mtbColtList -> {
|
||||
|
||||
if (mtbColtList == null || mtbColtList.size() == 0) {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
DialogCommon.showNoULFound(mContext, null);
|
||||
} else if (mtbColtList.size() == 1) {
|
||||
ColliMagazzinoRESTConsumer.getByTestataStatic(mtbColtList.get(0), true, false, mtbColt -> {
|
||||
|
||||
//TAKE HERE
|
||||
pickMerceULtoUL(mtbColt, progressDialog);
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
} else {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
showTooMuchULFound();
|
||||
}
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
} else {
|
||||
updatePosizione(foundPosizione, UtilityPosizione.isPosizioneWithLivello(foundPosizione), progressDialog);
|
||||
}
|
||||
}
|
||||
|
||||
private void showTooMuchULFound() {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
new SpannableString(mContext.getResources().getText(R.string.too_much_lu_found_message_in_mono_lu)),
|
||||
null, null)
|
||||
.show(mContext.getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
private void executeEtichettaEan128(BarcodeScanDTO barcodeScanDTO, Dialog progressDialog) {
|
||||
BarcodeRESTConsumer.decodeEan128Static(barcodeScanDTO, ean128Model -> {
|
||||
|
||||
String barcodeProd = null;
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin;
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Content))
|
||||
barcodeProd = ean128Model.Content;
|
||||
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(barcodeProd)) {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) {
|
||||
this.executeEtichettaLU(ean128Model.Sscc, false, progressDialog);
|
||||
} else {
|
||||
DialogCommon.showNoULFound(mContext, null);
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
//EAN 128 non completo o comunque mancano i riferimenti al prodotto
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void executeEtichettaLU(String sscc, boolean isAnonima, Dialog progressDialog) {
|
||||
ColliMagazzinoRESTConsumer.getBySSCCStatic(sscc, true, false, mtbColt -> {
|
||||
|
||||
if (mtbColt == null && !isAnonima) {
|
||||
DialogCommon.showNoULFound(mContext, null);
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
} else if(mtbColt != null && (/*mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO ||*/ mtbColt.getGestioneEnum() == GestioneEnum.VENDITA)) {
|
||||
showWrongGestioneUL();
|
||||
BarcodeManager.enable();
|
||||
progressDialog.dismiss();
|
||||
} else {
|
||||
if (mtbColt == null && isAnonima) {
|
||||
ColliMagazzinoRESTConsumer.createColloFromEtichettaAnonima(sscc, GestioneEnum.LAVORAZIONE, mtbColtAnonimo -> {
|
||||
pickMerceULtoUL(mtbColtAnonimo, progressDialog);
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
} else {
|
||||
pickMerceULtoUL(mtbColt, progressDialog);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
}
|
||||
|
||||
private void updatePosizione(MtbDepoPosizione mtbDepoPosizione, boolean shouldAskLivello, Dialog progressDialog) {
|
||||
|
||||
if (shouldAskLivello) {
|
||||
DialogAskLivelloPosizione.make(mContext, mtbDepoPosizione, false, newPosizione -> {
|
||||
|
||||
if (newPosizione == null) {
|
||||
updatePosizione(mtbDepoPosizione, shouldAskLivello, progressDialog);
|
||||
} else {
|
||||
updatePosizione(newPosizione, false, progressDialog);
|
||||
}
|
||||
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
} else {
|
||||
ColliMagazzinoRESTConsumer.changePosizione(mtbColt.get(), mtbDepoPosizione, () -> {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
|
||||
DialogCommon.showDataSaved(mContext, mOnVersamentoCompleted);
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex, progressDialog);
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void pickMerceULtoUL(MtbColt destMtbColt, Dialog progressDialog) {
|
||||
MtbColt sourceMtbColt = mtbColt.get();
|
||||
|
||||
List<MtbColr> mtbColrsToPick = Stream.of(mtbColt.get().getMtbColr())
|
||||
.filter(x -> x.getQtaCol().floatValue() > 0)
|
||||
.toList();
|
||||
|
||||
DialogChooseArtsFromListaArts.make(mContext, mtbColrsToPick, pickedAarts -> {
|
||||
|
||||
progressDialog.dismiss();
|
||||
|
||||
List<MtbColr> destNewMtbColr = new ArrayList<>();
|
||||
|
||||
askQuantities(pickedAarts.iterator(), destNewMtbColr, () -> {
|
||||
BarcodeManager.enable();
|
||||
|
||||
if (destNewMtbColr != null && destNewMtbColr.size() > 0) {
|
||||
MtbColt clonedSourceTestata = (MtbColt) sourceMtbColt.clone();
|
||||
MtbColt clonedDestTestata = (MtbColt) destMtbColt.clone();
|
||||
|
||||
ObservableArrayList<MtbColr> mtbColrSourceObservableField = new ObservableArrayList<>();
|
||||
ObservableArrayList<MtbColr> mtbColrDestObservableField = new ObservableArrayList<>();
|
||||
|
||||
for (int i = 0; i < destNewMtbColr.size(); i++) {
|
||||
MtbColr cloneMtbColr = (MtbColr) destNewMtbColr.get(i).clone();
|
||||
|
||||
boolean destroyMtbColrReferences = false;
|
||||
|
||||
//Se le gestioni sono uguali faccio uno storno sulla sorgente e non lavoro con
|
||||
//i riferimenti
|
||||
if ((sourceMtbColt.getGestioneEnum() == destMtbColt.getGestioneEnum() && sourceMtbColt.getGestioneEnum() == GestioneEnum.VENDITA) ||
|
||||
(sourceMtbColt.getGestioneEnum() == GestioneEnum.VENDITA && sourceMtbColt.getSegno() == -1 && destMtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE)) {
|
||||
destroyMtbColrReferences = true;
|
||||
|
||||
MtbColr stornoSourceMtbColr = (MtbColr) destNewMtbColr.get(i).clone();
|
||||
|
||||
stornoSourceMtbColr
|
||||
.setGestione((String) null)
|
||||
.setNumCollo(null)
|
||||
.setSerCollo(null)
|
||||
.setDataCollo(null)
|
||||
.setGestioneRif(null)
|
||||
.setNumColloRif(null)
|
||||
.setSerColloRif(null)
|
||||
.setDataColloRif((String) null)
|
||||
.setCausale(MtbColr.Causale.VERSAMENTO)
|
||||
.setUtente(SettingsManager.i().getUser().getFullname())
|
||||
|
||||
.setQtaCol(stornoSourceMtbColr.getQtaCol().multiply(new BigDecimal(-1)))
|
||||
.setNumCnf(stornoSourceMtbColr.getNumCnf().multiply(new BigDecimal(-1)));
|
||||
|
||||
mtbColrSourceObservableField.add(stornoSourceMtbColr);
|
||||
}
|
||||
|
||||
if (!destroyMtbColrReferences) {
|
||||
cloneMtbColr
|
||||
.setGestioneRif(cloneMtbColr.getGestione())
|
||||
.setSerColloRif(cloneMtbColr.getSerCollo())
|
||||
.setNumColloRif(cloneMtbColr.getNumCollo())
|
||||
.setDataColloRif(cloneMtbColr.getDataColloS());
|
||||
}
|
||||
|
||||
if (sourceMtbColt.getGestioneEnum() == GestioneEnum.VENDITA && sourceMtbColt.getSegno() == +1) {
|
||||
cloneMtbColr.setCodJcom(null);
|
||||
}
|
||||
|
||||
cloneMtbColr
|
||||
.setGestione((String) null)
|
||||
.setSerCollo(null)
|
||||
.setNumCollo(null)
|
||||
.setDataCollo(null)
|
||||
.setCausale(MtbColr.Causale.VERSAMENTO)
|
||||
.setUtente(SettingsManager.i().getUser().getFullname());
|
||||
|
||||
mtbColrDestObservableField.add(cloneMtbColr);
|
||||
}
|
||||
|
||||
clonedSourceTestata.setMtbColr(mtbColrSourceObservableField);
|
||||
clonedDestTestata.setMtbColr(mtbColrDestObservableField);
|
||||
|
||||
|
||||
saveLUs(clonedSourceTestata, clonedDestTestata);
|
||||
}
|
||||
|
||||
}, () -> {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
});
|
||||
|
||||
}, () -> {
|
||||
progressDialog.dismiss();
|
||||
BarcodeManager.enable();
|
||||
}).show();
|
||||
}
|
||||
|
||||
|
||||
private void askQuantities(Iterator<MtbColr> sourceMtbColrs, List<MtbColr> destMtbColr, Runnable onComplete, Runnable onAbort) {
|
||||
|
||||
if (sourceMtbColrs.hasNext()) {
|
||||
|
||||
askSingleQuantity(sourceMtbColrs.next(), mtbColr -> {
|
||||
|
||||
|
||||
destMtbColr.add(mtbColr);
|
||||
askQuantities(sourceMtbColrs, destMtbColr, onComplete, onAbort);
|
||||
}, onAbort);
|
||||
} else {
|
||||
onComplete.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void askSingleQuantity(MtbColr mtbColr, RunnableArgs<MtbColr> onComplete, Runnable onAbort) {
|
||||
DialogInputQuantityV2DTO dialogInputQuantityV2DTO = new DialogInputQuantityV2DTO()
|
||||
.setMtbAart(mtbColr.getMtbAart())
|
||||
.setInitialNumCnf(mtbColr.getNumCnf())
|
||||
.setInitialQtaCnf(mtbColr.getQtaCnf())
|
||||
.setInitialQtaTot(mtbColr.getQtaCol())
|
||||
.setTotalQtaAvailable(mtbColr.getQtaCol())
|
||||
.setTotalNumCnfAvailable(mtbColr.getNumCnf())
|
||||
.setQtaCnfAvailable(mtbColr.getQtaCnf())
|
||||
.setPartitaMag(mtbColr.getPartitaMag())
|
||||
.setDataScad(mtbColr.getDataScadPartitaD())
|
||||
.setCanOverflowOrderQuantity(false)
|
||||
.setCanPartitaMagBeChanged(false)
|
||||
.setCanLUBeClosed(false);
|
||||
|
||||
DialogInputQuantityV2View
|
||||
.newInstance(dialogInputQuantityV2DTO, (resultDTO, shouldCloseLU) -> {
|
||||
// PickedQuantityDTO pickedQuantityDTO = new PickedQuantityDTO()
|
||||
// .setNumCnf(resultDTO.getNumCnf())
|
||||
// .setQtaCnf(resultDTO.getQtaCnf())
|
||||
// .setQtaTot(resultDTO.getQtaTot())
|
||||
// .setPartitaMag(resultDTO.getPartitaMag())
|
||||
// .setDataScad(resultDTO.getDataScad());
|
||||
//
|
||||
// onComplete.run(pickedQuantityDTO, shouldCloseLU);
|
||||
|
||||
mtbColr
|
||||
.setQtaCol(resultDTO.getQtaTot())
|
||||
.setQtaCnf(resultDTO.getQtaCnf())
|
||||
.setNumCnf(resultDTO.getNumCnf())
|
||||
.setDatetimeRow(UtilityDate.getDateInstance());
|
||||
|
||||
onComplete.run(mtbColr);
|
||||
}, onAbort)
|
||||
.show(mContext.getSupportFragmentManager(), "tag");
|
||||
|
||||
|
||||
|
||||
|
||||
// DialogInputQuantity.DTO dto = new DialogInputQuantity.DTO()
|
||||
// .setBatchLot(mtbColr.getPartitaMag())
|
||||
// .setDataScad(mtbColr.getDataScadPartitaD())
|
||||
// .setMtbAart(mtbColr.getMtbAart())
|
||||
// .setQtaTot(mtbColr.getQtaCol())
|
||||
// .setQtaOrd(mtbColr.getQtaCol())
|
||||
// .setQtaDaEvadere(new BigDecimal(-1))
|
||||
// .setQtaEvasa(BigDecimal.ZERO)
|
||||
// .setCanPartitaMagBeChanged(false)
|
||||
// .setCanDataScadBeChanged(false)
|
||||
// .setMaxQta(mtbColr.getQtaCol());
|
||||
//
|
||||
// DialogInputQuantity.makeBase(mContext, dto, false, quantityDTO -> {
|
||||
// mtbColr
|
||||
// .setQtaCol(quantityDTO.qtaTot.getBigDecimal())
|
||||
// .setQtaCnf(quantityDTO.qtaCnf.getBigDecimal())
|
||||
// .setNumCnf(quantityDTO.numCnf.getBigDecimal())
|
||||
// .setDatetimeRow(UtilityDate.getDateInstance());
|
||||
//
|
||||
// onComplete.run(mtbColr);
|
||||
// }, onAbort).show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void askULVenditaConfirm(RunnableArgs<Boolean> callback) {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
new SpannableString(mContext.getResources().getString(R.string.lu_gest_v_loading_alert)),
|
||||
null,
|
||||
() -> callback.run(true),
|
||||
() -> callback.run(false))
|
||||
.show(mContext.getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
private void showWrongGestioneUL() {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
new SpannableString(Html.fromHtml(mContext.getResources().getText(R.string.gestione_V_not_accepted_message).toString())),
|
||||
null, null)
|
||||
.show(mContext.getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void saveLUs(MtbColt mtbColt1, MtbColt mtbColt2) {
|
||||
|
||||
ArrayList<MtbColt> mtbColts = new ArrayList<>();
|
||||
mtbColts.add(mtbColt1);
|
||||
mtbColts.add(mtbColt2);
|
||||
|
||||
for (MtbColt mtbColt : mtbColts) {
|
||||
mtbColt.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
|
||||
for (int i = 0; i < mtbColt.getMtbColr().size(); i++) {
|
||||
mtbColt.getMtbColr().get(i)
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ColliMagazzinoRESTConsumer.saveColliStatic(mtbColts, value -> {
|
||||
DialogCommon.showDataSaved(mContext, () -> {
|
||||
mOnVersamentoCompleted.run();
|
||||
});
|
||||
}, ex -> {
|
||||
UtilityExceptions.defaultException(mContext, ex);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
<variable
|
||||
name="viewmodel"
|
||||
type="it.integry.integrywmsnative.gest.versamento_merce.viewmodel.VersamentoMerceViewModel" />
|
||||
type="it.integry.integrywmsnative.gest.versamento_merce.VersamentoMerceViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
@ -21,12 +21,12 @@
|
||||
android:background="@color/full_white">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/gray_detail_background_round8"
|
||||
@ -35,7 +35,7 @@
|
||||
android:layout_marginRight="8dp"
|
||||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
@ -50,14 +50,14 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{viewmodel.mtbColt.getDataColloHumanLong()}"
|
||||
android:text="@{viewmodel.currentMtbColt.getDataColloHumanLong()}"
|
||||
tools:text="22 ottobre 2018"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
@ -72,14 +72,14 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{viewmodel.mtbColt.getPreparatoDa() != null ? viewmodel.mtbColt.getPreparatoDa() : `N/D`}"
|
||||
android:text="@{viewmodel.currentMtbColt.getPreparatoDa() != null ? viewmodel.currentMtbColt.getPreparatoDa() : `N/D`}"
|
||||
tools:text="Vito Falagario"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="italic" />
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
@ -95,14 +95,14 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{viewmodel.mtbColt.getPosizione() != null ? viewmodel.mtbColt.getPosizione() : `N/D`}"
|
||||
android:text="@{viewmodel.currentMtbColt.getPosizione() != null ? viewmodel.currentMtbColt.getPosizione() : `N/D`}"
|
||||
tools:text="A00F00C00L00"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
@ -117,7 +117,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{viewmodel.mtbColt.getCodMdep()}"
|
||||
android:text="@{viewmodel.currentMtbColt.getCodMdep()}"
|
||||
tools:text="10"
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp"
|
||||
@ -132,13 +132,13 @@
|
||||
android:textColor="@android:color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />-->
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
@ -146,7 +146,7 @@
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
@ -168,10 +168,10 @@
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="Scansiona il codice a barre di destinazione"/>
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</FrameLayout>
|
||||
</layout>
|
||||
@ -10,7 +10,7 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
||||
classpath 'com.android.tools.build:gradle:4.1.3'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'com.google.gms:google-services:4.3.5'
|
||||
classpath 'com.google.firebase:perf-plugin:1.3.5'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user