Update ancora gest timbrature

This commit is contained in:
Samuele Locatelli
2024-09-13 15:39:31 +02:00
parent 6bcea21059
commit fa845a823f
16 changed files with 771 additions and 48 deletions
@@ -227,6 +227,7 @@ namespace GPW.CORE.ADM.Components.Compo
private async Task ReloadData()
{
currPage = 1;
isLoading = true;
ListRecords = null;
try
@@ -0,0 +1,242 @@
<div class="card shadow">
<div class="card-header">
<div class="d-flex justify-content-between">
<div class="px-0">
<h4>Elenco Timbrature</h4>
</div>
<div class="px-0">
<div class="d-flex align-middle">
<div class="px-1 py-2">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" @bind=@ShowInatt @bind:after=ReloadData>
<label class="form-check-label">Mostra Inattivi</label>
</div>
</div>
<div class="px-1 py-1">
<select @bind="@IdxDipSel" class="form-select form-select-sm" @bind:after=ReloadData>
<option value="0">--- Selezionare ---</option>
@foreach (var item in ListDipendenti)
{
<option value="@item.IdxDipendente">@($"{item.Cognome} {item.Nome}")</option>
}
</select>
</div>
</div>
</div>
<div class="px-0">
<div class="d-flex">
<div class="px-1">
<PeriodoSel CurrPeriodo="@CurrPeriodo" E_PeriodoSel="@SavePeriodo"></PeriodoSel>
</div>
<div class="px-1 py-2">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" @bind=@ShowWE @bind:after=ReloadData>
<label class="form-check-label">Mostra Week-End</label>
</div>
</div>
</div>
</div>
<div class="px-0">
<button class="btn btn-sm btn-success" title="Ricalcola">&sum; (h)</button>
<button class="btn btn-sm btn-info" title="Export Ore">Exp.Ore</button>
<button class="btn btn-sm btn-primary" title="Export Commesse">Exp.Comm.</button>
</div>
</div>
</div>
<div class="card-body p-1 small">
@if (ListRecords == null || isLoading)
{
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-info">Nessun record trovato</div>
}
else
{
<div class="row">
<div class="col-8">
<table class="table table-striped table-sm text-start">
<thead>
<tr class="">
<th>
<button class="btn btn-info btn-sm" @onclick="() => ForceReload(true)"><i class="fa-solid fa-rotate"></i></button>
</th>
<th>Dipendente <Sorter ParamName="Dipendente" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
<th>Data <Sorter ParamName="DataLav" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
<th class="text-center">IN</th>
<th class="text-center">OUT</th>
<th class="text-center">IN</th>
<th class="text-center">OUT</th>
<th class="text-center">IN</th>
<th class="text-center">OUT</th>
<th class="text-center">IN</th>
<th class="text-center">OUT</th>
<th class="text-end">H Lav</th>
<th class="text-end">H Giu</th>
<th class="text-end">T/C19</th>
<th class="text-end">Tag</th>
<th class="text-end">Chk</th>
<th class="text-end">H Com</th>
</tr>
</thead>
<tbody>
@foreach (var item in ListRecords)
{
<tr class="align-middle lh-1 @CheckSel(item)">
<td>
<button class="btn btn-info btn-sm" @onclick="() => DoSelect(item)"><i class="fa-solid fa-search"></i></button>
</td>
<td class="fs-5">
@item.CognomeNome
</td>
<td>
<div>
@($"{item.DataLav:yyyy.MM.dd}")
</div>
<div>
@($"{item.DataLav:dddd}")
</div>
</td>
<td class="text-center text-success">
@if (item.entrata_1 != null)
{
@($"{item.entrata_1:HH:mm}")
}
</td>
<td class="text-center text-primary">
@if (item.uscita_1 != null)
{
@($"{item.uscita_1:HH:mm}")
}
</td>
<td class="text-center text-success">
@if (item.entrata_2 != null)
{
@($"{item.entrata_2:HH:mm}")
}
</td>
<td class="text-center text-primary">
@if (item.uscita_2 != null)
{
@($"{item.uscita_2:HH:mm}")
}
</td>
<td class="text-center text-success">
@if (item.entrata_3 != null)
{
@($"{item.entrata_3:HH:mm}")
}
</td>
<td class="text-center text-primary">
@if (item.uscita_3 != null)
{
@($"{item.uscita_3:HH:mm}")
}
</td>
<td class="text-center text-success">
@if (item.entrata_4 != null)
{
@($"{item.entrata_4:HH:mm}")
}
</td>
<td class="text-center text-primary">
@if (item.uscita_4 != null)
{
@($"{item.uscita_4:HH:mm}")
}
</td>
<td class="text-end fs-4 fw-bold">
@($"{item.h_lav:N2}")
</td>
<td class="text-end">
@if (item.h_giust > 0)
{
@($"{item.h_giust:N2}")
}
</td>
<td class="text-end">
@if (item.TempRil < 34)
{
<i class="fa-solid fa-temperature-low text-secondary"></i>
}
else if (item.TempRil < 37)
{
<i class="fa-solid fa-temperature-low text-success"></i>
}
else if (item.TempRil < (decimal)37.5)
{
<i class="fa-solid fa-temperature-low text-warning"></i>
}
else
{
<i class="fa-solid fa-temperature-low text-danger"></i>
}
</td>
<td class="text-end">
@if (!item.TagIsActive)
{
<span class="striked text-secondary">@item.CodTag</span>
}
else
{
@item.CodTag
}
</td>
<td class="text-end fw-bold">
@if (!item.isOkTim)
{
<span class="text-danger" tooltip="Errore Entrata/Uscita: non corrispondono.">T</span>
}
@if (!item.isOkApp)
{
<span class="text-danger" tooltip="Errore: timbrature non approvate.">A</span>
}
@if (item.isOkLav == 0)
{
<span class="text-danger" tooltip="Errore: manca copertura ore ordinarie.">O</span>
}
@if (!string.IsNullOrEmpty(item.chkFunCod))
{
<span tooltip="@item.chkFunRes">@item.minMpp</span>
}
@if (item.isOk != 0)
{
<span class="text-success" tooltip="Tutto OK.">Ok</span>
}
</td>
<td class="text-end fs-4 fw-bold">
@if (item.okLAvCom != 0)
{
<span class="text-dark">@($"{item.h_com:N2}")</span>
}
else
{
<span class="text-warning">@($"{item.h_com:N2}")</span>
}
</td>
</tr>
}
</tbody>
</table>
</div>
<div class="col-4">
@if (SelRecord != null)
{
<TimbList ListTimb="@ListTimbDay" EnableDelete="true" EnableEdit="true" EC_ReqUpdate="ForceUpdate" EC_ReqDelete="DoDelete"></TimbList>
<h4>Giustificativi</h4>
<h4>Record Commesse</h4>
}
</div>
</div>
}
</div>
<div class="card-footer">
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading" PageSizeList="@PageSizeListSpec"></EgwCoreLib.Razor.DataPager>
</div>
</div>
@@ -0,0 +1,254 @@
using EgwCoreLib.Razor;
using GPW.CORE.Data.DbModels;
using GPW.CORE.Data.Services;
using GPW.CORE.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using NLog;
using EgwCoreLib.Utils;
using System.Diagnostics;
namespace GPW.CORE.ADM.Components.Compo
{
public partial class ReviewTimbMan : IDisposable
{
#region Public Methods
public void Dispose()
{
AppMServ.EA_SearchUpdated -= AppMServ_EA_SearchUpdated;
}
#endregion Public Methods
#region Protected Fields
protected List<int> PageSizeListSpec = new List<int>() { 5, 10, 15, 20, 25, 50 };
#endregion Protected Fields
#region Protected Properties
[Inject]
protected MessageService AppMServ { get; set; } = null!;
[Inject]
protected GpwDataService GDataServ { get; set; } = null!;
protected int IdxDipSel { get; set; } = 0;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected string CheckSel(TeRaExplModel? SelItem)
{
string answ = "";
if (SelRecord != null)
{
answ = SelRecord.UID == SelItem.UID ? "table-info" : "";
}
return answ;
}
protected async void DoDelete(TimbratureModel selItem)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record?"))
return;
await GDataServ.TimbratureDelete(selItem);
SelRecord = null;
await ReloadData();
await InvokeAsync(StateHasChanged);
}
protected async Task DoSelect(TeRaExplModel selItem)
{
SelRecord = selItem;
// seleziono timbrature...
ListTimbDay = await GDataServ.TimbratureDay(selItem.DataLav, selItem.IdxDipendente);
await Task.Delay(1);
//await InvokeAsync(StateHasChanged);
}
protected async Task ForceReload(bool force)
{
SelRecord = null;
await ReloadData();
}
protected async Task ForceUpdate(TimbratureModel UpdRec)
{
await GDataServ.TimbratureUpdate(UpdRec);
await ReloadData();
}
protected override async Task OnInitializedAsync()
{
CurrPeriodo.Fine = DateTime.Today.AddDays(1);
CurrSearch = "";
AppMServ.SearchVal = "";
AppMServ.EA_SearchUpdated += AppMServ_EA_SearchUpdated;
numRecord = await AppMServ.NumRowGridGet(gridKey);
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
}
private List<TimbratureModel>? ListTimbDay { get; set; } = null;
protected async Task SetNumRec(int newNum)
{
numRecord = newNum;
currPage = 1;
await AppMServ.NumRowGridSet(gridKey, newNum);
await InvokeAsync(ReloadData);
}
protected async Task SetPage(int newNum)
{
currPage = newNum;
await InvokeAsync(ReloadData);
}
protected async Task SortRequested(Sorter.SortCallBack e)
{
sortField = e.ParamName;
sortAsc = e.IsAscending;
await ReloadData();
}
#endregion Protected Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private string gridKey = "RevTimbMan";
private bool sortAsc = true;
private string sortField = "";
#endregion Private Fields
#region Private Properties
private int currPage { get; set; } = 1;
private DtUtils.Periodo CurrPeriodo { get; set; } = new DtUtils.Periodo(DtUtils.PeriodSet.ThisMonth);
private string CurrSearch { get; set; } = "";
private bool filtDip { get; set; } = false;
private bool isLoading { get; set; } = false;
private List<DipendentiModel> ListDipendenti { get; set; } = new List<DipendentiModel>();
private List<TeRaExplModel>? ListRecords { get; set; } = null;
private int MaxErrMin { get; set; } = -30;
private int MaxErrPlus { get; set; } = 30;
private int numRecord { get; set; } = 10;
private List<TeRaExplModel>? SearchRecords { get; set; } = null;
private TeRaExplModel? SelRecord { get; set; } = null;
private bool ShowInatt { get; set; } = false;
private bool ShowWE { get; set; } = true;
private int totalCount { get; set; } = 0;
#endregion Private Properties
#region Private Methods
private async void AppMServ_EA_SearchUpdated()
{
CurrSearch = AppMServ.SearchVal;
await ReloadData();
await InvokeAsync(StateHasChanged);
}
private async Task ReloadData()
{
currPage = 1;
isLoading = true;
ListRecords = null;
var rawList = await GDataServ.DipendentiGetAll();
if (ShowInatt)
{
ListDipendenti = rawList;
}
else
{
ListDipendenti = rawList.Where(x => (x.Attivo ?? false)).ToList();
}
try
{
SearchRecords = await GDataServ.TeRaExplGetFilt(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine, ShowInatt, ShowWE, MaxErrMin, MaxErrPlus);
// verifico filtro per IdxDip
if (IdxDipSel > 0)
{
SearchRecords = SearchRecords.Where(x => x.IdxDipendente == IdxDipSel).ToList();
}
}
catch (Exception ex)
{
Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}");
}
totalCount = SearchRecords.Count;
SortTable();
isLoading = false;
}
private async Task SavePeriodo(DtUtils.Periodo newPeiodo)
{
CurrPeriodo = newPeiodo;
await ReloadData();
}
private void SortTable()
{
if (SearchRecords != null)
{
// se ho ordinamento riordino...
if (!string.IsNullOrEmpty(sortField))
{
switch (sortField)
{
case "Dipendente":
if (sortAsc)
{
SearchRecords = SearchRecords.OrderBy(x => x.CognomeNome).ToList();
}
else
{
SearchRecords = SearchRecords.OrderByDescending(x => x.CognomeNome).ToList();
}
break;
case "DataLav":
if (sortAsc)
{
SearchRecords = SearchRecords.OrderBy(x => x.DataLav).ToList();
}
else
{
SearchRecords = SearchRecords.OrderByDescending(x => x.DataLav).ToList();
}
break;
default:
break;
}
}
// filtro x display
ListRecords = SearchRecords
.Skip(numRecord * (currPage - 1))
.Take(numRecord)
.ToList();
}
else
{
ListRecords = new List<TeRaExplModel>();
}
}
#endregion Private Methods
}
}
@@ -0,0 +1,67 @@
<h3>Timbrature</h3>
<div class="card shadow">
<div class="card-header">
<h5>Timbrature</h5>
</div>
<div class="card-body">
@if (ListTimb == null || ListTimb.Count == 0)
{
<div class="alert alert info p3">Nessun record trovato</div>
}
else
{
<table class="table table-sm table-striped table-responsive-md">
<thead>
<tr>
<th><i class="far fa-clock"></i></th>
<th class="text-center" title="Entrata"><i class="fas fa-sign-in-alt"></i></th>
<th class="text-center">Scambio</th>
<th class="text-center" title="Uscita"><i class="fas fa-sign-out-alt"></i></th>
<th class="text-end"></th>
</tr>
</thead>
<tbody>
@foreach (var item in ListTimb)
{
<tr>
<td class="small">@item.DataOra.ToString("dd/MM - HH:mm")</td>
<td title="Entrata" class="text-center">
@if (@item.Entrata == true)
{
<i class="fas fa-times fs-5"></i>
}
</td>
<td class="text-center">
@if (EnableEdit)
{
<button class="btn btn-sm btn-primary" title="Scambio IN/OUT" @onclick="() => ScambioInOut(item)"><i class="fas fa-exchange-alt"></i></button>
}
else
{
<button class="btn btn-sm btn-secondary bg-opacity-50" title="Scambio IN/OUT"><i class="fas fa-exchange-alt"></i></button>
}
</td>
<td title="Uscita" class="text-center">
@if (@item.Entrata == false)
{
<i class="fas fa-times fs-5"></i>
}
</td>
<td class="text-end">
@if (EnableDelete)
{
<button class="btn btn-sm btn-danger" @onclick="() => Delete(item)" title="Elimina Timbratura"><i class="fas fa-trash-alt"></i></button>
}
else
{
<button class="btn btn-sm btn-secondary" disabled><i class="fas fa-trash-alt"></i></button>
}
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>
@@ -0,0 +1,82 @@
using GPW.CORE.Data.DbModels;
using Microsoft.AspNetCore.Components;
namespace GPW.CORE.ADM.Components.Compo
{
public partial class TimbList
{
#region Public Properties
[Parameter]
public bool EnableDelete { get; set; } = false;
[Parameter]
public bool EnableEdit { get; set; } = false;
[Parameter]
public List<TimbratureModel>? ListTimb
{
get => listTimb;
set => listTimb = value;
}
[Parameter]
public EventCallback<TimbratureModel> EC_ReqDelete { get; set; }
[Parameter]
public EventCallback<TimbratureModel> EC_ReqUpdate { get; set; }
#endregion Public Properties
#region Protected Properties
protected List<TimbratureModel>? listTimb
{
get
{
return _ListTimb;
}
set
{
if (value != null)
{
_ListTimb = value.OrderByDescending(x => x.DataOra).ToList();
}
else
{
_ListTimb = null;
}
}
}
#endregion Protected Properties
#region Protected Methods
protected async void Delete(TimbratureModel currRecord)
{
await EC_ReqDelete.InvokeAsync(currRecord);
}
protected override async Task OnParametersSetAsync()
{
await InvokeAsync(StateHasChanged);
}
protected async void ScambioInOut(TimbratureModel currRecord)
{
currRecord.Entrata = !currRecord.Entrata;
await EC_ReqUpdate.InvokeAsync(currRecord);
}
#endregion Protected Methods
#region Private Properties
private List<TimbratureModel>? _ListTimb { get; set; } = new List<TimbratureModel>();
#endregion Private Properties
}
}
@@ -1,7 +1,16 @@
@page "/ReviewTimbrature"
@inject MessageService AppMServ
@inject AppAuthService AuthServ
<WIP></WIP>
<ReviewTimbMan></ReviewTimbMan>
@code {
protected override void OnInitialized()
{
// imposto pagina e info testata
AppMServ.ShowSearch = true;
AppMServ.PageName = AuthServ.Traduci("reviewTimb");
AppMServ.PageIcon = AuthServ.Traduci("reviewTimbExpl");
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>4.1.2409.1309</Version>
<Version>4.1.2409.1315</Version>
</PropertyGroup>
<ItemGroup>
@@ -7,7 +7,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAw3dMMgC4FUywyOTV2xvCRgAAAAACAAAAAAADZgAAwAAAABAAAADrbAogtj/xpZqylbgs9Hb3AAAAAASAAACgAAAAEAAAAFm1lcdH7oj+NFy4QgZ7q18YAAAAROPsyRR12dhPTKfMEQ5yNCAZJ5K7C4pvFAAAAEFBVTwItjyYP2BlOTsuK1g9myQ8</EncryptedPassword>
<History>True|2024-09-12T14:07:39.0226825Z||;True|2024-09-12T10:58:30.2473031+02:00||;True|2024-09-12T10:03:37.9121520+02:00||;True|2024-09-11T19:18:09.6865317+02:00||;True|2024-09-11T17:21:29.6285775+02:00||;True|2024-09-11T17:06:36.9651346+02:00||;True|2024-09-10T17:58:48.6965236+02:00||;True|2024-09-10T15:56:39.2931971+02:00||;True|2024-09-10T12:27:20.6683309+02:00||;True|2024-09-07T10:37:21.9427027+02:00||;True|2024-09-06T19:01:32.2132061+02:00||;True|2024-09-06T18:20:28.3994458+02:00||;True|2024-09-05T10:43:51.3246848+02:00||;True|2024-09-05T10:26:17.6114175+02:00||;True|2024-09-05T09:25:03.5122942+02:00||;True|2024-09-04T18:21:49.9717603+02:00||;True|2023-04-11T10:12:15.0154900+02:00||;False|2023-04-11T10:11:47.1977827+02:00||;True|2023-04-11T09:18:55.4555319+02:00||;True|2023-04-11T09:16:05.8827677+02:00||;True|2022-06-06T12:56:03.5790550+02:00||;False|2022-06-06T12:54:19.4739620+02:00||;False|2022-06-06T12:53:46.4246554+02:00||;</History>
<History>True|2024-09-13T07:22:22.8253732Z||;True|2024-09-12T16:07:39.0226825+02:00||;True|2024-09-12T10:58:30.2473031+02:00||;True|2024-09-12T10:03:37.9121520+02:00||;True|2024-09-11T19:18:09.6865317+02:00||;True|2024-09-11T17:21:29.6285775+02:00||;True|2024-09-11T17:06:36.9651346+02:00||;True|2024-09-10T17:58:48.6965236+02:00||;True|2024-09-10T15:56:39.2931971+02:00||;True|2024-09-10T12:27:20.6683309+02:00||;True|2024-09-07T10:37:21.9427027+02:00||;True|2024-09-06T19:01:32.2132061+02:00||;True|2024-09-06T18:20:28.3994458+02:00||;True|2024-09-05T10:43:51.3246848+02:00||;True|2024-09-05T10:26:17.6114175+02:00||;True|2024-09-05T09:25:03.5122942+02:00||;True|2024-09-04T18:21:49.9717603+02:00||;True|2023-04-11T10:12:15.0154900+02:00||;False|2023-04-11T10:11:47.1977827+02:00||;True|2023-04-11T09:18:55.4555319+02:00||;True|2023-04-11T09:16:05.8827677+02:00||;True|2022-06-06T12:56:03.5790550+02:00||;False|2022-06-06T12:54:19.4739620+02:00||;False|2022-06-06T12:53:46.4246554+02:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
+38 -38
View File
@@ -1797,14 +1797,14 @@ namespace GPW.CORE.Data.Controllers
List<ParetoRegAttModel> dbResult = new List<ParetoRegAttModel>();
using (GPWContext localDbCtx = new GPWContext(_configuration))
{
var idxDipendente = new SqlParameter("@idxDipendente", idxDip);
var idxDipendente = new SqlParameter("@IdxDip", 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)
.FromSqlRaw("EXEC stp_freqProjByDipPeriodo @IdxDip, @inizio,@fine,@maxRes", idxDipendente, inizio, fine, maxRes)
.ToList();
}
return dbResult;
@@ -2406,38 +2406,6 @@ namespace GPW.CORE.Data.Controllers
return answ;
}
/// <summary>
/// Recupera record anomalie dipendenti
/// </summary>
/// <param name="idxDipendente">singolo idx oppure 0 = tutti</param>
/// <param name="dataFrom"></param>
/// <param name="dataTo"></param>
/// <param name="inatt"></param>
/// <param name="showWE"></param>
/// <param name="maxErrMin"></param>
/// <param name="maxErrPlus"></param>
/// <returns></returns>
public List<TeRaExplModel> TeRaExplGetAll(int idxDipendente, DateTime dataFrom, DateTime dataTo, bool inatt, bool showWE, int maxErrMin, int maxErrPlus)
{
List<TeRaExplModel> dbResult = new List<TeRaExplModel>();
using (GPWContext localDbCtx = new GPWContext(_configuration))
{
SqlParameter parIdxDip = new SqlParameter("@idxDipendente", idxDipendente);
SqlParameter parDataFrom = new SqlParameter("@dataFrom", dataFrom);
SqlParameter parDataTo = new SqlParameter("@dataTo", dataTo);
SqlParameter parInatt = new SqlParameter("@parInatt", inatt);
SqlParameter parShowWE = new SqlParameter("@showWE", showWE);
SqlParameter parMaxErrMin = new SqlParameter("@maxErrMin", maxErrMin);
SqlParameter parMaxErrPlus = new SqlParameter("@maxErrPlus", maxErrPlus);
dbResult = localDbCtx
.DbSetTeRaExpl
.FromSqlRaw("EXEC stp_TE_RA_ByUserDate @idxDipendente,@dataFrom,@dataTo,@parInatt,@showWE,@maxErrMin,@maxErrPlus", parIdxDip, parDataFrom, parDataTo, parInatt, parShowWE, parMaxErrMin, parMaxErrPlus)
.ToList();
}
return dbResult;
}
/// <summary>
/// Recupera record anomalie dipendenti
/// </summary>
@@ -2453,7 +2421,7 @@ namespace GPW.CORE.Data.Controllers
List<TimbratureExplModel> dbResult = new List<TimbratureExplModel>();
using (GPWContext localDbCtx = new GPWContext(_configuration))
{
SqlParameter parIdxDip = new SqlParameter("@idxDipendente", idxDipendente);
SqlParameter parIdxDip = new SqlParameter("@IdxDip", idxDipendente);
SqlParameter parInizio = new SqlParameter("@inizio", inizio);
SqlParameter parFine = new SqlParameter("@fine", fine);
SqlParameter parNotOkApp = new SqlParameter("@notOkApp", notOkApp);
@@ -2462,7 +2430,7 @@ namespace GPW.CORE.Data.Controllers
dbResult = localDbCtx
.DbSetTimbratureExpl
.FromSqlRaw("EXEC stp_timbratureExpl_getByAnomalia @idxDipendente,@inizio,@fine,@notOkApp,@notOkTim,@notOkLav", parIdxDip, parInizio, parFine, parNotOkApp, parNotOkTim, parNotOkLav)
.FromSqlRaw("EXEC stp_timbratureExpl_getByAnomalia @IdxDip,@inizio,@fine,@notOkApp,@notOkTim,@notOkLav", parIdxDip, parInizio, parFine, parNotOkApp, parNotOkTim, parNotOkLav)
.ToList();
}
return dbResult;
@@ -2480,13 +2448,45 @@ namespace GPW.CORE.Data.Controllers
List<TimbratureExplModel> dbResult = new List<TimbratureExplModel>();
using (GPWContext localDbCtx = new GPWContext(_configuration))
{
SqlParameter parIdxDip = new SqlParameter("@idxDipendente", idxDipendente);
SqlParameter parIdxDip = new SqlParameter("@IdxDip", idxDipendente);
SqlParameter parInizio = new SqlParameter("@inizio", inizio);
SqlParameter parFine = new SqlParameter("@fine", fine);
dbResult = localDbCtx
.DbSetTimbratureExpl
.FromSqlRaw("EXEC stp_timbratureExpl_getContinuato @idxDipendente,@inizio,@fine", parIdxDip, parInizio, parFine)
.FromSqlRaw("EXEC stp_timbratureExpl_getContinuato @IdxDip,@inizio,@fine", parIdxDip, parInizio, parFine)
.ToList();
}
return dbResult;
}
/// <summary>
/// Recupera record timbrature explose + consuntivo attivita dipendenti
/// </summary>
/// <param name="IdxDip">singolo idx oppure 0 = tutti</param>
/// <param name="DtFrom">Inizio periodo</param>
/// <param name="DtTo">Fine periodo</param>
/// <param name="ShowIn">Mostra inattivi</param>
/// <param name="ShowWE">Mostra weekend</param>
/// <param name="MaxErrMin">max consentito in mancanza</param>
/// <param name="MaxErrPlus">max consentito in eccesso</param>
/// <returns></returns>
public List<TeRaExplModel> TeRaExplGetFilt(int IdxDip, DateTime DtFrom, DateTime DtTo, bool ShowIn, bool ShowWE, int MaxErrMin, int MaxErrPlus)
{
List<TeRaExplModel> dbResult = new List<TeRaExplModel>();
using (GPWContext localDbCtx = new GPWContext(_configuration))
{
SqlParameter pIdxDip = new SqlParameter("@IdxDip", IdxDip);
SqlParameter pDataFrom = new SqlParameter("@DtFrom", DtFrom);
SqlParameter pDataTo = new SqlParameter("@DtTo", DtTo);
SqlParameter pInatt = new SqlParameter("@pInatt", ShowIn);
SqlParameter pShowWE = new SqlParameter("@ShowWE", ShowWE);
SqlParameter pMaxErrMin = new SqlParameter("@MaxErrMin", MaxErrMin);
SqlParameter pMaxErrPlus = new SqlParameter("@MaxErrPlus", MaxErrPlus);
dbResult = localDbCtx
.DbSetTeRaExpl
.FromSqlRaw("EXEC stp_TE_RA_ByUserDate @IdxDip,@DtFrom,@DtTo,@pInatt,@ShowWE,@MaxErrMin,@MaxErrPlus", pIdxDip, pDataFrom, pDataTo, pInatt, pShowWE, pMaxErrMin, pMaxErrPlus)
.ToList();
}
return dbResult;
+7 -1
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
namespace GPW.CORE.Data.DbModels
{
@@ -13,7 +14,7 @@ namespace GPW.CORE.Data.DbModels
public double h_giust { get; set; } = 0;
public decimal h_com { get; set; } = 0;
public string progetti { get; set; } = "";
public bool okLAvCom { get; set; } = false;
public int okLAvCom { get; set; } = 0;
public bool isOkTim { get; set; } = false;
public bool isOkApp { get; set; } = false;
public int isOkLav { get; set; } = 0;
@@ -45,5 +46,10 @@ namespace GPW.CORE.Data.DbModels
public bool TagIsActive { get; set; } = false;
public string CodTag { get; set; } = "";
[NotMapped]
public string UID
{
get => $"{IdxDipendente:000}_{DataLav:yyyyMMdd}";
}
}
}
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
namespace GPW.CORE.Data.DbModels
{
@@ -76,5 +77,11 @@ namespace GPW.CORE.Data.DbModels
/// Temperatura rilevata
/// </summary>
public decimal TempRil { get; set; }
[NotMapped]
public string UID
{
get => $"{IdxDipendente:000}_{DataLav:yyyyMMdd}";
}
}
}
@@ -20,7 +20,6 @@ namespace GPW.CORE.Data.DbModels
/// </summary>
public bool? Approv { get; set; }
[NotMapped]
public string UID
{
+57 -1
View File
@@ -1421,7 +1421,11 @@ namespace GPW.CORE.Data.Services
}
else
{
dbResult = dbController.DipendentiGetAll();
dbResult = dbController
.DipendentiGetAll()
.OrderBy(c => c.Cognome)
.ThenBy(c => c.Nome)
.ToList();
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
@@ -2484,6 +2488,58 @@ namespace GPW.CORE.Data.Services
return dbResult;
}
/// <summary>
/// Recupera record timbrature explose + consuntivo attivita dipendenti
/// </summary>
/// <param name="IdxDip">singolo idx oppure 0 = tutti</param>
/// <param name="DtFrom">Inizio periodo</param>
/// <param name="DtTo">Fine periodo</param>
/// <param name="ShowIn">Mostra inattivi</param>
/// <param name="ShowWE">Mostra weekend</param>
/// <param name="MaxErrMin">max consentito in mancanza</param>
/// <param name="MaxErrPlus">max consentito in eccesso</param>
/// <returns></returns>
public async Task<List<TeRaExplModel>> TeRaExplGetFilt(int IdxDip, DateTime DtFrom, DateTime DtTo, bool ShowIn, bool ShowWE, int MaxErrMin, int MaxErrPlus)
{
string source = "DB";
// calcolo i tag boolean
string bTags = "";
bTags += ShowIn ? "1" : "0";
bTags += ShowWE ? "1" : "0";
List<TeRaExplModel>? dbResult = new List<TeRaExplModel>();
string currKey = $"{rKeyTimb}:TeRa:{IdxDip}:{DtFrom:yyMMdd}:{DtTo:yyMMdd}:B_{bTags}:ME_{MaxErrMin}_{MaxErrPlus}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<TeRaExplModel>>(rawData);
if (tempResult == null)
{
dbResult = new List<TeRaExplModel>();
}
else
{
dbResult = tempResult;
}
}
else
{
dbResult = dbController.TeRaExplGetFilt(IdxDip, DtFrom, DtTo, ShowIn, ShowWE, MaxErrMin, MaxErrPlus);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
if (dbResult == null)
{
dbResult = new List<TeRaExplModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"TeRaExplGetFilt | {source} in: {ts.TotalMilliseconds} ms");
return dbResult;
}
public async Task<bool> TimbratureUpdate(TimbratureModel currItem)
{
bool answ = false;
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GPW - Gestione Presenze Web</i>
<h4>Versione: 4.1.2409.1309</h4>
<h4>Versione: 4.1.2409.1315</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
4.1.2409.1309
4.1.2409.1315
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>4.1.2409.1309</version>
<version>4.1.2409.1315</version>
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
<mandatory>false</mandatory>