Inizio pagina PODL/ODL correnti
This commit is contained in:
@@ -79,6 +79,15 @@ namespace MP.Data.Controllers
|
||||
return ListValuesFilt("AnagArticoli", "Tipo");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco valori ammessi x Stati commessa (es Yacht Baglietto)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ListValues> AnagStatiComm()
|
||||
{
|
||||
return ListValuesFilt("PODL", "StatoComm");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Elenco valori link (x home e navMenu laterale)
|
||||
|
||||
@@ -69,9 +69,38 @@ namespace MP.SPEC.Data
|
||||
|
||||
public async Task<List<ListValues>> AnagTipoArtLV()
|
||||
{
|
||||
return await Task.FromResult(dbController.AnagTipoArtLV());
|
||||
int maxAgeConfig = 5;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
List<ListValues>? result = new List<ListValues>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = await redisDb.StringGetAsync(redisTipoArt);
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ListValues>>($"{rawData}");
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"AnagTipoArtLV Read from REDIS: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.AnagTipoArtLV());
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(redisTipoArt, rawData, TimeSpan.FromMinutes(maxAgeConfig));
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"AnagTipoArtLV Read from DB: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ListValues>();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record selezionato
|
||||
/// </summary>
|
||||
@@ -202,6 +231,38 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<List<ListValues>> AnagStatiComm()
|
||||
{
|
||||
int maxAgeConfig = 5;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
List<ListValues>? result = new List<ListValues>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = await redisDb.StringGetAsync(redisStatoCom);
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ListValues>>($"{rawData}");
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"AnagStatiComm Read from REDIS: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.AnagStatiComm());
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(redisStatoCom, rawData, TimeSpan.FromMinutes(maxAgeConfig));
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"AnagStatiComm Read from DB: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ListValues>();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset dati cache config
|
||||
/// </summary>
|
||||
@@ -330,6 +391,8 @@ namespace MP.SPEC.Data
|
||||
private int fastRefreshMs = 1000;
|
||||
|
||||
private string redisConfKey = "MP:MON:Cache:Config";
|
||||
private string redisTipoArt = "MP:MON:Cache:TipoArt";
|
||||
private string redisStatoCom = "MP:MON:Cache:StatoCom";
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto per connessione a REDIS
|
||||
|
||||
+39
-3
@@ -1,7 +1,43 @@
|
||||
@page "/ODL"
|
||||
|
||||
<h3>ODL</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<h2>Ordini Di Lavoro </h2>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
ODL Programmati / In Corso
|
||||
<div class="form-check form-switch" title="Visualizzazione ODL Programmati / In Corso">
|
||||
<input class="form-check-input" type="checkbox" id="flexSwitchCheckDefault" @onclick="() => toggleCurrent()">
|
||||
<label class="form-check-label" for="flexSwitchCheckDefault">@textToggle</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<select @bind="@selStato" class="form-select">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListStati != null)
|
||||
{
|
||||
foreach (var item in ListStati)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
</div>
|
||||
@*<div class="card-footer py-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>*@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.SPEC;
|
||||
using MP.SPEC.Shared;
|
||||
using MP.SPEC.Components;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Pages
|
||||
{
|
||||
public partial class ODL
|
||||
{
|
||||
|
||||
private List<MP.Data.DatabaseModels.ListValues>? ListStati;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private bool showCurrent { get; set; } = false;
|
||||
|
||||
private async Task toggleCurrent()
|
||||
{
|
||||
showCurrent = !showCurrent;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private string textToggle
|
||||
{
|
||||
get => showCurrent ? "In Corso" : "Programmati";
|
||||
}
|
||||
|
||||
private string selStato { get; set; } = "*";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user