diff --git a/GPW.CORE.Data/Controllers/GPWController.cs b/GPW.CORE.Data/Controllers/GPWController.cs index 54f834c..4b7e91a 100644 --- a/GPW.CORE.Data/Controllers/GPWController.cs +++ b/GPW.CORE.Data/Controllers/GPWController.cs @@ -1,5 +1,6 @@ using GPW.CORE.Data.DbModels; using GPW.CORE.Data.DTO; +using Microsoft.Data.SqlClient; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using NLog; @@ -241,6 +242,32 @@ namespace GPW.CORE.Data.Controllers Log.Info("Dispose di GPWController"); } + /// + /// Elenco pareto progetti ordinati da filtro + /// + /// + /// + /// + /// + /// + public List ParetoRegAtt(int idxDip, DateTime dataStart, DateTime dataEnd, int maxResult) + { + List dbResult = new List(); + using (GPWContext localDbCtx = new GPWContext(_configuration)) + { + var idxDipendente = new SqlParameter("@idxDipendente", idxDip); + var inizio = new SqlParameter("@inizio", dataStart); + var fine = new SqlParameter("@fine", dataEnd); + var maxRes = new SqlParameter("@maxRes", maxResult); + + dbResult = localDbCtx + .DbSetParetoRegAtt + .FromSqlRaw("EXEC stp_freqProjByDipPeriodo @idxDipendente, @inizio,@fine,@maxRes", idxDipendente, inizio, fine, maxRes) + .ToList(); + } + return dbResult; + } + public bool RegAttDelete(RegAttivitaModel currItem) { bool answ = false; @@ -349,6 +376,7 @@ namespace GPW.CORE.Data.Controllers } return answ; } + public bool TimbratureDelete(TimbratureModel currItem) { bool answ = false; @@ -378,7 +406,7 @@ namespace GPW.CORE.Data.Controllers { var currRec = localDbCtx .DbSetTimbrature - .FirstOrDefault(x => x.IdxDipendente == currItem.IdxDipendente && x.DataOra==currItem.DataOra); + .FirstOrDefault(x => x.IdxDipendente == currItem.IdxDipendente && x.DataOra == currItem.DataOra); if (currRec != null) { // aggiorno solo entrata/uscita diff --git a/GPW.CORE.Data/DbModels/ParetoRegAttModel.cs b/GPW.CORE.Data/DbModels/ParetoRegAttModel.cs new file mode 100644 index 0000000..a2899f0 --- /dev/null +++ b/GPW.CORE.Data/DbModels/ParetoRegAttModel.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace GPW.CORE.Data.DbModels +{ + // + // This is here so CodeMaid doesn't reorganize this document + // + public partial class ParetoRegAttModel + { + [Key] + public long RowNum { get; set; } = 0; + public string nomeComm { get; set; } = ""; + public int idxFaseComm { get; set; } = 0; + public int idxFase { get; set; } = 0; + public string nomeProj { get; set; } = ""; + public string nomeFase { get; set; } = ""; + public decimal freq { get; set; } = 0; + public decimal qty { get; set; } = 0; + public int tot{ get; set; } = 0; + } +} diff --git a/GPW.CORE.Data/GPWContext.cs b/GPW.CORE.Data/GPWContext.cs index 9371b73..38183c0 100644 --- a/GPW.CORE.Data/GPWContext.cs +++ b/GPW.CORE.Data/GPWContext.cs @@ -48,6 +48,9 @@ namespace GPW.CORE.Data public virtual DbSet DbSetAnagFasi { get; set; } = null!; public virtual DbSet DbSetAnagProgetti { get; set; } = null!; public virtual DbSet DbSetAnagGruppi { get; set; } = null!; + public virtual DbSet DbSetParetoRegAtt { get; set; } = null!; + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) diff --git a/GPW.CORE.UI/Components/DayHoriz.razor.cs b/GPW.CORE.UI/Components/DayHoriz.razor.cs index 5767242..b692699 100644 --- a/GPW.CORE.UI/Components/DayHoriz.razor.cs +++ b/GPW.CORE.UI/Components/DayHoriz.razor.cs @@ -90,24 +90,6 @@ namespace GPW.CORE.UI.Components get { TimeSpan tSpan = TimeSpan.FromHours(oreLav); - -#if false - TimeSpan tSpan = TimeSpan.Zero; - double answ = 0; - if (DayDTO != null && DayDTO.TimbrExpl != null && DayDTO.TimbrExpl.HLav != null) - { - answ = (double)DayDTO.TimbrExpl.HLav; - // aggiungo ultima timb fino ad adesso... - var lastIn = DayDTO.ListTimbr.Where(x => x.Entrata == true).OrderByDescending(x => x.DataOra).FirstOrDefault(); - if (lastIn != null) - { - DateTime adesso = DateTime.Now; - answ += adesso.Subtract(lastIn.DataOra).TotalHours; - } - tSpan = TimeSpan.FromHours(answ); - } -#endif - return $"{tSpan.Hours}h {tSpan.Minutes}'"; } } @@ -117,17 +99,6 @@ namespace GPW.CORE.UI.Components get { TimeSpan tSpan = TimeSpan.FromHours(oreComm); - -#if false - TimeSpan tSpan = TimeSpan.Zero; - double answ = 0; - if (DayDTO != null && DayDTO.ListRA != null) - { - answ = (double)DayDTO.ListRA.Sum(x => x.OreTot); - tSpan = TimeSpan.FromHours(answ); - } -#endif - return $"{tSpan.Hours}h {tSpan.Minutes}'"; } } diff --git a/GPW.CORE.UI/Components/ParetoRA.razor b/GPW.CORE.UI/Components/ParetoRA.razor new file mode 100644 index 0000000..2647bb5 --- /dev/null +++ b/GPW.CORE.UI/Components/ParetoRA.razor @@ -0,0 +1,107 @@ +@using GPW.CORE.Data.DbModels +@using CORE.Data.DbModels +@using UI.Data + +@inject IJSRuntime JSRuntime +@inject GpwDataService GDataServ +@inject MessageService AppMServ + + + Pareto attività registrate + +@if (ListRecords == null) +{ + +} +else +{ + + + + + # + Progetto + Commessa + Fase + h + + + + @foreach (var item in ListRecords) + { + + @item.RowNum.ToString("00") + @item.nomeProj + @item.nomeComm + @item.nomeFase + @item.qty.ToString("N2") + + } + + +} + + + giorni precedenti da considerare + + + # days + + + + + + Risultati Max + + + # res + + + + + + +@code { + + private int _maxSugg = 10; + private int _ggPrec = 30; + + private int maxSugg + { + get + { + return _maxSugg; + } + set + { + _maxSugg = value; + var pUpd = Task.Run(async () => await ReloadData()); + pUpd.Wait(); + } + } + private int ggPrec + { + get + { + return _ggPrec; + } + set + { + _ggPrec = value; + var pUpd = Task.Run(async () => await ReloadData()); + pUpd.Wait(); + } + } + + protected List? ListRecords { get; set; } = null; + + protected override async Task OnInitializedAsync() + { + await ReloadData(); + } + + protected async Task ReloadData() + { + ListRecords = await GDataServ.ParetoRegAtt(AppMServ.IdxDipendente, ggPrec, maxSugg); + } +} diff --git a/GPW.CORE.UI/Components/RegAttEditor.razor b/GPW.CORE.UI/Components/RegAttEditor.razor index 96e6892..e5c701e 100644 --- a/GPW.CORE.UI/Components/RegAttEditor.razor +++ b/GPW.CORE.UI/Components/RegAttEditor.razor @@ -69,23 +69,29 @@ Periodo - - - - - + + + + + + + + + + - - - - - - - - - + + + + + + + + + + Descrizione diff --git a/GPW.CORE.UI/Data/GpwDataService.cs b/GPW.CORE.UI/Data/GpwDataService.cs index ff560b9..7af3b27 100644 --- a/GPW.CORE.UI/Data/GpwDataService.cs +++ b/GPW.CORE.UI/Data/GpwDataService.cs @@ -48,6 +48,7 @@ namespace GPW.CORE.UI.Data protected const string rKeyGrpAll = "Cache:GrpAll"; protected const string rKeyProjAll = "Cache:ProjAll"; protected const string rKeyWeekStats = "Cache:WeekStats"; + protected const string rKeyParetoRegAtt = "Cache:WeekStats"; protected static string connStringBBM = ""; #endregion Protected Fields @@ -224,6 +225,48 @@ namespace GPW.CORE.UI.Data } return await Task.FromResult(dbResult); } + + /// + /// Elenco pareto progetti ordinati da filtro + /// + /// + /// + /// + /// + public async Task> ParetoRegAtt(int idxDip, int numDayPrev, int maxResult) + { + List? dbResult = new List(); + string currKey = $"{rKeyParetoRegAtt}:{idxDip}:{numDayPrev}:{maxResult}"; + + DateTime dataFine = DateTime.Today.AddDays(1); + DateTime dataInizio = dataFine.AddDays(-numDayPrev); + + string rawData; + var redisDataList = await distributedCache.GetAsync(currKey); + if (redisDataList != null) + { + rawData = Encoding.UTF8.GetString(redisDataList); + dbResult = JsonConvert.DeserializeObject>(rawData); + } + else + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + dbResult = dbController.ParetoRegAtt(idxDip, dataInizio, dataFine, maxResult); + rawData = JsonConvert.SerializeObject(dbResult, JSSettings); + redisDataList = Encoding.UTF8.GetBytes(rawData); + await distributedCache.SetAsync(currKey, redisDataList, cacheOpt(true)); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Trace($"Effettuata lettura da DB + caching per ParetoRegAtt: {ts.TotalMilliseconds} ms"); + } + if (dbResult == null) + { + dbResult = new List(); + } + return await Task.FromResult(dbResult); + } + /// /// Recupera l'elenco fasi (tutte) /// diff --git a/GPW.CORE.UI/GPW.CORE.UI.csproj b/GPW.CORE.UI/GPW.CORE.UI.csproj index d3e18e3..91f810e 100644 --- a/GPW.CORE.UI/GPW.CORE.UI.csproj +++ b/GPW.CORE.UI/GPW.CORE.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 3.0.2201.1115 + 3.0.2201.1119 enable enable diff --git a/GPW.CORE.UI/Pages/FastRec.razor b/GPW.CORE.UI/Pages/FastRec.razor index 3dba9ce..8ba06af 100644 --- a/GPW.CORE.UI/Pages/FastRec.razor +++ b/GPW.CORE.UI/Pages/FastRec.razor @@ -1,18 +1,61 @@ @page "/FastRec" -FastRec +@using GPW.CORE.UI +@using GPW.CORE.UI.Components + + + + FastRec + + + + + + + + Selezione progetto + + ricerca e selezione company + ricerca e selezione progetto + ricerca e selezione fase + VERIFICA progetto attivo / ore disponibili + + + + + + Chiusura attività precedenti + + + Chiudi + + + + Durata Prevista + + + Min + + + + + + Start + + + start recording progetto (con "cronometro") + stop recording --> registrazione dato arrotondato per eccesso (ai 5/15 minuti?) + + + + display SOLA giornata corrente (titolo + riga)... + + + + -Pagina inserimento rapido progetto - - ricerca e selezione company - ricerca e selezione progetto - ricerca e selezione fase - VERIFICA progetto attivo / ore disponibili - start recording progetto (con "cronometro" - stop recording --> registrazione dato arrotondato per eccesso (ai 5/15 minuti?) - @code { - + private int minDur = 15; } diff --git a/GPW.CORE.UI/Pages/Index.razor b/GPW.CORE.UI/Pages/Index.razor index 1ce4081..cd16abd 100644 --- a/GPW.CORE.UI/Pages/Index.razor +++ b/GPW.CORE.UI/Pages/Index.razor @@ -2,6 +2,19 @@ GPW -GPW - commesse -Gestione commesse GPW \ No newline at end of file + + + GPW - Log Commesse + + + + Egalware + + + + + Gestione commesse utente GPW, visualizzazione formato planner settimanale + + + \ No newline at end of file diff --git a/GPW.CORE.UI/Shared/LoginDisplay.razor b/GPW.CORE.UI/Shared/LoginDisplay.razor index 52c1983..e436e4d 100644 --- a/GPW.CORE.UI/Shared/LoginDisplay.razor +++ b/GPW.CORE.UI/Shared/LoginDisplay.razor @@ -25,8 +25,6 @@ userName = $"{user.Identity.Name}"; // cerco su DB var listaDip = await GDataServ.DipendentiGetAll(); - string[] domUser = userName.Split("\\"); - DipendentiModel? rigaDip = listaDip .Where(x => $"{x.Dominio}\\{x.Utente}".ToLower() == userName.ToLower()) .FirstOrDefault(); diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 360601b..7368c90 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GPW - Gestione Presenze Web - Versione: 3.0.2201.1115 + Versione: 3.0.2201.1119 Note di rilascio: diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 5db112c..c432321 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -3.0.2201.1115 +3.0.2201.1119 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index bb279b8..b645831 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 3.0.2201.1115 + 3.0.2201.1119 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false