Implementate nuove logiche picking libero per scarichi di lavorazione
This commit is contained in:
parent
27577d10cf
commit
a73ecc1e81
10
.idea/deploymentTargetDropDown.xml
generated
Normal file
10
.idea/deploymentTargetDropDown.xml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<value>
|
||||
<entry key="app">
|
||||
<State />
|
||||
</entry>
|
||||
</value>
|
||||
</component>
|
||||
</project>
|
||||
@ -104,6 +104,8 @@ import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetM
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditModalModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.DialogAskLineaProdComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.DialogAskLineaProdModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.DialogAskUnknownBarcodeNotesComponent;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_unknown_barcode_notes.DialogAskUnknownBarcodeNotesModule;
|
||||
import it.integry.integrywmsnative.view.dialogs.bind_product_barcode_with_package.DialogBindProductBarcodeWithPackageComponent;
|
||||
@ -197,7 +199,8 @@ import it.integry.integrywmsnative.view.dialogs.scan_or_create_lu.DialogScanOrCr
|
||||
DialogAskUnknownBarcodeNotesModule.class,
|
||||
ProdVersamentoMaterialeInBufferModule.class,
|
||||
DialogInputQuantityToReturnModule.class,
|
||||
DialogInfoAggiuntiveLUModule.class
|
||||
DialogInfoAggiuntiveLUModule.class,
|
||||
DialogAskLineaProdModule.class
|
||||
})
|
||||
public interface MainApplicationComponent {
|
||||
|
||||
@ -331,6 +334,8 @@ public interface MainApplicationComponent {
|
||||
|
||||
DialogInfoAggiuntiveLUComponent.Factory dialogInfoAggiuntiveLUComponent();
|
||||
|
||||
DialogAskLineaProdComponent.Factory dialogAskLineaProdComponent();
|
||||
|
||||
void inject(MainApplication mainApplication);
|
||||
|
||||
void inject(AppContext mainApplication);
|
||||
|
||||
@ -2,6 +2,7 @@ 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.core.settings.SettingsManager;
|
||||
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;
|
||||
@ -85,7 +86,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
.setTitleText(R.string.free_picking)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_picking_libero)
|
||||
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
|
||||
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(GestioneEnum.VENDITA)))
|
||||
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(GestioneEnum.VENDITA, SettingsManager.iDB().isFlagAskClienteInPickingLibero(), false)))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_resi_cliente)
|
||||
@ -121,7 +122,7 @@ public class MenuConfiguration extends BaseMenuConfiguration {
|
||||
.setTitleText(R.string.free_lav_picking)
|
||||
.setTitleIcon(R.drawable.ic_dashboard_prod_picking_libero)
|
||||
.setDrawerIcon(R.drawable.ic_black_barcode_scanner)
|
||||
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(GestioneEnum.LAVORAZIONE)))
|
||||
.setFragmentFactory(() -> PickingLiberoFragment.newInstance(GestioneEnum.LAVORAZIONE, SettingsManager.iDB().isFlagAskClienteInPickingLibero(), false)))
|
||||
|
||||
.addItem(new MenuItem()
|
||||
.setID(R.id.nav_prod_posizionamento_da_ord)
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package it.integry.integrywmsnative.core.exception;
|
||||
|
||||
import it.integry.integrywmsnative.R;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityResources;
|
||||
|
||||
public class InvalidLineaProdBarcodeException extends Exception {
|
||||
|
||||
public InvalidLineaProdBarcodeException() {
|
||||
super(UtilityResources.getString(R.string.no_result_from_linea_prod_barcode));
|
||||
}
|
||||
|
||||
public InvalidLineaProdBarcodeException(String barcode) {
|
||||
super(UtilityResources.getString(R.string.no_result_from_linea_prod_barcode) + " (" + barcode + ")");
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,11 @@ public class CreateUDSRequestDTO {
|
||||
private Integer numCollo;
|
||||
private String serCollo;
|
||||
private int causaleCollo;
|
||||
|
||||
private String codJfas;
|
||||
private String codAnag;
|
||||
private String codVdes;
|
||||
private String rifOrd;
|
||||
private boolean orderRequired;
|
||||
private List<CreateUDSRequestOrderDTO> orders;
|
||||
|
||||
public String getCodMdep() {
|
||||
@ -67,6 +71,51 @@ public class CreateUDSRequestDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJfas() {
|
||||
return codJfas;
|
||||
}
|
||||
|
||||
public CreateUDSRequestDTO setCodJfas(String codJfas) {
|
||||
this.codJfas = codJfas;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodAnag() {
|
||||
return codAnag;
|
||||
}
|
||||
|
||||
public CreateUDSRequestDTO setCodAnag(String codAnag) {
|
||||
this.codAnag = codAnag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodVdes() {
|
||||
return codVdes;
|
||||
}
|
||||
|
||||
public CreateUDSRequestDTO setCodVdes(String codVdes) {
|
||||
this.codVdes = codVdes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRifOrd() {
|
||||
return rifOrd;
|
||||
}
|
||||
|
||||
public CreateUDSRequestDTO setRifOrd(String rifOrd) {
|
||||
this.rifOrd = rifOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isOrderRequired() {
|
||||
return orderRequired;
|
||||
}
|
||||
|
||||
public CreateUDSRequestDTO setOrderRequired(boolean orderRequired) {
|
||||
this.orderRequired = orderRequired;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<CreateUDSRequestOrderDTO> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
@ -42,7 +42,6 @@ import it.integry.integrywmsnative.core.model.MtbColr;
|
||||
import it.integry.integrywmsnative.core.model.MtbColt;
|
||||
import it.integry.integrywmsnative.core.model.VtbDest;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityExceptions;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityToast;
|
||||
import it.integry.integrywmsnative.databinding.FragmentPickingLiberoBinding;
|
||||
@ -54,6 +53,7 @@ import it.integry.integrywmsnative.ui.ElevatedToolbar;
|
||||
import it.integry.integrywmsnative.ui.SimpleDividerItemDecoration;
|
||||
import it.integry.integrywmsnative.view.bottom_sheet__mtb_colr_edit.BottomSheetMtbColrEditModalView;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_cliente.DialogAskClienteView;
|
||||
import it.integry.integrywmsnative.view.dialogs.ask_linea_prod.DialogAskLineaProdView;
|
||||
import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView;
|
||||
import it.integry.integrywmsnative.view.dialogs.choose_arts_from_mtbcolr_list.DialogChooseArtsFromMtbColrList;
|
||||
import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO;
|
||||
@ -86,16 +86,20 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
private int barcodeScannerIstanceID = -1;
|
||||
|
||||
private GestioneEnum mCurrentGestione;
|
||||
private boolean mAskCliente;
|
||||
private boolean mAskLineaProd;
|
||||
|
||||
public PickingLiberoFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static PickingLiberoFragment newInstance(GestioneEnum gestioneEnum) {
|
||||
public static PickingLiberoFragment newInstance(GestioneEnum gestioneEnum, boolean askCliente, boolean askLineaProd) {
|
||||
PickingLiberoFragment fragment = new PickingLiberoFragment();
|
||||
Bundle args = new Bundle();
|
||||
|
||||
args.putString("gestione", gestioneEnum.getText());
|
||||
args.putBoolean("askCliente", askCliente);
|
||||
args.putBoolean("askLineaProd", askLineaProd);
|
||||
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
@ -113,6 +117,8 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
setRetainInstance(true);
|
||||
|
||||
mCurrentGestione = GestioneEnum.fromString(getArguments().getString("gestione"));
|
||||
mAskCliente = getArguments().getBoolean("askCliente");
|
||||
mAskLineaProd = getArguments().getBoolean("askLineaProd");
|
||||
}
|
||||
|
||||
|
||||
@ -139,8 +145,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
|
||||
this.initRecyclerView();
|
||||
|
||||
boolean flagAskCliente = SettingsManager.iDB().isFlagAskClienteInPickingLibero();
|
||||
mViewModel.init(flagAskCliente, mCurrentGestione);
|
||||
mViewModel.init(mAskCliente, mAskLineaProd, mCurrentGestione);
|
||||
|
||||
return mBindings.getRoot();
|
||||
}
|
||||
@ -263,7 +268,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
null,
|
||||
() -> onComplete.run(true),
|
||||
() -> onComplete.run(false)
|
||||
).show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
).show(requireActivity().getSupportFragmentManager(), DialogSimpleMessageView.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -284,7 +289,13 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
@Override
|
||||
public void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort) {
|
||||
DialogAskClienteView.newInstance(onComplete, onAbort)
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
.show(requireActivity().getSupportFragmentManager(), DialogAskClienteView.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLULineaProdRequired(RunnableArgs<String> onComplete, Runnable onAbort) {
|
||||
DialogAskLineaProdView.newInstance(onComplete, onAbort)
|
||||
.show(getParentFragmentManager(), DialogAskLineaProdView.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -294,7 +305,7 @@ public class PickingLiberoFragment extends BaseFragment implements ITitledFragme
|
||||
onAbort.run();
|
||||
BarcodeManager.enable();
|
||||
})
|
||||
.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||
.show(requireActivity().getSupportFragmentManager(), DialogChooseArtsFromMtbColrList.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -6,7 +6,9 @@ import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
@ -21,8 +23,17 @@ public class PickingLiberoModule {
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
PosizioniRESTConsumer posizioniRESTConsumer,
|
||||
GiacenzaRESTConsumer giacenzaRESTConsumer,
|
||||
MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer
|
||||
MagazzinoAutomaticoRESTConsumer magazzinoAutomaticoRESTConsumer,
|
||||
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
|
||||
ColliSpedizioneRESTConsumer colliSpedizioneRESTConsumer
|
||||
) {
|
||||
return new PickingLiberoViewModel(articoloRESTConsumer, colliMagazzinoRESTConsumer, barcodeRESTConsumer, posizioniRESTConsumer, giacenzaRESTConsumer, magazzinoAutomaticoRESTConsumer);
|
||||
return new PickingLiberoViewModel(articoloRESTConsumer,
|
||||
colliMagazzinoRESTConsumer,
|
||||
barcodeRESTConsumer,
|
||||
posizioniRESTConsumer,
|
||||
giacenzaRESTConsumer,
|
||||
magazzinoAutomaticoRESTConsumer,
|
||||
colliLavorazioneRESTConsumer,
|
||||
colliSpedizioneRESTConsumer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,14 +32,18 @@ import it.integry.integrywmsnative.core.model.dto.PickDataDTO;
|
||||
import it.integry.integrywmsnative.core.model.secondary.GestioneEnum;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliLavorazioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliMagazzinoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.ColliSpedizioneRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.GiacenzaRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.MagazzinoAutomaticoRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.PosizioniRESTConsumer;
|
||||
import it.integry.integrywmsnative.core.rest.consumers.interfaces.ColliScaricoRESTConsumerInterface;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean128Model;
|
||||
import it.integry.integrywmsnative.core.rest.model.Ean13PesoModel;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.magazzino_automatico.MagazzinoAutomaticoPickItemsRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.CreateUDSRequestDTO;
|
||||
import it.integry.integrywmsnative.core.rest.model.uds.DeleteULRequestDTO;
|
||||
import it.integry.integrywmsnative.core.settings.SettingsManager;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
@ -63,8 +67,12 @@ public class PickingLiberoViewModel {
|
||||
private final GiacenzaRESTConsumer mGiacenzaRESTConsumer;
|
||||
private final MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer;
|
||||
|
||||
private ColliScaricoRESTConsumerInterface mColliScaricoRESTConsumer;
|
||||
private final ColliLavorazioneRESTConsumer mColliLavorazioneRESTConsumer;
|
||||
private final ColliSpedizioneRESTConsumer mColliSpedizioneRESTConsumer;
|
||||
|
||||
private boolean mFlagAskCliente;
|
||||
private boolean mFlagAskLineaProd;
|
||||
private GestioneEnum mDefaultGestione;
|
||||
|
||||
|
||||
@ -77,19 +85,30 @@ public class PickingLiberoViewModel {
|
||||
BarcodeRESTConsumer barcodeRESTConsumer,
|
||||
PosizioniRESTConsumer posizioniRESTConsumer,
|
||||
GiacenzaRESTConsumer giacenzaRESTConsumer,
|
||||
MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer) {
|
||||
MagazzinoAutomaticoRESTConsumer mMagazzinoAutomaticoRESTConsumer,
|
||||
ColliLavorazioneRESTConsumer colliLavorazioneRESTConsumer,
|
||||
ColliSpedizioneRESTConsumer colliSpedizioneRESTConsumer) {
|
||||
this.mArticoloRESTConsumer = articoloRESTConsumer;
|
||||
this.mColliMagazzinoRESTConsumer = colliMagazzinoRESTConsumer;
|
||||
this.mBarcodeRESTConsumer = barcodeRESTConsumer;
|
||||
this.mPosizioniRESTConsumer = posizioniRESTConsumer;
|
||||
this.mGiacenzaRESTConsumer = giacenzaRESTConsumer;
|
||||
this.mMagazzinoAutomaticoRESTConsumer = mMagazzinoAutomaticoRESTConsumer;
|
||||
this.mColliLavorazioneRESTConsumer = colliLavorazioneRESTConsumer;
|
||||
this.mColliSpedizioneRESTConsumer = colliSpedizioneRESTConsumer;
|
||||
}
|
||||
|
||||
|
||||
public void init(boolean flagAskCliente, GestioneEnum defaultGestione) {
|
||||
public void init(boolean flagAskCliente, boolean flagAskLineaProd, GestioneEnum defaultGestione) {
|
||||
this.mFlagAskCliente = defaultGestione == GestioneEnum.VENDITA && flagAskCliente;
|
||||
this.mFlagAskLineaProd = defaultGestione == GestioneEnum.LAVORAZIONE && flagAskLineaProd;
|
||||
this.mDefaultGestione = defaultGestione;
|
||||
|
||||
|
||||
switch (mDefaultGestione) {
|
||||
case LAVORAZIONE -> this.mColliScaricoRESTConsumer = mColliLavorazioneRESTConsumer;
|
||||
case VENDITA -> this.mColliScaricoRESTConsumer = mColliSpedizioneRESTConsumer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -279,46 +298,57 @@ public class PickingLiberoViewModel {
|
||||
public void createNewLU(Integer customNumCollo, String customSerCollo, Runnable onComplete) {
|
||||
if (this.mFlagAskCliente) {
|
||||
this.sendLUClienteRequired((vtbDest, codJcom) -> {
|
||||
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, vtbDest, codJcom, onComplete);
|
||||
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, vtbDest, onComplete);
|
||||
}, () -> {
|
||||
|
||||
});
|
||||
} else {
|
||||
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, null, null, onComplete);
|
||||
createNewLU_PostClienteAsk(customNumCollo, customSerCollo, null, onComplete);
|
||||
}
|
||||
}
|
||||
|
||||
private void createNewLU_PostClienteAsk(Integer customNumCollo, String customSerCollo, VtbDest vtbDest, String codJcom, Runnable onComplete) {
|
||||
private void createNewLU_PostClienteAsk(Integer customNumCollo, String customSerCollo, VtbDest vtbDest, Runnable onComplete) {
|
||||
if (this.mFlagAskLineaProd) {
|
||||
this.sendLULineaProdRequired(codJfas -> {
|
||||
createNewLU_PostLineaProdAsk(customNumCollo, customSerCollo, vtbDest, codJfas, onComplete);
|
||||
}, () -> {
|
||||
|
||||
});
|
||||
} else {
|
||||
createNewLU_PostLineaProdAsk(customNumCollo, customSerCollo, vtbDest, null, onComplete);
|
||||
}
|
||||
}
|
||||
|
||||
private void createNewLU_PostLineaProdAsk(Integer customNumCollo, String customSerCollo, VtbDest vtbDest, String codJfas, Runnable onComplete) {
|
||||
|
||||
this.sendOnLoadingStarted();
|
||||
|
||||
MtbColt mtbColt = new MtbColt();
|
||||
mtbColt.initDefaultFields(mDefaultGestione)
|
||||
var createUDSRequest = new CreateUDSRequestDTO()
|
||||
.setRifOrd(mDefaultGestione == GestioneEnum.LAVORAZIONE ? "PICKING LIBERO" : null)
|
||||
// .setCodAnag(SettingsManager.iDB().getProduzioneDefaultCodAnag())
|
||||
.setSegno(-1)
|
||||
.setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
.setCodMdep(SettingsManager.i().getUserSession().getDepo().getCodMdep())
|
||||
.setCausaleCollo(CreateUDSRequestDTO.Causale.SCARICO)
|
||||
.setOrderRequired(mFlagAskLineaProd);
|
||||
|
||||
if (customNumCollo != null) {
|
||||
mtbColt.setNumCollo(customNumCollo);
|
||||
createUDSRequest.setNumCollo(customNumCollo);
|
||||
}
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(customSerCollo)) {
|
||||
mtbColt.setSerCollo(customSerCollo);
|
||||
createUDSRequest.setSerCollo(customSerCollo);
|
||||
}
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(codJfas)) {
|
||||
createUDSRequest.setCodJfas(codJfas);
|
||||
}
|
||||
|
||||
if (vtbDest != null) {
|
||||
mtbColt.setCodAnag(vtbDest.getCodAnag());
|
||||
mtbColt.setCodVdes(vtbDest.getCodVdes());
|
||||
createUDSRequest.setCodAnag(vtbDest.getCodAnag());
|
||||
createUDSRequest.setCodVdes(vtbDest.getCodVdes());
|
||||
}
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(codJcom)) {
|
||||
mtbColt.setCodJcom(codJcom);
|
||||
}
|
||||
|
||||
mColliMagazzinoRESTConsumer.saveCollo(mtbColt, value -> {
|
||||
mColliScaricoRESTConsumer.createUDS(createUDSRequest, mtbColt -> {
|
||||
mtbColt
|
||||
.setNumCollo(value.getNumCollo())
|
||||
.setDataCollo(value.getDataColloS())
|
||||
.setMtbColr(new ObservableArrayList<>());
|
||||
|
||||
this.mCurrentMtbColt = mtbColt;
|
||||
@ -328,6 +358,43 @@ public class PickingLiberoViewModel {
|
||||
if (onComplete != null) onComplete.run();
|
||||
this.sendLUOpened(mtbColt);
|
||||
}, this::sendError);
|
||||
|
||||
// MtbColt mtbColt = new MtbColt();
|
||||
// mtbColt.initDefaultFields(mDefaultGestione)
|
||||
// .setRifOrd(mDefaultGestione == GestioneEnum.LAVORAZIONE ? "PICKING LIBERO" : null)
|
||||
// .setSegno(-1)
|
||||
// .setOperation(CommonModelConsts.OPERATION.INSERT_OR_UPDATE);
|
||||
//
|
||||
// if (customNumCollo != null) {
|
||||
// mtbColt.setNumCollo(customNumCollo);
|
||||
// }
|
||||
//
|
||||
// if (!UtilityString.isNullOrEmpty(customSerCollo)) {
|
||||
// mtbColt.setSerCollo(customSerCollo);
|
||||
// }
|
||||
//
|
||||
// if (vtbDest != null) {
|
||||
// mtbColt.setCodAnag(vtbDest.getCodAnag());
|
||||
// mtbColt.setCodVdes(vtbDest.getCodVdes());
|
||||
// }
|
||||
//
|
||||
// if (!UtilityString.isNullOrEmpty(codJcom)) {
|
||||
// mtbColt.setCodJcom(codJcom);
|
||||
// }
|
||||
|
||||
// mColliMagazzinoRESTConsumer.saveCollo(mtbColt, value -> {
|
||||
// mtbColt
|
||||
// .setNumCollo(value.getNumCollo())
|
||||
// .setDataCollo(value.getDataColloS())
|
||||
// .setMtbColr(new ObservableArrayList<>());
|
||||
//
|
||||
// this.mCurrentMtbColt = mtbColt;
|
||||
//
|
||||
// this.sendOnLoadingEnded();
|
||||
//
|
||||
// if (onComplete != null) onComplete.run();
|
||||
// this.sendLUOpened(mtbColt);
|
||||
// }, this::sendError);
|
||||
}
|
||||
|
||||
private void dispatchArt(MtbAart mtbAart, Ean128Model ean128Model) {
|
||||
@ -868,6 +935,10 @@ public class PickingLiberoViewModel {
|
||||
if (this.mListener != null) mListener.onLUClienteRequired(onComplete, onAbort);
|
||||
}
|
||||
|
||||
private void sendLULineaProdRequired(RunnableArgs<String> onComplete, Runnable onAbort) {
|
||||
if (this.mListener != null) mListener.onLULineaProdRequired(onComplete, onAbort);
|
||||
}
|
||||
|
||||
private void sendArtSelectionRequest(List<MtbColr> mtbColrsToPick, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort) {
|
||||
if (this.mListener != null)
|
||||
mListener.onArtSelectionRequest(mtbColrsToPick, mtbAart, onComplete, onAbort);
|
||||
@ -924,6 +995,8 @@ public class PickingLiberoViewModel {
|
||||
|
||||
void onLUClienteRequired(RunnableArgss<VtbDest, String> onComplete, Runnable onAbort);
|
||||
|
||||
void onLULineaProdRequired(RunnableArgs<String> onComplete, Runnable onAbort);
|
||||
|
||||
void onArtSelectionRequest(List<MtbColr> mtbColrsToPick, MtbAart mtbAart, RunnableArgs<List<MtbColr>> onComplete, Runnable onAbort);
|
||||
|
||||
void onItemDispatched(PickingObjectDTO pickingObjectDTO,
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.ask_linea_prod;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent
|
||||
public interface DialogAskLineaProdComponent {
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
DialogAskLineaProdComponent create();
|
||||
}
|
||||
|
||||
void inject(DialogAskLineaProdView dialogAskLineaProdView);
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.ask_linea_prod;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
@Module(subcomponents = DialogAskLineaProdComponent.class)
|
||||
public class DialogAskLineaProdModule {
|
||||
|
||||
@Provides
|
||||
DialogAskLineaProdViewModel providesDialogAskLineaProdViewModel() {
|
||||
return new DialogAskLineaProdViewModel();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,107 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.ask_linea_prod;
|
||||
|
||||
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 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.BaseDialogFragment;
|
||||
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
|
||||
import it.integry.integrywmsnative.databinding.DialogAskLineaProdBinding;
|
||||
|
||||
public class DialogAskLineaProdView extends BaseDialogFragment implements DialogAskLineaProdViewModel.Listener {
|
||||
|
||||
@Inject
|
||||
DialogAskLineaProdViewModel mViewModel;
|
||||
|
||||
private final RunnableArgs<String> onComplete;
|
||||
private final Runnable onAbort;
|
||||
|
||||
private DialogAskLineaProdBinding mBindings;
|
||||
private Context mContext;
|
||||
|
||||
|
||||
private int mBarcodeScannerIstanceID;
|
||||
|
||||
//Pass here all external parameters
|
||||
public static DialogAskLineaProdView newInstance(RunnableArgs<String> onComplete, Runnable onAbort) {
|
||||
return new DialogAskLineaProdView(onComplete, onAbort);
|
||||
}
|
||||
|
||||
private DialogAskLineaProdView(RunnableArgs<String> onComplete, Runnable onAbort) {
|
||||
super();
|
||||
this.onComplete = onComplete;
|
||||
this.onAbort = onAbort;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
this.mContext = requireContext();
|
||||
|
||||
mBindings = DialogAskLineaProdBinding.inflate(LayoutInflater.from(this.mContext), null, false);
|
||||
mBindings.setLifecycleOwner(this);
|
||||
|
||||
MainApplication.appComponent
|
||||
.dialogAskLineaProdComponent()
|
||||
.create()
|
||||
.inject(this);
|
||||
|
||||
mViewModel.setListener(this);
|
||||
|
||||
setCancelable(true);
|
||||
|
||||
var alertDialog = new MaterialAlertDialogBuilder(this.mContext)
|
||||
.setView(mBindings.getRoot())
|
||||
.setCancelable(isCancelable())
|
||||
.setNegativeButton(R.string.abort, (dialogInterface, i) -> {
|
||||
if(this.onAbort != null) this.onAbort.run();
|
||||
})
|
||||
.create();
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(isCancelable());
|
||||
alertDialog.setOnShowListener(this);
|
||||
return alertDialog;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
super.onShow(dialogInterface);
|
||||
|
||||
this.initBarcode();
|
||||
}
|
||||
|
||||
private void initBarcode() {
|
||||
mBarcodeScannerIstanceID = BarcodeManager.addCallback(new BarcodeCallbackDTO()
|
||||
.setOnScanSuccessful(onScanSuccessful)
|
||||
.setOnScanFailed(this::onError));
|
||||
|
||||
BarcodeManager.enable();
|
||||
}
|
||||
|
||||
private final RunnableArgs<BarcodeScanDTO> onScanSuccessful = data -> {
|
||||
BarcodeManager.disable();
|
||||
this.mViewModel.processBarcodeDTO(data, BarcodeManager::enable);
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onProductionLineSelected(String codJfas) {
|
||||
this.onComplete.run(codJfas);
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package it.integry.integrywmsnative.view.dialogs.ask_linea_prod;
|
||||
|
||||
import it.integry.barcode_base_android_library.model.BarcodeScanDTO;
|
||||
import it.integry.integrywmsnative.core.exception.InvalidLineaProdBarcodeException;
|
||||
import it.integry.integrywmsnative.core.exception.NoResultFromBarcodeException;
|
||||
import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener;
|
||||
import it.integry.integrywmsnative.core.model.MtbDepoPosizione;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityBarcode;
|
||||
import it.integry.integrywmsnative.core.utility.UtilityPosizione;
|
||||
|
||||
public class DialogAskLineaProdViewModel {
|
||||
|
||||
private Listener mListener;
|
||||
|
||||
public void processBarcodeDTO(BarcodeScanDTO data, Runnable onComplete) {
|
||||
if (UtilityBarcode.isEtichettaPosizione(data)) {
|
||||
|
||||
MtbDepoPosizione foundPosizione = UtilityPosizione.getFromCache(data.getStringValue());
|
||||
|
||||
if (!foundPosizione.isFlagLineaProduzione()) {
|
||||
this.sendError(new InvalidLineaProdBarcodeException(data.getStringValue()));
|
||||
onComplete.run();
|
||||
return;
|
||||
}
|
||||
|
||||
onComplete.run();
|
||||
this.sendOnProductionLineSelected(foundPosizione.getPosizione());
|
||||
|
||||
} else {
|
||||
this.sendError(new NoResultFromBarcodeException());
|
||||
onComplete.run();
|
||||
}
|
||||
}
|
||||
|
||||
public DialogAskLineaProdViewModel setListener(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 sendOnProductionLineSelected(String codJfas) {
|
||||
if (this.mListener != null) mListener.onProductionLineSelected(codJfas);
|
||||
}
|
||||
|
||||
private void sendError(Exception ex) {
|
||||
if (this.mListener != null) mListener.onError(ex);
|
||||
}
|
||||
|
||||
public interface Listener extends ILoadingListener {
|
||||
void onError(Exception ex);
|
||||
void onProductionLineSelected(String codJfas);
|
||||
}
|
||||
}
|
||||
66
app/src/main/res/layout/dialog_ask_linea_prod.xml
Normal file
66
app/src/main/res/layout/dialog_ask_linea_prod.xml
Normal file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingVertical="16dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Icon.CenterStacked"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:src="@drawable/ic_error_white_24dp"
|
||||
app:tint="?colorPrimary" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/MaterialAlertDialog.Material3.Title.Text.CenterStacked"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="Linea produzione" />
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginHorizontal="16dp">
|
||||
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_horizontal"
|
||||
style="@style/TextAppearance.Material3.BodyMedium"
|
||||
android:text="Scansiona il codice a barre di una linea di produzione"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</layout>
|
||||
@ -222,6 +222,7 @@
|
||||
|
||||
<string name="already_used_anonymous_barcode"><![CDATA[L\'etichetta scansionata è stata già utilizzata]]></string>
|
||||
<string name="no_result_from_barcode">Il barcode scansionato non ha fornito alcun risultato</string>
|
||||
<string name="no_result_from_linea_prod_barcode">Il barcode scansionato non riguarda una linea di produzione</string>
|
||||
<string name="no_result_from_cod_mart">Il codice articolo non ha fornito alcun risultato</string>
|
||||
<string name="multiple_results_from_barcode">Il barcode scansionato ha fornito molteplici risultati</string>
|
||||
<string name="no_doc_type_selected">Nessun tipo documento selezionato</string>
|
||||
|
||||
@ -227,7 +227,8 @@
|
||||
<string name="no_doc_type_selected">No document type selected</string>
|
||||
|
||||
<string name="already_used_anonymous_barcode">The scanned label has already been used</string>
|
||||
<string name="no_result_from_barcode">The scanned barcode did not produce any results</string>
|
||||
<string name="no_result_from_barcode">The scanned barcode does not produce any results</string>
|
||||
<string name="no_result_from_linea_prod_barcode">The scanned barcode does not represent any production line</string>
|
||||
<string name="no_result_from_cod_mart">The item code did not produce any results</string>
|
||||
<string name="please_open_lu">Before continuing open new LU</string>
|
||||
<string name="multiple_results_from_barcode">The scanned barcode produced multiple results</string>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user