Refactoring caricamento gest setup

This commit is contained in:
Giuseppe Scorrano 2023-09-15 12:54:35 +02:00
parent a7dbe55ad2
commit 1e129d1ea9
4 changed files with 286 additions and 207 deletions

View File

@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest.consumers;
import android.util.Log;
import java.util.List;
import java.util.stream.Collectors;
import javax.inject.Singleton;
@ -11,6 +12,7 @@ import it.integry.integrywmsnative.core.model.StbGestSetup;
import it.integry.integrywmsnative.core.rest.RESTBuilder;
import it.integry.integrywmsnative.core.rest.model.GestSetupDTO;
import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse;
import it.integry.integrywmsnative.core.settings.StbGestSetupReader;
import it.integry.integrywmsnative.core.utility.UtilityLogger;
import retrofit2.Call;
import retrofit2.Callback;
@ -76,12 +78,25 @@ public class GestSetupRESTConsumer extends _BaseRESTConsumer {
}
public void getValues(String codMdep, List<StbGestSetup> stbGestSetupList, RunnableArgs<List<StbGestSetup>> onComplete, RunnableArgs<Exception> onFailed) {
public void getValues(String codMdep, List<StbGestSetupReader> stbGestSetupList, RunnableArgs<List<StbGestSetupReader>> onComplete, RunnableArgs<Exception> onFailed) {
var stbGestSetups = stbGestSetupList.stream().map(x -> (StbGestSetup) x).collect(Collectors.toList());
GestSetupRESTConsumerService service = RESTBuilder.getService(GestSetupRESTConsumerService.class);
service.getGestSetupValues(codMdep, stbGestSetupList).enqueue(new Callback<>() {
service.getGestSetupValues(codMdep, stbGestSetups).enqueue(new Callback<>() {
@Override
public void onResponse(Call<ServiceRESTResponse<List<StbGestSetup>>> call, Response<ServiceRESTResponse<List<StbGestSetup>>> response) {
analyzeAnswer(response, "GestSetup", onComplete, onFailed);
analyzeAnswer(response, "GestSetup", data -> {
for (StbGestSetup stbGestSetup : data) {
stbGestSetupList.stream().filter(x -> stbGestSetup.getGestName().equalsIgnoreCase(x.getGestName()) &&
stbGestSetup.getSection().equalsIgnoreCase(x.getSection()) &&
stbGestSetup.getKeySection().equalsIgnoreCase(x.getKeySection()))
.findFirst()
.ifPresent(x -> x.setValue(stbGestSetup.getValue()));
}
onComplete.run(stbGestSetupList);
}, onFailed);
}
@Override

View File

@ -67,6 +67,7 @@ public class DBSettingsModel {
private boolean flagAskVersamentoAutomaticoAccettazioneBolla = false;
private boolean flagCanAddUnknownItemsAccettazioneBolla = false;
private boolean flagCanAddUnknownBarcodesAccettazioneBolla = false;
private boolean flagEnableFastPickAccettazioneBolla = false;
public boolean isFlagSpedizioneEnableFakeGiacenza() {
return flagSpedizioneEnableFakeGiacenza;
@ -536,4 +537,13 @@ public class DBSettingsModel {
this.flagCanAddUnknownBarcodesAccettazioneBolla = flagCanAddUnknownBarcodesAccettazioneBolla;
return this;
}
public boolean isFlagEnableFastPickAccettazioneBolla() {
return flagEnableFastPickAccettazioneBolla;
}
public DBSettingsModel setFlagEnableFastPickAccettazioneBolla(boolean flagEnableFastPickAccettazioneBolla) {
this.flagEnableFastPickAccettazioneBolla = flagEnableFastPickAccettazioneBolla;
return this;
}
}

View File

@ -2,7 +2,6 @@ package it.integry.integrywmsnative.core.settings;
import android.content.Context;
import com.annimon.stream.Stream;
import com.google.firebase.perf.metrics.Trace;
import com.google.gson.reflect.TypeToken;
@ -17,7 +16,6 @@ import javax.inject.Singleton;
import it.integry.integrywmsnative.R;
import it.integry.integrywmsnative.core.CommonConst;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.StbGestSetup;
import it.integry.integrywmsnative.core.model.dto.InternalCodAnagsDTO;
import it.integry.integrywmsnative.core.rest.consumers.AziendaRESTConsumer;
import it.integry.integrywmsnative.core.rest.consumers.GestSetupRESTConsumer;
@ -62,9 +60,6 @@ public class SettingsManager {
settingsModelIstance = new SettingsModel();
settingsModelIstance.setServer(new SettingsModel.Server());
//settingsModelIstance.user = new SettingsModel.User();
//settingsModelIstance.userSession = new SettingsModel.UserSession();
firstStart = true;
}
@ -210,297 +205,298 @@ public class SettingsManager {
private static void loadGestSetupValues(Runnable onComplete, RunnableArgs<Exception> onFailed) {
List<StbGestSetup> stbGestSetupList = new ArrayList<>();
List<StbGestSetupReader> stbGestSetupReaderList = new ArrayList<>();
stbGestSetupList.add(new StbGestSetup()
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SETUP")
.setKeySection("ENABLE_CHECK_PARTITA_MAG_PICKING_V"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("ENABLE_CHECK_PARTITA_MAG_PICKING_V")
.setSetter(dbSettingsModelIstance::setEnableCheckPartitaMagCheckPickingV));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SETUP")
.setKeySection("FLAG_MULTI_CLIENTE_ORD_VENDITA"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_MULTI_CLIENTE_ORD_VENDITA")
.setSetter(dbSettingsModelIstance::setFlagMultiClienteOrdV));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SETUP")
.setKeySection("FLAG_USE_COD_ANAG_AZIENDALE"));
stbGestSetupList.add(new StbGestSetup()
.setGestName("PICKING")
.setSection("SETUP")
.setKeySection("DEFAULT_CRITERIO_DISTRIBUZIONE"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_USE_COD_ANAG_AZIENDALE")
.setSetter(dbSettingsModelIstance::setFlagUseCodAnagAziendale));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("PICKING_LIBERO")
.setKeySection("FLAG_ASK_CLIENTE"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_ASK_CLIENTE")
.setSetter(dbSettingsModelIstance::setFlagAskClienteInPickingLibero));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("PICKING_LIBERO")
.setKeySection("FLAG_ALLOW_EMPTY_CLIENTE"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_ALLOW_EMPTY_CLIENTE")
.setSetter(dbSettingsModelIstance::setFlagPickLiberoAllowEmptyCliente));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_CAN_ADD_EXTRA_ITEMS"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_CAN_ADD_EXTRA_ITEMS")
.setSetter(dbSettingsModelIstance::setFlagCanAddExtraItemSpedizione));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("ACCETTAZIONE")
.setKeySection("FLAG_AUTO_OPEN_NEW_UL"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_AUTO_OPEN_NEW_UL")
.setSetter(dbSettingsModelIstance::setFlagCanAutoOpenNewULAccettazione));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_CAN_ADD_EXTRA_QUANTITY"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_CAN_ADD_EXTRA_QUANTITY")
.setSetter(dbSettingsModelIstance::setFlagCanAddExtraQuantitySpedizione));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("ENABLE_CHECK_DEPOSITO"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("ENABLE_CHECK_DEPOSITO")
.setSetter(dbSettingsModelIstance::setFlagEnableCheckDepositoSpedizione));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SETUP")
.setKeySection("FLAG_FORCE_ALL_TO_COLLI"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_FORCE_ALL_TO_COLLI")
.setSetter(dbSettingsModelIstance::setFlagForceAllToColli));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SETUP")
.setKeySection("FLAG_ASK_PESO_COLLO"));
stbGestSetupList.add(new StbGestSetup()
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_USE_NEW_PICKING_LIST"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_ASK_PESO_COLLO")
.setSetter(dbSettingsModelIstance::setFlagAskPesoColloSpedizione));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("PRODUZIONE")
.setKeySection("FLAG_VERSAMENTO_DIRETTO"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_VERSAMENTO_DIRETTO")
.setSetter(dbSettingsModelIstance::setFlagVersamentoDirettoProduzione));
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
.setGestName("PICKING")
.setSection("PRODUZIONE")
.setKeySection("FILTER_FORNTIORE_PROD"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FILTER_FORNTIORE_PROD")
.setSetter(dbSettingsModelIstance::setFilterFornitoreProd));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("ENABLE_MANUAL_PICK"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("ENABLE_MANUAL_PICK")
.setSetter(dbSettingsModelIstance::setFlagSpedizioneEnableManualPick));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("ENABLE_FAKE_GIACENZA"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("ENABLE_FAKE_GIACENZA")
.setSetter(dbSettingsModelIstance::setFlagSpedizioneEnableFakeGiacenza));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_CAN_SELECT_MULTIPLE_ORDERS"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_CAN_SELECT_MULTIPLE_ORDERS")
.setSetter(dbSettingsModelIstance::setFlagSpedizioneCanSelectMultipleOrders));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_USE_QTA_ORD"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_USE_QTA_ORD")
.setSetter(dbSettingsModelIstance::setFlagSpedizioneUseQtaOrd));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Integer.class)
.setGestName("PICKING")
.setSection("SETUP")
.setKeySection("ON_NUM_CNF_INPUT_CHANGED"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("ON_NUM_CNF_INPUT_CHANGED")
.setSetter(data -> {
if (data != null) dbSettingsModelIstance.setOnNumCnfInputChanged(data);
}));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Integer.class)
.setGestName("PICKING")
.setSection("SETUP")
.setKeySection("ON_QTA_TOT_INPUT_CHANGED"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("ON_QTA_TOT_INPUT_CHANGED")
.setSetter(data -> {
if (data != null) dbSettingsModelIstance.setOnQtaTotInputChanged(data);
}));
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
.setGestName("PVM")
.setSection("DOC_INTERNI")
.setKeySection("NOTE_PERDITA"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("NOTE_PERDITA")
.setSetter(data -> {
if (data != null)
dbSettingsModelIstance.setNotePerditaDocInterni(Arrays.asList(data.split("\\|")));
}));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PVM")
.setSection("ORDINI_A")
.setKeySection("ORDINA_NUOVI_ARTICOLI"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("ORDINA_NUOVI_ARTICOLI")
.setSetter(dbSettingsModelIstance::setFlagOrdinaNuoviArticoliInGriglia));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PVM")
.setSection("ORDINI_A")
.setKeySection("ORDINA_ARTICOLI_ON_SCAN"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("ORDINA_ARTICOLI_ON_SCAN")
.setSetter(dbSettingsModelIstance::setFlagOrdinaArticoliOnScan));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PVM")
.setSection("ORDINI_A")
.setKeySection("FLAG_CONSENTI_ORDINE_DA_GRIGLIA"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_CONSENTI_ORDINE_DA_GRIGLIA")
.setSetter(dbSettingsModelIstance::setFlagConsentiFuoriPianoLogistico));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PVM")
.setSection("ORDINI_A")
.setKeySection("FLAG_CONSENTI_ORDINE_SENZA_GRIGLIA"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_CONSENTI_ORDINE_SENZA_GRIGLIA")
.setSetter(dbSettingsModelIstance::setFlagConsentiOrdineSenzaGriglia));
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
.setGestName("PVM")
.setSection("DOC_INTERNI")
.setKeySection("CHECK_FORNITORE"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("CHECK_FORNITORE")
.setSetter(dbSettingsModelIstance::setDocInterniCheckFornitore));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("ACCETTAZIONE")
.setKeySection("FLAG_USE_QTA_ORD"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_USE_QTA_ORD")
.setSetter(dbSettingsModelIstance::setFlagAccettazioneUseQtaOrd));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("PICKING_LIBERO")
.setKeySection("FLAG_ALLOW_EMPTY_DEST"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_ALLOW_EMPTY_DEST")
.setSetter(dbSettingsModelIstance::setFlagPickLiberoAllowEmptyDest));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_PRINT_PACKING_LIST_ON_CLOSE"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_PRINT_PACKING_LIST_ON_CLOSE")
.setSetter(dbSettingsModelIstance::setFlagPrintPackingListOnOrderClose));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_PRINT_ETICHETTE_ON_CLOSE"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_PRINT_ETICHETTE_ON_CLOSE")
.setSetter(dbSettingsModelIstance::setFlagPrintEtichetteOnOrderClose));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_PRINT_ETICHETTE_ON_LU_CLOSE"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_PRINT_ETICHETTE_ON_LU_CLOSE")
.setSetter(dbSettingsModelIstance::setFlagPrintEtichetteOnLUClose)
.setDefaultValue(true));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_ALLOW_EMPTY_DEST"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_ASK_INFO_AGGIUNTIVE")
.setSetter(dbSettingsModelIstance::setFlagAskInfoAggiuntiveSpedizione));
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_ASK_INFO_AGGIUNTIVE"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("COD_DTIP_ORD_TRASF")
.setSetter(dbSettingsModelIstance::setCodDtipOrdTrasfV));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("COD_DTIP_ORD_TRASF"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_NOTIFICA_STATO_PARTITA")
.setSetter(dbSettingsModelIstance::setNotifyLotStatus));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_NOTIFICA_STATO_PARTITA"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_SHOW_COD_FORN")
.setSetter(dbSettingsModelIstance::setShowCodFornSpedizione)
.setDefaultValue(true));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_SHOW_COD_FORN"));
stbGestSetupList.add(new StbGestSetup()
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("FLAG_GROUP_BY_GRP_MERC"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_GROUP_BY_GRP_MERC")
.setSetter(dbSettingsModelIstance::setGroupShippingByCommodityGroup)
.setDefaultValue(false));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("INVENTARIO")
.setKeySection("FLAG_CAN_CREATE_INVENTARIO"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_CAN_CREATE_INVENTARIO")
.setSetter(dbSettingsModelIstance::setFlagCanCreateInventario)
.setDefaultValue(true));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("INVENTARIO")
.setKeySection("FLAG_CAN_ADD_UNKNOWN_ITEMS"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_CAN_ADD_UNKNOWN_ITEMS")
.setSetter(dbSettingsModelIstance::setFlagCanAddUnknownItemsInventario)
.setDefaultValue(true));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("INVENTARIO")
.setKeySection("FLAG_SHOULD_ASK_TO_CREATE_OR_UPDATE_ROW"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_SHOULD_ASK_TO_CREATE_OR_UPDATE_ROW")
.setSetter(dbSettingsModelIstance::setFlagShouldAskToCreateOrUpdateRowInventario)
.setDefaultValue(false));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("INVENTARIO")
.setKeySection("ENABLE_OFFLINE_CACHE"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("ENABLE_OFFLINE_CACHE")
.setSetter(dbSettingsModelIstance::setFlagIsInventarioCacheEnabled)
.setDefaultValue(false));
stbGestSetupReaderList.add(new StbGestSetupReader<>(String.class)
.setGestName("PICKING")
.setSection("SETUP")
.setKeySection("COMMESSA_MAGAZZINO"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("COMMESSA_MAGAZZINO")
.setSetter(dbSettingsModelIstance::setCommessaMagazzino)
.setDefaultValue(CommonConst.Config.COMMESSA_MAG));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("SPEDIZIONE")
.setKeySection("GENERA_DOC"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("GENERA_DOC")
.setSetter(dbSettingsModelIstance::setFlagGeneraDocumentoSpedizione)
.setDefaultValue(false));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("ACCETTAZIONE_BOLLA")
.setKeySection("FLAG_ASK_PRINT_UL"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_ASK_PRINT_UL")
.setSetter(dbSettingsModelIstance::setFlagAskPrintUlAccettazioneBolla)
.setDefaultValue(false));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("ACCETTAZIONE_BOLLA")
.setKeySection("FLAG_ASK_TIPO_COLLO"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_ASK_TIPO_COLLO")
.setSetter(dbSettingsModelIstance::setFlagAskTipoColloAccettazioneBolla)
.setDefaultValue(false));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("ACCETTAZIONE_BOLLA")
.setKeySection("FLAG_ASK_VERSAMENTO_AUTOMATICO"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_ASK_VERSAMENTO_AUTOMATICO")
.setSetter(dbSettingsModelIstance::setFlagAskVersamentoAutomaticoAccettazioneBolla)
.setDefaultValue(false));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("ACCETTAZIONE_BOLLA")
.setKeySection("FLAG_CAN_ADD_UNKNOWN_ITEMS"));
stbGestSetupList.add(new StbGestSetup()
.setKeySection("FLAG_CAN_ADD_UNKNOWN_ITEMS")
.setSetter(dbSettingsModelIstance::setFlagCanAddUnknownItemsAccettazioneBolla)
.setDefaultValue(false));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("ACCETTAZIONE_BOLLA")
.setKeySection("FLAG_CAN_ADD_UNKNOWN_BARCODES"));
.setKeySection("FLAG_CAN_ADD_UNKNOWN_BARCODES")
.setSetter(dbSettingsModelIstance::setFlagCanAddUnknownBarcodesAccettazioneBolla)
.setDefaultValue(false));
stbGestSetupReaderList.add(new StbGestSetupReader<>(Boolean.class)
.setGestName("PICKING")
.setSection("ACCETTAZIONE_BOLLA")
.setKeySection("FLAG_ENABLE_FAST_PICK")
.setSetter(dbSettingsModelIstance::setFlagEnableFastPickAccettazioneBolla)
.setDefaultValue(false));
String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep();
mGestSetupRESTConsumer.getValues(codMdep, stbGestSetupList, list -> {
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));
dbSettingsModelIstance.setFlagUseCodAnagAziendale(getValueFromList(list, "SETUP", "FLAG_USE_COD_ANAG_AZIENDALE", Boolean.class));
dbSettingsModelIstance.setFlagAskClienteInPickingLibero(getValueFromList(list, "PICKING_LIBERO", "FLAG_ASK_CLIENTE", Boolean.class));
dbSettingsModelIstance.setFlagPickLiberoAllowEmptyCliente(getValueFromList(list, "PICKING_LIBERO", "FLAG_ALLOW_EMPTY_CLIENTE", Boolean.class));
dbSettingsModelIstance.setFlagCanAddExtraItemSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_ITEMS", Boolean.class));
dbSettingsModelIstance.setFlagCanAutoOpenNewULAccettazione(getValueFromList(list, "ACCETTAZIONE", "FLAG_AUTO_OPEN_NEW_UL", Boolean.class));
dbSettingsModelIstance.setFlagCanAddExtraQuantitySpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_ADD_EXTRA_QUANTITY", Boolean.class));
dbSettingsModelIstance.setFlagEnableCheckDepositoSpedizione(getValueFromList(list, "SPEDIZIONE", "ENABLE_CHECK_DEPOSITO", Boolean.class));
dbSettingsModelIstance.setFlagForceAllToColli(getValueFromList(list, "SETUP", "FLAG_FORCE_ALL_TO_COLLI", Boolean.class));
dbSettingsModelIstance.setFlagAskPesoColloSpedizione(getValueFromList(list, "SETUP", "FLAG_ASK_PESO_COLLO", Boolean.class));
dbSettingsModelIstance.setFlagVersamentoDirettoProduzione(getValueFromList(list, "PRODUZIONE", "FLAG_VERSAMENTO_DIRETTO", Boolean.class));
dbSettingsModelIstance.setFlagSpedizioneEnableManualPick(getValueFromList(list, "SPEDIZIONE", "ENABLE_MANUAL_PICK", Boolean.class));
dbSettingsModelIstance.setFlagSpedizioneEnableFakeGiacenza(getValueFromList(list, "SPEDIZIONE", "ENABLE_FAKE_GIACENZA", Boolean.class));
dbSettingsModelIstance.setFlagSpedizioneCanSelectMultipleOrders(getValueFromList(list, "SPEDIZIONE", "FLAG_CAN_SELECT_MULTIPLE_ORDERS", Boolean.class));
dbSettingsModelIstance.setFlagSpedizioneUseQtaOrd(getValueFromList(list, "SPEDIZIONE", "FLAG_USE_QTA_ORD", Boolean.class));
dbSettingsModelIstance.setFlagOrdinaNuoviArticoliInGriglia(getValueFromList(list, "ORDINI_A", "ORDINA_NUOVI_ARTICOLI", Boolean.class));
dbSettingsModelIstance.setDocInterniCheckFornitore(getValueFromList(list, "DOC_INTERNI", "CHECK_FORNITORE", String.class));
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.setFlagConsentiFuoriPianoLogistico(getValueFromList(list, "ORDINI_A", "FLAG_CONSENTI_ORDINE_DA_GRIGLIA", Boolean.class));
dbSettingsModelIstance.setFlagConsentiOrdineSenzaGriglia(getValueFromList(list, "ORDINI_A", "FLAG_CONSENTI_ORDINE_SENZA_GRIGLIA", 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.setFlagPrintEtichetteOnLUClose(getValueFromList(list, "SPEDIZIONE", "FLAG_PRINT_ETICHETTE_ON_LU_CLOSE", Boolean.class, true));
dbSettingsModelIstance.setFlagAskInfoAggiuntiveSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_ASK_INFO_AGGIUNTIVE", Boolean.class));
dbSettingsModelIstance.setFilterFornitoreProd(getValueFromList(list, "PRODUZIONE", "FILTER_FORNTIORE_PROD", String.class));
dbSettingsModelIstance.setCodDtipOrdTrasfV(getValueFromList(list, "SPEDIZIONE", "COD_DTIP_ORD_TRASF", String.class));
dbSettingsModelIstance.setNotifyLotStatus(getValueFromList(list, "SPEDIZIONE", "FLAG_NOTIFICA_STATO_PARTITA", Boolean.class));
dbSettingsModelIstance.setShowCodFornSpedizione(getValueFromList(list, "SPEDIZIONE", "FLAG_SHOW_COD_FORN", Boolean.class, Boolean.TRUE));
dbSettingsModelIstance.setGroupShippingByCommodityGroup(getValueFromList(list, "SPEDIZIONE", "FLAG_GROUP_BY_GRP_MERC", Boolean.class, Boolean.FALSE));
dbSettingsModelIstance.setFlagCanCreateInventario(getValueFromList(list, "INVENTARIO", "FLAG_CAN_CREATE_INVENTARIO", Boolean.class, Boolean.TRUE));
dbSettingsModelIstance.setFlagCanAddUnknownItemsInventario(getValueFromList(list, "INVENTARIO", "FLAG_CAN_ADD_UNKNOWN_ITEMS", Boolean.class, Boolean.TRUE));
dbSettingsModelIstance.setFlagShouldAskToCreateOrUpdateRowInventario(getValueFromList(list, "INVENTARIO", "FLAG_SHOULD_ASK_TO_CREATE_OR_UPDATE_ROW", Boolean.class, Boolean.FALSE));
dbSettingsModelIstance.setCommessaMagazzino(getValueFromList(list, "SETUP", "COMMESSA_MAGAZZINO", String.class, CommonConst.Config.COMMESSA_MAG));
dbSettingsModelIstance.setFlagGeneraDocumentoSpedizione(getValueFromList(list, "SPEDIZIONE", "GENERA_DOC", Boolean.class, Boolean.FALSE));
dbSettingsModelIstance.setFlagIsInventarioCacheEnabled(getValueFromList(list, "INVENTARIO", "ENABLE_OFFLINE_CACHE", Boolean.class, Boolean.FALSE));
dbSettingsModelIstance.setFlagAskPrintUlAccettazioneBolla(getValueFromList(list, "ACCETTAZIONE_BOLLA", "FLAG_ASK_PRINT_UL", Boolean.class, Boolean.FALSE));
dbSettingsModelIstance.setFlagAskTipoColloAccettazioneBolla(getValueFromList(list, "ACCETTAZIONE_BOLLA", "FLAG_ASK_TIPO_COLLO", Boolean.class, Boolean.FALSE));
dbSettingsModelIstance.setFlagAskVersamentoAutomaticoAccettazioneBolla(getValueFromList(list, "ACCETTAZIONE_BOLLA", "FLAG_ASK_VERSAMENTO_AUTOMATICO", Boolean.class, Boolean.FALSE));
dbSettingsModelIstance.setFlagCanAddUnknownItemsAccettazioneBolla(getValueFromList(list, "ACCETTAZIONE_BOLLA", "FLAG_CAN_ADD_UNKNOWN_ITEMS", Boolean.class, Boolean.FALSE));
dbSettingsModelIstance.setFlagCanAddUnknownBarcodesAccettazioneBolla(getValueFromList(list, "ACCETTAZIONE_BOLLA", "FLAG_CAN_ADD_UNKNOWN_BARCODES", Boolean.class, Boolean.FALSE));
String notePerdita = getValueFromList(list, "DOC_INTERNI", "NOTE_PERDITA", String.class);
if (notePerdita != null)
dbSettingsModelIstance.setNotePerditaDocInterni(Arrays.asList(notePerdita.split("\\|")));
mGestSetupRESTConsumer.getValues(codMdep, stbGestSetupReaderList, list -> {
Integer onNumCnfInputChanged = getValueFromList(list, "SETUP", "ON_NUM_CNF_INPUT_CHANGED", Integer.class);
if (onNumCnfInputChanged != null)
dbSettingsModelIstance.setOnNumCnfInputChanged(onNumCnfInputChanged);
for (var stbGestSetupReader : list) {
var value = stbGestSetupReader.getValue();
var clazz = stbGestSetupReader.getClazz();
Integer onQtaTotInputChanged = getValueFromList(list, "SETUP", "ON_QTA_TOT_INPUT_CHANGED", Integer.class);
if (onQtaTotInputChanged != null)
dbSettingsModelIstance.setOnQtaTotInputChanged(onQtaTotInputChanged);
Object finalValue = null;
if (value != null) {
if (clazz == String.class) {
finalValue = clazz.cast(value);
} else if (clazz == Boolean.class) {
finalValue = clazz.cast("S".equalsIgnoreCase(value));
} else if (clazz == Integer.class && value != null) {
finalValue = clazz.cast(Integer.parseInt(value));
}
} else if (stbGestSetupReader.getDefaultValue() == null) {
if (clazz == Boolean.class) {
finalValue = clazz.cast(Boolean.FALSE);
} else if (clazz == Integer.class) {
finalValue = clazz.cast(0);
}
} else finalValue = stbGestSetupReader.getDefaultValue();
stbGestSetupReader.getSetter().run(finalValue);
}
if (onComplete != null) onComplete.run();
}, onFailed);
}
public static <T> T getValueFromList(List<StbGestSetup> stbGestSetupList, String section, String keySectionName, Class<T> clazz) {
return getValueFromList(stbGestSetupList, section, keySectionName, clazz, null);
}
public static <T> T getValueFromList(List<StbGestSetup> stbGestSetupList, String section, String keySectionName, Class<T> clazz, T defaultValue) {
StbGestSetup value = Stream.of(stbGestSetupList)
.filter(x -> x.getSection().equalsIgnoreCase(section) && x.getKeySection().equalsIgnoreCase(keySectionName))
.findFirstOrElse(null);
if (value != null) {
if (clazz == String.class) {
return clazz.cast(value.getValue());
} else if (clazz == Boolean.class) {
return clazz.cast("S".equalsIgnoreCase(value.getValue()));
} else if (clazz == Integer.class && value.getValue() != null) {
return clazz.cast(Integer.parseInt(value.getValue()));
}
} else if (defaultValue == null) {
if (clazz == Boolean.class) {
return clazz.cast(Boolean.FALSE);
} else if (clazz == Integer.class) {
return clazz.cast(0);
}
}
return defaultValue;
}
}

