Update editing insMan
This commit is contained in:
@@ -5,31 +5,31 @@
|
||||
@if (showDetail)
|
||||
{
|
||||
<div class="col-12 px-1 bg-gradient py-2">
|
||||
<div class="row">
|
||||
@if (DayMinTot < 1440)
|
||||
{
|
||||
<div class="col-3 my-2">
|
||||
<button class="btn btn-success w-100" @onclick="() => AddNew(true)" title="Inserisci produzione"><i class="fa-solid fa-plus"></i> Produzione</button>
|
||||
</div>
|
||||
<div class="col-3 my-2">
|
||||
<button class="btn btn-warning w-100" @onclick="() => AddNew(false)" title="Inserisci Fermata"><i class="fa-solid fa-plus"></i> Fermata</button>
|
||||
</div>
|
||||
<div class="col-3 my-2">
|
||||
<button class="btn btn-secondary w-100" @onclick="() => FixMissing()" title="Riempi periodi mancanti"><i class="fa-solid fa-fill-drip"></i> Spenta <i class="fa-solid fa-fill-drip"></i></button>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-9 my-2">
|
||||
</div>
|
||||
}
|
||||
<div class="col-3 my-2">
|
||||
<button class="btn btn-outline-light w-100" @onclick="@CloseDet"><i class="fa-solid fa-xmark"></i> Close</button>
|
||||
</div>
|
||||
</div>
|
||||
@if (EditRecord == null)
|
||||
{
|
||||
if (SeqStatus != null && SeqStatus.Count() > 0)
|
||||
<div class="row">
|
||||
@if (DayMinTot < 1440)
|
||||
{
|
||||
<div class="col-3 my-2">
|
||||
<button class="btn btn-success w-100" @onclick="() => AddNew(true)" title="Inserisci produzione"><i class="fa-solid fa-plus"></i> Produzione</button>
|
||||
</div>
|
||||
<div class="col-3 my-2">
|
||||
<button class="btn btn-warning w-100" @onclick="() => AddNew(false)" title="Inserisci Fermata"><i class="fa-solid fa-plus"></i> Fermata</button>
|
||||
</div>
|
||||
<div class="col-3 my-2">
|
||||
<button class="btn btn-secondary w-100" @onclick="() => FixMissing()" title="Riempi periodi mancanti"><i class="fa-solid fa-fill-drip"></i> Spenta <i class="fa-solid fa-fill-drip"></i></button>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-9 my-2">
|
||||
</div>
|
||||
}
|
||||
<div class="col-3 my-2">
|
||||
<button class="btn btn-outline-light w-100" @onclick="@CloseDet"><i class="fa-solid fa-xmark"></i> Close</button>
|
||||
</div>
|
||||
</div>
|
||||
@if (SeqStatus != null && SeqStatus.Count() > 0)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@@ -54,61 +54,66 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
@if(EditRecord.IsWork)
|
||||
{
|
||||
<div class="col-6 col-lg-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@EditRecord.KeyRichiesta"></input>
|
||||
<label>Commessa</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-lg-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@EditRecord.CodArticolo"></input>
|
||||
<label>Articolo</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 col-lg-2 my-2">
|
||||
<div class="form-floating">
|
||||
<input type="time" class="form-control" id="floatingComm" @bind="@EditRecord.InizioStato"></input>
|
||||
<label for="floatingComm">Inizio</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 col-lg-2 my-2">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" id="floatingComm" @bind="@EditRecord.PzBuoni"></input>
|
||||
<label for="floatingComm">Pezzi</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 col-lg-2 my-2">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" id="floatingComm" @bind="@EditRecord.TCiclo"></input>
|
||||
<label for="floatingComm">T.Ciclo</label>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-12 col-lg-6">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@EditRecord.KeyRichiesta"></input>
|
||||
<label>Tipo Fermata</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 col-lg-2 my-2">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" id="floatingComm" @bind="@EditRecord.MinProd"></input>
|
||||
<label for="floatingComm">Durata (min)</label>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="col-6">
|
||||
<button class="btn btn-sm btn-success w-100" @onclick="() => DoSave()"><i class="fa-solid fa-floppy-disk"></i> Save</button>
|
||||
<div class="row mx-0 bg-dark bg-gradient">
|
||||
<div class="col-6 mt-2">
|
||||
<button class="btn btn-warning w-100" @onclick="() => DoEdit(null)"><i class="fa-solid fa-ban"></i> Cancel</button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button class="btn btn-sm btn-warning w-100" @onclick="() => DoEdit(null)"><i class="fa-solid fa-ban"></i> Cancel</button>
|
||||
<div class="col-6 mt-2">
|
||||
<button class="btn btn-success w-100" @onclick="() => DoSave()"><i class="fa-solid fa-floppy-disk"></i> Save</button>
|
||||
</div>
|
||||
<div class="col-12 my-2">
|
||||
@if (EditRecord.IsWork)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@EditRecord.KeyRichiesta"></input>
|
||||
<label>Commessa</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-lg-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@EditRecord.CodArticolo"></input>
|
||||
<label>Articolo</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 col-lg-2 my-2">
|
||||
<div class="form-floating">
|
||||
<input type="time" class="form-control" @bind="@EditRecord.InizioStato"></input>
|
||||
<label for="floatingComm">Inizio</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 col-lg-2 my-2">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@EditRecord.PzBuoni"></input>
|
||||
<label for="floatingComm">Pezzi</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 col-lg-2 my-2">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@EditRecord.TCiclo"></input>
|
||||
<label for="floatingComm">T.Ciclo</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-8 my-2">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@EditRecord.IdxTipoEv"></input>
|
||||
<label>Tipo Fermata</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 my-2">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@EditRecord.MinProd" step="0.01" placeholder="0.0"></input>
|
||||
<label for="floatingComm">Durata (min)</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -142,7 +147,7 @@
|
||||
<td class="text-end">@item.PzBuoni</td>
|
||||
<td class="text-end">@($"{item.TCiclo:f2}")</td>
|
||||
<td class="text-end">@($"{item.MinProd:f2}")</td>
|
||||
<td class="text-end"><button class="btn btn-sm btn-danger"><i class="fa-solid fa-trash-can"></i></button></td>
|
||||
<td class="text-end"><button class="btn btn-sm btn-danger" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash-can"></i></button></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
||||
@@ -75,12 +75,31 @@ namespace MP_TAB3.Components
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// imposta record x editing
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
protected void DoEdit(InsManualiModel? selRec)
|
||||
{
|
||||
EditRecord = selRec;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// impossta record x eliminazione
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
protected async Task DoDelete(InsManualiModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler eliminare il record tipo {selRec.IdxTipoEv} | {selRec.InizioStato:yyyy.MM.dd HH:mm} per {selRec.MinProd:N2} min?"))
|
||||
return;
|
||||
// esegue eliminazione del record...
|
||||
await TabDServ.InsManDelete(selRec);
|
||||
|
||||
// rileggo i dati...
|
||||
ReloadData();
|
||||
RecalcDayData(dtCurr);
|
||||
}
|
||||
|
||||
protected async Task DoSave()
|
||||
{
|
||||
// solo se ho record...
|
||||
@@ -90,7 +109,16 @@ namespace MP_TAB3.Components
|
||||
var dayElap = EditRecord.InizioStato.Subtract(EditRecord.InizioStato.Date);
|
||||
EditRecord.MatrOpr = MServ.MatrOpr;
|
||||
EditRecord.InizioStato = dtCurr.Date.Add(dayElap);
|
||||
EditRecord.MinProd = EditRecord.TCiclo * EditRecord.PzBuoni;
|
||||
// imposto altri campi secondo il TIPO di record...
|
||||
if (EditRecord.IsWork)
|
||||
{
|
||||
EditRecord.MinProd = EditRecord.TCiclo * EditRecord.PzBuoni;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditRecord.PzBuoni = 0;
|
||||
EditRecord.TCiclo = 0;
|
||||
}
|
||||
EditRecord.FineStato = EditRecord.InizioStato.AddMinutes((double)EditRecord.MinProd);
|
||||
// lancio salvataggio sul DB
|
||||
await TabDServ.InsManUpsert(EditRecord);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2504.217</Version>
|
||||
<Version>6.16.2504.218</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2504.217</h4>
|
||||
<h4>Versione: 6.16.2504.218</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2504.217
|
||||
6.16.2504.218
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2504.217</version>
|
||||
<version>6.16.2504.218</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -646,6 +646,32 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina record
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public bool InsManDelete(InsManualiModel currRecord)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var actRec = dbCtx
|
||||
.DbSetInsManuali
|
||||
.Where(x => currRecord.IdxInsMan > 0 && x.IdxInsMan == currRecord.IdxInsMan)
|
||||
.FirstOrDefault();
|
||||
// se ci fosse aggiorno...
|
||||
if (actRec != null)
|
||||
{
|
||||
dbCtx
|
||||
.DbSetInsManuali
|
||||
.Remove(actRec);
|
||||
}
|
||||
var res = dbCtx.SaveChanges();
|
||||
fatto = res != 0;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco insert manuali dato
|
||||
/// </summary>
|
||||
@@ -668,7 +694,7 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue salvataggio record + svuotamento cache
|
||||
/// Esegue upsert record
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public bool InsManUpsert(InsManualiModel currRecord)
|
||||
|
||||
+135
-118
@@ -918,99 +918,20 @@ namespace MP.Data.Services
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco DTO x plotting seq stati giornaliero
|
||||
/// Elimina record + svuotamento cache
|
||||
/// </summary>
|
||||
/// <param name="listDetail">Record dettaglio giornata</param>
|
||||
/// <returns></returns>
|
||||
public List<ManualStatusDTO> InsManSeqDayStatus(List<InsManualiModel> listDetail)
|
||||
/// <param name="currRecord"></param>
|
||||
public async Task<bool> InsManDelete(InsManualiModel currRecord)
|
||||
{
|
||||
List<ManualStatusDTO>? result = new List<ManualStatusDTO>();
|
||||
// per sicurezza RIORDINO!
|
||||
listDetail = listDetail
|
||||
.OrderBy(x => x.InizioStato)
|
||||
.ToList();
|
||||
if (listDetail.Count > 0)
|
||||
{
|
||||
DateTime periodStart = listDetail.FirstOrDefault().InizioStato;
|
||||
DateTime periodEnd = listDetail.FirstOrDefault().FineStato.Value;
|
||||
double duration = 0;
|
||||
int lastIdxTipo = -1;
|
||||
ManualStatusDTO currRec = new ManualStatusDTO();
|
||||
// se NON parte da mezzanotte metto un "pad iniziale"...
|
||||
if (periodStart.TimeOfDay > new TimeSpan(0))
|
||||
{
|
||||
lastIdxTipo = 0;
|
||||
currRec = new ManualStatusDTO
|
||||
{
|
||||
IdxTipo = lastIdxTipo,
|
||||
CssBlock = "bg-light text-dark",
|
||||
Title = "missing",
|
||||
Value = periodStart.TimeOfDay.TotalMinutes,
|
||||
ValueMax = 1440
|
||||
};
|
||||
}
|
||||
// ciclo tutti i record, verificando idxTipo...
|
||||
foreach (var item in listDetail)
|
||||
{
|
||||
if (item.IdxTipoEv != lastIdxTipo)
|
||||
{
|
||||
// aggiungo rec precedente... se > 0
|
||||
if (currRec.Value > 0)
|
||||
{
|
||||
result.Add(currRec);
|
||||
}
|
||||
lastIdxTipo = item.IdxTipoEv;
|
||||
periodStart = item.InizioStato;
|
||||
periodEnd = item.FineStato.Value;
|
||||
duration = (double)item.MinProd;
|
||||
currRec = new ManualStatusDTO
|
||||
{
|
||||
IdxTipo = lastIdxTipo,
|
||||
// fare da DB --> anagEventi
|
||||
CssBlock = item.IdxTipoEv == 1 ? "bg-success text-light" : "bg-secondary text-light",
|
||||
Title = $"{periodStart:HH:mm}-{periodEnd:HH:mm}",
|
||||
Value = duration,
|
||||
ValueMax = 1440
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
duration += (double)item.MinProd;
|
||||
periodEnd = item.FineStato.Value;
|
||||
currRec = new ManualStatusDTO
|
||||
{
|
||||
IdxTipo = lastIdxTipo,
|
||||
// fare da DB --> anagEventi
|
||||
CssBlock = item.IdxTipoEv == 1 ? "bg-success text-light" : "bg-secondary text-light",
|
||||
Title = $"{periodStart:HH:mm}-{periodEnd:HH:mm}",
|
||||
Value = duration,
|
||||
ValueMax = 1440
|
||||
};
|
||||
}
|
||||
}
|
||||
// aggiungo rec precedente... se > 0
|
||||
if (currRec.Value > 0)
|
||||
{
|
||||
result.Add(currRec);
|
||||
}
|
||||
// se non arrivo a mezzanotte aggiungo "pad finale"
|
||||
var deltaFin = TimeSpan.FromHours(24).Subtract(periodEnd.TimeOfDay);
|
||||
if (deltaFin.TotalMinutes > 1)
|
||||
{
|
||||
lastIdxTipo = 0;
|
||||
currRec = new ManualStatusDTO
|
||||
{
|
||||
IdxTipo = lastIdxTipo,
|
||||
CssBlock = "bg-light text-dark",
|
||||
Title = "missing",
|
||||
Value = deltaFin.TotalMinutes,
|
||||
ValueMax = 1440
|
||||
};
|
||||
result.Add(currRec);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
fatto = dbTabController.InsManDelete(currRecord);
|
||||
// svuoto cache
|
||||
RedisValue pattern = $"{redisBaseKey}:InsMan:*";
|
||||
await ExecFlushRedisPatternAsync(pattern);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1120,6 +1041,101 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco DTO x plotting seq stati giornaliero
|
||||
/// </summary>
|
||||
/// <param name="listDetail">Record dettaglio giornata</param>
|
||||
/// <returns></returns>
|
||||
public List<ManualStatusDTO> InsManSeqDayStatus(List<InsManualiModel> listDetail)
|
||||
{
|
||||
List<ManualStatusDTO>? result = new List<ManualStatusDTO>();
|
||||
// per sicurezza RIORDINO!
|
||||
listDetail = listDetail
|
||||
.OrderBy(x => x.InizioStato)
|
||||
.ToList();
|
||||
if (listDetail.Count > 0)
|
||||
{
|
||||
DateTime periodStart = listDetail.FirstOrDefault().InizioStato;
|
||||
DateTime periodEnd = listDetail.FirstOrDefault().FineStato.Value;
|
||||
double duration = 0;
|
||||
int lastIdxTipo = -1;
|
||||
ManualStatusDTO currRec = new ManualStatusDTO();
|
||||
// se NON parte da mezzanotte metto un "pad iniziale"...
|
||||
if (periodStart.TimeOfDay > new TimeSpan(0))
|
||||
{
|
||||
lastIdxTipo = 0;
|
||||
currRec = new ManualStatusDTO
|
||||
{
|
||||
IdxTipo = lastIdxTipo,
|
||||
CssBlock = "bg-light text-dark",
|
||||
Title = "missing",
|
||||
Value = periodStart.TimeOfDay.TotalMinutes,
|
||||
ValueMax = 1440
|
||||
};
|
||||
}
|
||||
// ciclo tutti i record, verificando idxTipo...
|
||||
foreach (var item in listDetail)
|
||||
{
|
||||
if (item.IdxTipoEv != lastIdxTipo)
|
||||
{
|
||||
// aggiungo rec precedente... se > 0
|
||||
if (currRec.Value > 0)
|
||||
{
|
||||
result.Add(currRec);
|
||||
}
|
||||
lastIdxTipo = item.IdxTipoEv;
|
||||
periodStart = item.InizioStato;
|
||||
periodEnd = item.FineStato.Value;
|
||||
duration = (double)item.MinProd;
|
||||
currRec = new ManualStatusDTO
|
||||
{
|
||||
IdxTipo = lastIdxTipo,
|
||||
// fare da DB --> anagEventi
|
||||
CssBlock = item.IdxTipoEv == 1 ? "bg-success text-light" : "bg-secondary text-light",
|
||||
Title = $"{periodStart:HH:mm}-{periodEnd:HH:mm}",
|
||||
Value = duration,
|
||||
ValueMax = 1440
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
duration += (double)item.MinProd;
|
||||
periodEnd = item.FineStato.Value;
|
||||
currRec = new ManualStatusDTO
|
||||
{
|
||||
IdxTipo = lastIdxTipo,
|
||||
// fare da DB --> anagEventi
|
||||
CssBlock = item.IdxTipoEv == 1 ? "bg-success text-light" : "bg-secondary text-light",
|
||||
Title = $"{periodStart:HH:mm}-{periodEnd:HH:mm}",
|
||||
Value = duration,
|
||||
ValueMax = 1440
|
||||
};
|
||||
}
|
||||
}
|
||||
// aggiungo rec precedente... se > 0
|
||||
if (currRec.Value > 0)
|
||||
{
|
||||
result.Add(currRec);
|
||||
}
|
||||
// se non arrivo a mezzanotte aggiungo "pad finale"
|
||||
var deltaFin = TimeSpan.FromHours(24).Subtract(periodEnd.TimeOfDay);
|
||||
if (deltaFin.TotalMinutes > 1)
|
||||
{
|
||||
lastIdxTipo = 0;
|
||||
currRec = new ManualStatusDTO
|
||||
{
|
||||
IdxTipo = lastIdxTipo,
|
||||
CssBlock = "bg-light text-dark",
|
||||
Title = "missing",
|
||||
Value = deltaFin.TotalMinutes,
|
||||
ValueMax = 1440
|
||||
};
|
||||
result.Add(currRec);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue salvataggio record + svuotamento cache
|
||||
/// </summary>
|
||||
@@ -1134,6 +1150,7 @@ namespace MP.Data.Services
|
||||
await ExecFlushRedisPatternAsync(pattern);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue salvataggio record + svuotamento cache
|
||||
/// </summary>
|
||||
@@ -3794,34 +3811,6 @@ namespace MP.Data.Services
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Esegue flush memoria redis dato pattern in async
|
||||
/// </summary>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<bool> ExecFlushRedisPatternAsync(RedisValue pattern)
|
||||
{
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConn.GetEndPoints();
|
||||
foreach (var endPoint in listEndpoints)
|
||||
{
|
||||
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
|
||||
var server = redisConn.GetServer(endPoint);
|
||||
if (server != null)
|
||||
{
|
||||
var keyList = server.Keys(redisDb.Database, pattern);
|
||||
foreach (var item in keyList)
|
||||
{
|
||||
await redisDb.KeyDeleteAsync(item);
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
// notifico update ai client in ascolto x reset cache
|
||||
NotifyReloadRequest($"FlushRedisCache | {pattern}");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue flush memoria redis dato pattern, metodo sincrono
|
||||
/// </summary>
|
||||
@@ -3850,6 +3839,34 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue flush memoria redis dato pattern in async
|
||||
/// </summary>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<bool> ExecFlushRedisPatternAsync(RedisValue pattern)
|
||||
{
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConn.GetEndPoints();
|
||||
foreach (var endPoint in listEndpoints)
|
||||
{
|
||||
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
|
||||
var server = redisConn.GetServer(endPoint);
|
||||
if (server != null)
|
||||
{
|
||||
var keyList = server.Keys(redisDb.Database, pattern);
|
||||
foreach (var item in keyList)
|
||||
{
|
||||
await redisDb.KeyDeleteAsync(item);
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
// notifico update ai client in ascolto x reset cache
|
||||
NotifyReloadRequest($"FlushRedisCache | {pattern}");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hash dati EXE TASK x la macchina specificata
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user