Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 98119d4818 | |||
| ed2c694abd | |||
| c70ce33f26 | |||
| 03eb82c7b2 | |||
| 7655e340eb | |||
| 443a56cc07 | |||
| 06390295d2 | |||
| a3f5855b4a |
@@ -502,12 +502,13 @@ namespace MP.Data.Controllers
|
||||
/// <summary>
|
||||
/// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione)
|
||||
/// </summary>
|
||||
/// <param name="DtMax">Data massima (recupera eventi antecedenti)</param>
|
||||
/// <param name="DtMax">Data massima x eventi</param>
|
||||
/// <param name="DtMin">Data minima x eventi</param>
|
||||
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
|
||||
/// <param name="CodFlux">*=tutti, altrimenti solo selezionato</param>
|
||||
/// <param name="MaxRec">numero massimo record da restituire</param>
|
||||
/// <returns></returns>
|
||||
public List<FluxLog> FluxLogGetLastFilt(DateTime DtMax, string IdxMacchina, string CodFlux, int MaxRec)
|
||||
public List<FluxLog> FluxLogGetLastFilt(DateTime DtMax, DateTime DtMin, string IdxMacchina, string CodFlux, int MaxRec)
|
||||
{
|
||||
List<FluxLog> dbResult = new List<FluxLog>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
@@ -515,7 +516,7 @@ namespace MP.Data.Controllers
|
||||
dbResult = dbCtx
|
||||
.DbSetFluxLog
|
||||
.AsNoTracking()
|
||||
.Where(x => (x.dtEvento <= DtMax) && (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodFlux == "*" || x.CodFlux == CodFlux))
|
||||
.Where(x => (x.dtEvento >= DtMin && x.dtEvento <= DtMax) && (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodFlux == "*" || x.CodFlux == CodFlux))
|
||||
.OrderByDescending(x => x.dtEvento)
|
||||
.Take(MaxRec)
|
||||
.ToList();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.EntityFrameworkCore.Query.Internal;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.DTO;
|
||||
@@ -42,30 +41,7 @@ namespace MP.SPEC.Components
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
private bool selectFirst(string idxMacchina)
|
||||
{
|
||||
//string firstMacchina = "";
|
||||
bool answ = false;
|
||||
if (ListMacchine != null)
|
||||
{
|
||||
if (idxMacchina == idxMacchina)
|
||||
{
|
||||
answ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = false;
|
||||
}
|
||||
|
||||
//var rawData = ListMacchine.Select(x => x.IdxMacchina).FirstOrDefault();
|
||||
//firstMacchina = rawData != null ? rawData : "";
|
||||
}
|
||||
//if (firstMacchina == idxMacchina)
|
||||
//{
|
||||
// answ = true;
|
||||
//}
|
||||
return answ;
|
||||
}
|
||||
public string checkSelPar(FluxLogDTO recordSel)
|
||||
{
|
||||
string answ = "";
|
||||
@@ -89,6 +65,15 @@ namespace MP.SPEC.Components
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
public async Task flushCache()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await MDService.FlushRedisCache();
|
||||
await Task.Delay(1);
|
||||
// rimando a pagina corrente
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
@@ -143,7 +128,7 @@ namespace MP.SPEC.Components
|
||||
IdxMacchina = selRec.IdxMacchina,
|
||||
CodArticolo = selRec.CodArticolo,
|
||||
IdxODL = 0,
|
||||
Valore = selRec.Valore,
|
||||
Valore = selRec.Valore
|
||||
};
|
||||
currRecordClone = newRec;
|
||||
await Task.Delay(1);
|
||||
@@ -175,7 +160,7 @@ namespace MP.SPEC.Components
|
||||
|
||||
protected async Task newDossier(DossierModel selRec)
|
||||
{
|
||||
var alert = await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler creare un nuovo Dossier per l'impianto/articolo selezioanto?");
|
||||
var alert = await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler creare un nuovo Dossier per l'impianto/articolo selezionato?");
|
||||
|
||||
if (alert)
|
||||
{
|
||||
@@ -187,7 +172,6 @@ namespace MP.SPEC.Components
|
||||
DossierFluxLogDTO? valoreDeserializzato = JsonConvert.DeserializeObject<DossierFluxLogDTO>(selRec.Valore);
|
||||
if (valoreDeserializzato != null)
|
||||
{
|
||||
|
||||
listaFlux = valoreDeserializzato
|
||||
.ODL
|
||||
.OrderBy(x => x.CodFlux)
|
||||
@@ -200,6 +184,7 @@ namespace MP.SPEC.Components
|
||||
{
|
||||
item.IdxMacchina = selRec.IdxMacchina;
|
||||
item.Valore = "0";
|
||||
item.ValoreEdit = "0";
|
||||
item.dtEvento = DateTime.Now;
|
||||
}
|
||||
}
|
||||
@@ -212,13 +197,12 @@ namespace MP.SPEC.Components
|
||||
currRecordClone.CodArticolo = selRec.CodArticolo;
|
||||
currRecordClone.KeyRichiesta = selRec.KeyRichiesta;
|
||||
currRecordClone.Valore = newVal;
|
||||
// METODO PER UPDATE FLUX
|
||||
// METODO PER INSERT DOSSIER + FLUX
|
||||
await MDService.DossiersInsert(currRecordClone);
|
||||
//await reloadData(true);
|
||||
currRecordClone = null;
|
||||
isEditing = false;
|
||||
await Task.Delay(1);
|
||||
StateHasChanged();
|
||||
await flushCache();
|
||||
}
|
||||
return;
|
||||
@@ -227,8 +211,7 @@ namespace MP.SPEC.Components
|
||||
{
|
||||
currRecordClone = null;
|
||||
await Task.Delay(1);
|
||||
// TOGLIERE!!!!!
|
||||
NavManager.NavigateTo("DOSS", true);
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,18 +299,16 @@ namespace MP.SPEC.Components
|
||||
|
||||
private DossierModel? currRecordClone = null;
|
||||
|
||||
private List<AnagArticoli>? ListArticoli;
|
||||
private List<AnagGruppi>? ListGruppiFase;
|
||||
|
||||
private List<Macchine>? ListMacchine;
|
||||
private List<DossierModel>? ListRecords;
|
||||
|
||||
private List<ListValues>? ListStati;
|
||||
|
||||
private List<DossierModel>? SearchRecords;
|
||||
|
||||
private List<Macchine>? ListMacchine;
|
||||
|
||||
private List<AnagArticoli>? ListArticoli;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
@@ -413,14 +394,7 @@ namespace MP.SPEC.Components
|
||||
await RecordSelFlux.InvokeAsync(currFluxLogDto);
|
||||
await Task.Delay(1);
|
||||
}
|
||||
public async Task flushCache()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await MDService.FlushRedisCache();
|
||||
await Task.Delay(1);
|
||||
// rimando a pagina corrente
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
|
||||
private string css()
|
||||
{
|
||||
string answ = "";
|
||||
|
||||
@@ -93,12 +93,18 @@ namespace MP.SPEC.Components
|
||||
public async Task reloadData(bool setChanged)
|
||||
{
|
||||
isLoading = true;
|
||||
DateTime limitData = DateTime.Now;
|
||||
DateTime dataFrom = DateTime.Today.AddMonths(-1);
|
||||
DateTime dataTo = DateTime.Now.AddMinutes(5);
|
||||
if (SelFilter != null && SelFilter.dtMin != null)
|
||||
{
|
||||
dataFrom = (DateTime)SelFilter.dtMin;
|
||||
}
|
||||
if (SelDtMax != null)
|
||||
{
|
||||
limitData = (DateTime)SelDtMax;
|
||||
dataTo = (DateTime)SelDtMax;
|
||||
}
|
||||
SearchRecords = await MDService.FluxLogGetLastFilt(limitData, SelMacchina, SelFlux, MaxRecord);
|
||||
|
||||
SearchRecords = await MDService.FluxLogGetLastFilt(dataTo, dataFrom, SelMacchina, SelFlux, MaxRecord);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
@@ -157,7 +163,6 @@ namespace MP.SPEC.Components
|
||||
protected async Task resetSel()
|
||||
{
|
||||
currRecord = null;
|
||||
setDtMax();
|
||||
await RecordSel.InvokeAsync(null);
|
||||
}
|
||||
|
||||
@@ -240,31 +245,7 @@ namespace MP.SPEC.Components
|
||||
get => SelFilter.dtMax;
|
||||
set => SelFilter.dtMax = value;
|
||||
}
|
||||
protected void setDtMax()
|
||||
{
|
||||
// copio il filtro
|
||||
var currFilt = SelFilter;
|
||||
// fermo update
|
||||
//currFilt.LiveUpdate = true;
|
||||
currFilt.CurrPage = 0;
|
||||
currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
|
||||
currFilt.dtMax = RoundDatetime(5);
|
||||
currFilt.dtMin = RoundDatetime(5).AddHours(-25);
|
||||
SelFilter = currFilt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzazione con periodo e arrotondamento
|
||||
/// </summary>
|
||||
/// <param name="minRound"></param>
|
||||
/// <returns></returns>
|
||||
public static DateTime RoundDatetime(int minRound)
|
||||
{
|
||||
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
|
||||
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
|
||||
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
|
||||
return endRounded;
|
||||
}
|
||||
private int totalCount
|
||||
{
|
||||
get => _totalCount;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Components
|
||||
@@ -24,10 +25,7 @@ namespace MP.SPEC.Components
|
||||
/// <returns></returns>
|
||||
public static DateTime RoundDatetime(int minRound)
|
||||
{
|
||||
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
|
||||
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
|
||||
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
|
||||
return endRounded;
|
||||
return Utils.InitDatetime(DateTime.Now, minRound);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@@ -172,9 +170,9 @@ namespace MP.SPEC.Components
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
SelFilter = new SelectFluxParams();
|
||||
setDtMax();
|
||||
DateTime dtStart = SelFilter.dtMin != null ? (DateTime)SelFilter.dtMin : DateTime.Now.AddDays(-7);
|
||||
DateTime dtEnd = SelFilter.dtMax != null ? (DateTime)SelFilter.dtMax : DateTime.Now;
|
||||
setDtSnap();
|
||||
DateTime dtStart = SelFilter.dtMin != null ? (DateTime)SelFilter.dtMin : DateTime.Now.AddMonths(-1);
|
||||
DateTime dtEnd = SelFilter.dtMax != null ? (DateTime)SelFilter.dtMax : DateTime.Today.AddDays(1);
|
||||
ListMacchine = await MDService.MacchineWithFlux(dtStart, dtEnd);
|
||||
ListFlux = await MDService.ParametriGetFilt(selMacchina);
|
||||
|
||||
@@ -190,7 +188,7 @@ namespace MP.SPEC.Components
|
||||
await FilterChanged.InvokeAsync(SelFilter);
|
||||
}
|
||||
|
||||
protected void setDtMax()
|
||||
protected void setDtSnap()
|
||||
{
|
||||
// copio il filtro
|
||||
var currFilt = SelFilter;
|
||||
@@ -199,7 +197,7 @@ namespace MP.SPEC.Components
|
||||
currFilt.CurrPage = 0;
|
||||
currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
|
||||
currFilt.dtMax = RoundDatetime(5);
|
||||
currFilt.dtMin = RoundDatetime(5).AddHours(-numOreAnticipoSnapshot);
|
||||
currFilt.dtSnapMin = RoundDatetime(5).AddHours(-numOreAnticipoSnapshot);
|
||||
SelFilter = currFilt;
|
||||
}
|
||||
|
||||
@@ -226,7 +224,7 @@ namespace MP.SPEC.Components
|
||||
liveUpdate = false;
|
||||
// se non ho data rif uso adesso...
|
||||
DateTime dtMax = selDtMax == null ? RoundDatetime(5) : (DateTime)selDtMax;
|
||||
DateTime dtMin = selDtMin == null ? RoundDatetime(5).AddHours(-numOreAnticipoSnapshot) : (DateTime)selDtMin;
|
||||
DateTime dtMin = selDtSnapMin == null ? RoundDatetime(5).AddHours(-numOreAnticipoSnapshot) : (DateTime)selDtSnapMin;
|
||||
// aggiungo 15 sec
|
||||
dtMax = dtMax.AddSeconds(15);
|
||||
await MDService.DossiersTakeParamsSnapshotLast(selMacchina, dtMin, dtMax);
|
||||
@@ -314,6 +312,19 @@ namespace MP.SPEC.Components
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime? selDtSnapMin
|
||||
{
|
||||
get => SelFilter.dtSnapMin;
|
||||
set
|
||||
{
|
||||
if (SelFilter.dtSnapMin != value)
|
||||
{
|
||||
SelFilter.dtSnapMin = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool showEditPar { get; set; } = false;
|
||||
|
||||
private string snapMode
|
||||
|
||||
@@ -160,7 +160,9 @@ namespace MP.SPEC.Data
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ArticoliDeleteRecord(AnagArticoli currRec)
|
||||
{
|
||||
return await dbController.ArticoliDeleteRecord(currRec);
|
||||
bool fatto = await dbController.ArticoliDeleteRecord(currRec);
|
||||
await resetCacheArticoli();
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -207,7 +209,9 @@ namespace MP.SPEC.Data
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ArticoliUpdateRecord(AnagArticoli currRec)
|
||||
{
|
||||
return await dbController.ArticoliUpdateRecord(currRec);
|
||||
bool fatto = await dbController.ArticoliUpdateRecord(currRec);
|
||||
await resetCacheArticoli();
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -505,18 +509,19 @@ namespace MP.SPEC.Data
|
||||
/// <summary>
|
||||
/// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione)
|
||||
/// </summary>
|
||||
/// <param name="DtMax">Data massima (recupera eventi antecedenti)</param>
|
||||
/// <param name="DtMax">Data massima x eventi</param>
|
||||
/// <param name="DtMin">Data minima x eventi</param>
|
||||
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
|
||||
/// <param name="CodFlux">*=tutti, altrimenti solo selezionato</param>
|
||||
/// <param name="MaxRec">numero massimo record da restituire</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<FluxLog>> FluxLogGetLastFilt(DateTime DtMax, string IdxMacchina, string CodFlux, int MaxRec)
|
||||
public async Task<List<FluxLog>> FluxLogGetLastFilt(DateTime DtMax, DateTime DtMin, string IdxMacchina, string CodFlux, int MaxRec)
|
||||
{
|
||||
List<FluxLog>? result = new List<FluxLog>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
string currKey = $"{redisFluxLogFilt}:{IdxMacchina}:{CodFlux}:{MaxRec}:{DtMax:yyyyMMdd}:{DtMax:HHmm}";
|
||||
string currKey = $"{redisFluxLogFilt}:{IdxMacchina}:{CodFlux}:{MaxRec}:{DtMax:yyyyMMddHHmm}:{DtMin:yyyyMMddHHmm}";
|
||||
// cerco in redis dato valore sel macchina...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
@@ -526,7 +531,7 @@ namespace MP.SPEC.Data
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.FluxLogGetLastFilt(DtMax, IdxMacchina, CodFlux, MaxRec));
|
||||
result = await Task.FromResult(dbController.FluxLogGetLastFilt(DtMax, DtMin, IdxMacchina, CodFlux, MaxRec));
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(10));
|
||||
@@ -1098,6 +1103,14 @@ namespace MP.SPEC.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
private async Task resetCacheArticoli()
|
||||
{
|
||||
RedisValue pattern = new RedisValue($"{redisArtByDossier}:*");
|
||||
await ExecFlushRedisPattern(pattern);
|
||||
pattern = new RedisValue($"{redisArtList}:*");
|
||||
await ExecFlushRedisPattern(pattern);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,11 @@
|
||||
#region Public Constructors
|
||||
|
||||
public SelectFluxParams()
|
||||
{ }
|
||||
{
|
||||
dtMin = DateTime.Today.AddMonths(-1);
|
||||
dtMax = DateTime.Today.AddDays(1);
|
||||
dtSnapMin = DateTime.Today.AddDays(-2);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
@@ -16,6 +20,7 @@
|
||||
public DateTime? dtRif { get; set; } = null;
|
||||
public DateTime? dtMax { get; set; } = null;
|
||||
public DateTime? dtMin { get; set; } = null;
|
||||
public DateTime? dtSnapMin { get; set; } = null;
|
||||
public string IdxMacchina { get; set; } = "*";
|
||||
public string lastUpdate { get; set; } = "-";
|
||||
public bool LiveUpdate { get; set; } = true;
|
||||
@@ -36,6 +41,7 @@
|
||||
dtRif = this.dtRif,
|
||||
dtMax = this.dtMax,
|
||||
dtMin = this.dtMin,
|
||||
dtSnapMin = this.dtSnapMin,
|
||||
IdxMacchina = this.IdxMacchina,
|
||||
lastUpdate = this.lastUpdate,
|
||||
LiveUpdate = this.LiveUpdate,
|
||||
@@ -54,6 +60,18 @@
|
||||
if (IdxMacchina != item.IdxMacchina)
|
||||
return false;
|
||||
|
||||
if (dtMax != item.dtMax)
|
||||
return false;
|
||||
|
||||
if (dtMin != item.dtMin)
|
||||
return false;
|
||||
|
||||
if (dtRif != item.dtRif)
|
||||
return false;
|
||||
|
||||
if (dtSnapMin != item.dtSnapMin)
|
||||
return false;
|
||||
|
||||
if (CodFlux != item.CodFlux)
|
||||
return false;
|
||||
|
||||
@@ -65,11 +83,11 @@
|
||||
|
||||
if (TempoAgg != item.TempoAgg)
|
||||
return false;
|
||||
|
||||
if (NumRec!= item.NumRec)
|
||||
|
||||
if (NumRec != item.NumRec)
|
||||
return false;
|
||||
|
||||
if (TotCount!= item.TotCount)
|
||||
|
||||
if (TotCount != item.TotCount)
|
||||
return false;
|
||||
|
||||
if (CurrPage != item.CurrPage)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
<Version>6.16.2211.416</Version>
|
||||
<Version>6.16.2211.709</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -28,7 +28,6 @@ namespace MP.SPEC.Pages
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
//MessageService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
currRecord = null;
|
||||
ListTipoArt = null;
|
||||
ListAziende = null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2211.416</h4>
|
||||
<h4>Versione: 6.16.2211.709</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2211.416
|
||||
6.16.2211.709
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2211.416</version>
|
||||
<version>6.16.2211.709</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