diff --git a/MP.Data/Controllers/MpInveController.cs b/MP.Data/Controllers/MpInveController.cs index 1ea1b5fb..db9d4176 100644 --- a/MP.Data/Controllers/MpInveController.cs +++ b/MP.Data/Controllers/MpInveController.cs @@ -89,6 +89,25 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Elenco operatori + /// + /// + /// + public List ElencoOperatori() + { + List dbResult = new List(); + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + dbResult = dbCtx + .DbOperatori + .AsNoTracking() + .OrderByDescending(x => x.MatrOpr) + .ToList(); + } + return dbResult; + } + #endregion Public Methods #region Private Fields diff --git a/MP.Data/DatabaseModels/AnagOperatoriModel.cs b/MP.Data/DatabaseModels/AnagOperatoriModel.cs new file mode 100644 index 00000000..2db51371 --- /dev/null +++ b/MP.Data/DatabaseModels/AnagOperatoriModel.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MP.Data.DatabaseModels +{ + [Table("AnagraficaOperatori")] + public class AnagOperatoriModel + { + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int MatrOpr { get; set; } + public string Cognome { get; set; } = ""; + public string Nome { get; set; } = ""; + public bool isAdmin { get; set; } = false; + public int authKey { get; set; } + public int CodOprExt { get; set; } + } +} diff --git a/MP.Data/MoonPro_InveContext.cs b/MP.Data/MoonPro_InveContext.cs index c8844cb6..357f1010 100644 --- a/MP.Data/MoonPro_InveContext.cs +++ b/MP.Data/MoonPro_InveContext.cs @@ -47,6 +47,7 @@ namespace MP.Data public virtual DbSet DbInveSess { get; set; } public virtual DbSet DbScanData { get; set; } + public virtual DbSet DbOperatori { get; set; } #endregion Public Properties diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs new file mode 100644 index 00000000..ec8ffa65 --- /dev/null +++ b/MP.INVE/Data/MiDataService.cs @@ -0,0 +1,149 @@ +using MP.Data; +using MP.Data.Conf; +using MP.Data.DatabaseModels; +using MP.Data.DTO; +using Newtonsoft.Json; +using NLog; +using StackExchange.Redis; +using System.Diagnostics; + +namespace MP.INVE.Data +{ + public class MiDataService : IDisposable + { + #region Public Constructors + + public MiDataService(IConfiguration configuration, ILogger logger) + { + _logger = logger; + _logger.LogInformation("Starting MpDataService INIT"); + _configuration = configuration; + + // setup compoenti REDIS + redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis")); + redisConnAdmin = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("RedisAdmin")); + redisDb = redisConn.GetDatabase(); + + // leggo cache lungo periodo + int.TryParse(_configuration.GetValue("ServerConf:redisLongTimeCache"), out redisLongTimeCache); + + _logger.LogInformation("Redis INIT"); + + // conf DB + string connStr = _configuration.GetConnectionString("Mp.Data"); + if (string.IsNullOrEmpty(connStr)) + { + _logger.LogError("DbController: ConnString empty!"); + } + else + { + dbController = new MP.Data.Controllers.MpInveController(configuration); + _logger.LogInformation("DbController OK"); + } + } + + #endregion Public Constructors + + #region Public Properties + + public static MP.Data.Controllers.MpInveController dbController { get; set; } = null!; + + /// + /// Dizionario dei tag configurati per IOB + /// + public Dictionary> currTagConf { get; set; } = new Dictionary>(); + + #endregion Public Properties + + + + #region Protected Fields + + protected Random rand = new Random(); + + #endregion Protected Fields + + #region Protected Methods + + /// + /// Restituisce un timeout dai minuti richiesti + tempo random 1..60 sec + /// + /// + /// + protected TimeSpan getRandTOut(int stdMinutes) + { + double rndValue = (double)stdMinutes + (double)rand.Next(1, 60) / 60; + return TimeSpan.FromMinutes(rndValue); + } + + #endregion Protected Methods + + #region Private Fields + + private const string redisArtByDossier = redisBaseAddr + "SPEC:Cache:ArtByDossier"; + + private const string redisArtList = redisBaseAddr + "SPEC:Cache:ArtList"; + + private const string redisBaseAddr = "MP:"; + + private const string redisConfKey = redisBaseAddr + "SPEC:Cache:Config"; + + private const string redisDossByMac = redisBaseAddr + "SPEC:Cache:DossByMac"; + + private const string redisFluxByMac = redisBaseAddr + "SPEC:Cache:FluxByMac"; + + private const string redisFluxLogFilt = redisBaseAddr + "SPEC:Cache:FluxLogFilt"; + + private const string redisMacByFlux = redisBaseAddr + "SPEC:Cache:MacByFlux"; + + private const string redisMacList = redisBaseAddr + "SPEC:Cache:MacList"; + + private const string redisOdlCurrByMac = redisBaseAddr + "SPEC:Cache:OdlByMac"; + + private const string redisPOdlList = redisBaseAddr + "SPEC:Cache:POdlList"; + + private const string redisPOdlByPOdl = redisBaseAddr + "SPEC:Cache:POdlByPOdl"; + + private const string redisPOdlByOdl = redisBaseAddr + "SPEC:Cache:POdlByOdl"; + + private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom"; + + private const string redisTipoArt = redisBaseAddr + "SPEC:Cache:TipoArt"; + + private const string redisVocabolario = redisBaseAddr + "SPEC:Cache:Vocabolario"; + + private static IConfiguration _configuration = null!; + + private static ILogger _logger = null!; + + private static Logger Log = LogManager.GetCurrentClassLogger(); + + /// + /// Oggetto vocabolario x uso continuo traduzione + /// + private List ObjVocabolario = new List(); + + /// + /// Oggetto per connessione a REDIS + /// + private ConnectionMultiplexer redisConn = null!; + + /// + /// Oggetto per connessione a REDIS modalità admin (ex flux dati) + /// + private ConnectionMultiplexer redisConnAdmin = null!; + + /// + /// Oggetto DB redis da impiegare x chiamate R/W + /// + private IDatabase redisDb = null!; + + private int redisLongTimeCache = 5; + + #endregion Private Fields + + #region Private Methods + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index 47b449c5..e54368a5 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2211.1410 + 6.16.2211.1412 diff --git a/MP.INVE/Pages/Starter.razor b/MP.INVE/Pages/Starter.razor new file mode 100644 index 00000000..75eba1b5 --- /dev/null +++ b/MP.INVE/Pages/Starter.razor @@ -0,0 +1,9 @@ +@page "/Starter" + +

Starter

+ + + +@code { + +} diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index 1b79a6c1..7cdbda82 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

Versione: 6.16.2211.1410

+

Versione: 6.16.2211.1412


Note di rilascio:
  • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index deb405fb..b7a3fd27 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2211.1410 +6.16.2211.1412 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index 81e5a367..13e2158d 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2211.1410 + 6.16.2211.1412 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false