diff --git a/MP-TAB3/Components/InsManual.razor b/MP-TAB3/Components/InsManual.razor index e4658a9b..c9edf904 100644 --- a/MP-TAB3/Components/InsManual.razor +++ b/MP-TAB3/Components/InsManual.razor @@ -1,17 +1,119 @@ -

InsManual

+
+
+ +
+ @if (showDetail) + { + if (EditRecord == null) + { +
+
+
+ @($"{NumGray}%") +
+
+ @($"{NumGreen}%") +
+
+ @($"{NumYellow}%") +
+
+ @($"{NumGray}%") +
+
+
+ } + else + { +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
-

da completare con

+
+ +
+
+ +
+
+
+ } +
+ + + + + + + + + + + + + + + + @foreach (var item in ListDay) + { + + + + + + + + + + + + } + +
MaccComm.Art.OraPezzi #T.CicloMinuti
@item.IdxMacchina@item.KeyRichiesta@item.CodArticolo@($"{item.InizioStato:HH:mm}")@item.PzBuoni@($"{item.TCiclo:f3}")@($"{item.MinProd:f2}")
+
+
+ +
+ } +
+ diff --git a/MP-TAB3/Components/InsManual.razor.cs b/MP-TAB3/Components/InsManual.razor.cs index 7e2bda4a..5a0f4089 100644 --- a/MP-TAB3/Components/InsManual.razor.cs +++ b/MP-TAB3/Components/InsManual.razor.cs @@ -1,5 +1,8 @@ using Microsoft.AspNetCore.Components; +using MP.Core.DTO; using MP.Data.DbModels; +using MP.Data.Services; +using static MP_TAB3.Components.ProdAdvDispl; namespace MP_TAB3.Components { @@ -25,6 +28,8 @@ namespace MP_TAB3.Components /// [Parameter] public EventCallback> E_Updated { get; set; } + [Inject] + protected TabDataService TabDServ { get; set; } = null!; #endregion Public Properties @@ -33,6 +38,125 @@ namespace MP_TAB3.Components private bool confProdActive { get; set; } = false; private MappaStatoExpl? currRecMSE { get; set; } = null; + private DateTime dtCurr { get; set; } = DateTime.Today; + + private void DisplayDate(DateTime dtSel) + { + dtCurr = dtSel; + showDetail = true; + // filtra dati odierni x tab editabile... + if (ListPeriod != null && ListPeriod.Count > 0) + { + ListDay = ListPeriod.Where(x => x.InizioStato.Date == dtSel).ToList(); + } +#if false + MService.targetDate = dtSel; + MService.targetDateMancTimb = dtCurr; + // se sono in calendario --> mostro dettagli... + if (currMode == CalendarModeEnum.modoControllo.showCalendar) + { + setModeDetail(); + } + updateDetail(); + MService.ReportDateChange(); +#endif + } + + private void CloseDet() + { + showDetail = false; + } + + private async Task ReloadMonth(DateTime dtSel) + { + dtCurr = dtSel; +#if false + MService.targetDate = dtSel; + showDetail = false; + await Task.Delay(1); + MService.ReportDateChange(); +#endif + await Task.Delay(1); + } + private Dictionary DateCFF = new Dictionary(); + private Dictionary DateCheck = new Dictionary(); + private bool showDetail { get; set; } = false; + + protected override async Task OnParametersSetAsync() + { + //return base.OnParametersSetAsync(); + ReloadData(); + await Task.Delay(1); + } + + private void ReloadData() + { + // rileggo dati periodo... + ListDTO = new List(); + if (RecMSE != null) + { + DateTime MeseStart = new DateTime(dtCurr.Year, dtCurr.Month, 1); + DateTime MeseEnd = MeseStart.AddMonths(1); + ListPeriod = TabDServ.InsManFilt(RecMSE.IdxMacchina, MeseStart, MeseEnd); + ListDTO = TabDServ.InsManDayDto(ListPeriod); + DateCheck = new Dictionary(); + DateCFF = new Dictionary(); + string cssOkComm = "bg-success text-light rounded-circle p-2"; + string cssOkLav = "bg-warning text-light rounded-circle p-2"; + string cssToday = "bg-info text-dark rounded-circle p-2"; + string cssFest = "bg-danger text-warning rounded-pill2 px-0 opacity-50"; + string cssChius = "bg-warning text-dark rounded-pill2 px-0 opacity-50"; + string cssFerie = "bg-success text-light px-0 opacity-50"; + if (ListDTO != null) + { + string currCss = ""; + foreach (var item in ListDTO) + { + currCss = item.MinProdTot == 0 ? "" : cssOkLav; + if (item.DataRif == DateTime.Today) + { + currCss = cssToday; + } + else if (item.RatioImport == 1) + { + currCss = cssOkComm; + } + DateCheck.Add(item.DataRif, currCss); + } + } + } + } + + protected void DoEdit(InsManualiModel? selRec) + { + EditRecord = selRec; + } + + protected async Task DoSave() + { + // solo se ho record... + if (EditRecord != null) + { + // sistemo i dati... + EditRecord.MinProd = EditRecord.TCiclo * EditRecord.PzBuoni; + EditRecord.FineStato = EditRecord.InizioStato.AddMinutes((double)EditRecord.MinProd); + // lancio salvataggio sul DB + await TabDServ.InsManUpsert(EditRecord); + EditRecord = null; + // rileggo i dati... + ReloadData(); + } + } + + private double NumGreen = 25; + private double NumYellow = 5; + private double NumGray = 30; + + private List? ListDTO { get; set; } = new List(); + private List? ListPeriod { get; set; } = new List(); + private List? ListDay { get; set; } = new List(); + private InsManualiModel? EditRecord = null; + #endregion Private Properties } } \ No newline at end of file diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index bbe3c472..1e965623 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2503.3120 + 6.16.2504.112 enable MP_TAB3 @@ -36,8 +36,8 @@ - - + + diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index 763bd923..c55f2cff 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2503.3120

+

Versione: 6.16.2504.112


Note di rilascio:
  • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index 4e014262..2db9470f 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2503.3120 +6.16.2504.112 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index d1295926..54716764 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2503.3120 + 6.16.2504.112 https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html false diff --git a/MP.Core/DTO/InsManDayDto.cs b/MP.Core/DTO/InsManDayDto.cs new file mode 100644 index 00000000..33bf1360 --- /dev/null +++ b/MP.Core/DTO/InsManDayDto.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.Core.DTO +{ + public class InsManDayDto + { + public int IdxInsMan { get; set; } + + [MaxLength(50)] + public string IdxMacchina { get; set; } = "NA"; + public DateTime DataRif { get; set; } = DateTime.Today; + + public int PzBuoniTot { get; set; } = 0; + + /// + /// Minuti prodotti (da TC e pz prod + /// + public decimal MinProdTot { get; set; } = 0; + + /// + /// Rapporto record importati/totali, 0 = niente, 1 = tutto importato + /// + public double RatioImport { get; set; } = 0; + } +} diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs index 47ff53b7..909f3985 100644 --- a/MP.Data/Controllers/MpTabController.cs +++ b/MP.Data/Controllers/MpTabController.cs @@ -10,6 +10,8 @@ using System.Data; using System.Linq; using System.Threading.Tasks; using static MP.Core.Objects.Enums; +using System.Drawing.Drawing2D; +using ZXing; namespace MP.Data.Controllers { @@ -644,6 +646,68 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Elenco insert manuali dato + /// + /// + /// + /// + /// + public List InsManFilt(string IdxMacc, DateTime dtStart, DateTime dtEnd) + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbSetInsManuali + .Where(x => x.IdxMacchina == IdxMacc && x.InizioStato >= dtStart && x.InizioStato <= dtEnd) + .AsNoTracking() + .ToList(); + } + return dbResult; + } + + /// + /// Esegue salvataggio record + svuotamento cache + /// + /// + public bool InsManUpsert(InsManualiModel currRecord) + { + bool fatto = false; + using (var dbCtx = new MoonProContext(_configuration)) + { + var actRec = dbCtx + .DbSetInsManuali + .Where(x => currRecord.IdxInsMan > 0 && x.IdxInsMan == currRecord.IdxInsMan) + .FirstOrDefault(); + // se ci fosse aggiorno... + if (actRec == null) + { + dbCtx + .DbSetInsManuali + .Add(currRecord); + } + else + { + actRec.CodArticolo = currRecord.CodArticolo; + actRec.FineStato = currRecord.FineStato; + actRec.IdxMacchina = currRecord.IdxMacchina; + actRec.IdxTipoEv = currRecord.IdxTipoEv; + actRec.Imported = currRecord.Imported; + actRec.InizioStato = currRecord.InizioStato; + actRec.KeyRichiesta = currRecord.KeyRichiesta; + actRec.MatrOpr = currRecord.MatrOpr; + actRec.MinProd = currRecord.MinProd; + actRec.PzBuoni = currRecord.PzBuoni; + actRec.TCiclo = currRecord.TCiclo; + dbCtx.Entry(actRec).State = EntityState.Modified; + } + var res = dbCtx.SaveChanges(); + fatto = res != 0; + } + return fatto; + } + /// /// Elenco PODL macchina /// diff --git a/MP.Data/DbModels/InsManualiModel.cs b/MP.Data/DbModels/InsManualiModel.cs new file mode 100644 index 00000000..46f49a05 --- /dev/null +++ b/MP.Data/DbModels/InsManualiModel.cs @@ -0,0 +1,65 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.Data.DbModels +{ + [Table("InsManuali")] + public partial class InsManualiModel + { + #region Public Properties + + [Key] + public int IdxInsMan { get; set; } + + [MaxLength(50)] + public string IdxMacchina { get; set; } = "NA"; + public int IdxTipoEv { get; set; } = 0; + + [MaxLength(50)] + public string KeyRichiesta { get; set; } = ""; + [MaxLength(50)] + public string CodArticolo { get; set; } = ""; + + public DateTime InizioStato { get; set; } = DateTime.Now; + public DateTime? FineStato { get; set; } = null; + + + public int MatrOpr { get; set; } = 0; + public int PzBuoni { get; set; } = 0; + + /// + /// Tempo Ciclo std + /// + public decimal TCiclo { get; set; } = 0; + + /// + /// Minuti prodotti (da TC e pz prod + /// + public decimal MinProd { get; set; } = 0; + + /// + /// DataOra conferma import e trasformazione dati (come Eventi, DDB, ODL...) + /// + public DateTime? Imported { get; set; } = null; + + + /// + /// Navigazione oggetto Machine + /// + [ForeignKey("IdxMacchina")] + public virtual Macchine MachineNav { get; set; } = null!; + + /// + /// Navigazione oggetto Articolo + /// + [ForeignKey("CodArticolo")] + public virtual AnagArticoli ArticoloNav { get; set; } = null!; + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/DbModels/VMSFDModel.cs b/MP.Data/DbModels/VMSFDModel.cs index 3c3e7b9a..698e5a75 100644 --- a/MP.Data/DbModels/VMSFDModel.cs +++ b/MP.Data/DbModels/VMSFDModel.cs @@ -16,7 +16,7 @@ namespace MP.Data.DbModels public bool SimplePallet { get; set; } = true; public bool InsEnabled { get; set; } = true; public bool SLogEnabled { get; set; } = false; - public bool IsManual { get; set; } = false; + public int IsManual { get; set; } = 0; public int IdxFamigliaIngresso { get; set; } public int Multi { get; set; } public int BitFilt { get; set; } diff --git a/MP.Data/MoonProContext.cs b/MP.Data/MoonProContext.cs index 0700ffe1..50b380fe 100644 --- a/MP.Data/MoonProContext.cs +++ b/MP.Data/MoonProContext.cs @@ -91,12 +91,14 @@ namespace MP.Data public virtual DbSet DbSetStTemplateRows { get; set; } public virtual DbSet DbSetCommenti { get; set; } - public virtual DbSet DbSetFNQ { get; set; } + public virtual DbSet DbSetFNQ { get; set; } public virtual DbSet DbSetVSEB { get; set; } public virtual DbSet DbSetVSODL { get; set; } public virtual DbSet DbSetVSCS { get; set; } + public virtual DbSet DbSetInsManuali { get; set; } + #endregion Public Properties #region Private Methods diff --git a/MP.Data/Services/SharedMemService.cs b/MP.Data/Services/SharedMemService.cs index b1f97a21..58f4a3a7 100644 --- a/MP.Data/Services/SharedMemService.cs +++ b/MP.Data/Services/SharedMemService.cs @@ -229,7 +229,7 @@ namespace MP.Data.Services ListMSFD = newList ?? new List(); // salvo dizionario MULTI DictMacchMulti = ListMSFD.ToDictionary(x => x.IdxMacchina, x => x.Multi); - DictMacchManual = ListMSFD.ToDictionary(x => x.IdxMacchina, x => x.IsManual); + DictMacchManual = ListMSFD.ToDictionary(x => x.IdxMacchina, x => x.IsManual == 1); Log.Info("SharedMemService | SetMsfd executed!"); } diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs index afc3705e..9f6c614c 100644 --- a/MP.Data/Services/TabDataService.cs +++ b/MP.Data/Services/TabDataService.cs @@ -18,6 +18,8 @@ using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; +using MongoDB.Driver.Core.Operations; +using MP.Data.Controllers; namespace MP.Data.Services { @@ -79,16 +81,16 @@ namespace MP.Data.Services #region Public Events - /// - /// Evento richiesta rilettura dati pagina (x refresh pagine aperte) - /// - public event EventHandler ReloadRequest = delegate { }; - /// /// Evento report dati invalidati x rilettura /// public event EventHandler DataInvalidated = delegate { }; + /// + /// Evento richiesta rilettura dati pagina (x refresh pagine aperte) + /// + public event EventHandler ReloadRequest = delegate { }; + #endregion Public Events #region Public Properties @@ -890,6 +892,85 @@ namespace MP.Data.Services return answ; } + /// + /// Elenco DTO resoconto InsManuali macchina da records dettaglio + /// + /// Dettagli + /// + public List InsManDayDto(List listDetail) + { + List? result = new List(); + if (listDetail.Count > 0) + { + string idxMacchina = listDetail.FirstOrDefault().IdxMacchina; + // proietto... + result = listDetail + .GroupBy(x => x.InizioStato.Date) + .Select(group => new InsManDayDto + { + DataRif = group.Key, + IdxMacchina = idxMacchina, + MinProdTot = group.Sum(item => item.MinProd), + PzBuoniTot = group.Sum(item => item.PzBuoni), + RatioImport = group.Count(item => item.Imported != null) / group.Count() + }) + .ToList(); + } + return result; + } + + /// + /// Elenco insManuali macchina + /// + /// Macchina + /// Inizio periodo + /// Fine periodo + /// + public List InsManFilt(string idxMacchina, DateTime dtFrom, DateTime dtTo) + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:InsMan:{idxMacchina}:{dtFrom:yyyyMMdd-HHmmss}:{dtTo::yyyyMMdd-HHmmss}"; + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = dbTabController.InsManFilt(idxMacchina, dtFrom, dtTo); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, FastCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"InsManFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + /// + /// Esegue salvataggio record + svuotamento cache + /// + /// + public async Task InsManUpsert(InsManualiModel currRecord) + { + bool fatto = false; + // salvo + fatto = dbTabController.InsManUpsert(currRecord); + // svuoto cache + RedisValue pattern = $"{redisBaseKey}:InsMan"; + await ExecFlushRedisPattern(pattern); + return fatto; + } + /// /// Recupero info IOB x TAB (da info registrate IOB-WIN--> MP-IO) /// @@ -1062,7 +1143,7 @@ namespace MP.Data.Services // cerco in redis... string currKey = $"{redisBaseKey}:MachByMatOp:{MatrOpr}"; #if false - RedisValue rawData = await redisDb.StringGetAsync(currKey); + RedisValue rawData = await redisDb.StringGetAsync(currKey); #endif RedisValue rawData = redisDb.StringGet(currKey); //if (!string.IsNullOrEmpty($"{rawData}")) @@ -1078,7 +1159,7 @@ namespace MP.Data.Services rawData = JsonConvert.SerializeObject(result); redisDb.StringSet(currKey, rawData, UltraLongCache); #if false - await redisDb.StringSetAsync(currKey, rawData, LongCache); + await redisDb.StringSetAsync(currKey, rawData, LongCache); #endif } if (result == null) @@ -1087,7 +1168,7 @@ namespace MP.Data.Services } sw.Stop(); #if false - Log.Debug($"MacchineByMatrOper | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + Log.Debug($"MacchineByMatrOper | {source} | {sw.Elapsed.TotalMilliseconds}ms"); #endif string callName = $"MacchineByMatrOper.{source}"; @@ -1320,20 +1401,6 @@ namespace MP.Data.Services return result; } - /// - /// Invio notifica rilettura (con parametro) - /// - /// - public void NotifyReloadRequest(string message) - { - if (ReloadRequest != null) - { - // messaggio - ReloadEventArgs rea = new ReloadEventArgs(message); - ReloadRequest.Invoke(this, rea); - } - } - /// /// Invio notifica dati invalidati x impianto /// @@ -1349,9 +1416,18 @@ namespace MP.Data.Services } /// - /// gestore collezione statistiche esecuzione x logging + /// Invio notifica rilettura (con parametro) /// - private ExecStatsCollector esCollect = new ExecStatsCollector(); + /// + public void NotifyReloadRequest(string message) + { + if (ReloadRequest != null) + { + // messaggio + ReloadEventArgs rea = new ReloadEventArgs(message); + ReloadRequest.Invoke(this, rea); + } + } /// /// ODL da key @@ -1371,7 +1447,7 @@ namespace MP.Data.Services string currKey = $"{redisBaseKey}:ODL:{idxOdl}:{onlyUnused}"; RedisValue rawData = redisDb.StringGet(currKey); #if false - RedisValue rawData = await redisDb.StringGetAsync(currKey); + RedisValue rawData = await redisDb.StringGetAsync(currKey); #endif if (rawData.HasValue) { @@ -1382,14 +1458,14 @@ namespace MP.Data.Services { var listRes = dbTabController.OdlByIdx(idxOdl, onlyUnused); #if false - var listRes = await Task.FromResult(dbTabController.OdlByIdx(idxOdl, onlyUnused)); + var listRes = await Task.FromResult(dbTabController.OdlByIdx(idxOdl, onlyUnused)); #endif result = listRes.FirstOrDefault(); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); redisDb.StringSet(currKey, rawData, FastCache); #if false - await redisDb.StringSetAsync(currKey, rawData, FastCache); + await redisDb.StringSetAsync(currKey, rawData, FastCache); #endif } if (result == null) @@ -1398,7 +1474,7 @@ namespace MP.Data.Services } sw.Stop(); #if false - Log.Debug($"OdlByIdx | {idxOdl} | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + Log.Debug($"OdlByIdx | {idxOdl} | {source} | {sw.Elapsed.TotalMilliseconds}ms"); #endif string callName = $"OdlByIdx.{source}"; int numRec = esCollect.RecordCall(callName, sw.Elapsed.TotalMilliseconds); @@ -1453,7 +1529,7 @@ namespace MP.Data.Services string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:CURR"; RedisValue rawData = redisDb.StringGet(currKey); #if false - RedisValue rawData = await redisDb.StringGetAsync(currKey); + RedisValue rawData = await redisDb.StringGetAsync(currKey); #endif if (rawData.HasValue && !forceDb) { @@ -1464,14 +1540,14 @@ namespace MP.Data.Services { var listRes = dbTabController.OdlCurrByMacc(idxMacchina); #if false - var listRes = await Task.FromResult(dbTabController.OdlCurrByMacc(idxMacchina)); + var listRes = await Task.FromResult(dbTabController.OdlCurrByMacc(idxMacchina)); #endif result = listRes.FirstOrDefault(); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); redisDb.StringSet(currKey, rawData, FastCache); #if false - await redisDb.StringSetAsync(currKey, rawData, FastCache); + await redisDb.StringSetAsync(currKey, rawData, FastCache); #endif } if (result == null) @@ -1480,7 +1556,7 @@ namespace MP.Data.Services } sw.Stop(); #if false - Log.Debug($"OdlCurrByMacc | {source} | {idxMacchina} | {sw.Elapsed.TotalMilliseconds}ms"); + Log.Debug($"OdlCurrByMacc | {source} | {idxMacchina} | {sw.Elapsed.TotalMilliseconds}ms"); #endif string callName = $"OdlCurrByMacc.{source}"; int numRec = esCollect.RecordCall(callName, sw.Elapsed.TotalMilliseconds); @@ -1986,11 +2062,6 @@ namespace MP.Data.Services return answ; } - /// - /// Generatore random classe - /// - private Random rnd = new Random(); - /// /// Recupero PODL da chiave /// @@ -2017,7 +2088,7 @@ namespace MP.Data.Services else { rawData = await redisDb.StringGetAsync(currKey); - } + } #endif if (rawData.HasValue) { @@ -2049,7 +2120,7 @@ namespace MP.Data.Services else { await redisDb.StringSetAsync(currKey, rawData, FastCache); - } + } #endif } if (result == null) @@ -2058,7 +2129,7 @@ namespace MP.Data.Services } sw.Stop(); #if false - Log.Debug($"PODL_getByKey | {idxPODL} | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + Log.Debug($"PODL_getByKey | {idxPODL} | {source} | {sw.Elapsed.TotalMilliseconds}ms"); #endif string callName = $"PODL_getByKey.{source}"; int numRec = esCollect.RecordCall(callName, sw.Elapsed.TotalMilliseconds); @@ -2188,7 +2259,7 @@ namespace MP.Data.Services string currKey = $"{redisBaseKey}:RecContr:{idxMacchina}:{idxODL}:{dataFrom:yyyyyMMdd-HHmm}:{dataFrom:yyyyyMMdd-HHmm}:{showMulti}"; RedisValue rawData = redisDb.StringGet(currKey); #if false - RedisValue rawData = await redisDb.StringGetAsync(currKey); + RedisValue rawData = await redisDb.StringGetAsync(currKey); #endif if (rawData.HasValue) { @@ -2202,7 +2273,7 @@ namespace MP.Data.Services rawData = JsonConvert.SerializeObject(result); redisDb.StringSet(currKey, rawData, UltraLongCache); #if false - await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); + await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); #endif } if (result == null) @@ -2211,7 +2282,7 @@ namespace MP.Data.Services } sw.Stop(); #if false - Log.Debug($"RegControlliFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + Log.Debug($"RegControlliFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms"); #endif string callName = $"RegControlliFilt.{source}"; int numRec = esCollect.RecordCall(callName, sw.Elapsed.TotalMilliseconds); @@ -2266,7 +2337,7 @@ namespace MP.Data.Services string currKey = $"{redisBaseKey}:RecContr:{idxMacchina}:LAST"; RedisValue rawData = redisDb.StringGet(currKey); #if false - RedisValue rawData = await redisDb.StringGetAsync(currKey); + RedisValue rawData = await redisDb.StringGetAsync(currKey); #endif if (rawData.HasValue) { @@ -2279,7 +2350,7 @@ namespace MP.Data.Services // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); #if false - await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); + await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); #endif redisDb.StringSet(currKey, rawData, UltraLongCache); } @@ -2289,7 +2360,7 @@ namespace MP.Data.Services } sw.Stop(); #if false - Log.Debug($"RegControlliLast | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + Log.Debug($"RegControlliLast | {source} | {sw.Elapsed.TotalMilliseconds}ms"); #endif string callName = $"RegControlliLast.{source}"; int numRec = esCollect.RecordCall(callName, sw.Elapsed.TotalMilliseconds); @@ -3079,7 +3150,7 @@ namespace MP.Data.Services string currKey = $"{redisBaseKey}:StatoProd:{idxMacchina}:{dtReq:HHmm}"; RedisValue rawData = redisDb.StringGet(currKey); #if false - RedisValue rawData = await redisDb.StringGetAsync(currKey); + RedisValue rawData = await redisDb.StringGetAsync(currKey); #endif //if (!string.IsNullOrEmpty($"{rawData}")) if (rawData.HasValue) @@ -3094,7 +3165,7 @@ namespace MP.Data.Services rawData = JsonConvert.SerializeObject(result); redisDb.StringSet(currKey, rawData, UltraFastCache); #if false - await redisDb.StringSetAsync(currKey, rawData, UltraFastCache); + await redisDb.StringSetAsync(currKey, rawData, UltraFastCache); #endif } if (result == null) @@ -3103,7 +3174,7 @@ namespace MP.Data.Services } sw.Stop(); #if false - Log.Debug($"StatoProdMacchina | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + Log.Debug($"StatoProdMacchina | {source} | {sw.Elapsed.TotalMilliseconds}ms"); #endif string callName = $"StatoProdMacchina.{source}"; int numRec = esCollect.RecordCall(callName, sw.Elapsed.TotalMilliseconds); @@ -3114,11 +3185,6 @@ namespace MP.Data.Services return result; } - /// - /// numero minimo di record per cui iniziare fase di log - /// - private int nRecLog = 10; - /// /// Turno macchina /// @@ -3504,15 +3570,38 @@ namespace MP.Data.Services private static Logger Log = LogManager.GetCurrentClassLogger(); private string CodModulo = ""; + private string CodModuloParam = ""; + private string ConnStr = ""; + private Dictionary connStrParams = new Dictionary(); + private string DataBase = ""; + private string DataSource = ""; + + /// + /// gestore collezione statistiche esecuzione x logging + /// + private ExecStatsCollector esCollect = new ExecStatsCollector(); + private string MpIoNS = ""; + + /// + /// numero minimo di record per cui iniziare fase di log + /// + private int nRecLog = 10; + private string redisBaseKey = "MP:TAB:Cache"; + private string redisUserDataKey = "MP:TAB:Users"; + /// + /// Generatore random classe + /// + private Random rnd = new Random(); + #endregion Private Fields #region Private Properties