Fix filtraggio macchine come obj EFCore

This commit is contained in:
Samuele Locatelli
2022-11-30 15:18:47 +01:00
parent e4fe344af9
commit b71fb360e7
9 changed files with 58 additions and 28 deletions
+39 -6
View File
@@ -695,17 +695,50 @@ namespace MP.Data.Controllers
/// <summary>
/// Elenco da tabella Macchine
/// </summary>
/// <param name="codGruppo"></param>
/// <returns></returns>
public List<Macchine> MacchineGetAll()
public List<Macchine> MacchineGetFilt(string codGruppo)
{
List<Macchine> dbResult = new List<Macchine>();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbSetMacchine
.AsNoTracking()
.OrderBy(x => x.IdxMacchina)
.ToList();
if (codGruppo == "*")
{
dbResult = dbCtx
.DbSetMacchine
.AsNoTracking()
.OrderBy(x => x.IdxMacchina)
.ToList();
}
else
{
dbResult = dbCtx
.DbSetGrp2Macc
.Where(g => g.CodGruppo == codGruppo)
.Join(dbCtx.DbSetMacchine,
g => g.IdxMacchina,
m => m.IdxMacchina,
(g, m) => m
//(m, g) => new Macchine
//{
// IdxMacchina = m.IdxMacchina,
// CodMacchina = m.CodMacchina,
// Descrizione = m.Descrizione,
// Nome = m.Nome,
// Note = m.Note,
// url = m.url,
// locazione = m.locazione,
// css = m.css,
// RowNum = m.RowNum,
// ColNum = m.ColNum
//}
)
//.Distinct()
.AsNoTracking()
.OrderBy(x => x.IdxMacchina)
.ToList();
}
}
return dbResult;
}
+1 -1
View File
@@ -227,7 +227,7 @@ namespace MP.SPEC.Components
ListStati = await MDService.AnagStatiComm();
selAzienda = await MDService.tryGetConfig("AZIENDA");
ListArticoli = await MDService.ArticoliGetSearch(100000, selAzienda, "");
ListMacchine = await MDService.MacchineGetAll();
ListMacchine = await MDService.MacchineGetFilt("*");
await reloadData(true);
}
+5 -3
View File
@@ -788,14 +788,16 @@ namespace MP.SPEC.Data
/// <summary>
/// Elenco di tutte le macchine gestite
/// </summary>
/// <param name="codGruppo"></param>
/// <returns></returns>
public async Task<List<Macchine>> MacchineGetAll()
public async Task<List<Macchine>> MacchineGetFilt(string codGruppo)
{
List<Macchine>? result = new List<Macchine>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = redisMacList;
string keyGrp = codGruppo != "*" ? codGruppo : "ALL";
string currKey = $"{redisMacList}:{keyGrp}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
@@ -805,7 +807,7 @@ namespace MP.SPEC.Data
}
else
{
result = await Task.FromResult(dbController.MacchineGetAll());
result = await Task.FromResult(dbController.MacchineGetFilt(codGruppo));
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2211.3008</Version>
<Version>6.16.2211.3015</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -111,7 +111,7 @@ namespace MP.SPEC.Pages
ListGruppiFase = allGruppiData.Where(x => x.SelEnabled).ToList();
}
ListStati = await MDService.AnagStatiComm();
ListMacchine = await MDService.MacchineGetAll();
ListMacchine = await MDService.MacchineGetFilt(selReparto);
padCodXdl = await MDService.tryGetConfig("padCodXdl");
}
+8 -13
View File
@@ -108,12 +108,14 @@ namespace MP.SPEC.Pages
{
ListGruppiFase = allGruppiData.Where(x => x.SelEnabled).ToList();
}
ListMacchine = await MDService.MacchineGetAll();
ListStati = await MDService.AnagStatiComm();
ListArticoli = await MDService.ArticoliGetSearch(100, currAzienda, artSearch);
//SearchRecords = await MDService.ListPODLFilt(hasOdl, StatoSel, macchina, selReparto, selDtStart, selDtEnd);
//ListArticoli = await MDService.ArticoliGetSearch(100, currAzienda, artSearch);
currAzienda = await MDService.tryGetConfig("AZIENDA");
padCodXdl = await MDService.tryGetConfig("padCodXdl");
}
protected override async Task OnParametersSetAsync()
{
// carico dati
await reloadData();
}
@@ -136,13 +138,6 @@ namespace MP.SPEC.Pages
/// <returns></returns>
protected async Task reqNewPODL()
{
// aggiungo record articolo
//if (SearchRecords != null)
//{
// currRecordControlli = SearchRecords.FirstOrDefault();
//}
//currArticolo = "";
if (ListArticoli != null && ListArticoli.Count > 0)
{
//var firstArt = ListArticoli.FirstOrDefault();
@@ -427,12 +422,11 @@ namespace MP.SPEC.Pages
isLoading = true;
await Task.Delay(1);
ListMacchine = await MDService.MacchineGetFilt(selReparto);
ListArticoli = await MDService.ArticoliGetSearch(100, currAzienda, artSearch);
// ListArticoli = new List<AnagArticoli>();
//}
isLoading = false;
}
protected string header
protected string header
{
get => currFilter.Header;
set => currFilter.Header = value;
@@ -444,6 +438,7 @@ namespace MP.SPEC.Pages
currPage = 1;
// salvo comunque filtro reparto x utente
await localStorage.SetItemAsync("reparto", selReparto);
await reloadData();
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
currFilter = newParams;
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2211.3008</h4>
<h4>Versione: 6.16.2211.3015</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2211.3008
6.16.2211.3015
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2211.3008</version>
<version>6.16.2211.3015</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>