SPEC Reparti:
- OK editing - ok add
This commit is contained in:
@@ -83,6 +83,31 @@ namespace MP.Data.Controllers
|
||||
return AnagGruppiGetTipo("AZIENDA");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete record AnagraficaGruppi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool AnagGruppiDelete(AnagGruppiModel updRec)
|
||||
{
|
||||
bool answ = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var dbRec = dbCtx
|
||||
.DbSetAnagGruppi
|
||||
.AsNoTracking()
|
||||
.Where(x => x.CodGruppo == updRec.CodGruppo)
|
||||
.FirstOrDefault();
|
||||
// se trovato aggiorno descrizione (resto immutato x sicurezza!)
|
||||
if (dbRec != null)
|
||||
{
|
||||
dbCtx.DbSetAnagGruppi.Remove(dbRec);
|
||||
}
|
||||
var numRes = dbCtx.SaveChanges();
|
||||
answ = numRes != 0;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi tipo Fasi
|
||||
/// </summary>
|
||||
@@ -91,6 +116,45 @@ namespace MP.Data.Controllers
|
||||
{
|
||||
return AnagGruppiGetTipo("FASE");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<AnagGruppiModel> AnagGruppiGetAll()
|
||||
{
|
||||
List<AnagGruppiModel> dbResult = new List<AnagGruppiModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetAnagGruppi
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.CodGruppo)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gruppi x tipo
|
||||
/// </summary>
|
||||
/// <param name="tipoGruppo"></param>
|
||||
/// <returns></returns>
|
||||
public List<AnagGruppiModel> AnagGruppiGetTipo(string tipoGruppo)
|
||||
{
|
||||
List<AnagGruppiModel> dbResult = new List<AnagGruppiModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetAnagGruppi
|
||||
.Where(x => x.TipoGruppo == tipoGruppo)
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.CodGruppo)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi tipo REPARTO (x associazione Macchine-Operatori)
|
||||
/// </summary>
|
||||
@@ -138,44 +202,36 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi
|
||||
/// Upsert record AnagraficaGruppi (solo codice/descrizione)
|
||||
/// </summary>
|
||||
/// <param name="updRec"></param>
|
||||
/// <returns></returns>
|
||||
public List<AnagGruppiModel> AnagGruppiGetAll()
|
||||
public bool AnagGruppiUpsert(AnagGruppiModel updRec)
|
||||
{
|
||||
List<AnagGruppiModel> dbResult = new List<AnagGruppiModel>();
|
||||
bool answ = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
var dbRec = dbCtx
|
||||
.DbSetAnagGruppi
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.CodGruppo)
|
||||
.ToList();
|
||||
.Where(x => x.CodGruppo == updRec.CodGruppo)
|
||||
.FirstOrDefault();
|
||||
// se trovato aggiorno descrizione (resto immutato x sicurezza!)
|
||||
if (dbRec != null)
|
||||
{
|
||||
dbRec.DescrGruppo = updRec.DescrGruppo;
|
||||
dbCtx.Entry(dbRec).State = EntityState.Modified;
|
||||
}
|
||||
// altrimenti aggiungo
|
||||
else
|
||||
{
|
||||
dbCtx.DbSetAnagGruppi.Add(updRec);
|
||||
}
|
||||
var numRes = dbCtx.SaveChanges();
|
||||
answ = numRes != 0;
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gruppi x tipo
|
||||
/// </summary>
|
||||
/// <param name="tipoGruppo"></param>
|
||||
/// <returns></returns>
|
||||
public List<AnagGruppiModel> AnagGruppiGetTipo(string tipoGruppo)
|
||||
{
|
||||
List<AnagGruppiModel> dbResult = new List<AnagGruppiModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetAnagGruppi
|
||||
.Where(x => x.TipoGruppo == tipoGruppo)
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.CodGruppo)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -196,26 +252,6 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Elenco operatori
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<AnagOperatoriModel> ElencoOperatori()
|
||||
{
|
||||
List<AnagOperatoriModel> dbResult = new List<AnagOperatoriModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbOperatori
|
||||
.Where(s => s.MatrOpr > 0)
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.MatrOpr)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco valori ammessi x Stati commessa (es Yacht Baglietto)
|
||||
/// </summary>
|
||||
@@ -628,6 +664,25 @@ namespace MP.Data.Controllers
|
||||
return ListLinkFilt("SpecLink");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco operatori
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<AnagOperatoriModel> ElencoOperatori()
|
||||
{
|
||||
List<AnagOperatoriModel> dbResult = new List<AnagOperatoriModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbOperatori
|
||||
.Where(s => s.MatrOpr > 0)
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.MatrOpr)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record EventList
|
||||
/// </summary>
|
||||
@@ -1247,49 +1302,6 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco da tabella Operatori filtro x gruppo
|
||||
/// </summary>
|
||||
/// <param name="codGruppo"></param>
|
||||
/// <returns></returns>
|
||||
public List<AnagOperatoriModel> OperatoriGetFilt(string codGruppo)
|
||||
{
|
||||
List<AnagOperatoriModel> dbResult = new List<AnagOperatoriModel>();
|
||||
try
|
||||
{
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
if (codGruppo == "*")
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbOperatori
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.MatrOpr)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetGrp2Oper
|
||||
.Where(g => g.CodGruppo == codGruppo)
|
||||
.Join(dbCtx.DbOperatori,
|
||||
g => g.MatrOpr,
|
||||
m => m.MatrOpr,
|
||||
(g, m) => m
|
||||
)
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.MatrOpr)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in OperatoriGetFilt{Environment.NewLine}{exc}");
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco id Macchine che abbiano dati FLuxLog, nel periodo indicato
|
||||
/// </summary>
|
||||
@@ -1549,6 +1561,49 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco da tabella Operatori filtro x gruppo
|
||||
/// </summary>
|
||||
/// <param name="codGruppo"></param>
|
||||
/// <returns></returns>
|
||||
public List<AnagOperatoriModel> OperatoriGetFilt(string codGruppo)
|
||||
{
|
||||
List<AnagOperatoriModel> dbResult = new List<AnagOperatoriModel>();
|
||||
try
|
||||
{
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
if (codGruppo == "*")
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbOperatori
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.MatrOpr)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetGrp2Oper
|
||||
.Where(g => g.CodGruppo == codGruppo)
|
||||
.Join(dbCtx.DbOperatori,
|
||||
g => g.MatrOpr,
|
||||
m => m.MatrOpr,
|
||||
(g, m) => m
|
||||
)
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.MatrOpr)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in OperatoriGetFilt{Environment.NewLine}{exc}");
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco parametri validi x una data macchina
|
||||
/// </summary>
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
</table>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
@if(ShowAllDet)
|
||||
@if (ShowAllDet)
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary disabled"><i class="fa-solid fa-chevron-up"></i></button>
|
||||
}
|
||||
@@ -128,11 +128,11 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1 bg-danger text-light">
|
||||
@if (totalCount > numRecord)
|
||||
{
|
||||
@if (totalCount > numRecord)
|
||||
{
|
||||
<div class="card-footer py-1 bg-danger text-light">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="SetNumRec" numPageChanged="SetNumPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -345,6 +345,7 @@ namespace MP.SPEC.Components.ProdKit
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Toggle modale ricerca articoli
|
||||
/// </summary>
|
||||
|
||||
@@ -16,13 +16,20 @@
|
||||
<div class="card-header bg-primary text-light">Modifica</div>
|
||||
<div class="card-body p-1">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<div class="col-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" placeholder="Cod Gruppo" @bind="@EditRec.CodGruppo">
|
||||
@if (string.IsNullOrEmpty(EditRec.CodGruppo))
|
||||
{
|
||||
<input type="text" class="form-control" placeholder="Inserire CodGruppo (univoco)" @bind="@EditRec.CodGruppo">
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="text" class="form-control" disabled placeholder="Cod Gruppo" @bind="@EditRec.CodGruppo">
|
||||
}
|
||||
<label class="text-secondary">Cod Gruppo</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="col-5">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" placeholder="Descrizione Gruppo" @bind="@EditRec.DescrGruppo">
|
||||
<label class="text-secondary">Descrizione Gruppo</label>
|
||||
@@ -84,8 +91,12 @@
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@CheckSelect(record)">
|
||||
<td>
|
||||
<td class="text-nowrap">
|
||||
<button @onclick="() => DoSelect(record)" class="btn btn-primary btn-sm" title="Seleziona Record"><i class="bi bi-search"></i></button>
|
||||
@if (SelRecord == null)
|
||||
{
|
||||
<button @onclick="() => DoEdit(record)" class="btn btn-primary btn-sm ms-1" title="Seleziona Record"><i class="fa-solid fa-edit"></i></button>
|
||||
}
|
||||
</td>
|
||||
@if (SelRecord == null)
|
||||
{
|
||||
@@ -119,12 +130,12 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1 bg-dark text-light">
|
||||
@if (totalCount > numRecord)
|
||||
{
|
||||
@if (totalCount > numRecord)
|
||||
{
|
||||
<div class="card-footer py-1 bg-dark text-light">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="SetNumRec" numPageChanged="SetNumPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Core.DTO;
|
||||
using MP.Data.DbModels;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Components.Reparti
|
||||
{
|
||||
@@ -14,8 +17,21 @@ namespace MP.SPEC.Components.Reparti
|
||||
[Parameter]
|
||||
public EventCallback<string> EC_RecordSel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_RecordUpdated { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnInitialized()
|
||||
@@ -72,15 +88,16 @@ namespace MP.SPEC.Components.Reparti
|
||||
get => EditRec == null ? "btn-success" : "btn-secondary";
|
||||
}
|
||||
|
||||
private string addNewTxt
|
||||
{
|
||||
get => EditRec == null ? "Add New" : "Close Add New";
|
||||
}
|
||||
private string addNewIcon
|
||||
{
|
||||
get => EditRec == null ? "fa-plus-square" : "fa-minus-square";
|
||||
}
|
||||
|
||||
private string addNewTxt
|
||||
{
|
||||
get => EditRec == null ? "Add New" : "Close";
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
@@ -92,27 +109,49 @@ namespace MP.SPEC.Components.Reparti
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ELiminabile se non ha record child macchine/opr...
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
private bool DelEnabled(RepartiDTO currRec)
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
return answ;
|
||||
int numChild = currRec.CountMacc + currRec.CountOpr;
|
||||
return numChild == 0;
|
||||
}
|
||||
|
||||
private void DoUpdate(AnagGruppiModel UpdRec)
|
||||
{
|
||||
// salvo
|
||||
|
||||
EditRec = null;
|
||||
}
|
||||
private void DoCancel()
|
||||
{
|
||||
EditRec = null;
|
||||
}
|
||||
|
||||
private void DoDelete(RepartiDTO currRec)
|
||||
private async Task DoDelete(RepartiDTO selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione record Reparto: sei sicuro di voler procedere?"))
|
||||
return;
|
||||
|
||||
// eliminazione
|
||||
var rec2Del = new AnagGruppiModel()
|
||||
{
|
||||
CodGruppo = selRec.CodGruppo,
|
||||
DescrGruppo = selRec.DescrGruppo,
|
||||
SelEnabled = selRec.SelEnabled,
|
||||
TipoGruppo = selRec.TipoGruppo
|
||||
};
|
||||
MDService.AnagGruppiDelete(rec2Del);
|
||||
EditRec = null;
|
||||
await EC_RecordUpdated.InvokeAsync(true);
|
||||
}
|
||||
|
||||
private void DoEdit(RepartiDTO selRec)
|
||||
{
|
||||
EditRec = new AnagGruppiModel()
|
||||
{
|
||||
CodGruppo = selRec.CodGruppo,
|
||||
DescrGruppo = selRec.DescrGruppo,
|
||||
SelEnabled = selRec.SelEnabled,
|
||||
TipoGruppo = selRec.TipoGruppo
|
||||
};
|
||||
}
|
||||
|
||||
private async Task DoSelect(RepartiDTO currRec)
|
||||
@@ -122,6 +161,14 @@ namespace MP.SPEC.Components.Reparti
|
||||
await EC_RecordSel.InvokeAsync(currRec.CodGruppo);
|
||||
}
|
||||
|
||||
private async Task DoUpdate(AnagGruppiModel UpdRec)
|
||||
{
|
||||
// salvo...
|
||||
MDService.AnagGruppiUpsert(UpdRec);
|
||||
EditRec = null;
|
||||
await EC_RecordUpdated.InvokeAsync(true);
|
||||
}
|
||||
|
||||
private async Task ResetSel()
|
||||
{
|
||||
SelRecord = null;
|
||||
@@ -136,7 +183,7 @@ namespace MP.SPEC.Components.Reparti
|
||||
DateTime adesso = DateTime.Now;
|
||||
EditRec = new AnagGruppiModel()
|
||||
{
|
||||
CodGruppo = $"NEW-GROUP-{adesso:yyyyMMdd}-{adesso:HHmmss}",
|
||||
CodGruppo = "",
|
||||
DescrGruppo = "Descrizione",
|
||||
SelEnabled = false,
|
||||
TipoGruppo = "REPARTO"
|
||||
|
||||
@@ -155,6 +155,45 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete record AnagraficaGruppi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool AnagGruppiDelete(AnagGruppiModel updRec)
|
||||
{
|
||||
bool result = false;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
result = dbController.AnagGruppiDelete(updRec);
|
||||
// elimino cache redis...
|
||||
RedisValue pattern = new RedisValue($"{Utils.redisAnagGruppi}:*");
|
||||
bool answ = ExecFlushRedisPattern(pattern);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"AnagGruppiDelete | CodGruppo {updRec.CodGruppo} | {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upsert record AnagraficaGruppi
|
||||
/// </summary>
|
||||
/// <param name="UpdRec"></param>
|
||||
/// <returns></returns>
|
||||
public bool AnagGruppiUpsert(AnagGruppiModel UpdRec)
|
||||
{
|
||||
bool result = false;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
result = dbController.AnagGruppiUpsert(UpdRec);
|
||||
// elimino cache redis...
|
||||
RedisValue pattern = new RedisValue($"{Utils.redisAnagGruppi}:*");
|
||||
bool answ = ExecFlushRedisPattern(pattern);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"AnagGruppiUpsert | CodGruppo {UpdRec.CodGruppo} | {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi
|
||||
/// </summary>
|
||||
@@ -749,6 +788,11 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
public Task<List<LinkMenu>> ElencoLink()
|
||||
{
|
||||
return Task.FromResult(dbController.ElencoLink());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restitusice elenco Reparti
|
||||
/// </summary>
|
||||
@@ -788,11 +832,6 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
public Task<List<LinkMenu>> ElencoLink()
|
||||
{
|
||||
return Task.FromResult(dbController.ElencoLink());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record EventList
|
||||
/// </summary>
|
||||
@@ -1325,45 +1364,6 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Elenco operatori filtrati x gruppo
|
||||
/// </summary>
|
||||
/// <param name="codGruppo"></param>
|
||||
/// <returns></returns>
|
||||
public List<AnagOperatoriModel> OperatoriGetFilt(string codGruppo)
|
||||
{
|
||||
List<AnagOperatoriModel>? result = new List<AnagOperatoriModel>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
string keyGrp = codGruppo != "*" ? codGruppo : "ALL";
|
||||
string currKey = $"{Utils.redisOprList}:{keyGrp}";
|
||||
// cerco in redis dato valore sel idxMaccSel...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<AnagOperatoriModel>>($"{rawData}");
|
||||
readType = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbController.OperatoriGetFilt(codGruppo);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<AnagOperatoriModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"OperatoriGetFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se la idxMaccSel abbia un codice PATH ricette associato
|
||||
/// </summary>
|
||||
@@ -1735,6 +1735,43 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco operatori filtrati x gruppo
|
||||
/// </summary>
|
||||
/// <param name="codGruppo"></param>
|
||||
/// <returns></returns>
|
||||
public List<AnagOperatoriModel> OperatoriGetFilt(string codGruppo)
|
||||
{
|
||||
List<AnagOperatoriModel>? result = new List<AnagOperatoriModel>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
string keyGrp = codGruppo != "*" ? codGruppo : "ALL";
|
||||
string currKey = $"{Utils.redisOprList}:{keyGrp}";
|
||||
// cerco in redis dato valore sel idxMaccSel...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<AnagOperatoriModel>>($"{rawData}");
|
||||
readType = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbController.OperatoriGetFilt(codGruppo);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<AnagOperatoriModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"OperatoriGetFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco di tutti i parametri filtrati x idxMaccSel
|
||||
/// </summary>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
<Version>6.16.2504.1519</Version>
|
||||
<Version>6.16.2504.1607</Version>
|
||||
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="@CssMain">
|
||||
<MP.SPEC.Components.Reparti.ListReparti AllRecords="ListReparti" EC_RecordSel="SetCodGruppo"></MP.SPEC.Components.Reparti.ListReparti>
|
||||
<MP.SPEC.Components.Reparti.ListReparti AllRecords="ListReparti" EC_RecordSel="SetCodGruppo" EC_RecordUpdated="ForceReload"></MP.SPEC.Components.Reparti.ListReparti>
|
||||
</div>
|
||||
@if (ShowDetail)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using DnsClient.Protocol;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Core.DTO;
|
||||
using MP.Data.DbModels;
|
||||
@@ -9,9 +10,9 @@ namespace MP.SPEC.Pages
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected List<RepartiDTO>? ListReparti = null;
|
||||
protected List<Macchine>? ListMacchine = null;
|
||||
protected List<AnagOperatoriModel>? ListOperatori = null;
|
||||
protected List<RepartiDTO>? ListReparti = null;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
@@ -35,6 +36,8 @@ namespace MP.SPEC.Pages
|
||||
|
||||
private string CodGruppo = "";
|
||||
|
||||
private bool isLoading = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
@@ -53,6 +56,15 @@ namespace MP.SPEC.Pages
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void ForceReload(bool doForce)
|
||||
{
|
||||
if (doForce)
|
||||
{
|
||||
CodGruppo = "";
|
||||
}
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
private void ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
@@ -64,6 +76,7 @@ namespace MP.SPEC.Pages
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private void ReloadDetail()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(CodGruppo))
|
||||
@@ -72,7 +85,6 @@ namespace MP.SPEC.Pages
|
||||
ListOperatori = MDService.OperatoriGetFilt(CodGruppo);
|
||||
}
|
||||
}
|
||||
private bool isLoading = false;
|
||||
|
||||
private void SetCodGruppo(string CodGruppoSel)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2504.1519</h4>
|
||||
<h4>Versione: 6.16.2504.1607</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2504.1519
|
||||
6.16.2504.1607
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2504.1519</version>
|
||||
<version>6.16.2504.1607</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