aggiunta metodo per filtro podl senza ODL

This commit is contained in:
zaccaria.majid
2022-11-24 09:34:59 +01:00
parent db67889482
commit 830db57621
14 changed files with 124 additions and 16 deletions
+24
View File
@@ -589,6 +589,30 @@ namespace MP.Data.Controllers
return dbResult;
}
/// <summary>
/// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato)
/// </summary>
/// <param name="codArt">Cod articolo</param>
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
/// <returns></returns>
public List<PODLModel> ListPODLFiltNOOdl(string codArt, string keyRichPart)
{
List<PODLModel> dbResult = new List<PODLModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbSetPODL
.Where(x => (x.IdxOdl != 0) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt)))
.AsNoTracking()
.Include(m => m.MachineNav)
.Include(a => a.ArticoloNav)
.OrderByDescending(x => x.InsertDate)
.ToList();
}
return dbResult;
}
/// <summary>
/// Elenco valori ammessi x tabella/colonna
/// </summary>
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.INVE</RootNamespace>
<Version>6.16.2211.2408</Version>
<Version>6.16.2211.2409</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOINVE </i>
<h4>Versione: 6.16.2211.2408</h4>
<h4>Versione: 6.16.2211.2409</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2211.2408
6.16.2211.2409
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2211.2408</version>
<version>6.16.2211.2409</version>
<url>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+14 -1
View File
@@ -258,6 +258,11 @@ namespace MP.SPEC.Components
get => actFilter.CodFase;
set => actFilter.CodFase = value;
}
private bool hasOdl
{
get => actFilter.hasOdl;
set => actFilter.hasOdl = value;
}
private int totalCount
{
@@ -383,8 +388,16 @@ namespace MP.SPEC.Components
private async Task reloadData()
{
ListRecords = null;
isLoading = true;
SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel);
if (hasOdl)
{
SearchRecords = await MDService.ListPODLFiltNOOdl(SearchVal, StatoSel);
}
else
{
SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel);
}
totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
+39
View File
@@ -644,6 +644,44 @@ namespace MP.SPEC.Data
return result;
}
/// <summary>
/// Elenco PODL avviati filtrati x articolo, KeyRich (che contiene stato)
/// </summary>
/// <param name="codArt">Cod articolo</param>
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
/// <returns></returns>
public async Task<List<PODLModel>> ListPODLFiltNOOdl(string codArt, string keyRichPart)
{
List<PODLModel>? result = new List<PODLModel>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{redisPOdlListNOOdl}:{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.ListPODLFiltNOOdl(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($"ListPODLFiltNOOdl | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Elenco di tutte le macchine gestite
/// </summary>
@@ -1113,6 +1151,7 @@ namespace MP.SPEC.Data
private const string redisPOdlByOdl = redisBaseAddr + "SPEC:Cache:POdlByOdl";
private const string redisPOdlByPOdl = redisBaseAddr + "SPEC:Cache:POdlByPOdl";
private const string redisPOdlList = redisBaseAddr + "SPEC:Cache:POdlList";
private const string redisPOdlListNOOdl = redisBaseAddr + "SPEC:Cache:POdlListNOOdl";
private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom";
private const string redisTipoArt = redisBaseAddr + "SPEC:Cache:TipoArt";
+6 -1
View File
@@ -26,6 +26,7 @@ namespace MP.SPEC.Data
public string SearchVal { get; set; } = "*";
public int TotCount { get; set; } = 0;
public bool hasOdl { get; set; } = true;
#endregion Public Properties
@@ -41,7 +42,8 @@ namespace MP.SPEC.Data
MaxRecord = this.MaxRecord,
NumRec = this.NumRec,
SearchVal = this.SearchVal,
TotCount = this.TotCount
TotCount = this.TotCount,
hasOdl = this.hasOdl
};
return clonedData;
}
@@ -72,6 +74,9 @@ namespace MP.SPEC.Data
if (SearchVal != item.SearchVal)
return false;
if (hasOdl != item.hasOdl)
return false;
return true;
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2211.2317</Version>
<Version>6.16.2211.2409</Version>
</PropertyGroup>
<ItemGroup>
+13 -2
View File
@@ -6,9 +6,20 @@
<div class="d-flex justify-content-between">
<div class="col-6 col-lg-8">
<div class="d-flex">
<div class="px-2">
<div class="px-2 col-5">
<h3><b>P</b>romesse <b>ODL</b></h3>
</div>
<div class="col-2 align-content-center">
<div class="input-group input-group-sm">
<div class="input-group-text">
<span class="me-1">Con ODL</span>
<div class="form-check form-check-sm form-switch py-1" title="Parameter View Mode (RealTime / LogData)">
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" @onclick="()=> toggle()">
</div>
<span class="">Senza ODL</span>
</div>
</div>
</div>
<div class="px-2">
@if (addEnabled)
{
@@ -17,7 +28,7 @@
</div>
</div>
</div>
<div class="col-6 col-lg-4">
<div class="col-5 col-lg-4">
<div class="input-group input-group-sm">
@*<label class="input-group-text" for="maxRecord" title="Selezionare l'azienda da visualizzare"><i class="fa-solid fa-industry"></i></label>
<select @bind="@currAzienda" class="form-select" title="Selezionare l'azienda da visualizzare">
+20 -4
View File
@@ -101,10 +101,10 @@ namespace MP.SPEC.Pages
protected async Task reqNewPODL()
{
// aggiungo record articolo
if (SearchRecords != null)
{
currRecordControlli = SearchRecords.FirstOrDefault();
}
//if (SearchRecords != null)
//{
// currRecordControlli = SearchRecords.FirstOrDefault();
//}
//currArticolo = "";
if (ListArticoli != null && ListArticoli.Count > 0)
@@ -212,6 +212,11 @@ namespace MP.SPEC.Pages
}
}
protected async Task toggle()
{
hasOdl = !hasOdl;
await Task.Delay(1);
}
private bool selectFirst(string idxMacchina)
{
string firstMacchina = "";
@@ -273,7 +278,18 @@ namespace MP.SPEC.Pages
get => currFilter.CurrPage;
set => currFilter.CurrPage = value;
}
private bool hasOdl
{
get => currFilter.hasOdl;
set
{
if (currFilter.hasOdl != value)
{
currFilter.hasOdl = value;
}
}
}
private PODLModel? currRecord
{
get => _currRecord;
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2211.2317</h4>
<h4>Versione: 6.16.2211.2409</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2211.2317
6.16.2211.2409
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2211.2317</version>
<version>6.16.2211.2409</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>