SPEC:
- Completata procedura adv x ricalcolo FluxLog
This commit is contained in:
@@ -552,7 +552,7 @@ namespace MP.Data.Controllers
|
||||
/// <param name="valMode"></param>
|
||||
/// <param name="intReq"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> FluxLogDataRedux(string idxMaccSel, List<string> fluxList, Periodo currPeriodo, Enum.ValSelection valMode, Enum.DataInterval intReq)
|
||||
public async Task<bool> FluxLogDataRedux(string idxMaccSel, List<string> fluxList, Periodo currPeriodo, Enum.ValSelection valMode, Enum.DataInterval intReq, int maxItem)
|
||||
{
|
||||
Log.Info($"Inizio FluxLogDataRedux | idxMaccSel: {idxMaccSel} | periodo: {currPeriodo.Inizio} --> {currPeriodo.Fine}");
|
||||
bool fatto = false;
|
||||
@@ -560,13 +560,13 @@ namespace MP.Data.Controllers
|
||||
switch (intReq)
|
||||
{
|
||||
case Enum.DataInterval.minute:
|
||||
step = TimeSpan.FromMinutes(1);
|
||||
step = TimeSpan.FromMinutes(1.00/ maxItem);
|
||||
break;
|
||||
case Enum.DataInterval.hour:
|
||||
step = TimeSpan.FromHours(1);
|
||||
step = TimeSpan.FromHours(1.00 / maxItem);
|
||||
break;
|
||||
case Enum.DataInterval.day:
|
||||
step = TimeSpan.FromDays(1);
|
||||
step = TimeSpan.FromDays(1.00 / maxItem);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -576,7 +576,6 @@ namespace MP.Data.Controllers
|
||||
// setup parametri costanti x stored
|
||||
var pIdxMacchina = new SqlParameter("@IdxMacchina", idxMaccSel);
|
||||
var pOnlyTest = new SqlParameter("@OnlyTest", false);
|
||||
var pDoReIndex = new SqlParameter("@DoReIndex", false); // sarà cambiato solo alla fine x avere un reindex finale x macchina
|
||||
|
||||
// processo 1:1 ogni flusso
|
||||
foreach (var item in fluxList)
|
||||
@@ -591,7 +590,7 @@ namespace MP.Data.Controllers
|
||||
DateTime dtCursStart = currPeriodo.Inizio;
|
||||
DateTime dtCursEnd = dtCursStart.Add(step);
|
||||
bool setCompleted = false;
|
||||
// dbCOntext x ogni singolo flusso
|
||||
// dbContext x ogni singolo flusso
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
// li processo per intervallo richiesto, cercando dati nel periodo e selezionando VC
|
||||
@@ -646,7 +645,7 @@ namespace MP.Data.Controllers
|
||||
var pDtEnd = new SqlParameter("@DtEnd", slot.Fine);
|
||||
var dbResult = dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRaw("EXEC man.stp_ReduceFluxLog @IdxMacchina, @CodFlux, @DtStart, @DtEnd, @OnlyTest, @DoReIndex", pIdxMacchina, pCodFlux, pDtStart, pDtEnd, pOnlyTest, pDoReIndex);
|
||||
.ExecuteSqlRaw("EXEC man.stp_ReduceFluxLog @IdxMacchina, @CodFlux, @DtStart, @DtEnd, @OnlyTest", pIdxMacchina, pCodFlux, pDtStart, pDtEnd, pOnlyTest);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -673,6 +672,39 @@ namespace MP.Data.Controllers
|
||||
Log.Info($"FINE FluxLogDataRedux | idxMaccSel: {idxMaccSel} | periodo: {currPeriodo.Inizio} --> {currPeriodo.Fine}");
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stored manutenzione del DB
|
||||
/// </summary>
|
||||
/// <param name="doExec">Esegue realmente il task</param>
|
||||
/// <param name="doUpdStat">Aggiornamento statistiche</param>
|
||||
/// <param name="doSave">Salvataggio</param>
|
||||
/// <param name="minPgCnt">def: 1000</param>
|
||||
/// <param name="minAvgFrag">def: 10</param>
|
||||
/// <param name="maxAvgFragReb">def: 50</param>
|
||||
/// <returns></returns>
|
||||
public bool ForceDbMaint(bool doExec, bool doUpdStat, bool doSave, int minPgCnt, int minAvgFrag, int maxAvgFragReb)
|
||||
{
|
||||
Log.Info($"Inizio ForceDbMaint");
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var pFlgExec = new SqlParameter("@FlgExec", doExec ? "Y" : "N");
|
||||
var pFlgUpdStat = new SqlParameter("@FlgUpdStat", doUpdStat ? "Y" : "N");
|
||||
var pFlgSave = new SqlParameter("@FlgSave", doSave ? "Y" : "N");
|
||||
var pMinPgCnt = new SqlParameter("@min_page_count", minPgCnt);
|
||||
var pMinAvgFrag = new SqlParameter("@min_avg_fragmentation_in_percent", minAvgFrag);
|
||||
var pMaxAvgFrag = new SqlParameter("@max_avg_fragmentation_per_rebuild", maxAvgFragReb);
|
||||
|
||||
var dbResult = dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRaw("EXEC man.stp_Utility_Maintanance @FlgExec, @FlgUpdStat, @FlgSave, @min_page_count, @min_avg_fragmentation_in_percent, @max_avg_fragmentation_per_rebuild", pFlgExec, pFlgUpdStat, pFlgSave, pMinPgCnt, pMinAvgFrag, pMaxAvgFrag);
|
||||
fatto = true;
|
||||
}
|
||||
Log.Info($"FINE ForceDbMaint");
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserimento record risultati deduplica FluxLog
|
||||
/// </summary>
|
||||
|
||||
+5
-5
@@ -18,13 +18,13 @@ namespace MP.Data
|
||||
/// </summary>
|
||||
First,
|
||||
/// <summary>
|
||||
/// Selezione ULTIMO valore del set
|
||||
/// </summary>
|
||||
Last,
|
||||
/// <summary>
|
||||
/// Selezione Moda (norma) = elemento centrale
|
||||
/// </summary>
|
||||
Center
|
||||
Center,
|
||||
/// <summary>
|
||||
/// Selezione ULTIMO valore del set
|
||||
/// </summary>
|
||||
Last
|
||||
}
|
||||
/// <summary>
|
||||
/// Intervallo dati (es per definizione quanti dati FluxLog tenere x intervallo
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using EgwCoreLib.Utils;
|
||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
using MP.Data;
|
||||
using MP.Data.Conf;
|
||||
using MP.Data.DatabaseModels;
|
||||
@@ -1775,15 +1776,32 @@ namespace MP.SPEC.Data
|
||||
/// <summary>
|
||||
/// Funzione di Data Reduction x FluxLog
|
||||
/// </summary>
|
||||
/// <param name="idxMaccSel"></param>
|
||||
/// <param name="fluxList"></param>
|
||||
/// <param name="currPeriodo"></param>
|
||||
/// <param name="valMode"></param>
|
||||
/// <param name="intReq"></param>
|
||||
/// <param name="idxMaccSel">Macchina</param>
|
||||
/// <param name="fluxList">Elenco FL da processare</param>
|
||||
/// <param name="currPeriodo">Periodo</param>
|
||||
/// <param name="valMode">modalità sel valore</param>
|
||||
/// <param name="intReq">intervallo di analisi</param>
|
||||
/// <param name="maxItem">max num per intervallo</param>
|
||||
/// <returns></returns>
|
||||
public async Task FluxLogDataRedux(string idxMaccSel, List<string> fluxList, DtUtils.Periodo currPeriodo, ValSelection valMode, DataInterval intReq)
|
||||
public async Task FluxLogDataRedux(string idxMaccSel, List<string> fluxList, DtUtils.Periodo currPeriodo, ValSelection valMode, DataInterval intReq, int maxItem)
|
||||
{
|
||||
await dbController.FluxLogDataRedux(idxMaccSel, fluxList, currPeriodo, valMode, intReq);
|
||||
await dbController.FluxLogDataRedux(idxMaccSel, fluxList, currPeriodo, valMode, intReq, maxItem);
|
||||
await FlushCacheFluxLog();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stored manutenzione del DB
|
||||
/// </summary>
|
||||
/// <param name="doExec">Esegue realmente il task</param>
|
||||
/// <param name="doUpdStat">Aggiornamento statistiche</param>
|
||||
/// <param name="doSave">Salvataggio</param>
|
||||
/// <param name="minPgCnt">def: 1000</param>
|
||||
/// <param name="minAvgFrag">def: 10</param>
|
||||
/// <param name="maxAvgFragReb">def: 50</param>
|
||||
/// <returns></returns>
|
||||
public async Task ForceDbMaint(bool doExec = true, bool doUpdStat = true, bool doSave = true, int minPgCnt = 1000, int minAvgFrag = 10, int maxAvgFragReb = 50)
|
||||
{
|
||||
dbController.ForceDbMaint(doExec, doUpdStat, doSave, minPgCnt, minAvgFrag, maxAvgFragReb);
|
||||
await FlushCacheFluxLog();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
<Version>6.16.2310.2112</Version>
|
||||
<Version>6.16.2310.2312</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<div class="card mb-5">
|
||||
<div class="card-header">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<h3>FluxLogStatus</h3>
|
||||
<div class="col-2">
|
||||
<h3>Status</h3>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="input-group ">
|
||||
@@ -25,7 +25,7 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="col-6">
|
||||
<PeriodoSel CurrPeriodo="@CurrPeriodo" E_PeriodoSel="SetPeriodo"></PeriodoSel>
|
||||
</div>
|
||||
</div>
|
||||
@@ -33,7 +33,7 @@
|
||||
<div class="card-body">
|
||||
@if (isProcessing)
|
||||
{
|
||||
<ProgressDisplay CurrVal="@countFlux" MaxVal="numFlux" ExpTimeMSec="@expTimeMsec"></ProgressDisplay>
|
||||
<ProgressDisplay RefreshInterval="400" Title="Data Maintenance" MaxVal="@MaxVal" CurrVal="@currVal" NextVal="@nextVal" ExpTimeMSec="@expTimeMsec"></ProgressDisplay>
|
||||
<LoadingData DisplaySize="LoadingData.CtrlSize.Large" DisplayMode="LoadingData.SpinMode.BounceLine"></LoadingData>
|
||||
}
|
||||
else
|
||||
@@ -45,22 +45,12 @@
|
||||
<div class="card-footer">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
Selezione parametri Cleanup
|
||||
Parametri Cleanup
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Var</span>
|
||||
<select class="form-select text-end" @bind="ValMode">
|
||||
@foreach (var item in Enum.GetValues(typeof(MP.Data.Enum.ValSelection)).Cast<MP.Data.Enum.ValSelection>())
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Intervallo</span>
|
||||
<span class="input-group-text">Max</span>
|
||||
<input class="form-control" type="number" @bind="@NumItem" />
|
||||
<select class="form-select text-end" @bind="IntReq">
|
||||
@foreach (var item in Enum.GetValues(typeof(MP.Data.Enum.DataInterval)).Cast<MP.Data.Enum.DataInterval>())
|
||||
{
|
||||
@@ -69,8 +59,22 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Sel</span>
|
||||
<select class="form-select text-end" @bind="ValMode">
|
||||
@foreach (var item in Enum.GetValues(typeof(MP.Data.Enum.ValSelection)).Cast<MP.Data.Enum.ValSelection>())
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<button class="btn btn-warning w-100" title="Data Cleanup" @onclick="DoCleanup"><i class="fa-solid fa-broom"></i> Data Cleanup</button>
|
||||
<div class="btn-group w-100">
|
||||
<button class="btn btn-danger w-100" title="Data Cleanup" @onclick="DoCleanup"><i class="fa-solid fa-broom"></i> Data Cleanup</button>
|
||||
<button class="btn btn-warning w-100" title="Data Cleanup" @onclick="IdxRebuild"><i class="fa-solid fa-database"></i> Maint</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using global::Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.SPEC.Data;
|
||||
using NLog;
|
||||
using System;
|
||||
using static EgwCoreLib.Utils.DtUtils;
|
||||
using static MP.Data.Enum;
|
||||
|
||||
@@ -11,24 +11,84 @@ namespace MP.SPEC.Pages
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected DataInterval IntReq = DataInterval.hour;
|
||||
protected int numRecPage = 10;
|
||||
protected int pageNum = 1;
|
||||
protected int totalCount = 0;
|
||||
|
||||
protected ValSelection ValMode = ValSelection.Center;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected Dictionary<string, string> ListMacchineAll { get; set; } = new Dictionary<string, string>();
|
||||
protected List<string> fluxList { get; set; } = new List<string>();
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
protected Dictionary<string, string> ListMacchineAll { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDataServ { get; set; } = null!;
|
||||
|
||||
protected int NumItem
|
||||
{
|
||||
get => numItem;
|
||||
set
|
||||
{
|
||||
if (numItem != value)
|
||||
{
|
||||
// controllo valori ammissibili
|
||||
numItem = value >= 1 ? value : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Esegue cleanup dati
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task DoCleanup()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Attenzione! il task di Data Cleanup eliminerà in modo definitivo i dati in eccesso secondo lo schema impostato, sei sicuro di voler procedere?"))
|
||||
return;
|
||||
|
||||
isProcessing = true;
|
||||
int currStep = 1;
|
||||
int stepVal = 1;
|
||||
foreach (var item in fluxList)
|
||||
{
|
||||
await InvokeAsync(StateHasChanged);
|
||||
// aggiorno valori
|
||||
currVal = (currStep - 1) * stepVal;
|
||||
nextVal = currStep * stepVal;
|
||||
// processo i flussi 1:1 x mandare update ad avanzamento
|
||||
await MDataServ.FluxLogDataRedux(idxMaccSel, new List<string> { item }, CurrPeriodo, ValMode, IntReq, NumItem);
|
||||
currStep++;
|
||||
}
|
||||
//await MDataServ.FluxLogDataRedux(idxMaccSel, fluxList, CurrPeriodo, ValMode, IntReq, maxItem);
|
||||
isProcessing = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue cleanup dati
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task IdxRebuild()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Manutenzione Database: si tratta di un operazione che può richiedere un tempo levato sei sicuro di voler procedere?"))
|
||||
return;
|
||||
|
||||
isProcessing = true;
|
||||
await MDataServ.ForceDbMaint(true, true, true, 1000, 10, 50);
|
||||
isProcessing = false;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
@@ -47,6 +107,12 @@ namespace MP.SPEC.Pages
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task SaveFluxList(List<string> newList)
|
||||
{
|
||||
fluxList = newList;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected void SaveNumRec(int newNum)
|
||||
{
|
||||
if (numRecPage != newNum)
|
||||
@@ -77,11 +143,6 @@ namespace MP.SPEC.Pages
|
||||
totalCount = numRec;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
protected async Task SaveFluxList(List<string> newList)
|
||||
{
|
||||
fluxList = newList;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
@@ -89,6 +150,14 @@ namespace MP.SPEC.Pages
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Tempo atteso processing
|
||||
/// - da calcolare in base al num eventi e alla tab logProcessing...
|
||||
/// </summary>
|
||||
private int expTimeMsec = 3000;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
@@ -98,6 +167,16 @@ namespace MP.SPEC.Pages
|
||||
private string idxMaccSel { get; set; } = "";
|
||||
private bool isProcessing { get; set; } = false;
|
||||
|
||||
|
||||
protected double currVal = 0;
|
||||
protected double nextVal = 0;
|
||||
protected int MaxVal
|
||||
{
|
||||
get => fluxList.Count;
|
||||
}
|
||||
|
||||
private int numItem { get; set; } = 1;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
@@ -109,31 +188,6 @@ namespace MP.SPEC.Pages
|
||||
DateTime dtStart = dtEnd.AddMonths(-1);
|
||||
CurrPeriodo = new Periodo(dtStart, dtEnd);
|
||||
}
|
||||
/// <summary>
|
||||
/// Esegue cleanup dati
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task DoCleanup()
|
||||
{
|
||||
isProcessing = true;
|
||||
// processo i flussi in subset x mandare update ad avanzamento
|
||||
await MDataServ.FluxLogDataRedux(idxMaccSel, fluxList, CurrPeriodo, ValMode, IntReq);
|
||||
isProcessing = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tempo atteso processing
|
||||
/// - da calcolare in abse al num eventi e alla tab logProcessing...
|
||||
/// </summary>
|
||||
private int expTimeMsec = 10000;
|
||||
private int countFlux = 0;
|
||||
private int numFlux
|
||||
{
|
||||
get => fluxList.Count * 10;
|
||||
}
|
||||
|
||||
protected ValSelection ValMode = ValSelection.Center;
|
||||
protected DataInterval IntReq = DataInterval.hour;
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2310.2112</h4>
|
||||
<h4>Versione: 6.16.2310.2312</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2310.2112
|
||||
6.16.2310.2312
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2310.2112</version>
|
||||
<version>6.16.2310.2312</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user