Aggiunta preliminare pareto progetti in FastREc
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco pareto progetti ordinati da filtro
|
||||
/// </summary>
|
||||
/// <param name="idxDip"></param>
|
||||
/// <param name="dataStart"></param>
|
||||
/// <param name="dataEnd"></param>
|
||||
/// <param name="maxResult"></param>
|
||||
/// <returns></returns>
|
||||
public List<ParetoRegAttModel> ParetoRegAtt(int idxDip, DateTime dataStart, DateTime dataEnd, int maxResult)
|
||||
{
|
||||
List<ParetoRegAttModel> dbResult = new List<ParetoRegAttModel>();
|
||||
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
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace GPW.CORE.Data.DbModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,9 @@ namespace GPW.CORE.Data
|
||||
public virtual DbSet<AnagFasiModel> DbSetAnagFasi { get; set; } = null!;
|
||||
public virtual DbSet<AnagProgettiModel> DbSetAnagProgetti { get; set; } = null!;
|
||||
public virtual DbSet<AnagGruppiModel> DbSetAnagGruppi { get; set; } = null!;
|
||||
public virtual DbSet<ParetoRegAttModel> DbSetParetoRegAtt { get; set; } = null!;
|
||||
|
||||
|
||||
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
|
||||
@@ -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}'";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
<div>
|
||||
Pareto attività registrate
|
||||
</div>
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
<table class="table table-sm table-striped table-responsive-md">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Progetto</th>
|
||||
<th>Commessa</th>
|
||||
<th>Fase</th>
|
||||
<th>h</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr>
|
||||
<td>@item.RowNum.ToString("00")</td>
|
||||
<td>@item.nomeProj</td>
|
||||
<td>@item.nomeComm</td>
|
||||
<td>@item.nomeFase</td>
|
||||
<td>@item.qty.ToString("N2")</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<label class="small">giorni precedenti da considerare</label>
|
||||
<div class="input-group input-group-sm mb-2">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"># days</span>
|
||||
</div>
|
||||
<input type="number" class="form-control text-right" placeholder="Giorni Precedenti" @bind-value="@ggPrec">
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<label class="small">Risultati Max</label>
|
||||
<div class="input-group input-group-sm mb-2">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"># res</span>
|
||||
</div>
|
||||
<input type="number" class="form-control text-right" placeholder="Max Suggerimenti" @bind-value="@maxSugg">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@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<ParetoRegAttModel>? ListRecords { get; set; } = null;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
ListRecords = await GDataServ.ParetoRegAtt(AppMServ.IdxDipendente, ggPrec, maxSugg);
|
||||
}
|
||||
}
|
||||
@@ -69,23 +69,29 @@
|
||||
</div>
|
||||
<div class="col-6 px-0">
|
||||
<label class="small">Periodo</label>
|
||||
<div class="input-group input-group-sm2">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<i class="fas fa-play"></i>
|
||||
</span>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<i class="fas fa-play"></i>
|
||||
</span>
|
||||
</div>
|
||||
<input type="datetime-local" @bind="@currRecord.Inizio" style="width: 12rem;"></input>
|
||||
</div>
|
||||
</div>
|
||||
<input type="datetime-local" @bind="@currRecord.Inizio" style="width: 12rem;"></input>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<i class="fas fa-stop"></i>
|
||||
</span>
|
||||
</div>
|
||||
<input type="datetime-local" @bind="@currRecord.Fine" style="width: 12rem;"></input>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary" type="button"><i class="fas fa-angle-down"></i></button>
|
||||
<div class="px-0">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<i class="fas fa-stop"></i>
|
||||
</span>
|
||||
</div>
|
||||
<input type="datetime-local" @bind="@currRecord.Fine" style="width: 12rem;"></input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="small">Descrizione</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco pareto progetti ordinati da filtro
|
||||
/// </summary>
|
||||
/// <param name="idxDip"></param>
|
||||
/// <param name="numDayPrev"></param>
|
||||
/// <param name="maxResult"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ParetoRegAttModel>> ParetoRegAtt(int idxDip, int numDayPrev, int maxResult)
|
||||
{
|
||||
List<ParetoRegAttModel>? dbResult = new List<ParetoRegAttModel>();
|
||||
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<List<ParetoRegAttModel>>(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<ParetoRegAttModel>();
|
||||
}
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera l'elenco fasi (tutte)
|
||||
/// </summary>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Version>3.0.2201.1115</Version>
|
||||
<Version>3.0.2201.1119</Version>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,18 +1,61 @@
|
||||
@page "/FastRec"
|
||||
|
||||
<h3>FastRec</h3>
|
||||
@using GPW.CORE.UI
|
||||
@using GPW.CORE.UI.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary py-1">
|
||||
<h3>FastRec</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<ParetoRA></ParetoRA>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
Selezione progetto
|
||||
<ul>
|
||||
<li>ricerca e selezione company</li>
|
||||
<li>ricerca e selezione progetto</li>
|
||||
<li>ricerca e selezione fase</li>
|
||||
<li><b>VERIFICA</b> progetto attivo / ore disponibili</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<label class="small">Chiusura attività precedenti</label>
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="switchClosePrec">
|
||||
<label class="custom-control-label" for="switchClosePrec">Chiudi</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-2 text-right">
|
||||
<label class="small">Durata Prevista</label>
|
||||
<div class="input-group mb-2">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">Min</span>
|
||||
</div>
|
||||
<input type="text" class="form-control text-right" placeholder="minuti" @bind-value="@minDur">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-lg btn-block btn-success" style="font-size:4em;"><i class="fas fa-play"></i> Start</button>
|
||||
|
||||
<ul>
|
||||
<li>start recording progetto (con "cronometro")</li>
|
||||
<li>stop recording --> registrazione dato arrotondato per eccesso (ai 5/15 minuti?)</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
display SOLA giornata corrente (titolo + riga)...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Pagina inserimento rapido progetto
|
||||
<ul>
|
||||
<li>ricerca e selezione company</li>
|
||||
<li>ricerca e selezione progetto</li>
|
||||
<li>ricerca e selezione fase</li>
|
||||
<li><b>VERIFICA</b> progetto attivo / ore disponibili</li>
|
||||
<li>start recording progetto (con "cronometro"</li>
|
||||
<li>stop recording --> registrazione dato arrotondato per eccesso (ai 5/15 minuti?)</li>
|
||||
</ul>
|
||||
|
||||
@code {
|
||||
|
||||
private int minDur = 15;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,19 @@
|
||||
|
||||
<PageTitle>GPW</PageTitle>
|
||||
|
||||
<h1>GPW - commesse</h1>
|
||||
|
||||
Gestione commesse GPW
|
||||
<div class="row mt-3">
|
||||
<div class="col-6">
|
||||
<h1>GPW - Log Commesse</h1>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<span class="badge badge-pill badge-dark" style="font-size:3em;">
|
||||
<img class="img-fluid" width="64" src="images/LogoBlu.svg" /> <b>Egalware</b>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-12 text-center mt-5">
|
||||
<div class="alert alert-secondary">
|
||||
Gestione commesse utente GPW, visualizzazione formato planner settimanale
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>GPW - Gestione Presenze Web</i>
|
||||
<h4>Versione: 3.0.2201.1115</h4>
|
||||
<h4>Versione: 3.0.2201.1119</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.0.2201.1115
|
||||
3.0.2201.1119
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>3.0.2201.1115</version>
|
||||
<version>3.0.2201.1119</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user