View File

@ -0,0 +1,58 @@
package it.integry.integrywmsnative.core.settings;
import it.integry.integrywmsnative.core.expansion.RunnableArgs;
import it.integry.integrywmsnative.core.model.StbGestSetup;
public class StbGestSetupReader<T> extends StbGestSetup {
private RunnableArgs<T> setter;
private T defaultValue;
private transient Class<T> clazz;
public StbGestSetupReader(Class<T> clazz) {
this.clazz = clazz;
}
public StbGestSetupReader<T> setGestName(String gestName) {
super.setGestName(gestName);
return this;
}
public StbGestSetupReader<T> setSection(String section) {
super.setSection(section);
return this;
}
public StbGestSetupReader<T> setKeySection(String keySection) {
super.setKeySection(keySection);
return this;
}
public RunnableArgs<T> getSetter() {
return setter;
}
public StbGestSetupReader<T> setSetter(RunnableArgs<T> setter) {
this.setter = setter;
return this;
}
public T getDefaultValue() {
return defaultValue;
}
public StbGestSetupReader<T> setDefaultValue(T defaultValue) {
this.defaultValue = defaultValue;
return this;
}
public Class<T> getClazz() {
return clazz;
}
// public Class<T> reflectClassType() {
// return ((Class<T>) ((ParameterizedType) getClass()
// .getGenericSuperclass()).getActualTypeArguments()[0]);
// }
}