Ancora problema a recuperare fasi (da indagare ancora...)

This commit is contained in:
Samuele Locatelli
2021-12-11 12:42:33 +01:00
parent 232e783844
commit 618bdfb5ef
7 changed files with 61 additions and 11 deletions
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -35,7 +35,7 @@
<div class="d-flex justify-content-between text-center">
@foreach (var item in ListRegAtt())
{
<RegAtt CurrData="item" Periodo="periodo"></RegAtt>
<RegAtt CurrData="item" Periodo="periodo" ListFasi="@ListFasi"></RegAtt>
}
</div>
}
+6
View File
@@ -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<AnagFasiModel> 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<CORE.Data.DbModels.RegAttivitaModel> ListRegAtt()
{
// init
+25 -3
View File
@@ -1,4 +1,6 @@
@using CORE.Data.DbModels
@using UI.Data
@inject GpwDataService GDataServ
<div class="px-1 py-0 small flex-fill @blockCss" style="width: @widthPerc">
<div class="d-flex">
@@ -10,8 +12,7 @@
<div><b>@($"{CurrData.OreTot:N2}h")</b></div>
</div>
<div class="px-1 text-left textTrim">
@*<div><b>@CurrData.FasiNav.NomeFase</b> </div>*@
<div><b>@CurrData.IdxFase</b> </div>
<div><b>@(headFase(CurrData.IdxFase))</b></div>
<div class="small" title="@CurrData.Descrizione">@CurrData.Descrizione</div>
</div>
}
@@ -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<AnagFasiModel> 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;
}
}
+19 -2
View File
@@ -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
/// <param name="dtRif"></param>
/// <param name="numWeek"></param>
/// <returns></returns>
public async Task<List<CORE.Data.DTO.WeekStatDTO>> LastWeeks(int idxDipendente, DateTime dtRif,int numWeek)
public async Task<List<CORE.Data.DTO.WeekStatDTO>> LastWeeks(int idxDipendente, DateTime dtRif, int numWeek)
{
List<CORE.Data.DTO.WeekStatDTO>? dbResult = new List<CORE.Data.DTO.WeekStatDTO>();
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);
}
/// <summary>
/// Recupera info x una specifica FASE
/// </summary>
/// <returns></returns>
public async Task<AnagFasiModel?> 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);
}
/// <summary>
/// invalida tutta la cache in caso di update
/// </summary>
+2 -2
View File
@@ -50,12 +50,12 @@
<div class="row">
<div class="col-12">
<DayHoriz IsTitle="true" StartHour="@startHour" EndHour="@endHour"></DayHoriz>
<DayHoriz IsTitle="true" StartHour="@startHour" EndHour="@endHour" ListFasi="@ListFasi"></DayHoriz>
</div>
@foreach (var currItem in ListRecords)
{
<div class="col-12">
<DayHoriz DayDTO="@currItem" StartHour="@startHour" EndHour="@endHour"></DayHoriz>
<DayHoriz DayDTO="@currItem" StartHour="@startHour" EndHour="@endHour" ListFasi="@ListFasi"></DayHoriz>
</div>
}
</div>
+7 -2
View File
@@ -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<CORE.Data.DTO.WeekStatDTO> weekStatList;
private List<WeekStatDTO> weekStatList = new List<WeekStatDTO>();
private List<CORE.Data.DTO.DailyDataDTO> ListRecords;
private List<DailyDataDTO> ListRecords=new List<DailyDataDTO>();
private List<AnagFasiModel> ListFasi = new List<AnagFasiModel>();
#if false
private WeekPlanModel currRecord = null;
private List<PlantDTO> 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();