Implementata gestione del versamento materiale a magazzino buffer
This commit is contained in:
@@ -69,6 +69,8 @@ import it.integry.integrywmsnative.gest.prod_rientro_merce.ProdRientroMerceCompo
|
||||
import it.integry.integrywmsnative.gest.prod_rientro_merce.order_detail.ProdRientroMerceOrderDetailComponent;
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeComponent;
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeModule;
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale_su_mag_prossimita.ProdVersamentoMaterialeInBufferComponent;
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale_su_mag_prossimita.ProdVersamentoMaterialeInBufferModule;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditComponent;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.PVOrdineAcquistoEditModule;
|
||||
import it.integry.integrywmsnative.gest.pv_ordine_acquisto_edit.dialog.edit_articolo.DialogEditArticoloComponent;
|
||||
@@ -117,6 +119,8 @@ import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdC
|
||||
import it.integry.integrywmsnative.view.dialogs.input_lu_prod.DialogInputLUProdModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_peso_lu.DialogInputPesoLUComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_peso_lu.DialogInputPesoLUModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_to_return.DialogInputQuantityToReturnComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_to_return.DialogInputQuantityToReturnModule;
|
||||
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.printSsccUl.DialogPrintUlSSCCComponent;
|
||||
@@ -189,7 +193,9 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
MainAccettazioneBollaElencoModule.class,
|
||||
AccettazioneBollaPickingModule.class,
|
||||
DialogBindProductBarcodeWithPackageModule.class,
|
||||
DialogAskUnknownBarcodeNotesModule.class
|
||||
DialogAskUnknownBarcodeNotesModule.class,
|
||||
ProdVersamentoMaterialeInBufferModule.class,
|
||||
DialogInputQuantityToReturnModule.class
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
@@ -316,8 +322,13 @@ public interface MainApplicationComponent {
|
||||
AccettazioneBollaPickingComponent.Factory accettazioneBollaPickingComponent();
|
||||
|
||||
DialogBindProductBarcodeWithPackageComponent.Factory dialogBindProductBarcodeWithPackageComponent();
|
||||
|
||||
DialogAskUnknownBarcodeNotesComponent.Factory dialogAskUnknownBarcodeNotesComponent();
|
||||
|
||||
ProdVersamentoMaterialeInBufferComponent.Factory prodVersamentoMaterialeInBufferComponent();
|
||||
|
||||
DialogInputQuantityToReturnComponent.Factory dialogInputQuantityToReturnComponent();
|
||||
|
||||
void inject(MainApplication mainApplication);
|
||||
|
||||
void inject(AppContext mainApplication);
|
||||
|
||||
@@ -32,6 +32,7 @@ import it.integry.integrywmsnative.core.rest.consumers.EntityRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoBufferRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MesRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.OrdiniRESTConsumer;
|
||||
@@ -281,4 +282,10 @@ public class MainApplicationModule {
|
||||
return new MagazzinoAutomaticoRESTConsumer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
MagazzinoBufferRESTConsumer provideMagazzinoBufferRESTConsumer() {
|
||||
return new MagazzinoBufferRESTConsumer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package it.integry.integrywmsnative.core.class_router.configs;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordini_elenco.MainAccettazioneOrdiniElencoFragment;
|
||||
import it.integry.integrywmsnative.gest.accettazione_bolla_elenco.MainAccettazioneBollaElencoFragment;
|
||||
import it.integry.integrywmsnative.gest.accettazione_ordini_elenco.MainAccettazioneOrdiniElencoFragment;
|
||||
import it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniFragment;
|
||||
import it.integry.integrywmsnative.gest.inventario.ElencoInventariFragment;
|
||||
import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoFragment;
|
||||
@@ -14,6 +14,7 @@ import it.integry.integrywmsnative.gest.prod_linee_produzione.ProdLineeProduzion
|
||||
import it.integry.integrywmsnative.gest.prod_recupero_materiale.ProdRecuperoMaterialeFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_rientro_merce.ProdRientroMerceFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale.ProdVersamentoMaterialeFragment;
|
||||
import it.integry.integrywmsnative.gest.prod_versamento_materiale_su_mag_prossimita.ProdVersamentoMaterialeInBufferFragment;
|
||||
import it.integry.integrywmsnative.gest.pv_ordini_acquisto.PVOrdiniAcquistoGrigliaFragment;
|
||||
import it.integry.integrywmsnative.gest.rettifica_giacenze.RettificaGiacenzeFragment;
|
||||
import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.info_situazione_articolo.DialogInfoSituazioneArticoloView;
|
||||
@@ -161,6 +162,14 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
.setTitleIcon(R.drawable.ic_production_line)
|
||||
.setDrawerIcon(R.drawable.ic_production_line)
|
||||
.setFragmentFactory(ProdLineeProduzioneFragment::newInstance))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_versamento_materiale_in_buffer)
|
||||
.setCodMenu("MG066")
|
||||
.setTitleText(R.string.prod_versamento_materiale_in_buffer_title_fragment)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_versamento_materiale)
|
||||
.setDrawerIcon(R.drawable.ic_black_external)
|
||||
.setFragmentFactory(ProdVersamentoMaterialeInBufferFragment::newInstance))
|
||||
).addGroup(
|
||||
new MenuGroup()
|
||||
.setGroupText(R.string.internal_handling)
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.rest.RESTBuilder;
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_buffer.MagazzinoBufferVersamentoMaterialeCloseRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_buffer.MagazzinoBufferVersamentoMaterialeRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
@Singleton
|
||||
public class MagazzinoBufferRESTConsumer extends _BaseRESTConsumer {
|
||||
|
||||
public void isVersamentoStarted(MtbDepoPosizione posizione, MagazzinoBufferVersamentoMaterialeRequestDTO magazzinoBufferVersamentoMaterialeRequestDTO, RunnableArgs<Boolean> onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoBufferRESTConsumerService magazzinoBufferRESTConsumerService = RESTBuilder.getService(MagazzinoBufferRESTConsumerService.class);
|
||||
magazzinoBufferRESTConsumerService.isVersamentoStarted(posizione.getPosizione(), magazzinoBufferVersamentoMaterialeRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Boolean>> call, Response<ServiceRESTResponse<Boolean>> response) {
|
||||
analyzeAnswer(response, "magazzino-buffer/isVersamentoStarted", onComplete, onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Boolean>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void startVersamentoMateriale(MtbDepoPosizione posizione, MagazzinoBufferVersamentoMaterialeRequestDTO magazzinoBufferVersamentoMaterialeRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoBufferRESTConsumerService magazzinoBufferRESTConsumerService = RESTBuilder.getService(MagazzinoBufferRESTConsumerService.class);
|
||||
magazzinoBufferRESTConsumerService.startVersamentoMateriale(posizione.getPosizione(), magazzinoBufferVersamentoMaterialeRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "magazzino-buffer/startVersamentoMateriale", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void endVersamentoMateriale(MtbDepoPosizione posizione, MagazzinoBufferVersamentoMaterialeCloseRequestDTO magazzinoBufferVersamentoMaterialeCloseRequestDTO, Runnable onComplete, RunnableArgs<Exception> onFailed) {
|
||||
MagazzinoBufferRESTConsumerService magazzinoBufferRESTConsumerService = RESTBuilder.getService(MagazzinoBufferRESTConsumerService.class);
|
||||
magazzinoBufferRESTConsumerService.endVersamentoMateriale(posizione.getPosizione(), magazzinoBufferVersamentoMaterialeCloseRequestDTO)
|
||||
.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(Call<ServiceRESTResponse<Void>> call, Response<ServiceRESTResponse<Void>> response) {
|
||||
analyzeAnswer(response, "magazzino-buffer/endVersamentoMateriale", data -> onComplete.run(), onFailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ServiceRESTResponse<Void>> call, Throwable t) {
|
||||
onFailed.run(new Exception(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package it.integry.integrywmsnative.core.rest.consumers;
|
||||
|
||||
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_buffer.MagazzinoBufferVersamentoMaterialeCloseRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_buffer.MagazzinoBufferVersamentoMaterialeRequestDTO;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Path;
|
||||
|
||||
public interface MagazzinoBufferRESTConsumerService {
|
||||
|
||||
@POST("wms/magazzino-buffer/{posizione}/isVersamentoStarted")
|
||||
Call<ServiceRESTResponse<Boolean>> isVersamentoStarted(
|
||||
@Path("posizione") String posizione,
|
||||
@Body MagazzinoBufferVersamentoMaterialeRequestDTO magazzinoBufferVersamentoMaterialeRequestDTO);
|
||||
|
||||
@POST("wms/magazzino-buffer/{posizione}/startVersamentoMateriale")
|
||||
Call<ServiceRESTResponse<Void>> startVersamentoMateriale(
|
||||
@Path("posizione") String posizione,
|
||||
@Body MagazzinoBufferVersamentoMaterialeRequestDTO magazzinoBufferVersamentoMaterialeRequestDTO);
|
||||
|
||||
@POST("wms/magazzino-buffer/{posizione}/endVersamentoMateriale")
|
||||
Call<ServiceRESTResponse<Void>> endVersamentoMateriale(
|
||||
@Path("posizione") String posizione,
|
||||
@Body MagazzinoBufferVersamentoMaterialeCloseRequestDTO magazzinoBufferVersamentoMaterialeCloseRequestDTO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.magazzino_buffer;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class MagazzinoBufferVersamentoMaterialeCloseRequestDTO {
|
||||
|
||||
private MtbColt inputMtbColt;
|
||||
private BigDecimal qtaTotDaScaricare;
|
||||
private BigDecimal numCnfDaScaricare;
|
||||
|
||||
|
||||
|
||||
public MtbColt getInputMtbColt() {
|
||||
return inputMtbColt;
|
||||
}
|
||||
|
||||
public MagazzinoBufferVersamentoMaterialeCloseRequestDTO setInputMtbColt(MtbColt inputMtbColt) {
|
||||
this.inputMtbColt = inputMtbColt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaTotDaScaricare() {
|
||||
return qtaTotDaScaricare;
|
||||
}
|
||||
|
||||
public MagazzinoBufferVersamentoMaterialeCloseRequestDTO setQtaTotDaScaricare(BigDecimal qtaTotDaScaricare) {
|
||||
this.qtaTotDaScaricare = qtaTotDaScaricare;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getNumCnfDaScaricare() {
|
||||
return numCnfDaScaricare;
|
||||
}
|
||||
|
||||
public MagazzinoBufferVersamentoMaterialeCloseRequestDTO setNumCnfDaScaricare(BigDecimal numCnfDaScaricare) {
|
||||
this.numCnfDaScaricare = numCnfDaScaricare;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package it.integry.integrywmsnative.core.rest.model.magazzino_buffer;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
|
||||
public class MagazzinoBufferVersamentoMaterialeRequestDTO {
|
||||
|
||||
private MtbColt inputMtbColt;
|
||||
|
||||
|
||||
public MtbColt getInputMtbColt() {
|
||||
return inputMtbColt;
|
||||
}
|
||||
|
||||
public MagazzinoBufferVersamentoMaterialeRequestDTO setInputMtbColt(MtbColt inputMtbColt) {
|
||||
this.inputMtbColt = inputMtbColt;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
package it.integry.integrywmsnative.gest.prod_recupero_materiale.views;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.databinding.DialogInputQuantityToReturnBinding;
|
||||
|
||||
public class InputQuantityToReturnDialog {
|
||||
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private Dialog currentDialog;
|
||||
|
||||
public static Dialog make(final Context context, MtbAart mtbAart, BigDecimal minQuantity, BigDecimal maxQuantity, RunnableArgs<BigDecimal> onDialogDismiss) {
|
||||
return new InputQuantityToReturnDialog(context, mtbAart, minQuantity, maxQuantity, onDialogDismiss).currentDialog;
|
||||
}
|
||||
|
||||
private InputQuantityToReturnDialog(Context context, MtbAart mtbAart, BigDecimal minQuantity, BigDecimal maxQuantity, RunnableArgs<BigDecimal> onDialogDismiss) {
|
||||
this.mContext = context;
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
DialogInputQuantityToReturnBinding bindings = DataBindingUtil.inflate(inflater, R.layout.dialog_input_quantity_to_return, null, false);
|
||||
|
||||
currentDialog = new Dialog(context);
|
||||
currentDialog.setContentView(bindings.getRoot());
|
||||
|
||||
currentDialog.setCanceledOnTouchOutside(false);
|
||||
currentDialog.setCancelable(false);
|
||||
currentDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
InputQuantityToReturnViewModel viewModel = new InputQuantityToReturnViewModel();
|
||||
viewModel.setMtbAart(mtbAart)
|
||||
.setMinQuantity(minQuantity)
|
||||
.setMaxQuantity(maxQuantity);
|
||||
|
||||
bindings.setMViewModel(viewModel);
|
||||
|
||||
bindings.buttonConfirm.setOnClickListener(v -> {
|
||||
currentDialog.dismiss();
|
||||
onDialogDismiss.run(BigDecimal.ZERO);
|
||||
});
|
||||
|
||||
bindings.buttonAbort.setOnClickListener(v -> {
|
||||
currentDialog.dismiss();
|
||||
onDialogDismiss.run(BigDecimal.ZERO);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class InputQuantityToReturnViewModel {
|
||||
|
||||
public MtbAart mtbAart;
|
||||
public BigDecimal minQuantity;
|
||||
public BigDecimal maxQuantity;
|
||||
|
||||
public MtbAart getMtbAart() {
|
||||
return mtbAart;
|
||||
}
|
||||
|
||||
public InputQuantityToReturnViewModel setMtbAart(MtbAart mtbAart) {
|
||||
this.mtbAart = mtbAart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getMinQuantity() {
|
||||
return minQuantity;
|
||||
}
|
||||
|
||||
public InputQuantityToReturnViewModel setMinQuantity(BigDecimal minQuantity) {
|
||||
this.minQuantity = minQuantity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getMaxQuantity() {
|
||||
return maxQuantity;
|
||||
}
|
||||
|
||||
public InputQuantityToReturnViewModel setMaxQuantity(BigDecimal maxQuantity) {
|
||||
this.maxQuantity = maxQuantity;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ObservableArrayList;
|
||||
import androidx.databinding.ObservableField;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@@ -76,7 +75,7 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
setRetainInstance(true);
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_prod_versamento_materiale, container, false);
|
||||
mBinding = FragmentProdVersamentoMaterialeBinding.inflate(inflater, container, false);
|
||||
|
||||
MainApplication.appComponent
|
||||
.prodVersamentoMaterialeComponent()
|
||||
@@ -182,8 +181,8 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
|
||||
|
||||
if (mtbColt.getMtbColr() == null || mtbColt.getMtbColr().size() == 0) {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
new SpannableString(Html.fromHtml("E' stata scansionata una UL già vuota")),
|
||||
null, this::openLU)
|
||||
new SpannableString(Html.fromHtml("E' stata scansionata una UL già vuota")),
|
||||
null, this::openLU)
|
||||
.show((requireActivity()).getSupportFragmentManager(), "tag");
|
||||
|
||||
} else {
|
||||
@@ -198,20 +197,21 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
|
||||
}
|
||||
|
||||
private void choosePosition() {
|
||||
DialogAskPositionOfLUView.makeBase(true, (status, mtbDepoPosizione) -> {
|
||||
DialogAskPositionOfLUView.makeBase(false, (status, mtbDepoPosizione) -> {
|
||||
|
||||
if (status == DialogConsts.Results.ABORT) {
|
||||
popMe();
|
||||
} else {
|
||||
mViewModel.setPosizione(mtbDepoPosizione);
|
||||
}
|
||||
if (status == DialogConsts.Results.ABORT) {
|
||||
popMe();
|
||||
} else {
|
||||
mViewModel.setPosizione(mtbDepoPosizione);
|
||||
}
|
||||
|
||||
}, this::onError).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}, this::onError)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
|
||||
private void recalcAllQuantities() {
|
||||
if(this.mViewModel.getMtbColrMutableLiveData().getValue() == null) return;
|
||||
if (this.mViewModel.getMtbColrMutableLiveData().getValue() == null) return;
|
||||
|
||||
BigDecimal residuoCol = this.mViewModel.getMtbColrMutableLiveData().getValue().getQtaCol();
|
||||
BigDecimal residuoCnf = this.mViewModel.getMtbColrMutableLiveData().getValue().getNumCnf();
|
||||
@@ -228,14 +228,14 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
|
||||
.mapToInt(x -> x.getOriginalOrdineLavorazione().getHrNum())
|
||||
.sum();
|
||||
|
||||
if(selectedOrders.size() > 0 && totalHr <= 0) {
|
||||
if (selectedOrders.size() > 0 && totalHr <= 0) {
|
||||
this.onError(new Exception("Il totale delle <b>risorse umane</b> è pari a 0"));
|
||||
return;
|
||||
}
|
||||
|
||||
fabVisible.set(selectedOrders.size() > 0);
|
||||
|
||||
for(VersamentoMerceOrdineLavListModel versamentoMerceOrdineLavListModel : this.mCurrentOrders) {
|
||||
for (VersamentoMerceOrdineLavListModel versamentoMerceOrdineLavListModel : this.mCurrentOrders) {
|
||||
versamentoMerceOrdineLavListModel.setNumCnfBigDecimal(BigDecimal.ZERO);
|
||||
versamentoMerceOrdineLavListModel.setQtaBigDecimal(BigDecimal.ZERO);
|
||||
|
||||
@@ -243,23 +243,23 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
|
||||
versamentoMerceOrdineLavListModel.getOriginalOrdineLavorazione().setNumCnfVersamento(0f);
|
||||
}
|
||||
|
||||
for(VersamentoMerceOrdineLavListModel versamentoMerceOrdineLavListModel : selectedOrders) {
|
||||
for (VersamentoMerceOrdineLavListModel versamentoMerceOrdineLavListModel : selectedOrders) {
|
||||
int usagePerc = (versamentoMerceOrdineLavListModel.getOriginalOrdineLavorazione().getHrNum() * 100) / totalHr;
|
||||
BigDecimal usedCol;
|
||||
BigDecimal usedCnf;
|
||||
|
||||
if (SettingsManager.iDB().isFlagForceAllToColli() || (versamentoMerceOrdineLavListModel.getOriginalMtbAart() != null && !versamentoMerceOrdineLavListModel.getOriginalMtbAart().isFlagQtaCnfFissaBoolean())){
|
||||
if (SettingsManager.iDB().isFlagForceAllToColli() || (versamentoMerceOrdineLavListModel.getOriginalMtbAart() != null && !versamentoMerceOrdineLavListModel.getOriginalMtbAart().isFlagQtaCnfFissaBoolean())) {
|
||||
usedCnf = UtilityBigDecimal.divideAndRoundToInteger(residuoCnf.multiply(BigDecimal.valueOf(usagePerc)), BigDecimal.valueOf(100), RoundingMode.FLOOR);
|
||||
|
||||
if(UtilityBigDecimal.equalsOrLowerThan(usedCnf, BigDecimal.ZERO) && UtilityBigDecimal.greaterThan(offsetCnf, BigDecimal.ZERO)) {
|
||||
if (UtilityBigDecimal.equalsOrLowerThan(usedCnf, BigDecimal.ZERO) && UtilityBigDecimal.greaterThan(offsetCnf, BigDecimal.ZERO)) {
|
||||
usedCnf = BigDecimal.ONE;
|
||||
}
|
||||
|
||||
usedCol = usedCnf.multiply(qtaCnf).setScale(0,BigDecimal.ROUND_FLOOR);
|
||||
usedCol = usedCnf.multiply(qtaCnf).setScale(0, BigDecimal.ROUND_FLOOR);
|
||||
} else {
|
||||
usedCol = UtilityBigDecimal.divideAndRoundToInteger(residuoCol.multiply(BigDecimal.valueOf(usagePerc)), BigDecimal.valueOf(100), RoundingMode.FLOOR);
|
||||
|
||||
if (UtilityBigDecimal.equalsOrLowerThan(usedCol, BigDecimal.ZERO) && UtilityBigDecimal.greaterThan(offsetCol, BigDecimal.ZERO)){
|
||||
if (UtilityBigDecimal.equalsOrLowerThan(usedCol, BigDecimal.ZERO) && UtilityBigDecimal.greaterThan(offsetCol, BigDecimal.ZERO)) {
|
||||
usedCol = BigDecimal.ONE;
|
||||
}
|
||||
|
||||
@@ -282,8 +282,8 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
|
||||
Stream.of(selectedOrders)
|
||||
.max((o1, o2) -> Integer.compare(o1.getOriginalOrdineLavorazione().getHrNum(), o2.getOriginalOrdineLavorazione().getHrNum())).get();
|
||||
|
||||
if (offsetCnf.floatValue() != 0 || offsetCol.floatValue() != 0){
|
||||
if ( SettingsManager.iDB().isFlagForceAllToColli() || (majorOrder.getOriginalMtbAart() != null && !majorOrder.getOriginalMtbAart().isFlagQtaCnfFissaBoolean())) {
|
||||
if (offsetCnf.floatValue() != 0 || offsetCol.floatValue() != 0) {
|
||||
if (SettingsManager.iDB().isFlagForceAllToColli() || (majorOrder.getOriginalMtbAart() != null && !majorOrder.getOriginalMtbAart().isFlagQtaCnfFissaBoolean())) {
|
||||
majorOrder.setNumCnfBigDecimal(majorOrder.getNumCnfBigDecimal().add(offsetCnf));
|
||||
majorOrder.getOriginalOrdineLavorazione().setNumCnfVersamento(majorOrder.getNumCnfBigDecimal().floatValue());
|
||||
|
||||
@@ -307,7 +307,7 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
|
||||
.map(VersamentoMerceOrdineLavListModel::getOriginalOrdineLavorazione)
|
||||
.toList();
|
||||
|
||||
if(selectedOrders.size() > 0) {
|
||||
if (selectedOrders.size() > 0) {
|
||||
this.mViewModel.save(selectedOrders);
|
||||
} else {
|
||||
Toast.makeText(requireActivity(), "Nessun ordine selezionato!", Toast.LENGTH_SHORT).show();
|
||||
@@ -315,7 +315,6 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreateActionBar(AppCompatTextView titleText, Context context) {
|
||||
titleText.setText(context.getText(R.string.prod_versamento_materiale_title_fragment).toString());
|
||||
@@ -329,7 +328,7 @@ public class ProdVersamentoMaterialeFragment extends BaseFragment implements Pro
|
||||
@Override
|
||||
public void onError(Exception ex, boolean requestClose) {
|
||||
super.onError(ex);
|
||||
if(requestClose) popMe();
|
||||
if (requestClose) popMe();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.gest.prod_versamento_materiale_su_mag_prossimita;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface ProdVersamentoMaterialeInBufferComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
ProdVersamentoMaterialeInBufferComponent create();
|
||||
}
|
||||
|
||||
void inject(ProdVersamentoMaterialeInBufferFragment prodVersamentoMaterialeInBufferFragment);
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package it.integry.integrywmsnative.gest.prod_versamento_materiale_su_mag_prossimita;
|
||||
|
||||
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 java.math.BigDecimal;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.MainApplication;
|
||||
import it.integry.integrywmsnative.core.expansion.BaseFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.databinding.FragmentProdVersamentoMaterialeInBufferBinding;
|
||||
import it.integry.integrywmsnative.view.dialogs.DialogConsts;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_position_of_lu.DialogAskPositionOfLUView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_to_return.DialogInputQuantityToReturnView;
|
||||
import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCreateLUView;
|
||||
|
||||
public class ProdVersamentoMaterialeInBufferFragment extends BaseFragment implements ProdVersamentoMaterialeInBufferViewModel.Listener {
|
||||
|
||||
@Inject
|
||||
ProdVersamentoMaterialeInBufferViewModel mViewModel;
|
||||
|
||||
private FragmentProdVersamentoMaterialeInBufferBinding mBindings;
|
||||
|
||||
|
||||
public ProdVersamentoMaterialeInBufferFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static ProdVersamentoMaterialeInBufferFragment newInstance() {
|
||||
return new ProdVersamentoMaterialeInBufferFragment();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
setRetainInstance(true);
|
||||
|
||||
mBindings = FragmentProdVersamentoMaterialeInBufferBinding.inflate(inflater, container, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
|
||||
MainApplication.appComponent
|
||||
.prodVersamentoMaterialeInBufferComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
mBindings.setViewmodel(mViewModel);
|
||||
mViewModel.setListener(this);
|
||||
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
this.openLU();
|
||||
}
|
||||
|
||||
|
||||
private void openLU() {
|
||||
DialogScanOrCreateLUView.newInstance(false, false, true, false, true, (mtbColt, created) -> {
|
||||
if (mtbColt == null) {
|
||||
popMe();
|
||||
} else if ((mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO ||
|
||||
mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE ||
|
||||
mtbColt.getGestioneEnum() == GestioneEnum.VENDITA) &&
|
||||
mtbColt.getSegno() == 1) {
|
||||
|
||||
if (mtbColt.getMtbColr() == null || mtbColt.getMtbColr().size() == 0) {
|
||||
DialogSimpleMessageView.makeWarningDialog(
|
||||
new SpannableString(Html.fromHtml("E' stata scansionata una UL già vuota")),
|
||||
null, this::openLU)
|
||||
.show((requireActivity()).getSupportFragmentManager(), "tag");
|
||||
|
||||
} else {
|
||||
mViewModel.setMtbColt(mtbColt);
|
||||
choosePosition();
|
||||
}
|
||||
|
||||
} else {
|
||||
this.onError(new Exception("Sono accettate solamente UL di <b>Acquisto</b> o <b>Lavorazione</b> di <b>CARICO</b>"));
|
||||
}
|
||||
}).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
|
||||
private void choosePosition() {
|
||||
DialogAskPositionOfLUView.makeBase(true, (status, mtbDepoPosizione) -> {
|
||||
|
||||
if (status == DialogConsts.Results.ABORT) {
|
||||
popMe();
|
||||
} else {
|
||||
mViewModel.setPosizione(mtbDepoPosizione, () -> {
|
||||
popMe();
|
||||
});
|
||||
}
|
||||
|
||||
}, this::onError)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestColliQuantityToConfirm(RunnableArgs<BigDecimal> onComplete) {
|
||||
DialogInputQuantityToReturnView.newInstance(mViewModel.getMtbColr().getMtbAart(),
|
||||
BigDecimal.ZERO,
|
||||
mViewModel.getMtbColr().getNumCnf(),
|
||||
onComplete)
|
||||
.show(this.getParentFragmentManager(), DialogInputQuantityToReturnView.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex, boolean requestClose) {
|
||||
super.onError(ex);
|
||||
if (requestClose) popMe();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.gest.prod_versamento_materiale_su_mag_prossimita;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoBufferRESTConsumer;
|
||||
|
||||
@Module(subcomponents = ProdVersamentoMaterialeInBufferComponent.class)
|
||||
public class ProdVersamentoMaterialeInBufferModule {
|
||||
|
||||
@Provides
|
||||
ProdVersamentoMaterialeInBufferViewModel providesProdVersamentoMaterialeInBufferViewModel(MagazzinoBufferRESTConsumer magazzinoBufferRESTConsumer) {
|
||||
return new ProdVersamentoMaterialeInBufferViewModel(magazzinoBufferRESTConsumer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package it.integry.integrywmsnative.gest.prod_versamento_materiale_su_mag_prossimita;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
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.rest.consumers.MagazzinoBufferRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_buffer.MagazzinoBufferVersamentoMaterialeCloseRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_buffer.MagazzinoBufferVersamentoMaterialeRequestDTO;
|
||||
|
||||
public class ProdVersamentoMaterialeInBufferViewModel {
|
||||
|
||||
private final MagazzinoBufferRESTConsumer magazzinoBufferRESTConsumer;
|
||||
|
||||
private ProdVersamentoMaterialeInBufferViewModel.Listener mListener;
|
||||
|
||||
private final MutableLiveData<MtbColt> mtbColtMutableLiveData = new MutableLiveData<>();
|
||||
|
||||
@Inject
|
||||
public ProdVersamentoMaterialeInBufferViewModel(MagazzinoBufferRESTConsumer magazzinoBufferRESTConsumer) {
|
||||
this.magazzinoBufferRESTConsumer = magazzinoBufferRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
public MutableLiveData<MtbColt> getMtbColtMutable() {
|
||||
return mtbColtMutableLiveData;
|
||||
}
|
||||
|
||||
public MtbColr getMtbColr() {
|
||||
MtbColt mtbColt = mtbColtMutableLiveData.getValue();
|
||||
if(mtbColt == null || mtbColt.getMtbColr() == null || mtbColt.getMtbColr().isEmpty()) return null;
|
||||
|
||||
return mtbColt.getMtbColr().get(0);
|
||||
}
|
||||
|
||||
public void setMtbColt(MtbColt mtbColt) {
|
||||
this.mtbColtMutableLiveData.setValue(mtbColt);
|
||||
}
|
||||
|
||||
public void setPosizione(MtbDepoPosizione mtbDepoPosizione, Runnable onComplete) {
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
var magazzinoRequest = new MagazzinoBufferVersamentoMaterialeRequestDTO()
|
||||
.setInputMtbColt(mtbColtMutableLiveData.getValue());
|
||||
|
||||
magazzinoBufferRESTConsumer.isVersamentoStarted(mtbDepoPosizione, magazzinoRequest, versamentoStarted -> {
|
||||
|
||||
if (!versamentoStarted) {
|
||||
magazzinoBufferRESTConsumer.startVersamentoMateriale(mtbDepoPosizione, magazzinoRequest, () -> {
|
||||
this.sendOnLoadingEnded();
|
||||
onComplete.run();
|
||||
}, this::sendError);
|
||||
} else {
|
||||
this.sendOnRequestColliQuantityToConfirm(inputQuantity -> {
|
||||
if(inputQuantity == null) {
|
||||
this.sendOnLoadingEnded();
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
|
||||
var closeRequest = new MagazzinoBufferVersamentoMaterialeCloseRequestDTO()
|
||||
.setInputMtbColt(mtbColtMutableLiveData.getValue())
|
||||
.setNumCnfDaScaricare(inputQuantity);
|
||||
|
||||
magazzinoBufferRESTConsumer.endVersamentoMateriale(mtbDepoPosizione, closeRequest, () -> {
|
||||
this.sendOnLoadingEnded();
|
||||
onComplete.run();
|
||||
}, this::sendError);
|
||||
});
|
||||
|
||||
}
|
||||
}, this::sendError);
|
||||
}
|
||||
|
||||
|
||||
public ProdVersamentoMaterialeInBufferViewModel setListener(ProdVersamentoMaterialeInBufferViewModel.Listener listener) {
|
||||
this.mListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
private void sendOnLoadingStarted() {
|
||||
if (this.mListener != null) mListener.onLoadingStarted();
|
||||
}
|
||||
|
||||
private void sendOnLoadingEnded() {
|
||||
if (this.mListener != null) mListener.onLoadingEnded();
|
||||
}
|
||||
|
||||
private void sendOnRequestColliQuantityToConfirm(RunnableArgs<BigDecimal> onComplete) {
|
||||
if (this.mListener != null) mListener.onRequestColliQuantityToConfirm(onComplete);
|
||||
}
|
||||
|
||||
private void sendError(Exception ex) {
|
||||
if (this.mListener != null) mListener.onError(ex, true);
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
void onRequestColliQuantityToConfirm(RunnableArgs<BigDecimal> onComplete);
|
||||
|
||||
void onError(Exception ex, boolean requestClose);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -90,7 +91,7 @@ public class DialogAskPositionOfLUView extends BaseDialogFragment implements Dia
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
if(getDialog() != null) {
|
||||
if (getDialog() != null) {
|
||||
getDialog().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
|
||||
getDialog().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
}
|
||||
@@ -180,8 +181,12 @@ public class DialogAskPositionOfLUView extends BaseDialogFragment implements Dia
|
||||
|
||||
} else {
|
||||
BarcodeManager.enable();
|
||||
Toast.makeText(requireContext(), "Barcode non riconosciuto", Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(requireContext(), "Barcode non riconosciuto", Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.input_quantity_to_return;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogInputQuantityToReturnComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogInputQuantityToReturnComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogInputQuantityToReturnView dialogInputQuantityToReturnView);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.input_quantity_to_return;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
@Module(subcomponents = DialogInputQuantityToReturnComponent.class)
|
||||
public class DialogInputQuantityToReturnModule {
|
||||
|
||||
@Provides
|
||||
DialogInputQuantityToReturnViewModel providesDialogInputQuantityToReturnViewModel() {
|
||||
return new DialogInputQuantityToReturnViewModel();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.input_quantity_to_return;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
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.RunnableArgs;
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityFocus;
|
||||
import it.integry.integrywmsnative.databinding.DialogInputQuantityToReturnBinding;
|
||||
|
||||
public class DialogInputQuantityToReturnView extends BaseDialogFragment {
|
||||
|
||||
@Inject
|
||||
DialogInputQuantityToReturnViewModel mViewModel;
|
||||
|
||||
private DialogInputQuantityToReturnBinding mBindings;
|
||||
private Context mContext;
|
||||
|
||||
|
||||
private final MtbAart mtbAart;
|
||||
private final BigDecimal minQuantity;
|
||||
private final BigDecimal maxQuantity;
|
||||
private final RunnableArgs<BigDecimal> onDialogDismiss;
|
||||
|
||||
public static DialogInputQuantityToReturnView newInstance(@NotNull MtbAart mtbAart, BigDecimal minQuantity, BigDecimal maxQuantity, RunnableArgs<BigDecimal> onDialogDismiss) {
|
||||
return new DialogInputQuantityToReturnView(mtbAart, minQuantity, maxQuantity, onDialogDismiss);
|
||||
}
|
||||
|
||||
private DialogInputQuantityToReturnView(@NotNull MtbAart mtbAart, BigDecimal minQuantity, BigDecimal maxQuantity, RunnableArgs<BigDecimal> onDialogDismiss) {
|
||||
super();
|
||||
|
||||
this.mtbAart = mtbAart;
|
||||
this.minQuantity = minQuantity;
|
||||
this.maxQuantity = maxQuantity;
|
||||
this.onDialogDismiss = onDialogDismiss;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
this.mContext = requireContext();
|
||||
|
||||
mBindings = DialogInputQuantityToReturnBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogInputQuantityToReturnComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
mViewModel.init(mtbAart, minQuantity, maxQuantity);
|
||||
mBindings.setViewModel(mViewModel);
|
||||
|
||||
setCancelable(false);
|
||||
|
||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(isCancelable())
|
||||
.setPositiveButton(R.string.confirm, (dialogInterface, i) -> {
|
||||
onDialogDismiss.run(mViewModel.getInputQuanity());
|
||||
})
|
||||
.setNegativeButton(R.string.abort, (dialogInterface, i) -> {
|
||||
onDialogDismiss.run(null);
|
||||
})
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||
alertDialog.setOnShowListener(this);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
super.onShow(dialogInterface);
|
||||
|
||||
UtilityFocus.focusTextBox(requireContext(), mBindings.additionalNotesText);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.input_quantity_to_return;
|
||||
|
||||
import androidx.databinding.ObservableField;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import it.integry.integrywmsnative.core.model.MtbAart;
|
||||
|
||||
public class DialogInputQuantityToReturnViewModel {
|
||||
|
||||
private MtbAart mtbAart;
|
||||
private BigDecimal minQuantity;
|
||||
private BigDecimal maxQuantity;
|
||||
|
||||
public ObservableField<BigDecimal> inputQuantity = new ObservableField<>(BigDecimal.ZERO);
|
||||
|
||||
|
||||
public void init(MtbAart mtbAart, BigDecimal minQuantity, BigDecimal maxQuantity) {
|
||||
this.minQuantity = minQuantity;
|
||||
this.maxQuantity = maxQuantity;
|
||||
this.mtbAart = mtbAart;
|
||||
}
|
||||
|
||||
public MtbAart getMtbAart() {
|
||||
return mtbAart;
|
||||
}
|
||||
|
||||
public BigDecimal getMinQuantity() {
|
||||
return minQuantity;
|
||||
}
|
||||
|
||||
public BigDecimal getMaxQuantity() {
|
||||
return maxQuantity;
|
||||
}
|
||||
|
||||
public BigDecimal getInputQuanity() {
|
||||
return inputQuantity.get();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user