Merge branch 'Release/FIxArtInsertDelete'
This commit is contained in:
@@ -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
|
||||
@@ -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)
|
||||
@@ -212,13 +196,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 +210,7 @@ namespace MP.SPEC.Components
|
||||
{
|
||||
currRecordClone = null;
|
||||
await Task.Delay(1);
|
||||
// TOGLIERE!!!!!
|
||||
NavManager.NavigateTo("DOSS", true);
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,18 +298,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 +393,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);
|
||||
|
||||
@@ -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,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
<Version>6.16.2211.416</Version>
|
||||
<Version>6.16.2211.417</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.417</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2211.416
|
||||
6.16.2211.417
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2211.416</version>
|
||||
<version>6.16.2211.417</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