Compare commits

..

34 Commits

Author SHA1 Message Date
Samuele Locatelli 1cae70c244 Merge branch 'Release/UpdateModuloDoss' 2022-10-20 14:54:22 +02:00
Samuele Locatelli 18ee183b05 Pulizia codice DOSS x spostamento modulo update 2022-10-20 14:54:03 +02:00
Samuele Locatelli d88c4cc2bd Update comportamento edit dossier 2022-10-20 13:16:07 +02:00
zaccaria.majid 67922520b8 fix edit mode label 'PENDING CHANGES' 2022-10-20 11:42:10 +02:00
zaccaria.majid c5b5b54586 fix edit mode 2022-10-20 11:21:01 +02:00
zaccaria.majid ae3864a614 fix salva solo quando finito 2022-10-20 11:08:31 +02:00
zaccaria.majid f878f1c496 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-20 09:42:27 +02:00
zaccaria.majid d453c1d944 modifiche comportamento editing 2022-10-20 09:42:19 +02:00
Samuele Locatelli 921bf52659 Filtro eventi macchina spenta
- preso da semaforo (no idxStato)
2022-10-20 09:31:42 +02:00
Samuele Locatelli e948ae31af Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-19 20:07:36 +02:00
Samuele Locatelli b344180da2 Fix gestione HideSpenta da statistiche 2022-10-19 20:07:33 +02:00
zaccaria.majid 4b885d780c Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-19 17:47:48 +02:00
zaccaria.majid 01e181a4fc inizio modifiche editing 2022-10-19 17:47:07 +02:00
Samuele Locatelli 56f342a488 refresh test 2022-10-19 17:30:26 +02:00
Samuele Locatelli ed72bdfa24 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-19 17:14:20 +02:00
Samuele Locatelli 5e6924f0fe Inizio gestione nascondi spenta 2022-10-19 17:13:43 +02:00
zaccaria.majid cae7e50cbd cleanUp 2022-10-19 17:11:27 +02:00
zaccaria.majid e769227bb3 fix not update if "annulla" 2022-10-19 17:10:56 +02:00
zaccaria.majid 60f757965e CleanUp 2022-10-19 13:07:05 +02:00
zaccaria.majid 603ed3782f Cleanup 2022-10-19 13:02:59 +02:00
zaccaria.majid 71177e04c7 Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-19 13:01:28 +02:00
zaccaria.majid 1a211ebca5 delete msgService da PARAMS 2022-10-19 13:01:21 +02:00
zaccaria.majid 591b66b52d delete msgService da dossier 2022-10-19 12:49:13 +02:00
Samuele Locatelli 96f4bb3b4c Merge tag 'UpdateLogCall' into develop
Fix log chaimate MP/IO
2022-10-19 11:02:23 +02:00
Samuele Locatelli f1c295993c Merge branch 'Release/UpdateLogCall' 2022-10-19 11:02:16 +02:00
Samuele Locatelli a293ce825e Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop 2022-10-19 11:01:34 +02:00
Samuele Locatelli e3b67ee6c0 Fix log vari x chiamate MP/IO 2022-10-19 11:01:29 +02:00
zaccaria.majid 0c5e41826e fix recordsel = null in dossier post chiusura 2022-10-19 10:43:45 +02:00
Samuele Locatelli 0d4e1aed88 Merge tag 'FixPAramsDetailAndReload' into develop
Sistemazione reload e params detail
2022-10-18 20:02:34 +02:00
Samuele Locatelli 93f4f09b85 Merge branch 'Release/FixPAramsDetailAndReload' 2022-10-18 20:02:26 +02:00
Samuele Locatelli aebae6b406 Update selezione dossier:
- selezione x periodo
- ancora check ottimizzazione sel distinct
2022-10-18 20:01:53 +02:00
Samuele Locatelli a2bf5f4a8b Ottimizzazioni selezione casi distinct 2022-10-18 19:16:20 +02:00
Samuele Locatelli 759373b5a4 Modifica display valori fluxLog x Dossier 2022-10-18 18:37:26 +02:00
Samuele Locatelli 0ea3ee6341 Merge tag 'FixMemoryLeakError' into develop
Update x gestione condizione errore memory leak (ridotto in test debug)
x gestione dispose componenti
2022-10-18 17:12:23 +02:00
30 changed files with 799 additions and 326 deletions
+11 -7
View File
@@ -333,10 +333,10 @@ namespace MP.Data.Controllers
/// </summary> /// </summary>
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param> /// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
/// <param name="CodArticolo">* = tutti, altrimenti solo x un dato articolo</param> /// <param name="CodArticolo">* = tutti, altrimenti solo x un dato articolo</param>
/// <param name="DtRef">Data di riferimento (Massima) per estrazioen records</param> /// <param name="DtStart">Data minima per estrazione records</param>
/// <param name="MaxRec">numero massimo record da restituire</param> /// <param name="DtEnd">Data Massima per estrazione records</param>
/// <returns></returns> /// <returns></returns>
public List<Dossiers> DossiersGetLastFilt(string IdxMacchina, string CodArticolo, DateTime DtRef, int MaxRec) public List<Dossiers> DossiersGetLastFilt(string IdxMacchina, string CodArticolo, DateTime DtStart, DateTime DtEnd)
{ {
List<Dossiers> dbResult = new List<Dossiers>(); List<Dossiers> dbResult = new List<Dossiers>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
@@ -344,12 +344,11 @@ namespace MP.Data.Controllers
dbResult = dbCtx dbResult = dbCtx
.DbSetDossiers .DbSetDossiers
.AsNoTracking() .AsNoTracking()
.Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodArticolo == "*" || x.OdlNav.CodArticolo == CodArticolo) && x.DtRif <= DtRef) .Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodArticolo == "*" || x.OdlNav.CodArticolo == CodArticolo) && (x.DtRif >= DtStart && x.DtRif <= DtEnd))
.Include(m => m.MachineNav) .Include(m => m.MachineNav)
.Include(o => o.OdlNav) .Include(o => o.OdlNav)
.Include(a => a.OdlNav.ArticoloNav) .Include(a => a.OdlNav.ArticoloNav)
.OrderByDescending(x => x.DtRif) .OrderByDescending(x => x.DtRif)
.Take(MaxRec)
.ToList(); .ToList();
} }
return dbResult; return dbResult;
@@ -602,10 +601,12 @@ namespace MP.Data.Controllers
} }
/// <summary> /// <summary>
/// Elenco id Macchine che abbiano dati FLuxLog /// Elenco id Macchine che abbiano dati FLuxLog, nel periodo indicato
/// </summary> /// </summary>
/// <param name="dtStart"></param>
/// <param name="dtEnd"></param>
/// <returns></returns> /// <returns></returns>
public async Task<List<string>> MacchineWithFlux() public async Task<List<string>> MacchineWithFlux(DateTime dtStart, DateTime dtEnd)
{ {
List<string> dbResult = new List<string>(); List<string> dbResult = new List<string>();
using (var dbCtx = new MoonProContext(_configuration)) using (var dbCtx = new MoonProContext(_configuration))
@@ -613,6 +614,7 @@ namespace MP.Data.Controllers
dbResult = await dbCtx dbResult = await dbCtx
.DbSetFluxLog .DbSetFluxLog
.AsNoTracking() .AsNoTracking()
.Where(x => x.dtEvento >= dtStart && x.dtEvento <= dtEnd)
.Select(i => i.IdxMacchina) .Select(i => i.IdxMacchina)
.Distinct() .Distinct()
.ToListAsync(); .ToListAsync();
@@ -795,8 +797,10 @@ namespace MP.Data.Controllers
.DbSetFluxLog .DbSetFluxLog
.AsNoTracking() .AsNoTracking()
.Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina)) .Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina))
.Take(1000)
.Select(i => i.CodFlux) .Select(i => i.CodFlux)
.Distinct() .Distinct()
.OrderBy(x => x)
.ToList(); .ToList();
} }
return dbResult; return dbResult;
+17 -2
View File
@@ -37,7 +37,22 @@
} }
</select> </select>
</div> </div>
<div class="input-group p-2">
<div class="small mt-2">
<label class="px-2" for="dtMin" title="Selezionare inizio periodo">Inizio Periodo</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="dtMin" title="Selezionare inizio periodo"><i class="fa-regular fa-calendar-minus"></i></label>
<input class="form-control" @bind="@selDtMin" id="dtMin" type="datetime-local" title="Data minima eventi da visualizzare">
</div>
<div class="small mt-2">
<label class="px-2" for="dtMax" title="Selezionare fine periodo">Fine Periodo</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="dtMax" title="Selezionare fine periodo"><i class="fa-regular fa-calendar-plus"></i></label>
<input class="form-control" @bind="@selDtMax" id="dtMax" type="datetime-local" title="Selezionare fine periodo">
</div>
@*<div class="input-group p-2">
<label class="input-group-text" for="DtMin" title="Selezionare la data da visualizzare"><i class="fa-solid fa-calendar-check"></i></label> <label class="input-group-text" for="DtMin" title="Selezionare la data da visualizzare"><i class="fa-solid fa-calendar-check"></i></label>
<input @bind="@selDtRef" id="DtMin" class="form-control" type="datetime-local" title="Selezionare la data minima da visualizzare" /> <input @bind="@selDtRef" id="DtMin" class="form-control" type="datetime-local" title="Selezionare la data minima da visualizzare" />
</div> </div>
@@ -49,7 +64,7 @@
<option value="250">250</option> <option value="250">250</option>
<option value="500">500</option> <option value="500">500</option>
</select> </select>
</div> </div>*@
</div> </div>
</div> </div>
</div> </div>
+24 -5
View File
@@ -39,18 +39,35 @@ namespace MP.SPEC.Components
} }
} }
protected DateTime selDtRef protected DateTime selDtMax
{ {
get get
{ {
return SelFilterDossier.DtRef; return SelFilterDossier.DtEnd;
} }
set set
{ {
if (!SelFilterDossier.DtRef.Equals(value)) if (!SelFilterDossier.DtEnd.Equals(value))
{ {
SelFilterDossier.DtRef = value; SelFilterDossier.DtEnd = value;
reportChange();
}
}
}
protected DateTime selDtMin
{
get
{
return SelFilterDossier.DtStart;
}
set
{
if (!SelFilterDossier.DtStart.Equals(value))
{
SelFilterDossier.DtStart = value;
reportChange(); reportChange();
} }
} }
@@ -101,7 +118,9 @@ namespace MP.SPEC.Components
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
SelFilterDossier = new SelectDossierParams(); SelFilterDossier = new SelectDossierParams();
ListMacchine = await MDService.MacchineWithFlux(); DateTime dtEnd = SelFilterDossier.DtEnd;
DateTime dtStart = dtEnd.Subtract(SelFilterDossier.DtStart).TotalDays < 15 ? SelFilterDossier.DtStart : dtEnd.AddDays(-14);
ListMacchine = await MDService.MacchineWithFlux(dtStart, dtEnd);
ListArticoli = await MDService.ArticleWithDossier(); ListArticoli = await MDService.ArticleWithDossier();
await FilterChanged.InvokeAsync(SelFilterDossier); await FilterChanged.InvokeAsync(SelFilterDossier);
} }
+102 -17
View File
@@ -1,6 +1,9 @@
@using MP.SPEC.Components @using MP.SPEC.Components
@using MP.SPEC.Data @using MP.SPEC.Data
@if (ListRecords == null) @if (ListRecords == null)
{ {
<LoadingData></LoadingData> <LoadingData></LoadingData>
@@ -11,20 +14,83 @@ else if (totalCount == 0)
} }
else else
{ {
@if (currFluxLogDto != null)
{
<div class="row">
<div class="col-12">
<div class="card mb-5">
<div class="card-header bg-primary text-light d-flex justify-content-between">
<div>
Modifica Parametro
</div>
<div>
@if (isEditing)
{
<span class="text-light">PENDING CHANGES...</span>
}
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">MACCHINA</span>
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currFluxLogDto.IdxMacchina">
</div>
</div>
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">DATA</span>
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currFluxLogDto.dtEvento">
</div>
</div>
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">DATA TYPE</span>
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currFluxLogDto.CodFlux">
</div>
</div>
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">VALORE</span>
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currFluxLogDto.ValoreEdit" @onclick="()=> enableEditing()">
</div>
</div>
</div>
<div class="row pt-4" style="visibility: @css()">
<div class="col-3 pe-0">
</div>
<div class="col-3 pe-0">
</div>
<div class="col-3 pe-0">
<div class="d-grid gap-2">
<button @onclick="() => cancel()" class="btn btn-warning">Annulla <i class="bi bi-x-circle"></i></button>
</div>
</div>
<div class="col-3 pe-0">
<div class="d-grid gap-2">
<button @onclick="() => update(currFluxLogDto)" class="btn btn-success">Save <i class="bi bi-save"></i></button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
}
<div class="row"> <div class="row">
<div class="d-flex justify justify-content-between"> <div class="d-flex justify justify-content-between">
<table class="table table-sm table-striped small"> <table class="table table-sm table-striped small">
<thead> <thead>
<tr> <tr>
<th> <th>
<button @onclick="() => unToggleTableFlux()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button> <button @onclick="() => closeTableFlux()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
</th> </th>
<th><i class="fa-solid fa-file"></i> Articolo</th> <th><i class="fa-solid fa-file"></i> Articolo</th>
<th><i class="fa-solid fa-screwdriver-wrench"></i> Fase</th> <th><i class="fa-solid fa-screwdriver-wrench"></i> Fase</th>
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th> <th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th><i class="fa-regular fa-calendar-days"></i> Data Snap</th> <th><i class="fa-regular fa-calendar-days"></i> Data Snap</th>
<th><i class="fa-solid fa-sliders"></i> ODL</th> <th><i class="fa-solid fa-sliders"></i> ODL</th>
@*<th><i class="fa-solid fa-circle-info"></i> DATA TYPE</th>*@
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
@@ -33,7 +99,15 @@ else
{ {
<tr class="@checkSelect(@record)"> <tr class="@checkSelect(@record)">
<td> <td>
<button class="btn btn-primary btn-sm" @onclick="() => selRecord(record)"><i class="fa-solid fa-magnifying-glass"></i></button> @if (isEditing == false)
{
<button class="btn btn-primary btn-sm" @onclick="() => selRecord(record)"><i class="fa-solid fa-magnifying-glass"></i></button>
}
else
{
<button class="btn btn-secondary btn-sm disabled"><i class="fa-solid fa-magnifying-glass"></i></button>
}
</td> </td>
<td> <td>
@record.OdlNav.CodArticolo @record.OdlNav.CodArticolo
@@ -52,11 +126,17 @@ else
<td> <td>
@record.IdxODL @record.IdxODL
</td> </td>
@*<td>
@record.DataType
</td>*@
<td> <td>
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button> @if (isEditing == false)
{
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
}
else
{
<button class="btn btn-secondary btn-sm disabled"><i class="bi bi-trash-fill"></i></button>
}
</td> </td>
</tr> </tr>
} }
@@ -75,23 +155,21 @@ else
<table class="table table-light table-sm table-striped small mb-0"> <table class="table table-light table-sm table-striped small mb-0">
<thead> <thead>
<tr> <tr>
<th></th> <th>
<button class="btn btn-info" @onclick="() => closeTableFlux()"><i class="fa-solid fa-xmark"></i></button>
</th>
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th> <th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th><i class="fa-regular fa-calendar-days"></i> Data</th> <th><i class="fa-regular fa-calendar-days"></i> Data</th>
<th><i class="fa-solid fa-sliders"></i> Data Type</th> <th><i class="fa-solid fa-sliders"></i> Data Type</th>
<th> <th style="text-align: right;">
<div class="d-flex justify-content-between col-12"> <span class="col-11"> Valore </span>
<span class="col-11" style="text-align: right;"> Valore </span>
<button class="btn btn-primary btn-sm py-0" @onclick="() => unToggleTableFlux()"><i class="fa-solid fa-xmark"></i></button>
</div>
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var record in listaFlux) @foreach (var record in listaFlux)
{ {
<tr> <tr class="@checkSelPar(@record)">
<td> <td>
<button @onclick="() => editRecord(record)" class="btn btn-primary btn-sm" title="Modifica Record"><i class="bi bi-pencil-square"></i></button> <button @onclick="() => editRecord(record)" class="btn btn-primary btn-sm" title="Modifica Record"><i class="bi bi-pencil-square"></i></button>
</td> </td>
@@ -105,8 +183,15 @@ else
@record.CodFlux @record.CodFlux
</td> </td>
<td style="text-align: right;"> <td style="text-align: right;">
<div><span class="small text-dark">Modificato: </span><b>@record.ValoreEdit</b></div> @if (record.ValoreEdit != record.Valore)
<div class="small text-secondary"><span class="small text-dark">Originale: </span><i>@record.Valore</i></div> {
<div title="Valore Modificato"><span class="small text-dark"></span><b>@record.ValoreEdit</b></div>
<div class="small text-secondary" title="Valore Registrato">(<i>@record.Valore</i>)</div>
}
else
{
<div><span class="small text-dark"></span>@record.ValoreEdit</div>
}
</td> </td>
</tr> </tr>
} }
+117 -24
View File
@@ -1,12 +1,14 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.JSInterop; using Microsoft.JSInterop;
using MP.Data.DatabaseModels; using MP.Data.DatabaseModels;
using MP.Data.DTO; using MP.Data.DTO;
using MP.SPEC.Data; using MP.SPEC.Data;
using Newtonsoft.Json;
namespace MP.SPEC.Components namespace MP.SPEC.Components
{ {
public partial class ListDossiers: IDisposable public partial class ListDossiers : IDisposable
{ {
#region Public Properties #region Public Properties
@@ -26,6 +28,24 @@ namespace MP.SPEC.Components
#region Public Methods #region Public Methods
private FluxLogDTO? currFluxLogDto = null;
public string checkSelPar(FluxLogDTO recordSel)
{
string answ = "";
if (currFluxLogDto != null)
{
try
{
answ = (currFluxLogDto.CodFlux == recordSel.CodFlux && currFluxLogDto.dtEvento == recordSel.dtEvento) ? "table-info" : "";
}
catch
{ }
}
return answ;
}
public string checkSelect(Dossiers recordSel) public string checkSelect(Dossiers recordSel)
{ {
string answ = ""; string answ = "";
@@ -34,6 +54,7 @@ namespace MP.SPEC.Components
try try
{ {
answ = (currRecord.IdxMacchina == recordSel.IdxMacchina && currRecord.DtRif == recordSel.DtRif) ? "table-info" : ""; answ = (currRecord.IdxMacchina == recordSel.IdxMacchina && currRecord.DtRif == recordSel.DtRif) ? "table-info" : "";
} }
catch catch
{ } { }
@@ -42,15 +63,20 @@ namespace MP.SPEC.Components
} }
public void Dispose() public void Dispose()
{ {
MessageService.EA_PageUpdated -= MessageService_EA_PageUpdated;
MessageService.EA_SearchUpdated -= OnSeachUpdated;
currRecord = null; currRecord = null;
SearchRecords = null; SearchRecords = null;
ListRecords = null; ListRecords = null;
GC.Collect(); GC.Collect();
} }
private SelectDossierParams lastFilter { get; set; } = new SelectDossierParams() { CurrPage = -1 };
protected override async Task OnParametersSetAsync()
{
if (!lastFilter.Equals(SelFilter))
{
lastFilter = SelFilter.clone();
await reloadData(true);
}
}
#endregion Public Methods #endregion Public Methods
#region Protected Properties #region Protected Properties
@@ -60,10 +86,6 @@ namespace MP.SPEC.Components
[Inject] [Inject]
protected MpDataService MDService { get; set; } = null!; protected MpDataService MDService { get; set; } = null!;
[Inject]
protected MessageService MessageService { get; set; } = null!;
#endregion Protected Properties #endregion Protected Properties
#region Protected Methods #region Protected Methods
@@ -87,14 +109,64 @@ namespace MP.SPEC.Components
protected async Task editRecord(FluxLogDTO selRec) protected async Task editRecord(FluxLogDTO selRec)
{ {
currFluxLogDto = selRec;
// indico record selezionato // indico record selezionato
await RecordSelFlux.InvokeAsync(selRec); await RecordSelFlux.InvokeAsync(selRec);
} }
private void enableEditing()
{
isEditing = true;
}
protected async Task cancel()
{
var alert = await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler annullare TUTTE le modifiche? i dati saranno ricaricati.");
if (alert)
{
currFluxLogDto = null;
isEditing = false;
await Task.Delay(1);
listaFlux = MDService.getFluxLog(currRecord.Valore);
StateHasChanged();
}
}
protected async Task update(FluxLogDTO selRec)
{
var alert = await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare TUTTE le modifiche? queste saranno parte del dossier inviato all'impianto");
if (alert)
{
await Task.Delay(1);
if (currRecord != null)
{
// serializzo valore x flux log...
DossierFluxLogDTO updatedResult = new DossierFluxLogDTO() { ODL = listaFlux };
string newVal = JsonConvert.SerializeObject(updatedResult);
currRecord.Valore = newVal;
// METODO PER UPDATE FLUX
await MDService.DossiersUpdateValore(currRecord);
currFluxLogDto = null;
isEditing = false;
await Task.Delay(1);
StateHasChanged();
}
return;
}
else
{
currFluxLogDto = null;
await Task.Delay(1);
await JSRuntime.InvokeAsync<bool>("location.reload");
}
}
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
MessageService.EA_PageUpdated += MessageService_EA_PageUpdated;
MessageService.EA_SearchUpdated += OnSeachUpdated;
ListStati = await MDService.AnagStatiComm(); ListStati = await MDService.AnagStatiComm();
await reloadData(true); await reloadData(true);
} }
@@ -121,6 +193,19 @@ namespace MP.SPEC.Components
currRecord = null; currRecord = null;
await reloadData(true); await reloadData(true);
} }
private string css()
{
string answ = "";
if (isEditing)
{
answ = "visible";
}
else
{
answ = "hidden";
}
return answ;
}
#endregion Protected Methods #endregion Protected Methods
@@ -142,8 +227,14 @@ namespace MP.SPEC.Components
private int currPage private int currPage
{ {
get => MessageService.currPage; get => SelFilter.CurrPage;
set => MessageService.currPage = value; set => SelFilter.CurrPage = value;
}
private bool isEditing
{
get => SelFilter.isEditing;
set => SelFilter.isEditing = value;
} }
private bool isLoading { get; set; } = false; private bool isLoading { get; set; } = false;
@@ -157,8 +248,8 @@ namespace MP.SPEC.Components
private int numRecord private int numRecord
{ {
get => MessageService.numRecord; get => SelFilter.NumRec;
set => MessageService.numRecord = value; set => SelFilter.NumRec = value;
} }
private string SelArticolo private string SelArticolo
@@ -166,9 +257,13 @@ namespace MP.SPEC.Components
get => SelFilter.CodArticolo; get => SelFilter.CodArticolo;
} }
private DateTime SelDtRef private DateTime SelDtEnd
{ {
get => SelFilter.DtRef; get => SelFilter.DtEnd;
}
private DateTime SelDtStart
{
get => SelFilter.DtStart;
} }
private string SelMacchina private string SelMacchina
@@ -195,15 +290,10 @@ namespace MP.SPEC.Components
#region Private Methods #region Private Methods
private async void MessageService_EA_PageUpdated()
{
await reloadData(true);
}
private async Task reloadData(bool setChanged) private async Task reloadData(bool setChanged)
{ {
isLoading = true; isLoading = true;
SearchRecords = await MDService.DossiersGetLastFilt(SelMacchina, SelArticolo, SelDtRef, MaxRecord); SearchRecords = await MDService.DossiersGetLastFilt(SelMacchina, SelArticolo, SelDtStart, SelDtEnd);
totalCount = SearchRecords.Count; totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1); await Task.Delay(1);
@@ -234,10 +324,13 @@ namespace MP.SPEC.Components
return answ; return answ;
} }
private async Task unToggleTableFlux() private async Task closeTableFlux()
{ {
currFluxLogDto = null;
currRecord = null; currRecord = null;
visualizzaFlux = true; visualizzaFlux = true;
isEditing = false;
await RecordSelFlux.InvokeAsync(currFluxLogDto);
await Task.Delay(1); await Task.Delay(1);
} }
+16 -5
View File
@@ -198,6 +198,17 @@ else
</div> </div>
} }
</td> </td>
<td>
<div class="input-group input-group-sm">
<div class="input-group-text">
<span class="me-1 @leftStringCSS">Tutti gli Stati</span>
<span class="form-check form-check-sm form-switch py-1" title="Mostra/Nascondi macchina spenta">
<input class="form-check-input" type="checkbox" id="switchSpenta" @onchange="() => toggleSpenta()" value="@hideSpenta">
</span>
<span class="@rightStringCSS">Nascondi Spenta</span>
</div>
</div>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -205,10 +216,9 @@ else
<div> <div>
@if (statRecord != null) @if (statRecord != null)
{ {
@if (ListOdlStatsAct != null)
@if (ListOdlStats != null)
{ {
@foreach (var stat in ListOdlStats) @foreach (var stat in ListOdlStatsAct)
{ {
<div class="p-1"> <div class="p-1">
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
@@ -234,11 +244,12 @@ else
@if (statRecord != null && ListOdlStats != null) @if (statRecord != null && ListOdlStats != null)
{ {
<div class="dcBox"> <div class="dcBox">
<ODLPlot SelectedOdl="@statRecord.IdxOdl"></ODLPlot> <ODLPlot SelectedOdl="@statRecord.IdxOdl" hideSpenta="@hideSpenta"></ODLPlot>
</div> </div>
<div class="dcBox dcOverlay d-flex"> <div class="dcBox dcOverlay d-flex">
<div class="align-self-center text-center w-100"> <div class="align-self-center text-center w-100">
<b class="fs-3">@statRecord.DurataMinuti</b> <b class="fs-3">@durataFilt</b>
@*<b class="fs-3">@statRecord.DurataMinuti</b>*@
</div> </div>
</div> </div>
} }
+102 -28
View File
@@ -3,6 +3,7 @@ using Microsoft.JSInterop;
using MP.Data.DatabaseModels; using MP.Data.DatabaseModels;
using MP.SPEC.Data; using MP.SPEC.Data;
using MP.SPEC.Services; using MP.SPEC.Services;
using NLog;
namespace MP.SPEC.Components namespace MP.SPEC.Components
{ {
@@ -45,6 +46,7 @@ namespace MP.SPEC.Components
ListRecords = null; ListRecords = null;
ListStati = null; ListStati = null;
ListOdlStats = null; ListOdlStats = null;
ListOdlStatsNetto = null;
statRecord = null; statRecord = null;
GC.Collect(); GC.Collect();
} }
@@ -84,8 +86,9 @@ namespace MP.SPEC.Components
{ {
// effettua chiusura sul DB // effettua chiusura sul DB
await MDService.ODLClose(currRecord.IdxOdl, currRecord.IdxMacchina, 0, true); await MDService.ODLClose(currRecord.IdxOdl, currRecord.IdxMacchina, 0, true);
Log.Info($"Effettuata chiusura ODL {currRecord.IdxOdl}");
// ricarica... // ricarica...
await selectRecord(null); await selRecord(null);
} }
await reloadData(); await reloadData();
} }
@@ -112,8 +115,9 @@ namespace MP.SPEC.Components
if (currRecord != null) if (currRecord != null)
{ {
await callSyncDb(currRecord.IdxMacchina); await callSyncDb(currRecord.IdxMacchina);
Log.Info($"Richiesto forceSyncDb per idxMacc {currRecord.IdxMacchina}");
// ricarica... // ricarica...
await selectRecord(null); await selRecord(null);
} }
await reloadData(); await reloadData();
} }
@@ -140,27 +144,10 @@ namespace MP.SPEC.Components
protected async Task resetSel() protected async Task resetSel()
{ {
await selectRecord(null); await selRecord(null);
await reloadData(); await reloadData();
} }
protected async Task selectRecord(ODLModel? currRec)
{
showStats = true;
await Task.Delay(1);
currRecord = currRec;
if (currRec != null)
{
showStats = true;
ListOdlStats = await MDService.StatOdl(currRec.IdxOdl);
}
else
{
showStats = false;
ListOdlStats = null;
}
}
protected async Task selectStatRecord(ODLModel? currRec) protected async Task selectStatRecord(ODLModel? currRec)
{ {
showStats = true; showStats = true;
@@ -168,8 +155,7 @@ namespace MP.SPEC.Components
statRecord = currRec; statRecord = currRec;
if (currRec != null) if (currRec != null)
{ {
showStats = true; await reloadStatsData(currRec);
ListOdlStats = await MDService.StatOdl(currRec.IdxOdl);
} }
else else
{ {
@@ -185,11 +171,22 @@ namespace MP.SPEC.Components
currRecord = currRec; currRecord = currRec;
showStats = false; showStats = false;
ListOdlStats = null; ListOdlStats = null;
ListOdlStatsNetto = null;
}
protected async Task toggleSpenta()
{
hideSpenta = !hideSpenta;
await Task.Delay(1);
if (statRecord != null)
{
await reloadStatsData(statRecord);
}
} }
protected async Task UpdateData() protected async Task UpdateData()
{ {
await selectRecord(null); await selRecord(null);
await reloadData(); await reloadData();
} }
@@ -197,10 +194,14 @@ namespace MP.SPEC.Components
#region Private Fields #region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private ODLModel? currRecord = null; private ODLModel? currRecord = null;
private List<StatODLModel>? ListOdlStats; private List<StatODLModel>? ListOdlStats;
private List<StatODLModel>? ListOdlStatsNetto;
private List<ODLModel>? ListRecords; private List<ODLModel>? ListRecords;
private List<ListValues>? ListStati; private List<ListValues>? ListStati;
@@ -221,6 +222,39 @@ namespace MP.SPEC.Components
set => currFilter.CurrPage = value; set => currFilter.CurrPage = value;
} }
private string durataFilt
{
get
{
string answ = "ND";
if (statRecord != null)
{
if (hideSpenta)
{
if (ListOdlStatsNetto != null)
{
var tsDurata = TimeSpan.FromMinutes(ListOdlStatsNetto.Sum(x => x.TotDurata));
if (tsDurata.TotalDays < 1)
{
answ = $"{tsDurata.Hours:00}h {tsDurata.Minutes:00}'";
}
else
{
answ = $"{tsDurata.Days}gg {tsDurata.Hours:00}h";
}
}
}
else
{
answ = statRecord.DurataMinuti;
}
}
return answ;
}
}
private bool hideSpenta { get; set; } = false;
/// <summary> /// <summary>
/// Indica se si tratti di ODL correnti /// Indica se si tratti di ODL correnti
/// </summary> /// </summary>
@@ -231,12 +265,39 @@ namespace MP.SPEC.Components
private bool isLoading { get; set; } = false; private bool isLoading { get; set; } = false;
private string leftStringCSS
{
get => hideSpenta ? "text-secondary" : "text-dark fw-bold";
}
private List<StatODLModel>? ListOdlStatsAct
{
get
{
List<StatODLModel> answ = new List<StatODLModel>();
if (hideSpenta)
{
answ = ListOdlStatsNetto;
}
else
{
answ = ListOdlStats;
}
return answ;
}
}
private int numRecord private int numRecord
{ {
get => currFilter.NumRec; get => currFilter.NumRec;
set => currFilter.NumRec = value; set => currFilter.NumRec = value;
} }
private string rightStringCSS
{
get => hideSpenta ? "text-dark fw-bold" : "text-secondary";
}
private DateTime selDtFine { get; set; } = DateTime.Now; private DateTime selDtFine { get; set; } = DateTime.Now;
private bool showStats { get; set; } = false; private bool showStats { get; set; } = false;
@@ -273,6 +334,7 @@ namespace MP.SPEC.Components
} }
catch (Exception exc) catch (Exception exc)
{ {
Log.Error($"Errore durante chiamata: {Environment.NewLine}{exc}");
} }
} }
@@ -281,12 +343,9 @@ namespace MP.SPEC.Components
double answ = 0; double answ = 0;
double tot = 0; double tot = 0;
if (ListOdlStats != null) if (ListOdlStatsAct != null)
{ {
foreach (var item in ListOdlStats) tot = ListOdlStatsAct.Sum(x => x.TotDurata);
{
tot += item.TotDurata;
}
double perc = (durata / tot) * 100; double perc = (durata / tot) * 100;
if (perc > 1) if (perc > 1)
@@ -344,6 +403,21 @@ namespace MP.SPEC.Components
isLoading = false; isLoading = false;
} }
private async Task reloadStatsData(ODLModel? currRec)
{
showStats = true;
if (currRec != null)
{
ListOdlStats = await MDService.StatOdl(currRec.IdxOdl);
ListOdlStatsNetto = ListOdlStats.Where(x => x.Semaforo != "sGr").ToList();
}
else
{
ListOdlStats = null;
ListOdlStatsNetto = null;
}
}
private string tradFase(string codFase) private string tradFase(string codFase)
{ {
string answ = codFase; string answ = codFase;
+8 -20
View File
@@ -25,7 +25,7 @@ namespace MP.SPEC.Components
#endregion Public Properties #endregion Public Properties
#region Public Methods #region Public Methods
private SelectFluxParams lastFilter { get; set; } = new SelectFluxParams() { CurrPage = -1 };
public string checkSelect(FluxLog selRecord) public string checkSelect(FluxLog selRecord)
{ {
string answ = ""; string answ = "";
@@ -45,10 +45,10 @@ namespace MP.SPEC.Components
{ {
await Task.Delay(1); await Task.Delay(1);
// se sono cambiati --> rileggo... // se sono cambiati --> rileggo...
if (LastFilter==null || !SelFilter.Equals(LastFilter)) if (!lastFilter.Equals(SelFilter))
{ {
await reloadData(false); lastFilter = SelFilter.clone();
LastFilter = SelFilter; await reloadData(true);
} }
} }
@@ -58,8 +58,6 @@ namespace MP.SPEC.Components
public void Dispose() public void Dispose()
{ {
aTimer.Elapsed -= ElapsedTimer; aTimer.Elapsed -= ElapsedTimer;
MessageService.EA_PageUpdated -= MessageService_EA_PageUpdated;
MessageService.EA_SearchUpdated -= OnSeachUpdated;
aTimer.Stop(); aTimer.Stop();
aTimer.Dispose(); aTimer.Dispose();
currRecord = null; currRecord = null;
@@ -128,9 +126,6 @@ namespace MP.SPEC.Components
[Inject] [Inject]
protected MpDataService MDService { get; set; } = null!; protected MpDataService MDService { get; set; } = null!;
[Inject]
protected MessageService MessageService { get; set; } = null!;
protected int RefreshPeriod protected int RefreshPeriod
{ {
get => SelFilter.TempoAgg; get => SelFilter.TempoAgg;
@@ -142,8 +137,6 @@ namespace MP.SPEC.Components
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
MessageService.EA_PageUpdated += MessageService_EA_PageUpdated;
MessageService.EA_SearchUpdated += OnSeachUpdated;
StartTimer(); StartTimer();
} }
@@ -197,8 +190,8 @@ namespace MP.SPEC.Components
private int currPage private int currPage
{ {
get => MessageService.currPage; get => SelFilter.CurrPage;
set => MessageService.currPage = value; set => SelFilter.CurrPage = value;
} }
private bool isLoading { get; set; } = false; private bool isLoading { get; set; } = false;
@@ -215,8 +208,8 @@ namespace MP.SPEC.Components
private int numRecord private int numRecord
{ {
get => MessageService.numRecord; get => SelFilter.NumRec;
set => MessageService.numRecord = value; set => SelFilter.NumRec = value;
} }
private string SelFlux private string SelFlux
@@ -250,11 +243,6 @@ namespace MP.SPEC.Components
#region Private Methods #region Private Methods
private async void MessageService_EA_PageUpdated()
{
await reloadData(true);
}
#endregion Private Methods #endregion Private Methods
} }
} }
+25 -8
View File
@@ -3,6 +3,7 @@ using Microsoft.JSInterop;
using MP.Data.DatabaseModels; using MP.Data.DatabaseModels;
using MP.SPEC.Data; using MP.SPEC.Data;
using MP.SPEC.Services; using MP.SPEC.Services;
using NLog;
namespace MP.SPEC.Components namespace MP.SPEC.Components
{ {
@@ -13,8 +14,6 @@ namespace MP.SPEC.Components
[Parameter] [Parameter]
public SelectPOdlParams actFilter { get; set; } = new SelectPOdlParams(); public SelectPOdlParams actFilter { get; set; } = new SelectPOdlParams();
private SelectPOdlParams lastFilter { get; set; } = new SelectPOdlParams() { CurrPage = -1 };
[Parameter] [Parameter]
public EventCallback<bool> PagerResetReq { get; set; } public EventCallback<bool> PagerResetReq { get; set; }
@@ -43,8 +42,6 @@ namespace MP.SPEC.Components
return answ; return answ;
} }
#endregion Public Methods
public void Dispose() public void Dispose()
{ {
currRecord = null; currRecord = null;
@@ -54,6 +51,8 @@ namespace MP.SPEC.Components
GC.Collect(); GC.Collect();
} }
#endregion Public Methods
#region Protected Properties #region Protected Properties
[Inject] [Inject]
@@ -211,12 +210,21 @@ namespace MP.SPEC.Components
#region Private Fields #region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private PODLModel? currRecord = null; private PODLModel? currRecord = null;
private List<PODLModel>? ListRecords; private List<PODLModel>? ListRecords;
private List<ListValues>? ListStati; private List<ListValues>? ListStati;
/// <summary>
/// scadenza validità lista ODL correnti
/// </summary>
private DateTime odlCurrExp = DateTime.Now.AddMinutes(-1);
/// <summary>
/// Elenco ODL correnti...
/// </summary>
private List<string> odlCurrList = new List<string>();
private List<PODLModel>? SearchRecords; private List<PODLModel>? SearchRecords;
#endregion Private Fields #endregion Private Fields
@@ -232,6 +240,7 @@ namespace MP.SPEC.Components
} }
private bool isLoading { get; set; } = false; private bool isLoading { get; set; } = false;
private SelectPOdlParams lastFilter { get; set; } = new SelectPOdlParams() { CurrPage = -1 };
private int numRecord private int numRecord
{ {
@@ -282,6 +291,7 @@ namespace MP.SPEC.Components
} }
catch (Exception exc) catch (Exception exc)
{ {
Log.Error($"Errore durante chiamata: {Environment.NewLine}{exc}");
} }
} }
@@ -325,8 +335,15 @@ namespace MP.SPEC.Components
/// <returns></returns> /// <returns></returns>
private bool canStartOdl(string idxMacchina) private bool canStartOdl(string idxMacchina)
{ {
var listOdlCurr = MDService.OdlGetCurrent(); // controllo se lista scaduta...
bool answ = !listOdlCurr.Contains(idxMacchina); bool answ = false;
DateTime adesso = DateTime.Now;
if (adesso > odlCurrExp || odlCurrList == null || odlCurrList.Count == 0)
{
odlCurrList = MDService.OdlGetCurrent();
odlCurrExp = adesso.AddSeconds(2);
}
answ = !odlCurrList.Contains(idxMacchina);
return answ; return answ;
} }
+35 -17
View File
@@ -1,14 +1,25 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels; using MP.Data.DatabaseModels;
using MP.SPEC.Components;
using MP.SPEC.Data; using MP.SPEC.Data;
namespace MP.SPEC.Components namespace MP.SPEC.Components
{ {
public partial class ODLPlot public partial class ODLPlot
{ {
#region Public Properties #region Public Fields
public List<DoughnutStyling> colors = new List<DoughnutStyling>();
public List<double> Data = new List<double>();
public List<string> Labels = new List<string>();
#endregion Public Fields
#region Public Properties
[Parameter]
public bool hideSpenta { get; set; }
public int OdlId public int OdlId
{ {
@@ -29,34 +40,36 @@ namespace MP.SPEC.Components
//protected DataLogFilter _SelFilter { get; set; } = new DataLogFilter(); //protected DataLogFilter _SelFilter { get; set; } = new DataLogFilter();
protected int _selParam { get; set; } = -1; protected int _selParam { get; set; } = -1;
[Inject]
protected MpDataService MDService { get; set; } = null!;
#endregion Protected Properties #endregion Protected Properties
#region Protected Methods #region Protected Methods
private bool isLoading { get; set; } = false;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
isLoading = true; isLoading = true;
await Task.Delay(1); await Task.Delay(1);
} }
private List<StatODLModel>? ListRecords = null;
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
await ReloadData(); await ReloadData();
await Task.Delay(1); await Task.Delay(1);
} }
public List<double> Data = new List<double>();
public List<string> Labels = new List<string>();
public List<DoughnutStyling> colors = new List<DoughnutStyling>();
protected async Task ReloadData() protected async Task ReloadData()
{ {
Data.Clear(); Data.Clear();
Labels.Clear(); Labels.Clear();
colors.Clear(); colors.Clear();
ListRecords = await MDService.StatOdl(SelectedOdl); ListRecords = await MDService.StatOdl(SelectedOdl);
// se hideSpenta --> filtro stato 11 = spenta...
if (hideSpenta)
{
ListRecords = ListRecords.Where(x => x.Semaforo != "sGr").ToList();
}
foreach (var record in ListRecords) foreach (var record in ListRecords)
{ {
Data.Add(record.TotDurata); Data.Add(record.TotDurata);
@@ -73,18 +86,23 @@ namespace MP.SPEC.Components
{ {
colors.Add(new DoughnutStyling(record.Css, "ccc")); colors.Add(new DoughnutStyling(record.Css, "ccc"));
} }
} }
await Task.Delay(1); await Task.Delay(1);
isLoading = false; isLoading = false;
} }
[Inject]
protected MpDataService MDService { get; set; } = null!;
#endregion Protected Methods #endregion Protected Methods
#region Private Fields
private List<StatODLModel>? ListRecords = null;
#endregion Private Fields
#region Private Properties
private bool isLoading { get; set; } = false;
#endregion Private Properties
} }
} }
-1
View File
@@ -1,7 +1,6 @@
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<div class="d-flex justify-content-between pt-1 mb-1"> <div class="d-flex justify-content-between pt-1 mb-1">
<div class="px-2"> <div class="px-2">
@if (!liveUpdate) @if (!liveUpdate)
{ {
<button class="btn btn-secondary" type="button" @onclick="() => toggleUpdate()" title="Click per tornare a Valori Live"> <button class="btn btn-secondary" type="button" @onclick="() => toggleUpdate()" title="Click per tornare a Valori Live">
+7 -5
View File
@@ -168,7 +168,10 @@ namespace MP.SPEC.Components
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
SelFilter = new SelectFluxParams(); SelFilter = new SelectFluxParams();
ListMacchine = await MDService.MacchineWithFlux(); setDtMax();
DateTime dtStart = SelFilter.dtMin != null ? (DateTime)SelFilter.dtMin : DateTime.Now.AddDays(-7);
DateTime dtEnd = SelFilter.dtMax != null ? (DateTime)SelFilter.dtMax : DateTime.Now;
ListMacchine = await MDService.MacchineWithFlux(dtStart, dtEnd);
ListFlux = await MDService.ParametriGetFilt(selMacchina); ListFlux = await MDService.ParametriGetFilt(selMacchina);
var configData = await MDService.ConfigGetAll(); var configData = await MDService.ConfigGetAll();
@@ -186,7 +189,7 @@ namespace MP.SPEC.Components
// copio il filtro // copio il filtro
var currFilt = SelFilter; var currFilt = SelFilter;
// fermo update // fermo update
//currFilt.LiveUpdate = false; currFilt.LiveUpdate = true;
currFilt.CurrPage = 0; currFilt.CurrPage = 0;
currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}"; currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
currFilt.dtMax = RoundDatetime(5); currFilt.dtMax = RoundDatetime(5);
@@ -210,9 +213,8 @@ namespace MP.SPEC.Components
// se non ho data rif uso adesso... // se non ho data rif uso adesso...
DateTime dtMax = selDtMax == null ? RoundDatetime(5) : (DateTime)selDtMax; DateTime dtMax = selDtMax == null ? RoundDatetime(5) : (DateTime)selDtMax;
DateTime dtMin = selDtMin == null ? RoundDatetime(5).AddHours(-numOreAnticipoSnapshot) : (DateTime)selDtMin; DateTime dtMin = selDtMin == null ? RoundDatetime(5).AddHours(-numOreAnticipoSnapshot) : (DateTime)selDtMin;
// aggiungo 2 sec // aggiungo 15 sec
dtMax = dtMax.AddSeconds(15); dtMax = dtMax.AddSeconds(15);
//dtMin = dtMin.AddMinutes(-30);
await MDService.DossiersTakeParamsSnapshotLast(selMacchina, dtMin, dtMax); await MDService.DossiersTakeParamsSnapshotLast(selMacchina, dtMin, dtMax);
lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}"; lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
// indico snapshot fatto // indico snapshot fatto
@@ -267,7 +269,7 @@ namespace MP.SPEC.Components
// copio il filtro // copio il filtro
var currFilt = SelFilter; var currFilt = SelFilter;
// fermo update // fermo update
currFilt.LiveUpdate = false; currFilt.LiveUpdate = (value == null);
currFilt.CurrPage = 0; currFilt.CurrPage = 0;
currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}"; currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
currFilt.dtMax = value; currFilt.dtMax = value;
+88 -22
View File
@@ -82,7 +82,7 @@ namespace MP.SPEC.Data
else else
{ {
result = await Task.FromResult(dbController.AnagStatiComm()); result = await Task.FromResult(dbController.AnagStatiComm());
// serializzp e salvo... // serializzo e salvo...
rawData = JsonConvert.SerializeObject(result); rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(redisStatoCom, rawData, getRandTOut(redisLongTimeCache)); await redisDb.StringSetAsync(redisStatoCom, rawData, getRandTOut(redisLongTimeCache));
stopWatch.Stop(); stopWatch.Stop();
@@ -113,7 +113,7 @@ namespace MP.SPEC.Data
else else
{ {
result = await Task.FromResult(dbController.AnagTipoArtLV()); result = await Task.FromResult(dbController.AnagTipoArtLV());
// serializzp e salvo... // serializzo e salvo...
rawData = JsonConvert.SerializeObject(result); rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(redisTipoArt, rawData, getRandTOut(redisLongTimeCache)); await redisDb.StringSetAsync(redisTipoArt, rawData, getRandTOut(redisLongTimeCache));
stopWatch.Stop(); stopWatch.Stop();
@@ -148,7 +148,7 @@ namespace MP.SPEC.Data
else else
{ {
result = await Task.FromResult(dbController.ArticleWithDossier()); result = await Task.FromResult(dbController.ArticleWithDossier());
// serializzp e salvo... // serializzo e salvo...
rawData = JsonConvert.SerializeObject(result); rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache)); redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
} }
@@ -277,7 +277,7 @@ namespace MP.SPEC.Data
else else
{ {
result = await Task.FromResult(dbController.ConfigGetAll()); result = await Task.FromResult(dbController.ConfigGetAll());
// serializzp e salvo... // serializzo e salvo...
rawData = JsonConvert.SerializeObject(result); rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(redisConfKey, rawData, getRandTOut(redisLongTimeCache)); await redisDb.StringSetAsync(redisConfKey, rawData, getRandTOut(redisLongTimeCache));
stopWatch.Stop(); stopWatch.Stop();
@@ -341,16 +341,16 @@ namespace MP.SPEC.Data
/// macchina (ordinato x data registrazione) /// macchina (ordinato x data registrazione)
/// </summary> /// </summary>
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param> /// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
/// <param name="DtRef">Data di riferimento (Massima) per estrazione records</param> /// <param name="DtStart">Data minima per estrazione records</param>
/// <param name="MaxRec">numero massimo record da restituire</param> /// <param name="DtEnd">Data Massima per estrazione records</param>
/// <returns></returns> /// <returns></returns>
public async Task<List<Dossiers>> DossiersGetLastFilt(string IdxMacchina, string CodArticolo, DateTime DtRef, int MaxRec) public async Task<List<Dossiers>> DossiersGetLastFilt(string IdxMacchina, string CodArticolo, DateTime DtStart, DateTime DtEnd)
{ {
List<Dossiers>? result = new List<Dossiers>(); List<Dossiers>? result = new List<Dossiers>();
Stopwatch stopWatch = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
stopWatch.Start(); stopWatch.Start();
string readType = "DB"; string readType = "DB";
string currKey = $"{redisDossByMac}:{IdxMacchina}:{CodArticolo}:{DtRef}:{MaxRec}"; string currKey = $"{redisDossByMac}:{IdxMacchina}:{CodArticolo}:{DtStart:yyyyMMddHHmm}:{DtEnd:yyyyMMddHHmm}";
// cerco in redis dato valore sel macchina... // cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey); RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue) if (rawData.HasValue)
@@ -360,8 +360,8 @@ namespace MP.SPEC.Data
} }
else else
{ {
result = await Task.FromResult(dbController.DossiersGetLastFilt(IdxMacchina, CodArticolo, DtRef, MaxRec)); result = await Task.FromResult(dbController.DossiersGetLastFilt(IdxMacchina, CodArticolo, DtStart, DtEnd));
// serializzp e salvo... // serializzo e salvo...
rawData = JsonConvert.SerializeObject(result); rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache / 5)); redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache / 5));
} }
@@ -468,13 +468,33 @@ namespace MP.SPEC.Data
/// <returns></returns> /// <returns></returns>
public async Task<List<FluxLog>> FluxLogGetLastFilt(DateTime DtMax, string IdxMacchina, string CodFlux, int MaxRec) public async Task<List<FluxLog>> FluxLogGetLastFilt(DateTime DtMax, string IdxMacchina, string CodFlux, int MaxRec)
{ {
List<FluxLog>? result = new List<FluxLog>();
Stopwatch stopWatch = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
stopWatch.Start(); stopWatch.Start();
var results = await Task.FromResult(dbController.FluxLogGetLastFilt(DtMax, IdxMacchina, CodFlux, MaxRec)); string readType = "DB";
string currKey = $"{redisFluxLogFilt}:{IdxMacchina}:{CodFlux}:{MaxRec}:{DtMax:yyyyMMdd}:{DtMax:HHmm}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<FluxLog>>($"{rawData}");
readType = "REDIS";
}
else
{
result = await Task.FromResult(dbController.FluxLogGetLastFilt(DtMax, IdxMacchina, CodFlux, MaxRec));
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(10));
}
if (result == null)
{
result = new List<FluxLog>();
}
stopWatch.Stop(); stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed; TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"FluxLogGetLastFilt | Read from DB: {ts.TotalMilliseconds}ms"); Log.Debug($"FluxLogGetLastFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
return results; return result;
} }
/// <summary> /// <summary>
@@ -546,7 +566,35 @@ namespace MP.SPEC.Data
/// <returns></returns> /// <returns></returns>
public async Task<List<PODLModel>> ListPODLFilt(string codArt, string keyRichPart) public async Task<List<PODLModel>> ListPODLFilt(string codArt, string keyRichPart)
{ {
return await Task.FromResult(dbController.ListPODLFilt(codArt, keyRichPart)); List<PODLModel>? result = new List<PODLModel>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{redisPOdlList}:{codArt}:{keyRichPart}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<PODLModel>>($"{rawData}");
readType = "REDIS";
}
else
{
result = await Task.FromResult(dbController.ListPODLFilt(codArt, keyRichPart));
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(3));
}
if (result == null)
{
result = new List<PODLModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ListPODLFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
} }
/// <summary> /// <summary>
@@ -570,7 +618,7 @@ namespace MP.SPEC.Data
else else
{ {
result = await Task.FromResult(dbController.MacchineGetAll()); result = await Task.FromResult(dbController.MacchineGetAll());
// serializzp e salvo... // serializzo e salvo...
rawData = JsonConvert.SerializeObject(result); rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache)); redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
} }
@@ -585,16 +633,18 @@ namespace MP.SPEC.Data
} }
/// <summary> /// <summary>
/// Elenco ID macchine con dati FluxLog gestite /// Elenco id Macchine che abbiano dati FLuxLog, nel periodo indicato
/// </summary> /// </summary>
/// <param name="dtStart"></param>
/// <param name="dtEnd"></param>
/// <returns></returns> /// <returns></returns>
public async Task<List<string>> MacchineWithFlux() public async Task<List<string>> MacchineWithFlux(DateTime dtStart, DateTime dtEnd)
{ {
List<string>? result = new List<string>(); List<string>? result = new List<string>();
Stopwatch stopWatch = new Stopwatch(); Stopwatch stopWatch = new Stopwatch();
stopWatch.Start(); stopWatch.Start();
string readType = "DB"; string readType = "DB";
string currKey = redisMacByFlux; string currKey = $"{redisMacByFlux}:{dtStart:yyyyMMddHHmm}:{dtEnd:yyyyMMddHHmm}";
// cerco in redis dato valore sel macchina... // cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey); RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue) if (rawData.HasValue)
@@ -604,8 +654,8 @@ namespace MP.SPEC.Data
} }
else else
{ {
result = await dbController.MacchineWithFlux(); result = await dbController.MacchineWithFlux(dtStart, dtEnd);
// serializzp e salvo... // serializzo e salvo...
rawData = JsonConvert.SerializeObject(result); rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache)); redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
} }
@@ -728,7 +778,7 @@ namespace MP.SPEC.Data
else else
{ {
result = await Task.FromResult(dbController.ParametriGetFilt(IdxMacchina)); result = await Task.FromResult(dbController.ParametriGetFilt(IdxMacchina));
// serializzp e salvo... // serializzo e salvo...
rawData = JsonConvert.SerializeObject(result); rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache)); redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
} }
@@ -779,7 +829,12 @@ namespace MP.SPEC.Data
/// <returns></returns> /// <returns></returns>
public async Task<bool> POdlUpdateRecord(PODLModel currRec) public async Task<bool> POdlUpdateRecord(PODLModel currRec)
{ {
return await dbController.PODLUpdateRecord(currRec); var dbResult = await dbController.PODLUpdateRecord(currRec);
// elimino cache redis...
RedisValue pattern = new RedisValue($"{redisPOdlList}:*");
bool answ = await ExecFlushRedisPattern(pattern);
return dbResult;
} }
/// <summary> /// <summary>
@@ -831,6 +886,15 @@ namespace MP.SPEC.Data
return answ; return answ;
} }
public async Task<bool> DossiersUpdateValore(Dossiers currDoss)
{
// aggiorno record sul DB
bool answ = await dbController.DossiersUpdateValore(currDoss);
return answ;
}
#endregion Public Methods #endregion Public Methods
#region Protected Fields #region Protected Fields
@@ -868,6 +932,8 @@ namespace MP.SPEC.Data
private const string redisMacByFlux = redisBaseAddr + "SPEC:Cache:MacByFlux"; private const string redisMacByFlux = redisBaseAddr + "SPEC:Cache:MacByFlux";
private const string redisMacList = redisBaseAddr + "SPEC:Cache:MacList"; private const string redisMacList = redisBaseAddr + "SPEC:Cache:MacList";
private const string redisPOdlList = redisBaseAddr + "SPEC:Cache:POdlList";
private const string redisFluxLogFilt = redisBaseAddr + "SPEC:Cache:FluxLogFilt";
private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom"; private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom";
+74
View File
@@ -0,0 +1,74 @@
namespace MP.SPEC.Data
{
public class SelectArticoliParams
{
#region Public Constructors
public SelectArticoliParams()
{ }
#endregion Public Constructors
#region Public Properties
public int CurrPage { get; set; } = 1;
public string IdxMacchina { get; set; } = "*";
public string Azienda { get; set; } = "*";
public int MaxRecord { get; set; } = 100;
public int NumRec { get; set; } = 10;
public int TotCount { get; set; } = 0;
#endregion Public Properties
#region Public Methods
public SelectArticoliParams clone()
{
SelectArticoliParams clonedData = new SelectArticoliParams()
{
CurrPage = this.CurrPage,
IdxMacchina = this.IdxMacchina,
Azienda = this.Azienda,
MaxRecord = this.MaxRecord,
NumRec = this.NumRec,
TotCount = this.TotCount
};
return clonedData;
}
public override bool Equals(object obj)
{
if (!(obj is SelectArticoliParams item))
return false;
if (MaxRecord != item.MaxRecord)
return false;
if (NumRec != item.NumRec)
return false;
if (TotCount != item.TotCount)
return false;
if (CurrPage != item.CurrPage)
return false;
if (IdxMacchina != item.IdxMacchina)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
}
+29 -17
View File
@@ -1,4 +1,6 @@
namespace MP.SPEC.Data using MP.Data;
namespace MP.SPEC.Data
{ {
public class SelectDossierParams public class SelectDossierParams
{ {
@@ -13,29 +15,35 @@
public int CurrPage { get; set; } = 1; public int CurrPage { get; set; } = 1;
public DateTime DtRef { get; set; } = InitDatetime(5); public DateTime DtEnd { get; set; } = Utils.InitDatetime(DateTime.Now, 5);
public DateTime DtStart { get; set; } = Utils.InitDatetime(DateTime.Now, 5).AddDays(-730);
public string IdxMacchina { get; set; } = "*"; public string IdxMacchina { get; set; } = "*";
public string CodArticolo { get; set; } = "*"; public string CodArticolo { get; set; } = "*";
public int NumRec { get; set; } = 10;
public int TotCount { get; set; } = 0;
public int MaxRecord { get; set; } = 100; public int MaxRecord { get; set; } = 100;
public bool isEditing { get; set; } = false;
#endregion Public Properties #endregion Public Properties
#region Public Methods #region Public Methods
public SelectDossierParams clone()
/// <summary>
/// Inizializzazione con periodo e arrotondamento
/// </summary>
/// <param name="minRound"></param>
/// <returns></returns>
public static DateTime InitDatetime(int minRound)
{ {
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today); SelectDossierParams clonedData = new SelectDossierParams()
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound; {
DateTime endRounded = DateTime.Today.AddMinutes(minDay); DtEnd = this.DtEnd,
return endRounded; DtStart = this.DtStart,
CurrPage = this.CurrPage,
IdxMacchina = this.IdxMacchina,
CodArticolo = this.CodArticolo,
MaxRecord = this.MaxRecord,
NumRec = this.NumRec,
TotCount = this.TotCount
};
return clonedData;
} }
public override bool Equals(object obj) public override bool Equals(object obj)
@@ -52,14 +60,18 @@
if (MaxRecord != item.MaxRecord) if (MaxRecord != item.MaxRecord)
return false; return false;
if (DtRef != item.DtRef) if (TotCount != item.TotCount)
return false;
if (NumRec != item.NumRec)
return false;
if (DtEnd != item.DtEnd)
return false; return false;
if (CurrPage != item.CurrPage) if (CurrPage != item.CurrPage)
return false; return false;
//if (lastUpdate != item.lastUpdate)
// return false;
return true; return true;
} }
+27 -2
View File
@@ -19,14 +19,33 @@
public string IdxMacchina { get; set; } = "*"; public string IdxMacchina { get; set; } = "*";
public string lastUpdate { get; set; } = "-"; public string lastUpdate { get; set; } = "-";
public bool LiveUpdate { get; set; } = true; public bool LiveUpdate { get; set; } = true;
public int NumRec { get; set; } = 10;
public int MaxRecord { get; set; } = 100; public int MaxRecord { get; set; } = 100;
public int TempoAgg { get; set; } = 10000; public int TempoAgg { get; set; } = 10000;
public int TotCount { get; set; } = 0;
#endregion Public Properties #endregion Public Properties
#region Public Methods #region Public Methods
public SelectFluxParams clone()
{
SelectFluxParams clonedData = new SelectFluxParams()
{
CodFlux = this.CodFlux,
CurrPage = this.CurrPage,
dtRif = this.dtRif,
dtMax = this.dtMax,
dtMin = this.dtMin,
IdxMacchina = this.IdxMacchina,
lastUpdate = this.lastUpdate,
LiveUpdate = this.LiveUpdate,
NumRec = this.NumRec,
MaxRecord = this.MaxRecord,
TotCount = this.TotCount,
TempoAgg = this.TempoAgg
};
return clonedData;
}
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if (!(obj is SelectFluxParams item)) if (!(obj is SelectFluxParams item))
@@ -46,6 +65,12 @@
if (TempoAgg != item.TempoAgg) if (TempoAgg != item.TempoAgg)
return false; return false;
if (NumRec!= item.NumRec)
return false;
if (TotCount!= item.TotCount)
return false;
if (CurrPage != item.CurrPage) if (CurrPage != item.CurrPage)
return false; return false;
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace> <RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2210.1817</Version> <Version>6.16.2210.2014</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
+7 -11
View File
@@ -24,9 +24,11 @@ namespace MP.SPEC.Pages
return answ; return answ;
} }
private SelectArticoliParams currFilter = new SelectArticoliParams();
public void Dispose() public void Dispose()
{ {
MessageService.EA_SearchUpdated -= OnSeachUpdated; //MessageService.EA_SearchUpdated -= OnSeachUpdated;
currRecord = null; currRecord = null;
ListTipoArt = null; ListTipoArt = null;
ListAziende = null; ListAziende = null;
@@ -55,9 +57,6 @@ namespace MP.SPEC.Pages
[Inject] [Inject]
protected MpDataService MDService { get; set; } = null!; protected MpDataService MDService { get; set; } = null!;
[Inject]
protected MessageService MessageService { get; set; } = null!;
[Inject] [Inject]
protected NavigationManager NavManager { get; set; } protected NavigationManager NavManager { get; set; }
@@ -131,9 +130,6 @@ namespace MP.SPEC.Pages
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
numRecord = 10; numRecord = 10;
// mostro ricerca
MessageService.ShowSearch = true;
MessageService.EA_SearchUpdated += OnSeachUpdated;
configData = await MDService.ConfigGetAll(); configData = await MDService.ConfigGetAll();
var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA"); var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA");
if (currRec != null) if (currRec != null)
@@ -172,14 +168,14 @@ namespace MP.SPEC.Pages
{ {
Azienda = selRec.Azienda, Azienda = selRec.Azienda,
CodArticolo = selRec.CodArticolo, CodArticolo = selRec.CodArticolo,
DescArticolo = $"CLONE - { selRec.DescArticolo }", DescArticolo = $"CLONE - {selRec.DescArticolo}",
Disegno = selRec.Disegno, Disegno = selRec.Disegno,
Tipo=selRec.Tipo Tipo = selRec.Tipo
}; };
currRecord = newRec; currRecord = newRec;
await Task.Delay(1); await Task.Delay(1);
} }
protected async Task update(AnagArticoli selRec) protected async Task update(AnagArticoli selRec)
{ {
@@ -294,7 +290,7 @@ namespace MP.SPEC.Pages
private async Task reloadData() private async Task reloadData()
{ {
isLoading = true; isLoading = true;
SearchRecords = await MDService.ArticoliGetSearch(100000, selAzienda, MessageService.SearchVal); SearchRecords = await MDService.ArticoliGetSearch(100000, selAzienda, "*");
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
isLoading = false; isLoading = false;
} }
+9 -65
View File
@@ -21,72 +21,16 @@
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
@if (currDetFluxLogRecord != null) @if (isLoading)
{ {
<div class="row"> <LoadingData></LoadingData>
<div class="col-12"> }
<div class="card mb-5"> else
<div class="card-header bg-primary text-light">Modifica Parametro</div> {
<div class="card-body"> <ListDossiers SelFilter="@currFilter" RecordSel="@selRecordDoss" TotRecordChanged="updateTotal"></ListDossiers>
<div class="row">
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">MACCHINA</span>
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currDetFluxLogRecord.IdxMacchina">
</div>
</div>
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">DATA</span>
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currDetFluxLogRecord.dtEvento">
</div>
</div>
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">DATA TYPE</span>
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currDetFluxLogRecord.CodFlux">
</div>
</div>
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">VALORE</span>
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currDetFluxLogRecord.ValoreEdit">
</div>
</div>
</div>
<div class="row pt-4">
<div class="col-3 pe-0">
</div>
<div class="col-3 pe-0">
</div>
<div class="col-3 pe-0">
<div class="d-grid gap-2">
<button @onclick="() => cancel()" class="btn btn-warning">Annulla <i class="bi bi-x-circle"></i></button>
</div>
</div>
<div class="col-3 pe-0">
<div class="d-grid gap-2">
<button @onclick="() => update(currDetFluxLogRecord)" class="btn btn-success">Save <i class="bi bi-save"></i></button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
} }
</div> </div>
@if (isLoading) <div class="card-footer py-1">
{ <DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
<LoadingData></LoadingData> </div>
}
else
{
<ListDossiers SelFilter="@currFilter" RecordSel="@selRecordDoss" RecordSelFlux="@selRecordFlux" TotRecordChanged="updateTotal"></ListDossiers>
}
</div> </div>
<div class="card-footer py-1">
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div>
+32 -37
View File
@@ -23,19 +23,11 @@ namespace MP.SPEC.Pages
[Inject] [Inject]
protected MpDataService MDService { get; set; } = null!; protected MpDataService MDService { get; set; } = null!;
[Inject]
protected MessageService MsgService { get; set; } = null!;
#endregion Protected Properties #endregion Protected Properties
#region Protected Methods #region Protected Methods
protected async Task cancel()
{
currDetFluxLogRecord = null;
await Task.Delay(1);
}
protected void ForceReload(int newNum) protected void ForceReload(int newNum)
{ {
numRecord = newNum; numRecord = newNum;
@@ -51,9 +43,6 @@ namespace MP.SPEC.Pages
{ {
isLoading = true; isLoading = true;
isFiltering = true; isFiltering = true;
// disabilito ricerca...
MsgService.SearchVal = "";
MsgService.ShowSearch = false;
// fix pagina // fix pagina
await Task.Delay(1); await Task.Delay(1);
var modFilter = currFilter; var modFilter = currFilter;
@@ -69,25 +58,23 @@ namespace MP.SPEC.Pages
await Task.Delay(1); await Task.Delay(1);
} }
protected async Task selRecordFlux(FluxLogDTO selRec) private string css()
{ {
currDetFluxLogRecord = selRec; string answ = "";
await Task.Delay(1); if (isEditing == false)
{
answ = "hidden";
}
else
{
answ = "visible";
}
return answ;
} }
protected async Task update(FluxLogDTO selRec) private void enableEditing()
{ {
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare le modifiche? queste saranno parte del dossier inviato all'impianto")) isEditing = true;
return;
await Task.Delay(1);
if (currRecordDoss != null)
{
// METODO PER UPDATE FLUX
await MDService.updateDossierValue(currRecordDoss, selRec);
}
currDetFluxLogRecord = null;
await Task.Delay(1);
} }
protected void updateTotal(int newTotCount) protected void updateTotal(int newTotCount)
@@ -105,18 +92,14 @@ namespace MP.SPEC.Pages
#region Private Properties #region Private Properties
private FluxLogDTO? currDetFluxLogRecord
{
get => _currDetFluxLogRecord;
set { _currDetFluxLogRecord = value; }
}
private SelectDossierParams currFilter { get; set; } = new SelectDossierParams(); private SelectDossierParams currFilter { get; set; } = new SelectDossierParams();
private int currPage private int currPage
{ {
get => MsgService.currPage; get => currFilter.CurrPage;
set => MsgService.currPage = value; set => currFilter.CurrPage = value;
} }
private Dossiers? currRecordDoss { get; set; } = null; private Dossiers? currRecordDoss { get; set; } = null;
@@ -125,11 +108,19 @@ namespace MP.SPEC.Pages
private int numRecord private int numRecord
{ {
get => MsgService.numRecord; get => currFilter.NumRec;
set => MsgService.numRecord = value; set => currFilter.NumRec = value;
}
private bool isEditing
{
get => currFilter.isEditing;
set => currFilter.isEditing = value;
}
private int totalCount
{
get => currFilter.TotCount;
set => currFilter.TotCount = value;
} }
private int totalCount { get; set; } = 0;
#endregion Private Properties #endregion Private Properties
@@ -146,6 +137,10 @@ namespace MP.SPEC.Pages
currFilter = newParams; currFilter = newParams;
isLoading = false; isLoading = false;
} }
protected void UpdateTotCount(int newTotCount)
{
totalCount = newTotCount;
}
#endregion Private Methods #endregion Private Methods
} }
+1 -1
View File
@@ -85,7 +85,7 @@ namespace MP.SPEC.Pages
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
ListStati = await MDService.AnagStatiComm(); ListStati = await MDService.AnagStatiComm();
ListMacchine = await MDService.MacchineWithFlux(); ListMacchine = await MDService.MacchineWithFlux(currFilter.DtStart, currFilter.DtEnd);
} }
protected async Task pgResetReq(bool doReset) protected async Task pgResetReq(bool doReset)
+1 -3
View File
@@ -25,12 +25,10 @@
} }
else else
{ {
<ListPARAMS SelFilter="@currFilter" TotRecordChanged="@updateTotal" RecordSel="@detailSel"></ListPARAMS> <ListPARAMS SelFilter="@currFilter" TotRecordChanged="@UpdateTotCount" RecordSel="@detailSel"></ListPARAMS>
} }
</div> </div>
<div class="card-footer py-1"> <div class="card-footer py-1">
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" /> <DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div> </div>
</div> </div>
+9 -11
View File
@@ -15,8 +15,6 @@ namespace MP.SPEC.Pages
#region Protected Properties #region Protected Properties
[Inject]
protected MessageService MsgService { get; set; } = null!;
#endregion Protected Properties #endregion Protected Properties
@@ -43,9 +41,6 @@ namespace MP.SPEC.Pages
{ {
isLoading = true; isLoading = true;
isFiltering = true; isFiltering = true;
// disabilito ricerca...
MsgService.SearchVal = "";
MsgService.ShowSearch = false;
// fix pagina // fix pagina
await Task.Delay(1); await Task.Delay(1);
var modFilter = currFilter; var modFilter = currFilter;
@@ -100,8 +95,8 @@ namespace MP.SPEC.Pages
private int currPage private int currPage
{ {
get => MsgService.currPage; get => currFilter.CurrPage;
set => MsgService.currPage = value; set => currFilter.CurrPage = value;
} }
private bool isFiltering { get; set; } = false; private bool isFiltering { get; set; } = false;
@@ -109,8 +104,8 @@ namespace MP.SPEC.Pages
private int numRecord private int numRecord
{ {
get => MsgService.numRecord; get => currFilter.NumRec;
set => MsgService.numRecord = value; set => currFilter.NumRec = value;
} }
private int totalCount { get; set; } = 0; private int totalCount { get; set; } = 0;
@@ -128,7 +123,7 @@ namespace MP.SPEC.Pages
if (newParams.CurrPage == 0) if (newParams.CurrPage == 0)
{ {
newParams.CurrPage = 1; newParams.CurrPage = 1;
newParams.LiveUpdate = false; //newParams.LiveUpdate = false;
} }
else else
{ {
@@ -139,7 +134,10 @@ namespace MP.SPEC.Pages
currFilter = newParams; currFilter = newParams;
isLoading = false; isLoading = false;
} }
protected void UpdateTotCount(int newTotCount)
{
totalCount = newTotCount;
}
#endregion Private Methods #endregion Private Methods
} }
} }
+26 -14
View File
@@ -4,6 +4,7 @@ using MP.Data.DatabaseModels;
using MP.SPEC.Components; using MP.SPEC.Components;
using MP.SPEC.Data; using MP.SPEC.Data;
using MP.SPEC.Services; using MP.SPEC.Services;
using NLog;
namespace MP.SPEC.Pages namespace MP.SPEC.Pages
{ {
@@ -150,6 +151,9 @@ namespace MP.SPEC.Pages
await callSyncDb(selRec); await callSyncDb(selRec);
currRecord = null; currRecord = null;
await reloadData(); await reloadData();
// forzo update parametri
await Task.Delay(1);
currFase = "*";
await Task.Delay(1); await Task.Delay(1);
} }
@@ -162,6 +166,7 @@ namespace MP.SPEC.Pages
#region Private Fields #region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private PODLModel? _currRecord = null; private PODLModel? _currRecord = null;
private List<AnagArticoli>? ListArticoli; private List<AnagArticoli>? ListArticoli;
private List<AnagGruppi>? ListAziende; private List<AnagGruppi>? ListAziende;
@@ -223,6 +228,19 @@ namespace MP.SPEC.Pages
} }
} }
private string currFase
{
get => currFilter.CodFase;
set
{
if (!currFilter.CodFase.Equals(value))
{
currFilter.CodFase = value;
currPage = 1;
}
}
}
private SelectPOdlParams currFilter { get; set; } = new SelectPOdlParams(); private SelectPOdlParams currFilter { get; set; } = new SelectPOdlParams();
private int currPage private int currPage
@@ -249,19 +267,6 @@ namespace MP.SPEC.Pages
set => currFilter.NumRec = value; set => currFilter.NumRec = value;
} }
private string currFase
{
get => currFilter.CodFase;
set
{
if (!currFilter.CodFase.Equals(value))
{
currFilter.CodFase = value;
currPage = 1;
}
}
}
private int totalCount private int totalCount
{ {
get => currFilter.TotCount; get => currFilter.TotCount;
@@ -282,7 +287,14 @@ namespace MP.SPEC.Pages
// chiamo aggiunta task SyncDb... // chiamo aggiunta task SyncDb...
string idxMacc = selRec.IdxMacchina; string idxMacc = selRec.IdxMacchina;
string restUrl = $"IOB/addTask2Exe/{idxMacc}?taskName=syncDbData&taskVal="; string restUrl = $"IOB/addTask2Exe/{idxMacc}?taskName=syncDbData&taskVal=";
var response = await MpIoApiCall.callMpIoUrlGet(restUrl); try
{
var response = await MpIoApiCall.callMpIoUrlGet(restUrl);
}
catch (Exception exc)
{
Log.Error($"Errore durante chiamata: {Environment.NewLine}{exc}");
}
} }
private async Task reloadData() private async Task reloadData()
+1 -1
View File
@@ -1,6 +1,6 @@
<body> <body>
<i>Modulo MAPOSPEC </i> <i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2210.1817</h4> <h4>Versione: 6.16.2210.2014</h4>
<br /> Note di rilascio: <br /> Note di rilascio:
<ul> <ul>
<li> <li>
+1 -1
View File
@@ -1 +1 @@
6.16.2210.1817 6.16.2210.2014
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<item> <item>
<version>6.16.2210.1817</version> <version>6.16.2210.2014</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url> <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> <changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory> <mandatory>false</mandatory>
+7
View File
@@ -1,5 +1,6 @@
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using MP.SPEC.Data; using MP.SPEC.Data;
using NLog;
using System.Text.Json; using System.Text.Json;
namespace MP.SPEC.Services namespace MP.SPEC.Services
@@ -18,6 +19,9 @@ namespace MP.SPEC.Services
private static IConfiguration _configuration = null!; private static IConfiguration _configuration = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
private static string MpIoBaseUrl = ""; private static string MpIoBaseUrl = "";
public IOApiService(IHttpClientFactory clientFactory, IConfiguration configuration, ILogger<MpDataService> logger) public IOApiService(IHttpClientFactory clientFactory, IConfiguration configuration, ILogger<MpDataService> logger)
@@ -40,15 +44,18 @@ namespace MP.SPEC.Services
var request = new HttpRequestMessage(HttpMethod.Get, $"{MpIoBaseUrl}{relUrl}"); var request = new HttpRequestMessage(HttpMethod.Get, $"{MpIoBaseUrl}{relUrl}");
request.Headers.Add("Accept", "application/vnd.github.v3+json"); request.Headers.Add("Accept", "application/vnd.github.v3+json");
var client = _clientFactory.CreateClient(); var client = _clientFactory.CreateClient();
Log.Info($"Richiesta call per {MpIoBaseUrl}{relUrl}");
var response = await client.SendAsync(request); var response = await client.SendAsync(request);
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
var stringResponse = await response.Content.ReadAsStringAsync(); var stringResponse = await response.Content.ReadAsStringAsync();
result = stringResponse; result = stringResponse;
Log.Info($"Richiesta call per {MpIoBaseUrl}{relUrl}");
} }
else else
{ {
result = "NO"; result = "NO";
Log.Error($"Errore in chaimata | code {response.StatusCode} | {response.Content}");
} }
return result; return result;
} }
+6
View File
@@ -5,5 +5,11 @@
"Default": "Information", "Default": "Information",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
},
"ServerConf": {
"maxAge": "2000",
"cacheCheckArtUsato": 2,
"redisLongTimeCache": 15,
"MpIoBaseUrl": "https://iis01.egalware.com/MP/IO/"
} }
} }
+15
View File
@@ -0,0 +1,15 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ServerConf": {
"maxAge": "2000",
"cacheCheckArtUsato": 2,
"redisLongTimeCache": 15,
"MpIoBaseUrl": "http://localhost/MP/IO/"
}
}