Fix gestione reparti/operatore
This commit is contained in:
@@ -1175,21 +1175,19 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="rec2del"></param>
|
||||
/// <returns></returns>
|
||||
public bool Grp2MaccDelete(Gruppi2MaccModel rec2del)
|
||||
public async Task<bool> Grp2MaccDeleteAsync(Gruppi2MaccModel rec2del)
|
||||
{
|
||||
bool answ = false;
|
||||
using (var dbCtx = new MoonProContext(options))
|
||||
using var dbCtx = new MoonProContext(options);
|
||||
var dbRec = await dbCtx
|
||||
.DbSetGrp2Macc
|
||||
.Where(x => x.CodGruppo == rec2del.CodGruppo && x.IdxMacchina == rec2del.IdxMacchina)
|
||||
.FirstOrDefaultAsync();
|
||||
if (dbRec != null)
|
||||
{
|
||||
var dbRec = dbCtx
|
||||
.DbSetGrp2Macc
|
||||
.Where(x => x.CodGruppo == rec2del.CodGruppo && x.IdxMacchina == rec2del.IdxMacchina)
|
||||
.FirstOrDefault();
|
||||
if (dbRec != null)
|
||||
{
|
||||
dbCtx.DbSetGrp2Macc.Remove(dbRec);
|
||||
int numDone = dbCtx.SaveChanges();
|
||||
answ = numDone != 0;
|
||||
}
|
||||
dbCtx.DbSetGrp2Macc.Remove(dbRec);
|
||||
int numDone = await dbCtx.SaveChangesAsync();
|
||||
answ = numDone != 0;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -1199,22 +1197,20 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="upsRec"></param>
|
||||
/// <returns></returns>
|
||||
public bool Grp2MaccInsert(Gruppi2MaccModel upsRec)
|
||||
public async Task<bool> Grp2MaccInsertAsync(Gruppi2MaccModel upsRec)
|
||||
{
|
||||
bool answ = false;
|
||||
using (var dbCtx = new MoonProContext(options))
|
||||
using var dbCtx = new MoonProContext(options);
|
||||
var dbRec = await dbCtx
|
||||
.DbSetGrp2Macc
|
||||
.Where(x => x.CodGruppo == upsRec.CodGruppo && x.IdxMacchina == upsRec.IdxMacchina)
|
||||
.FirstOrDefaultAsync();
|
||||
if (dbRec == null)
|
||||
{
|
||||
var dbRec = dbCtx
|
||||
.DbSetGrp2Macc
|
||||
.Where(x => x.CodGruppo == upsRec.CodGruppo && x.IdxMacchina == upsRec.IdxMacchina)
|
||||
.FirstOrDefault();
|
||||
if (dbRec == null)
|
||||
{
|
||||
dbCtx.DbSetGrp2Macc.Add(upsRec);
|
||||
// salvo
|
||||
int numDone = dbCtx.SaveChanges();
|
||||
answ = numDone != 0;
|
||||
}
|
||||
await dbCtx.DbSetGrp2Macc.AddAsync(upsRec);
|
||||
// salvo
|
||||
int numDone = await dbCtx.SaveChangesAsync();
|
||||
answ = numDone != 0;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -1224,21 +1220,19 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="rec2del"></param>
|
||||
/// <returns></returns>
|
||||
public bool Grp2OperDelete(Gruppi2OperModel rec2del)
|
||||
public async Task<bool> Grp2OperDeleteAsync(Gruppi2OperModel rec2del)
|
||||
{
|
||||
bool answ = false;
|
||||
using (var dbCtx = new MoonProContext(options))
|
||||
{
|
||||
var dbRec = dbCtx
|
||||
using var dbCtx = new MoonProContext(options);
|
||||
var dbRec = await dbCtx
|
||||
.DbSetGrp2Oper
|
||||
.Where(x => x.CodGruppo == rec2del.CodGruppo && x.MatrOpr == rec2del.MatrOpr)
|
||||
.FirstOrDefault();
|
||||
if (dbRec != null)
|
||||
{
|
||||
dbCtx.DbSetGrp2Oper.Remove(dbRec);
|
||||
int numDone = dbCtx.SaveChanges();
|
||||
answ = numDone != 0;
|
||||
}
|
||||
.FirstOrDefaultAsync();
|
||||
if (dbRec != null)
|
||||
{
|
||||
dbCtx.DbSetGrp2Oper.Remove(dbRec);
|
||||
int numDone = await dbCtx.SaveChangesAsync();
|
||||
answ = numDone != 0;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -1248,22 +1242,20 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="upsRec"></param>
|
||||
/// <returns></returns>
|
||||
public bool Grp2OperInsert(Gruppi2OperModel upsRec)
|
||||
public async Task<bool> Grp2OperInsertAsync(Gruppi2OperModel upsRec)
|
||||
{
|
||||
bool answ = false;
|
||||
using (var dbCtx = new MoonProContext(options))
|
||||
{
|
||||
var dbRec = dbCtx
|
||||
using var dbCtx = new MoonProContext(options);
|
||||
var dbRec = await dbCtx
|
||||
.DbSetGrp2Oper
|
||||
.Where(x => x.CodGruppo == upsRec.CodGruppo && x.MatrOpr == upsRec.MatrOpr)
|
||||
.FirstOrDefault();
|
||||
if (dbRec == null)
|
||||
{
|
||||
dbCtx.DbSetGrp2Oper.Add(upsRec);
|
||||
// salvo
|
||||
int numDone = dbCtx.SaveChanges();
|
||||
answ = numDone != 0;
|
||||
}
|
||||
.FirstOrDefaultAsync();
|
||||
if (dbRec == null)
|
||||
{
|
||||
await dbCtx.DbSetGrp2Oper.AddAsync(upsRec);
|
||||
// salvo
|
||||
int numDone = await dbCtx.SaveChangesAsync();
|
||||
answ = numDone != 0;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace MP.SPEC.Components.Reparti
|
||||
CodGruppo = CodGruppoCurr,
|
||||
IdxMacchina = currRec.IdxMacchina
|
||||
};
|
||||
MDService.Grp2MaccInsert(rec2del);
|
||||
await MDService.Grp2MaccInsertAsync(rec2del);
|
||||
await EC_RecChange.InvokeAsync(false);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace MP.SPEC.Components.Reparti
|
||||
CodGruppo = CodGruppoCurr,
|
||||
IdxMacchina = currRec.IdxMacchina
|
||||
};
|
||||
MDService.Grp2MaccDelete(rec2del);
|
||||
await MDService.Grp2MaccDeleteAsync(rec2del);
|
||||
await EC_RecChange.InvokeAsync(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace MP.SPEC.Components.Reparti
|
||||
CodGruppo = CodGruppoCurr,
|
||||
MatrOpr = currRec.MatrOpr
|
||||
};
|
||||
MDService.Grp2OperInsert(rec2del);
|
||||
await MDService.Grp2OperInsertAsync(rec2del);
|
||||
await EC_RecChange.InvokeAsync(false);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace MP.SPEC.Components.Reparti
|
||||
CodGruppo = CodGruppoCurr,
|
||||
MatrOpr = currRec.MatrOpr
|
||||
};
|
||||
MDService.Grp2OperDelete(rec2del);
|
||||
await MDService.Grp2OperDeleteAsync(rec2del);
|
||||
await EC_RecChange.InvokeAsync(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@ namespace MP.SPEC.Components.Reparti
|
||||
[Parameter]
|
||||
public List<RepartiDTO>? AllRecords { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public string CodGruppoSel { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> EC_RecordSel { get; set; }
|
||||
|
||||
@@ -24,11 +27,6 @@ namespace MP.SPEC.Components.Reparti
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected bool IsSuperAdmin
|
||||
{
|
||||
get => HasRole(AppAuthService.RoleSuperAdmin);
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
@@ -62,6 +60,11 @@ namespace MP.SPEC.Components.Reparti
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
isLoading = true;
|
||||
// verifico se ho gruppo sel...
|
||||
if (!string.IsNullOrEmpty(CodGruppoSel) && AllRecords != null && AllRecords.Any())
|
||||
{
|
||||
SelRecord = AllRecords.FirstOrDefault(x => x.CodGruppo == CodGruppoSel);
|
||||
}
|
||||
UpdateTable();
|
||||
isLoading = false;
|
||||
}
|
||||
@@ -116,6 +119,11 @@ namespace MP.SPEC.Components.Reparti
|
||||
get => EditRec == null ? "Aggiungi Reparto" : "Chiudi/Annulla";
|
||||
}
|
||||
|
||||
private bool IsSuperAdmin
|
||||
{
|
||||
get => HasRole(AppAuthService.RoleSuperAdmin);
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
@@ -1065,16 +1065,16 @@ namespace MP.SPEC.Data
|
||||
/// </summary>
|
||||
/// <param name="rec2del"></param>
|
||||
/// <returns></returns>
|
||||
public bool Grp2MaccDelete(Gruppi2MaccModel rec2del)
|
||||
public async Task<bool> Grp2MaccDeleteAsync(Gruppi2MaccModel rec2del)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("Grp2MaccDelete");
|
||||
using var activity = ActivitySource.StartActivity("Grp2MaccDeleteAsync");
|
||||
bool result = false;
|
||||
result = dbController.Grp2MaccDelete(rec2del);
|
||||
result = await dbController.Grp2MaccDeleteAsync(rec2del);
|
||||
// elimino cache redis...
|
||||
ResetMacGrpCache();
|
||||
activity?.SetTag("data.source", "DB+REDIS");
|
||||
await ResetMacGrpCache();
|
||||
activity?.SetTag("data.source", "DB");
|
||||
activity?.Stop();
|
||||
LogTrace($"Grp2MaccDelete | CodGruppo {rec2del.CodGruppo} | IdxMacc {rec2del.IdxMacchina} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
LogTrace($"Grp2MaccDeleteAsync | CodGruppo {rec2del.CodGruppo} | IdxMacc {rec2del.IdxMacchina} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1083,16 +1083,16 @@ namespace MP.SPEC.Data
|
||||
/// </summary>
|
||||
/// <param name="upsRec"></param>
|
||||
/// <returns></returns>
|
||||
public bool Grp2MaccInsert(Gruppi2MaccModel upsRec)
|
||||
public async Task<bool> Grp2MaccInsertAsync(Gruppi2MaccModel upsRec)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("Grp2MaccInsert");
|
||||
using var activity = ActivitySource.StartActivity("Grp2MaccInsertAsync");
|
||||
bool result = false;
|
||||
result = dbController.Grp2MaccInsert(upsRec);
|
||||
result = await dbController.Grp2MaccInsertAsync(upsRec);
|
||||
// elimino cache redis...
|
||||
ResetMacGrpCache();
|
||||
activity?.SetTag("data.source", "DB+REDIS");
|
||||
await ResetMacGrpCache();
|
||||
activity?.SetTag("data.source", "DB");
|
||||
activity?.Stop();
|
||||
LogTrace($"Grp2MaccInsert | CodGruppo {upsRec.CodGruppo} | IdxMacc {upsRec.IdxMacchina} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
LogTrace($"Grp2MaccInsertAsync | CodGruppo {upsRec.CodGruppo} | IdxMacc {upsRec.IdxMacchina} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1101,16 +1101,16 @@ namespace MP.SPEC.Data
|
||||
/// </summary>
|
||||
/// <param name="rec2del"></param>
|
||||
/// <returns></returns>
|
||||
public bool Grp2OperDelete(Gruppi2OperModel rec2del)
|
||||
public async Task<bool> Grp2OperDeleteAsync(Gruppi2OperModel rec2del)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("Grp2OperDelete");
|
||||
using var activity = ActivitySource.StartActivity("Grp2OperDeleteAsync");
|
||||
bool result = false;
|
||||
result = dbController.Grp2OperDelete(rec2del);
|
||||
result = await dbController.Grp2OperDeleteAsync(rec2del);
|
||||
// elimino cache redis...
|
||||
ResetOprGrpCache();
|
||||
activity?.SetTag("data.source", "DB+REDIS");
|
||||
await ResetOprGrpCache();
|
||||
activity?.SetTag("data.source", "DB");
|
||||
activity?.Stop();
|
||||
LogTrace($"Grp2OperDelete | CodGruppo {rec2del.CodGruppo} | MatrOpr {rec2del.MatrOpr} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
LogTrace($"Grp2OperDeleteAsync | CodGruppo {rec2del.CodGruppo} | MatrOpr {rec2del.MatrOpr} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1119,16 +1119,16 @@ namespace MP.SPEC.Data
|
||||
/// </summary>
|
||||
/// <param name="upsRec"></param>
|
||||
/// <returns></returns>
|
||||
public bool Grp2OperInsert(Gruppi2OperModel upsRec)
|
||||
public async Task<bool> Grp2OperInsertAsync(Gruppi2OperModel upsRec)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("Grp2OperInsert");
|
||||
using var activity = ActivitySource.StartActivity("Grp2OperInsertAsync");
|
||||
bool result = false;
|
||||
result = dbController.Grp2OperInsert(upsRec);
|
||||
result = await dbController.Grp2OperInsertAsync(upsRec);
|
||||
// elimino cache redis...
|
||||
ResetOprGrpCache();
|
||||
activity?.SetTag("data.source", "DB+REDIS");
|
||||
await ResetOprGrpCache();
|
||||
activity?.SetTag("data.source", "DB");
|
||||
activity?.Stop();
|
||||
LogTrace($"Grp2OperInsert | CodGruppo {upsRec.CodGruppo} | MatrOpr {upsRec.MatrOpr} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
LogTrace($"Grp2OperInsertAsync | CodGruppo {upsRec.CodGruppo} | MatrOpr {upsRec.MatrOpr} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2579,19 +2579,19 @@ namespace MP.SPEC.Data
|
||||
/// <summary>
|
||||
/// Reset macchine e gruppi
|
||||
/// </summary>
|
||||
private void ResetMacGrpCache()
|
||||
private async Task ResetMacGrpCache()
|
||||
{
|
||||
ExecFlushRedisPattern($"{Utils.redisAnagGruppi}:*");
|
||||
ExecFlushRedisPattern($"{Utils.redisMacList}:*");
|
||||
await FlushCacheByTagsAsync(new List<string> { Utils.redisAnagGruppi, Utils.redisMacList });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset cache operatori e gruppi
|
||||
/// </summary>
|
||||
private void ResetOprGrpCache()
|
||||
private async Task ResetOprGrpCache()
|
||||
{
|
||||
ExecFlushRedisPattern($"{Utils.redisAnagGruppi}:*");
|
||||
ExecFlushRedisPattern($"{Utils.redisOprList}:*");
|
||||
//ExecFlushRedisPattern($"{Utils.redisAnagGruppi}:*");
|
||||
//ExecFlushRedisPattern($"{Utils.redisOprList}:*");
|
||||
await FlushCacheByTagsAsync(new List<string> { Utils.redisAnagGruppi, Utils.redisOprList });
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
<Version>8.16.2605.3007</Version>
|
||||
<Version>8.16.2605.3009</Version>
|
||||
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="@CssMain">
|
||||
<MP.SPEC.Components.Reparti.ListReparti AllRecords="ListReparti" EC_RecordSel="SetCodGruppo" EC_RecordUpdated="ForceReload"></MP.SPEC.Components.Reparti.ListReparti>
|
||||
<MP.SPEC.Components.Reparti.ListReparti AllRecords="ListReparti" CodGruppoSel="@CodGruppo" EC_RecordSel="SetCodGruppo" EC_RecordUpdated="ForceReload"></MP.SPEC.Components.Reparti.ListReparti>
|
||||
</div>
|
||||
@if (ShowDetail)
|
||||
{
|
||||
|
||||
@@ -89,10 +89,10 @@ namespace MP.SPEC.Pages
|
||||
private async Task ReloadDataAsync()
|
||||
{
|
||||
isLoading = true;
|
||||
ListMacchine?.Clear();
|
||||
ListReparti?.Clear();
|
||||
if (string.IsNullOrEmpty(CodGruppo))
|
||||
//ListMacchine?.Clear();
|
||||
if (string.IsNullOrEmpty(CodGruppo) || true)
|
||||
{
|
||||
ListReparti?.Clear();
|
||||
var rawList = await MDService.ElencoRepartiDtoAsync();
|
||||
if (string.IsNullOrEmpty(SearchVal))
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 8.16.2605.3007</h4>
|
||||
<h4>Versione: 8.16.2605.3009</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2605.3007
|
||||
8.16.2605.3009
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2605.3007</version>
|
||||
<version>8.16.2605.3009</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>
|
||||
|
||||
+2
-1
@@ -46,7 +46,7 @@ Migrare la logica di caching manuale (Redis + DB) verso l'utilizzo di `IFusionCa
|
||||
- `OdlListGetFiltAsync`
|
||||
- `OperatoriGetFiltAsync`
|
||||
- `ParametriGetFiltAsync`
|
||||
- `PODL_getDictOdlPodlAsync` (Parziale/Ibrido)
|
||||
- `PODL_getDictOdlPodlAsync` (Migrato con gestione manuale L1/L2)
|
||||
- `POdlGetByOdlAsync`
|
||||
- `POdlToKitListGetFiltAsync`
|
||||
- `StatoMacchinaAsync`
|
||||
@@ -87,3 +87,4 @@ Migrare la logica di caching manuale (Redis + DB) verso l'utilizzo di `IFusionCa
|
||||
- *Mitigazione*: `FusionCache` gestisce la serializzazione, ma è necessario assicurarsi che i tipi di ritorno siano compatibili con le aspettative dei chiamanti.
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user