From 618bdfb5efbf9229cfb9b2fe23fd32bc40c995d4 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 11 Dec 2021 12:42:33 +0100 Subject: [PATCH] Ancora problema a recuperare fasi (da indagare ancora...) --- GPW.CORE.Data/Controllers/GPWController.cs | 2 +- GPW.CORE.UI/Components/DayHoriz.razor | 2 +- GPW.CORE.UI/Components/DayHoriz.razor.cs | 6 +++++ GPW.CORE.UI/Components/RegAtt.razor | 28 +++++++++++++++++++--- GPW.CORE.UI/Data/GpwDataService.cs | 21 ++++++++++++++-- GPW.CORE.UI/Pages/Planner.razor | 4 ++-- GPW.CORE.UI/Pages/Planner.razor.cs | 9 +++++-- 7 files changed, 61 insertions(+), 11 deletions(-) diff --git a/GPW.CORE.Data/Controllers/GPWController.cs b/GPW.CORE.Data/Controllers/GPWController.cs index aaf6bd6..79bfb45 100644 --- a/GPW.CORE.Data/Controllers/GPWController.cs +++ b/GPW.CORE.Data/Controllers/GPWController.cs @@ -40,7 +40,7 @@ namespace GPW.CORE.Data.Controllers // recupero intero set dati timbrature e attività.... dbResult = localDbCtx .DbSetAnagFasi - .Include(p => p.ProgettoNav) + //.Include(p => p.ProgettoNav) .ToList(); } return dbResult; diff --git a/GPW.CORE.UI/Components/DayHoriz.razor b/GPW.CORE.UI/Components/DayHoriz.razor index 705ca22..330d2ae 100644 --- a/GPW.CORE.UI/Components/DayHoriz.razor +++ b/GPW.CORE.UI/Components/DayHoriz.razor @@ -35,7 +35,7 @@
@foreach (var item in ListRegAtt()) { - + }
} diff --git a/GPW.CORE.UI/Components/DayHoriz.razor.cs b/GPW.CORE.UI/Components/DayHoriz.razor.cs index f123dbb..fb95cc0 100644 --- a/GPW.CORE.UI/Components/DayHoriz.razor.cs +++ b/GPW.CORE.UI/Components/DayHoriz.razor.cs @@ -14,6 +14,7 @@ using Microsoft.JSInterop; using GPW.CORE.UI; using GPW.CORE.UI.Shared; using GPW.CORE.Data.DTO; +using GPW.CORE.Data.DbModels; namespace GPW.CORE.UI.Components { @@ -30,6 +31,10 @@ namespace GPW.CORE.UI.Components [Parameter] public bool IsTitle { get; set; } = false; + + [Parameter] + public List ListFasi { get; set; } = null!; + private bool noData { get => DayDTO == null || DayDTO.ListRA == null || DayDTO.ListRA.Count == 0; } private string TotLav @@ -78,6 +83,7 @@ namespace GPW.CORE.UI.Components } } + private List ListRegAtt() { // init diff --git a/GPW.CORE.UI/Components/RegAtt.razor b/GPW.CORE.UI/Components/RegAtt.razor index bab1b04..7e60593 100644 --- a/GPW.CORE.UI/Components/RegAtt.razor +++ b/GPW.CORE.UI/Components/RegAtt.razor @@ -1,4 +1,6 @@ @using CORE.Data.DbModels +@using UI.Data +@inject GpwDataService GDataServ
@@ -10,8 +12,7 @@
@($"{CurrData.OreTot:N2}h")
- @*
@CurrData.FasiNav.NomeFase
*@ -
@CurrData.IdxFase
+
@(headFase(CurrData.IdxFase))
@CurrData.Descrizione
} @@ -27,12 +28,17 @@ @code { [Parameter] - public RegAttivitaModel CurrData { get; set; } + public RegAttivitaModel CurrData { get; set; } = null!; [Parameter] public int Periodo { get; set; } = 1; + + [Parameter] + public List ListFasi { get; set; } = null!; + + private string widthPerc { get @@ -55,4 +61,20 @@ return answ; } } + + private string headFase(int idxFase) + { + string answ = $"F.{idxFase}"; + if (ListFasi != null) + { + var currFase = ListFasi + .Where(x => x.IdxFase == idxFase) + .FirstOrDefault(); + if (currFase != null) + { + answ = $"{currFase.NomeFase}"; + } + } + return answ; + } } diff --git a/GPW.CORE.UI/Data/GpwDataService.cs b/GPW.CORE.UI/Data/GpwDataService.cs index 57251f7..d006eec 100644 --- a/GPW.CORE.UI/Data/GpwDataService.cs +++ b/GPW.CORE.UI/Data/GpwDataService.cs @@ -5,6 +5,7 @@ using GPW.CORE.Data.DbModels; using NLog; using System.Diagnostics; using System.Text; +using System.Linq; namespace GPW.CORE.UI.Data { @@ -112,7 +113,7 @@ namespace GPW.CORE.UI.Data /// /// /// - public async Task> LastWeeks(int idxDipendente, DateTime dtRif,int numWeek) + public async Task> LastWeeks(int idxDipendente, DateTime dtRif, int numWeek) { List? dbResult = new List(); string currKey = $"{rKeyWeekStats}:{idxDipendente}:{dtRif.ToString("yyyy-MM-dd")}:{numWeek}"; @@ -131,7 +132,7 @@ namespace GPW.CORE.UI.Data { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - dbResult = dbController.WeekOverview(idxDipendente,dtRif,numWeek); + dbResult = dbController.WeekOverview(idxDipendente, dtRif, numWeek); rawData = JsonConvert.SerializeObject(dbResult, JSSettings); redisDataList = Encoding.UTF8.GetBytes(rawData); await distributedCache.SetAsync(currKey, redisDataList, cacheOpt(true)); @@ -222,6 +223,22 @@ namespace GPW.CORE.UI.Data return await Task.FromResult(dbResult); } + /// + /// Recupera info x una specifica FASE + /// + /// + public async Task AnagFasiSearch(int idxFase) + { + AnagFasiModel dbResult = new AnagFasiModel(); + var rawData = await AnagFasiAll(); + if (rawData != null) + { + dbResult = rawData.FirstOrDefault(x => x.IdxFase == idxFase); + } + + return await Task.FromResult(dbResult); + } + /// /// invalida tutta la cache in caso di update /// diff --git a/GPW.CORE.UI/Pages/Planner.razor b/GPW.CORE.UI/Pages/Planner.razor index 2de5e13..fbaa96e 100644 --- a/GPW.CORE.UI/Pages/Planner.razor +++ b/GPW.CORE.UI/Pages/Planner.razor @@ -50,12 +50,12 @@
- +
@foreach (var currItem in ListRecords) {
- +
}
diff --git a/GPW.CORE.UI/Pages/Planner.razor.cs b/GPW.CORE.UI/Pages/Planner.razor.cs index ffccbf8..324581c 100644 --- a/GPW.CORE.UI/Pages/Planner.razor.cs +++ b/GPW.CORE.UI/Pages/Planner.razor.cs @@ -15,6 +15,8 @@ using GPW.CORE.UI; using GPW.CORE.UI.Shared; using GPW.CORE.UI.Data; using GPW.CORE.Data; +using GPW.CORE.Data.DbModels; +using GPW.CORE.Data.DTO; namespace GPW.CORE.UI.Pages { @@ -26,9 +28,11 @@ namespace GPW.CORE.UI.Pages private string currRecord; - private List weekStatList; + private List weekStatList = new List(); - private List ListRecords; + private List ListRecords=new List(); + + private List ListFasi = new List(); #if false private WeekPlanModel currRecord = null; private List PlantsList; @@ -245,6 +249,7 @@ namespace GPW.CORE.UI.Pages { isLoading = true; ListRecords = await DataService.DailyDetails(1, currWeekSel.inizio, currWeekSel.fine); + //ListFasi = await DataService.AnagFasiAll(); #if false ListRecords = await DataService.WeekPlanGet();