From 4842a6091b6f2d792723dc436ebcd93b7c127f6e Mon Sep 17 00:00:00 2001 From: ValerioC Date: Wed, 13 Jul 2022 17:29:26 +0200 Subject: [PATCH] =?UTF-8?q?Documento=20perdite=20(wms).=20La=20possibilit?= =?UTF-8?q?=C3=A0=20di=20scaricare=20l'intera=20anagrafica=20puo'=20essere?= =?UTF-8?q?=20effettuata=20soltanto=20una=20volta=20(a=20cache=20vuota)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inserire il campo 'Annotazioni' quando si crea un collo che sia editabile dall'utente (picking Vendita) --- .../core/expansion/BaseDialogFragment.java | 1 - .../rest/consumers/GestSetupRESTConsumer.java | 4 +- .../GestSetupRESTConsumerService.java | 1 + .../core/settings/DBSettingsModel.java | 10 +++++ .../core/settings/SettingsManager.java | 40 +++++++++++-------- .../dialog/DialogSelectDocInfoViewModel.java | 7 ++++ .../gest/spedizione/SpedizioneActivity.java | 7 ++++ .../gest/spedizione/SpedizioneViewModel.java | 40 +++++++++++++++---- .../InfoAggiuntiveLUDialog.java | 27 ++++++++++--- 9 files changed, 104 insertions(+), 33 deletions(-) diff --git a/app/src/main/java/it/integry/integrywmsnative/core/expansion/BaseDialogFragment.java b/app/src/main/java/it/integry/integrywmsnative/core/expansion/BaseDialogFragment.java index 9e893a49..6c37ddb4 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/expansion/BaseDialogFragment.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/expansion/BaseDialogFragment.java @@ -27,7 +27,6 @@ public class BaseDialogFragment extends DialogFragment { private boolean mBarcodeListener = false; - @Override public void show(FragmentManager manager, String tag) { try { diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GestSetupRESTConsumer.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GestSetupRESTConsumer.java index 384c6d0d..0d498c1e 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GestSetupRESTConsumer.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GestSetupRESTConsumer.java @@ -78,9 +78,9 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer { } - public static void getValues(List stbGestSetupList, RunnableArgs> onComplete, RunnableArgs onFailed) { + public static void getValues(String codMdep, List stbGestSetupList, RunnableArgs> onComplete, RunnableArgs onFailed) { GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class); - service.getGestSetupValues(stbGestSetupList).enqueue(new Callback<>() { + service.getGestSetupValues(codMdep, stbGestSetupList).enqueue(new Callback<>() { @Override public void onResponse(Call>> call, Response>> response) { analyzeAnswer(response, "GestSetup", onComplete, onFailed); diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GestSetupRESTConsumerService.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GestSetupRESTConsumerService.java index b4ba1d63..d2561898 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GestSetupRESTConsumerService.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/GestSetupRESTConsumerService.java @@ -28,6 +28,7 @@ public interface GestSetupRESTConsumerService { @POST("gestSetupList") Call>> getGestSetupValues( + @Query("codMdep") String codMdep, @Body List stbGestSetupList); } diff --git a/app/src/main/java/it/integry/integrywmsnative/core/settings/DBSettingsModel.java b/app/src/main/java/it/integry/integrywmsnative/core/settings/DBSettingsModel.java index 619ec067..ce29fedd 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/settings/DBSettingsModel.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/settings/DBSettingsModel.java @@ -48,6 +48,7 @@ public class DBSettingsModel { private int onQtaTotInputChanged = 1; private boolean flagAccettazioneUseQtaOrd = false; private boolean flagPickLiberoAllowEmptyDest = false; + private boolean flagAskInfoAggiuntiveSpedizione = false; public boolean isFlagSpedizioneEnableFakeGiacenza() { return flagSpedizioneEnableFakeGiacenza; @@ -364,4 +365,13 @@ public class DBSettingsModel { this.flagOrdinaArticoliOnScan = flagOrdinaArticoliOnScan; return this; } + + public boolean isFlagAskInfoAggiuntiveSpedizione() { + return flagAskInfoAggiuntiveSpedizione; + } + + public DBSettingsModel setFlagAskInfoAggiuntiveSpedizione(boolean flagAskInfoAggiuntiveSpedizione) { + this.flagAskInfoAggiuntiveSpedizione = flagAskInfoAggiuntiveSpedizione; + return this; + } } diff --git a/app/src/main/java/it/integry/integrywmsnative/core/settings/SettingsManager.java b/app/src/main/java/it/integry/integrywmsnative/core/settings/SettingsManager.java index 34423a2b..4da3aea9 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/settings/SettingsManager.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/settings/SettingsManager.java @@ -306,9 +306,21 @@ public class SettingsManager { .setGestName("PICKING") .setSection("PICKING_LIBERO") .setKeySection("FLAG_ALLOW_EMPTY_DEST")); + stbGestSetupList.add(new StbGestSetup() + .setGestName("PICKING") + .setSection("SPEDIZIONE") + .setKeySection("FLAG_PRINT_PACKING_LIST_ON_CLOSE")); + stbGestSetupList.add(new StbGestSetup() + .setGestName("PICKING") + .setSection("SPEDIZIONE") + .setKeySection("FLAG_ALLOW_EMPTY_DEST")); + stbGestSetupList.add(new StbGestSetup() + .setGestName("PICKING") + .setSection("SPEDIZIONE") + .setKeySection("FLAG_ASK_INFO_AGGIUNTIVE")); + String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep(); - - GestSetupRESTConsumer.getValues(stbGestSetupList, list -> { + GestSetupRESTConsumer.getValues(codMdep, stbGestSetupList, list -> { dbSettingsModelIstance.setDefaultCausaleRettificaGiacenze(getValueFromList(list, "SETUP", "DEFAULT_CAUSALE_RETTIFICA_GIACENZE", String.class)); dbSettingsModelIstance.setEnableCheckPartitaMagCheckPickingV(getValueFromList(list, "SETUP", "ENABLE_CHECK_PARTITA_MAG_PICKING_V", Boolean.class)); dbSettingsModelIstance.setFlagMultiClienteOrdV(getValueFromList(list, "SETUP", "FLAG_MULTI_CLIENTE_ORD_VENDITA", Boolean.class)); @@ -333,29 +345,23 @@ public class SettingsManager { dbSettingsModelIstance.setFlagAccettazioneUseQtaOrd(getValueFromList(list, "ACCETTAZIONE", "FLAG_USE_QTA_ORD", Boolean.class)); dbSettingsModelIstance.setFlagPickLiberoAllowEmptyDest(getValueFromList(list, "PICKING_LIBERO", "FLAG_ALLOW_EMPTY_DEST", Boolean.class)); dbSettingsModelIstance.setFlagOrdinaArticoliOnScan(getValueFromList(list, "ORDINI_A", "ORDINA_ARTICOLI_ON_SCAN", Boolean.class)); + dbSettingsModelIstance.setFlagPrintPackingListOnOrderClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_PACKING_LIST_ON_CLOSE", Boolean.class)); + dbSettingsModelIstance.setFlagPrintEtichetteOnOrderClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_ETICHETTE_ON_CLOSE", Boolean.class)); + dbSettingsModelIstance.setFlagAskInfoAggiuntiveSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_ASK_INFO_AGGIUNTIVE", Boolean.class)); String notePerdita = getValueFromList(list, "DOC_INTERNI", "NOTE_PERDITA", String.class); - if (notePerdita != null) { + if (notePerdita != null) dbSettingsModelIstance.setNotePerditaDocInterni(Arrays.asList(notePerdita.split("\\|"))); - } Integer onNumCnfInputChanged = getValueFromList(list, "SETUP", "ON_NUM_CNF_INPUT_CHANGED", Integer.class); - if (onNumCnfInputChanged != null) { + if (onNumCnfInputChanged != null) dbSettingsModelIstance.setOnNumCnfInputChanged(onNumCnfInputChanged); - } Integer onQtaTotInputChanged = getValueFromList(list, "SETUP", "ON_QTA_TOT_INPUT_CHANGED", Integer.class); - if (onQtaTotInputChanged != null) { + if (onQtaTotInputChanged != null) dbSettingsModelIstance.setOnQtaTotInputChanged(onQtaTotInputChanged); - } - String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep(); - GestSetupRESTConsumer.getBooleanValue("PICKING", "SPEDIZIONE", "FLAG_PRINT_PACKING_LIST_ON_CLOSE", codMdep, (value) -> { - dbSettingsModelIstance.setFlagPrintPackingListOnOrderClose(value); - GestSetupRESTConsumer.getBooleanValue("PICKING", "SPEDIZIONE", "FLAG_PRINT_ETICHETTE_ON_CLOSE", codMdep, (setupValue) -> { - dbSettingsModelIstance.setFlagPrintEtichetteOnOrderClose(setupValue); - if (onComplete != null) onComplete.run(); - }, onFailed); - }, onFailed); + + if (onComplete != null) onComplete.run(); }, onFailed); } @@ -365,7 +371,7 @@ public class SettingsManager { StbGestSetup value = Stream.of(stbGestSetupList) .filter(x -> x.getSection().equalsIgnoreCase(section) && x.getKeySection().equalsIgnoreCase(keySectionName)) - .findFirst().get(); + .findFirstOrElse(new StbGestSetup()); if (clazz == String.class) { return clazz.cast(value.getValue()); diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/contab_doc_interni/dialog/DialogSelectDocInfoViewModel.java b/app/src/main/java/it/integry/integrywmsnative/gest/contab_doc_interni/dialog/DialogSelectDocInfoViewModel.java index a5455f2d..38a80d64 100644 --- a/app/src/main/java/it/integry/integrywmsnative/gest/contab_doc_interni/dialog/DialogSelectDocInfoViewModel.java +++ b/app/src/main/java/it/integry/integrywmsnative/gest/contab_doc_interni/dialog/DialogSelectDocInfoViewModel.java @@ -35,6 +35,13 @@ public class DialogSelectDocInfoViewModel { public void init(DocInterniSetupDTO initialList) { this.mDocInterniSetupDTO = initialList; + this.mTipoDoc = null; + this.mGruppoArt = null; + this.mFornitore = null; + this.mDataDoc = null; + this.mNumDoc = null; + this.mNote = null; + this.mListener = null; } public String getCodDtip() { diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneActivity.java b/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneActivity.java index 54b87d73..78927c6b 100644 --- a/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneActivity.java +++ b/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneActivity.java @@ -44,6 +44,7 @@ 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.MtbPartitaMag; +import it.integry.integrywmsnative.core.model.MtbTCol; import it.integry.integrywmsnative.core.model.secondary.GestioneEnum; import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO; import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO; @@ -72,6 +73,7 @@ import it.integry.integrywmsnative.view.dialogs.ask_should_print.DialogAskShould import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleInputHelper; import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView; import it.integry.integrywmsnative.view.dialogs.choose_batch_lot.DialogChooseBatchLotView; +import it.integry.integrywmsnative.view.dialogs.info_aggiuntive_lu.InfoAggiuntiveLUDialog; import it.integry.integrywmsnative.view.dialogs.input_peso_lu.DialogInputPeso; import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2DTO; import it.integry.integrywmsnative.view.dialogs.input_quantity_v2.DialogInputQuantityV2View; @@ -938,4 +940,9 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo } } } + + @Override + public void onInfoAggiuntiveRequired(MtbColt mtbColt, RunnableArgss onComplete) { + InfoAggiuntiveLUDialog.newInstance(mtbColt, onComplete).show(getSupportFragmentManager(), "InfoAggiuntiveLUDialog"); + } } diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java b/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java index 506c6a36..a22c73c0 100644 --- a/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java +++ b/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneViewModel.java @@ -43,6 +43,7 @@ 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.MtbPartitaMag; +import it.integry.integrywmsnative.core.model.MtbTCol; import it.integry.integrywmsnative.core.model.dto.PickDataDTO; import it.integry.integrywmsnative.core.model.secondary.GestioneEnum; import it.integry.integrywmsnative.core.report.ReportType; @@ -1617,14 +1618,36 @@ public class SpedizioneViewModel { } else { if (mDefaultSegnoCol == -1) { Runnable saveAction = () -> { - mColliMagazzinoRESTConsumer.updateDataFine( - mCurrentMtbColt, () -> distribuisciLU((generatedMtbColts) -> { - if (shouldPrint) - printCollo(generatedMtbColts, () -> this.postCloseOperations(generatedMtbColts)); - else { - postCloseOperations(generatedMtbColts); - } - }), this::sendError); + if (SettingsManager.iDB().isFlagAskInfoAggiuntiveSpedizione()) { + this.mListener.onInfoAggiuntiveRequired(mCurrentMtbColt, (note, mtbTcol) -> { + mCurrentMtbColt.setAnnotazioni(note); + if (mtbTcol != null) { + mCurrentMtbColt.setMtbTCol(mtbTcol); + mCurrentMtbColt.setCodTcol(mtbTcol.getCodTcol()); + } else { + mCurrentMtbColt.setMtbTCol(null); + mCurrentMtbColt.setCodTcol(null); + } + mColliMagazzinoRESTConsumer.updateDataFine( + mCurrentMtbColt, () -> distribuisciLU((generatedMtbColts) -> { + if (shouldPrint) + printCollo(generatedMtbColts, () -> this.postCloseOperations(generatedMtbColts)); + else { + postCloseOperations(generatedMtbColts); + } + }), this::sendError); + }); + } else { + + mColliMagazzinoRESTConsumer.updateDataFine( + mCurrentMtbColt, () -> distribuisciLU((generatedMtbColts) -> { + if (shouldPrint) + printCollo(generatedMtbColts, () -> this.postCloseOperations(generatedMtbColts)); + else { + postCloseOperations(generatedMtbColts); + } + }), this::sendError); + } }; if (mShouldAskPesoLU) { @@ -1992,6 +2015,7 @@ public class SpedizioneViewModel { boolean canBatchLotBeChanged, RunnableArgss onComplete); + void onInfoAggiuntiveRequired(MtbColt currentMtbColt, RunnableArgss onComplete); void onLUPositionChangeRequest(RunnableArgss onComplete); diff --git a/app/src/main/java/it/integry/integrywmsnative/view/dialogs/info_aggiuntive_lu/InfoAggiuntiveLUDialog.java b/app/src/main/java/it/integry/integrywmsnative/view/dialogs/info_aggiuntive_lu/InfoAggiuntiveLUDialog.java index 75155e02..21ec2357 100644 --- a/app/src/main/java/it/integry/integrywmsnative/view/dialogs/info_aggiuntive_lu/InfoAggiuntiveLUDialog.java +++ b/app/src/main/java/it/integry/integrywmsnative/view/dialogs/info_aggiuntive_lu/InfoAggiuntiveLUDialog.java @@ -26,9 +26,11 @@ import it.integry.integrywmsnative.MainApplication; import it.integry.integrywmsnative.R; import it.integry.integrywmsnative.core.expansion.BaseDialogFragment; import it.integry.integrywmsnative.core.expansion.RunnableArgss; +import it.integry.integrywmsnative.core.model.MtbColt; import it.integry.integrywmsnative.core.model.MtbTCol; import it.integry.integrywmsnative.core.utility.UtilityDialog; import it.integry.integrywmsnative.core.utility.UtilityObservable; +import it.integry.integrywmsnative.core.utility.UtilityString; import it.integry.integrywmsnative.databinding.DialogNoteAggiuntiveNuovaUlBinding; import it.integry.integrywmsnative.view.dialogs.input_lu_prod.adapter.DialogInputLUProdTipoColloAdapter; import it.integry.integrywmsnative.view.dialogs.input_lu_prod.adapter.DialogInputLUProdTipoColloListModel; @@ -40,20 +42,24 @@ public class InfoAggiuntiveLUDialog extends BaseDialogFragment implements InfoAg private DialogNoteAggiuntiveNuovaUlBinding mBindings; private final RunnableArgss mOnComplete; - + private MtbColt currentMtbColt; private DialogInputLUProdTipoColloAdapter codTcolArrayAdapter = null; public ObservableField additionalNotes = new ObservableField<>(); public ObservableField selectedMtbTcol = new ObservableField<>(); public ObservableField currentMtbTCol = new ObservableField<>(); public static InfoAggiuntiveLUDialog newInstance(@NotNull RunnableArgss onComplete) { - return new InfoAggiuntiveLUDialog(onComplete); + return new InfoAggiuntiveLUDialog(null, onComplete); } - private InfoAggiuntiveLUDialog(@NotNull RunnableArgss onComplete) { + public static InfoAggiuntiveLUDialog newInstance(MtbColt mtbColt, @NotNull RunnableArgss onComplete) { + return new InfoAggiuntiveLUDialog(mtbColt, onComplete); + } + + private InfoAggiuntiveLUDialog(MtbColt mtbColt, @NotNull RunnableArgss onComplete) { super(); this.mOnComplete = onComplete; - + this.currentMtbColt = mtbColt; } @@ -121,9 +127,17 @@ public class InfoAggiuntiveLUDialog extends BaseDialogFragment implements InfoAg this.mViewModel.getTipiCollo().observe(getViewLifecycleOwner(), tipiCollo -> { + codTcolArrayAdapter = new DialogInputLUProdTipoColloAdapter(getActivity(), R.layout.array_adapter_single_item, tipiCollo); mBindings.filledExposedDropdownCodTcol.setAdapter(codTcolArrayAdapter); + if (currentMtbTCol != null && !UtilityString.isNullOrEmpty(currentMtbColt.getCodTcol()) && UtilityString.isNullOrEmpty(this.selectedMtbTcol.get())) { + MtbTCol tipoPedana = Stream.of(tipiCollo).filter(x -> x.getCodTcol().equalsIgnoreCase(currentMtbColt.getCodTcol())).findFirstOrElse(null); + if (tipoPedana != null) { + this.selectedMtbTcol.set(tipoPedana.getCodTcol() + " - " + tipoPedana.getDescrizione()); + } + } + }); this.mBindings.filledExposedDropdownCodTcol.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @@ -141,6 +155,9 @@ public class InfoAggiuntiveLUDialog extends BaseDialogFragment implements InfoAg mBindings.buttonConfirm.setOnClickListener(v -> { dismiss(); }); - } + if (this.currentMtbColt != null) { + this.additionalNotes.set(currentMtbColt.getAnnotazioni()); + } + } }