diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj
index 108f2d0c..104cd909 100644
--- a/MP-TAB3/MP-TAB3.csproj
+++ b/MP-TAB3/MP-TAB3.csproj
@@ -3,7 +3,7 @@
net8.0
enable
- 8.16.2606.108
+ 8.16.2606.109
enable
MP_TAB3
diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html
index 87c10ba8..9d115dbc 100644
--- a/MP-TAB3/Resources/ChangeLog.html
+++ b/MP-TAB3/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 8.16.2606.108
+ Versione: 8.16.2606.109
Note di rilascio:
-
diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt
index 39fc2c3d..ce4acb58 100644
--- a/MP-TAB3/Resources/VersNum.txt
+++ b/MP-TAB3/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.108
+8.16.2606.109
diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml
index baac9408..819108c5 100644
--- a/MP-TAB3/Resources/manifest.xml
+++ b/MP-TAB3/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.108
+ 8.16.2606.109
https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip
https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html
false
diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs
index 2bc53fc1..7e42b2f1 100644
--- a/MP.Data/Controllers/MpSpecController.cs
+++ b/MP.Data/Controllers/MpSpecController.cs
@@ -33,23 +33,6 @@ namespace MP.Data.Controllers
#region Public Methods
- ///
- /// Elenco di tutti i counter coi valori correnti
- ///
- ///
- public List AnagCounters()
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = dbCtx
- .DbSetAnagCount
- .AsNoTracking()
- .ToList();
- }
- return dbResult;
- }
-
///
/// Stacca un nuovo counter x il tipo richiesto
///
@@ -129,26 +112,6 @@ namespace MP.Data.Controllers
return dbResult ?? new();
}
- ///
- /// Restituisce l'anagrafica EVENTI per macchina
- ///
- ///
- public List AnagEventiGetByMacc(string IdxMac)
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- var IdxMacch = new SqlParameter("@idxMacchina", IdxMac);
-
- dbResult = dbCtx
- .DbSetVSEB
- .FromSqlRaw("exec dbo.stp_vseb_getByIdxMacchinaFull @idxMacchina", IdxMacch)
- .AsNoTracking()
- .AsEnumerable()
- .ToList();
- }
- return dbResult;
- }
///
/// Elenco Gruppi tipo Azienda
@@ -163,25 +126,21 @@ namespace MP.Data.Controllers
/// Delete record AnagraficaGruppi
///
///
- public bool AnagGruppiDelete(AnagGruppiModel updRec)
+ public async Task AnagGruppiDeleteAsync(AnagGruppiModel updRec)
{
- bool answ = false;
- using (var dbCtx = new MoonProContext(options))
+ using var dbCtx = new MoonProContext(options);
+ var dbRec = await dbCtx
+ .DbSetAnagGruppi
+ .AsNoTracking()
+ .Where(x => x.CodGruppo == updRec.CodGruppo)
+ .FirstOrDefaultAsync();
+ // se trovato aggiorno descrizione (resto immutato x sicurezza!)
+ if (dbRec != null)
{
- 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;
+ dbCtx.DbSetAnagGruppi.Remove(dbRec);
}
- return answ;
+ var numRes = await dbCtx.SaveChangesAsync();
+ return numRes != 0;
}
///
@@ -193,43 +152,6 @@ namespace MP.Data.Controllers
return AnagGruppiGetTipoAsync("FASE");
}
- ///
- /// Elenco Gruppi
- ///
- ///
- public List AnagGruppiGetAll()
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = dbCtx
- .DbSetAnagGruppi
- .AsNoTracking()
- .OrderBy(x => x.CodGruppo)
- .ToList();
- }
- return dbResult;
- }
-
- ///
- /// Gruppi x tipo
- ///
- ///
- ///
- public List AnagGruppiGetTipo(string tipoGruppo)
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = dbCtx
- .DbSetAnagGruppi
- .Where(x => x.TipoGruppo == tipoGruppo)
- .AsNoTracking()
- .OrderBy(x => x.CodGruppo)
- .ToList();
- }
- return dbResult;
- }
///
/// Gruppi x tipo modalità Async
@@ -238,26 +160,13 @@ namespace MP.Data.Controllers
///
public async Task
> AnagGruppiGetTipoAsync(string tipoGruppo)
{
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = await dbCtx
- .DbSetAnagGruppi
- .Where(x => x.TipoGruppo == tipoGruppo)
- .AsNoTracking()
- .OrderBy(x => x.CodGruppo)
- .ToListAsync();
- }
- return dbResult;
- }
-
- ///
- /// Elenco Gruppi tipo REPARTO (x associazione Macchine-Operatori)
- ///
- ///
- public List AnagGruppiReparto()
- {
- return AnagGruppiGetTipo("REPARTO");
+ using var dbCtx = new MoonProContext(options);
+ return await dbCtx
+ .DbSetAnagGruppi
+ .Where(x => x.TipoGruppo == tipoGruppo)
+ .AsNoTracking()
+ .OrderBy(x => x.CodGruppo)
+ .ToListAsync();
}
///
@@ -268,7 +177,7 @@ namespace MP.Data.Controllers
{
using var dbCtx = new MoonProContext(options);
// in primis recupero i reparti...
- var listReparti = AnagGruppiGetTipo("REPARTO");
+ var listReparti = await AnagGruppiGetTipoAsync("REPARTO");
// recupero TUTTE le macchine da DbSetGrp2Macc
var listMacc = await dbCtx
@@ -299,49 +208,28 @@ namespace MP.Data.Controllers
///
///
///
- public bool AnagGruppiUpsert(AnagGruppiModel updRec)
+ public async Task AnagGruppiUpsertAsync(AnagGruppiModel updRec)
{
- bool answ = false;
- using (var dbCtx = new MoonProContext(options))
+ using var dbCtx = new MoonProContext(options);
+ var dbRec = await dbCtx
+ .DbSetAnagGruppi
+ .AsNoTracking()
+ .Where(x => x.CodGruppo == updRec.CodGruppo)
+ .FirstOrDefaultAsync();
+ // se trovato aggiorno descrizione (resto immutato x sicurezza!)
+ if (dbRec != null)
{
- var dbRec = dbCtx
- .DbSetAnagGruppi
- .AsNoTracking()
- .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;
+ dbRec.DescrGruppo = updRec.DescrGruppo;
+ dbCtx.Entry(dbRec).State = EntityState.Modified;
}
- return answ;
- }
+ // altrimenti aggiungo
+ else
+ {
+ await dbCtx.DbSetAnagGruppi.AddAsync(updRec);
+ }
+ var numRes = await dbCtx.SaveChangesAsync();
- ///
- /// Elenco Gruppi
- ///
- ///
- public List AnagKeyValGetAll()
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = dbCtx
- .DbSetAKV
- .AsNoTracking()
- .OrderBy(x => x.nomeVar)
- .ToList();
- }
- return dbResult;
+ return numRes != 0;
}
///
@@ -366,17 +254,15 @@ namespace MP.Data.Controllers
/// Elenco codice articoli che abbiano dati Dossier
///
///
- public List ArticleWithDossier()
+ public async Task> ArticleWithDossierAsync()
{
- List dbResult = new List();
using var dbCtx = new MoonPro_FluxContext(_configuration);
- dbResult = dbCtx
+ return await dbCtx
.DbSetDossiers
.AsNoTracking()
.Select(i => i.CodArticolo)
.Distinct()
- .ToList();
- return dbResult;
+ .ToListAsync();
}
///
@@ -452,29 +338,17 @@ namespace MP.Data.Controllers
///
///
///
- public async Task ArticoliDeleteRecord(AnagArticoliModel currRec)
+ public async Task ArticoliDeleteRecordAsync(AnagArticoliModel currRec)
{
- bool fatto = false;
- using (var dbCtx = new MoonProContext(options))
- {
- try
- {
- var currVal = dbCtx
- .DbSetArticoli
- .Where(x => x.CodArticolo == currRec.CodArticolo)
- .FirstOrDefault();
- dbCtx
- .DbSetArticoli
- .Remove(currVal);
- await dbCtx.SaveChangesAsync();
- fatto = true;
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione durante ArticoliDeleteRecord{Environment.NewLine}{exc}");
- }
- }
- return fatto;
+ using var dbCtx = new MoonProContext(options);
+ var currVal = dbCtx
+ .DbSetArticoli
+ .Where(x => x.CodArticolo == currRec.CodArticolo)
+ .FirstOrDefault();
+ dbCtx
+ .DbSetArticoli
+ .Remove(currVal);
+ return await dbCtx.SaveChangesAsync() > 0;
}
///
@@ -486,17 +360,13 @@ namespace MP.Data.Controllers
///
public async Task> ArticoliGetByTipoAsync(string tipo, string azienda = "*")
{
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = await dbCtx
+ using var dbCtx = new MoonProContext(options);
+ return await dbCtx
.DbSetArticoli
.AsNoTracking()
.Where(x => x.Tipo.ToUpper() == tipo.ToUpper() && (azienda == "*" || x.Azienda.ToUpper() == azienda.ToUpper()))
.OrderBy(x => x.CodArticolo)
.ToListAsync();
- }
- return dbResult;
}
///
@@ -547,34 +417,12 @@ namespace MP.Data.Controllers
///
public async Task> ArticoliGetUnusedAsync()
{
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = await dbCtx
- .DbSetArticoli
- .FromSqlRaw("EXEC stp_ART_getNotUsed")
- .AsNoTracking()
- .ToListAsync();
- }
- return dbResult;
- }
-
- ///
- /// Elenco tabella Articoli IMPIEGATI (da stored stp_ART_getUsed)
- ///
- ///
- public List ArticoliGetUsed()
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = dbCtx
+ using var dbCtx = new MoonProContext(options);
+ return await dbCtx
.DbSetArticoli
- .FromSqlRaw("EXEC stp_ART_getUsed")
+ .FromSqlRaw("EXEC stp_ART_getNotUsed")
.AsNoTracking()
- .ToList();
- }
- return dbResult;
+ .ToListAsync();
}
///
@@ -583,16 +431,12 @@ namespace MP.Data.Controllers
///
public async Task> ArticoliGetUsedAsync()
{
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = await dbCtx
- .DbSetArticoli
- .FromSqlRaw("EXEC stp_ART_getUsed")
- .AsNoTracking()
- .ToListAsync();
- }
- return dbResult;
+ using var dbCtx = new MoonProContext(options);
+ return await dbCtx
+ .DbSetArticoli
+ .FromSqlRaw("EXEC stp_ART_getUsed")
+ .AsNoTracking()
+ .ToListAsync();
}
///
@@ -618,56 +462,26 @@ namespace MP.Data.Controllers
///
public async Task ArticoliUpdateRecord(AnagArticoliModel editRec)
{
- bool fatto = false;
- using (var dbCtx = new MoonProContext(options))
- {
- try
- {
- var currRec = dbCtx
- .DbSetArticoli
- .Where(x => x.CodArticolo == editRec.CodArticolo)
- .FirstOrDefault();
- if (currRec != null)
- {
- currRec.Disegno = editRec.Disegno;
- currRec.DescArticolo = editRec.DescArticolo;
- currRec.Tipo = editRec.Tipo;
- currRec.Azienda = editRec.Azienda;
- dbCtx.Entry(currRec).State = EntityState.Modified;
- }
- else
- {
- dbCtx
+ using var dbCtx = new MoonProContext(options);
+ var currRec = dbCtx
.DbSetArticoli
- .Add(editRec);
- }
- await dbCtx.SaveChangesAsync();
- fatto = true;
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione durante ArticoliUpdateRecord{Environment.NewLine}{exc}");
- }
- }
- return fatto;
- }
-
- ///
- /// Elenco da tabella Config
- ///
- ///
- public List ConfigGetAll()
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
+ .Where(x => x.CodArticolo == editRec.CodArticolo)
+ .FirstOrDefault();
+ if (currRec != null)
{
- dbResult = dbCtx
- .DbSetConfig
- .AsNoTracking()
- .OrderBy(x => x.Chiave)
- .ToList();
+ currRec.Disegno = editRec.Disegno;
+ currRec.DescArticolo = editRec.DescArticolo;
+ currRec.Tipo = editRec.Tipo;
+ currRec.Azienda = editRec.Azienda;
+ dbCtx.Entry(currRec).State = EntityState.Modified;
}
- return dbResult;
+ else
+ {
+ dbCtx
+ .DbSetArticoli
+ .Add(editRec);
+ }
+ return await dbCtx.SaveChangesAsync() > 0;
}
///
@@ -692,40 +506,19 @@ namespace MP.Data.Controllers
{
bool fatto = false;
ConfigModel dbResult = new ConfigModel();
- using (var dbCtx = new MoonProContext(options))
+ using var dbCtx = new MoonProContext(options);
+ dbResult = await dbCtx
+ .DbSetConfig
+ .Where(x => x.Chiave == updRec.Chiave)
+ .FirstOrDefaultAsync();
+ if (dbResult != null)
{
- dbResult = await dbCtx
- .DbSetConfig
- .Where(x => x.Chiave == updRec.Chiave)
- .FirstOrDefaultAsync();
- if (dbResult != null)
- {
- dbResult.Valore = updRec.Valore;
- await dbCtx.SaveChangesAsync();
- fatto = true;
- }
+ dbResult.Valore = updRec.Valore;
+ fatto = await dbCtx.SaveChangesAsync() > 0;
}
return fatto;
}
- ///
- /// Intera tab dati macchina
- ///
- ///
- public List DatiMacchineGetAll()
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = dbCtx
- .DbSetDatiMacchine
- .AsNoTracking()
- .OrderBy(x => x.IdxMacchina)
- .ToList();
- }
- return dbResult;
- }
-
///
/// Eliminazione di un dossier
///
@@ -757,10 +550,8 @@ namespace MP.Data.Controllers
///
public async Task> DossiersGetLastFiltAsync(string IdxMacchina, string CodArticolo, DateTime DtStart, DateTime DtEnd, int MaxRec)
{
- List dbResult = new List();
- using (var dbCtx = new MoonPro_FluxContext(_configuration))
- {
- dbResult = await dbCtx
+ using var dbCtx = new MoonPro_FluxContext(_configuration);
+ return await dbCtx
.DbSetDossiers
.AsNoTracking()
.Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodArticolo == "*" || x.CodArticolo == CodArticolo) && (x.DtRif >= DtStart && x.DtRif <= DtEnd))
@@ -769,8 +560,6 @@ namespace MP.Data.Controllers
.OrderByDescending(x => x.DtRif)
.Take(MaxRec)
.ToListAsync();
- }
- return dbResult;
}
///
@@ -787,29 +576,6 @@ namespace MP.Data.Controllers
return await dbCtx.SaveChangesAsync() > 0;
}
- ///
- /// Effettua salvataggio snapshot parametri (con stored) + svuota eventuale cache _redisConn
- ///
- /// macchina
- /// Num massimo secondi per recuperare dati correnti
- /// DataOra riferimento x cui prendere valori antecedenti
- public bool DossiersTakeParamsSnapshot(string idxMacchina, int maxSec, DateTime dtRif)
- {
- bool answ = false;
- using (var dbCtx = new MoonPro_FluxContext(_configuration))
- {
- var pIdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
- var pMaxSec = new SqlParameter("@MaxSec", maxSec);
- var pDtRif = new SqlParameter("@DtRif", dtRif);
-
- var dbResult = dbCtx
- .Database
- .ExecuteSqlRaw("EXEC stp_FL_TakeSnapshot @IdxMacchina,@MaxSec,@DtRif", pIdxMacchina, pMaxSec, pDtRif);
- answ = true;
- }
- return answ;
- }
-
///
/// Effettua salvataggio snapshot parametri (con stored) + svuota eventuale cache _redisConn
///
@@ -864,25 +630,6 @@ namespace MP.Data.Controllers
return ListLinkFiltAsync("SpecLink");
}
- ///
- /// Elenco operatori
- ///
- ///
- public List ElencoOperatori()
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = dbCtx
- .DbOperatori
- .Where(s => s.MatrOpr > 0)
- .AsNoTracking()
- .OrderBy(x => x.MatrOpr)
- .ToList();
- }
- return dbResult;
- }
-
///
/// Aggiunta record EventList
///
@@ -936,6 +683,10 @@ namespace MP.Data.Controllers
var pIdxMacchina = new SqlParameter("@IdxMacchina", idxMaccSel);
var pOnlyTest = new SqlParameter("@OnlyTest", false);
+ // dbContext condiviso
+ using var dbCtx = new MoonPro_FluxContext(_configuration);
+ // opzionalmente timeout comandi a 2 minuti... NON usato x ora e da testare
+ //dbCtx.Database.SetCommandTimeout(TimeSpan.FromMinutes(2));
// processo 1:1 ogni flusso
foreach (var item in fluxList)
{
@@ -949,83 +700,76 @@ namespace MP.Data.Controllers
DateTime dtCursStart = currPeriodo.Inizio;
DateTime dtCursEnd = dtCursStart.Add(step);
bool setCompleted = false;
- // dbContext x ogni singolo flusso
- using (var dbCtx = new MoonPro_FluxContext(_configuration))
+ // li processo per intervallo richiesto, cercando dati nel periodo eselezionando VC
+ while (!setCompleted)
{
- // opzionalmente timeout comandi a 2 minuti... NON usato x ora e da testare
- //dbCtx.Database.SetCommandTimeout(TimeSpan.FromMinutes(2));
- // li processo per intervallo richiesto, cercando dati nel periodo e
- // selezionando VC
- while (!setCompleted)
+ // ora recupero TUTTI i dati della macchina
+ var currFlux = await dbCtx
+ .DbSetFluxLog
+ .Where(x => (x.CodFlux == item) && (x.dtEvento >= dtCursStart && x.dtEvento < dtCursEnd) && (x.IdxMacchina == idxMaccSel))
+ .ToListAsync();
+
+ int numRec = currFlux.Count;
+ numRecProc += numRec;
+ if (numRec > maxItem)
{
- // ora recupero TUTTI i dati della macchina
- var currFlux = await dbCtx
- .DbSetFluxLog
- .Where(x => (x.CodFlux == item) && (x.dtEvento >= dtCursStart && x.dtEvento < dtCursEnd) && (x.IdxMacchina == idxMaccSel))
- .ToListAsync();
+ List listPeriodi = new List();
- int numRec = currFlux.Count;
- numRecProc += numRec;
- if (numRec > maxItem)
+ switch (valMode)
{
- List listPeriodi = new List();
+ case Enums.ValSelection.First:
+ // recupero 2° item
+ var recStart = currFlux.Skip(1).FirstOrDefault();
+ // salvo periodo!
+ listPeriodi.Add(new Periodo(recStart.dtEvento, dtCursEnd));
+ break;
- switch (valMode)
- {
- case Enums.ValSelection.First:
- // recupero 2° item
- var recStart = currFlux.Skip(1).FirstOrDefault();
- // salvo periodo!
- listPeriodi.Add(new Periodo(recStart.dtEvento, dtCursEnd));
- break;
+ case Enums.ValSelection.Last:
+ // recupero ultimo item
+ var recEnd = currFlux.LastOrDefault();
+ // salvo periodo!
+ listPeriodi.Add(new Periodo(dtCursStart, recEnd.dtEvento));
+ break;
- case Enums.ValSelection.Last:
- // recupero ultimo item
- var recEnd = currFlux.LastOrDefault();
- // salvo periodo!
- listPeriodi.Add(new Periodo(dtCursStart, recEnd.dtEvento));
- break;
-
- case Enums.ValSelection.Center:
- int idx = 1;
- // per iniziare mi metto a 1/(n+1) rec come step
- var recCent = currFlux.Skip(idx / (maxItem + 1)).FirstOrDefault();
- listPeriodi.Add(new Periodo(dtCursStart, recCent.dtEvento));
- // salvo restanti periodi (se > 1)!
- if (maxItem > 1)
+ case Enums.ValSelection.Center:
+ int idx = 1;
+ // per iniziare mi metto a 1/(n+1) rec come step
+ var recCent = currFlux.Skip(idx / (maxItem + 1)).FirstOrDefault();
+ listPeriodi.Add(new Periodo(dtCursStart, recCent.dtEvento));
+ // salvo restanti periodi (se > 1)!
+ if (maxItem > 1)
+ {
+ for (int i = 2; i < maxItem; i++)
{
- for (int i = 2; i < maxItem; i++)
- {
- DateTime dtInizio = recCent.dtEvento;
- recCent = currFlux.Skip(i / (maxItem + 1)).FirstOrDefault();
- listPeriodi.Add(new Periodo(dtInizio, recCent.dtEvento));
- }
+ DateTime dtInizio = recCent.dtEvento;
+ recCent = currFlux.Skip(i / (maxItem + 1)).FirstOrDefault();
+ listPeriodi.Add(new Periodo(dtInizio, recCent.dtEvento));
}
- // aggiungo ultimo...
- listPeriodi.Add(new Periodo(recCent.dtEvento.AddSeconds(1), dtCursEnd));
- break;
+ }
+ // aggiungo ultimo...
+ listPeriodi.Add(new Periodo(recCent.dtEvento.AddSeconds(1), dtCursEnd));
+ break;
- default:
- break;
- }
-
- // ciclo x tutti i periodi e chiamo stored...
- foreach (var slot in listPeriodi)
- {
- // parametri x periodo (base)
- var pDtStart = new SqlParameter("@DtStart", slot.Inizio);
- var pDtEnd = new SqlParameter("@DtEnd", slot.Fine);
- var dbResult = await dbCtx
- .Database
- .ExecuteSqlRawAsync("EXEC man.stp_ReduceFluxLog @IdxMacchina, @CodFlux, @DtStart, @DtEnd, @OnlyTest", pIdxMacchina, pCodFlux, pDtStart, pDtEnd, pOnlyTest);
- }
+ default:
+ break;
}
- // incremento dt fine periodo
- dtCursStart = dtCursEnd;
- dtCursEnd = dtCursStart.Add(step);
- setCompleted = dtCursStart >= currPeriodo.Fine;
+ // ciclo x tutti i periodi e chiamo stored...
+ foreach (var slot in listPeriodi)
+ {
+ // parametri x periodo (base)
+ var pDtStart = new SqlParameter("@DtStart", slot.Inizio);
+ var pDtEnd = new SqlParameter("@DtEnd", slot.Fine);
+ var dbResult = await dbCtx
+ .Database
+ .ExecuteSqlRawAsync("EXEC man.stp_ReduceFluxLog @IdxMacchina, @CodFlux, @DtStart, @DtEnd, @OnlyTest", pIdxMacchina, pCodFlux, pDtStart, pDtEnd, pOnlyTest);
+ }
}
+
+ // incremento dt fine periodo
+ dtCursStart = dtCursEnd;
+ dtCursEnd = dtCursStart.Add(step);
+ setCompleted = dtCursStart >= currPeriodo.Fine;
}
// fermo cronometro e salvo su DB...
sw.Stop();
@@ -1092,28 +836,24 @@ namespace MP.Data.Controllers
/// def: 10
/// def: 50
///
- public async Task ForceDbMaint(bool doExec, bool doUpdStat, bool doSave, int minPgCnt, int minAvgFrag, int maxAvgFragReb)
+ public async Task ForceDbMaintAsync(bool doExec, bool doUpdStat, bool doSave, int minPgCnt, int minAvgFrag, int maxAvgFragReb)
{
- Log.Info($"Inizio ForceDbMaint on MoonProAdminContext");
- bool fatto = false;
+ Log.Info($"Inizio ForceDbMaintAsync on MoonProAdminContext");
// uso context admin x query lunghe
- using (var dbCtx = new MoonProAdminContext(_configuration))
- {
- var pFlgExec = new SqlParameter("@FlgExec", doExec ? "Y" : "N");
- var pFlgUpdStat = new SqlParameter("@FlgUpdStat", doUpdStat ? "Y" : "N");
- var pFlgSave = new SqlParameter("@FlgSave", doSave ? "Y" : "N");
- var pMinPgCnt = new SqlParameter("@min_page_count", minPgCnt);
- var pMinAvgFrag = new SqlParameter("@min_avg_fragmentation_in_percent", minAvgFrag);
- var pMaxAvgFrag = new SqlParameter("@max_avg_fragmentation_per_rebuild", maxAvgFragReb);
+ using var dbCtx = new MoonProAdminContext(_configuration);
+ var pFlgExec = new SqlParameter("@FlgExec", doExec ? "Y" : "N");
+ var pFlgUpdStat = new SqlParameter("@FlgUpdStat", doUpdStat ? "Y" : "N");
+ var pFlgSave = new SqlParameter("@FlgSave", doSave ? "Y" : "N");
+ var pMinPgCnt = new SqlParameter("@min_page_count", minPgCnt);
+ var pMinAvgFrag = new SqlParameter("@min_avg_fragmentation_in_percent", minAvgFrag);
+ var pMaxAvgFrag = new SqlParameter("@max_avg_fragmentation_per_rebuild", maxAvgFragReb);
- var dbResult = await dbCtx
- .Database
- .ExecuteSqlRawAsync("EXEC man.stp_Utility_Maintanance");
- //.ExecuteSqlRaw("EXEC man.stp_Utility_Maintanance @FlgExec, @FlgUpdStat, @FlgSave, @min_page_count, @min_avg_fragmentation_in_percent, @max_avg_fragmentation_per_rebuild", pFlgExec, pFlgUpdStat, pFlgSave, pMinPgCnt, pMinAvgFrag, pMaxAvgFrag);
- fatto = true;
- }
- Log.Info($"FINE ForceDbMaint on MoonProAdminContext");
- return fatto;
+ var dbResult = await dbCtx
+ .Database
+ .ExecuteSqlRawAsync("EXEC man.stp_Utility_Maintanance");
+ //.ExecuteSqlRaw("EXEC man.stp_Utility_Maintanance @FlgExec, @FlgUpdStat, @FlgSave, @min_page_count, @min_avg_fragmentation_in_percent, @max_avg_fragmentation_per_rebuild", pFlgExec, pFlgUpdStat, pFlgSave, pMinPgCnt, pMinAvgFrag, pMaxAvgFrag);
+ Log.Info($"FINE ForceDbMaintAsync on MoonProAdminContext");
+ return dbResult != 0;
}
///
@@ -1313,38 +1053,14 @@ namespace MP.Data.Controllers
///
///
///
- public List ListLinkAll()
+ public async Task> ListLinkAllAsync()
{
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = dbCtx
+ using var dbCtx = new MoonProContext(options);
+ return await dbCtx
.DbSetLinkMenu
.AsNoTracking()
.OrderBy(x => x.Ordine)
- .ToList();
- }
- return dbResult;
- }
-
- ///
- /// Elenco link JQM dato filtro tipo
- ///
- ///
- ///
- public List ListLinkFilt(string tipoLink)
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = dbCtx
- .DbSetLinkMenu
- .Where(x => x.TipoLink == tipoLink)
- .AsNoTracking()
- .OrderBy(x => x.Ordine)
- .ToList();
- }
- return dbResult;
+ .ToListAsync();
}
///
@@ -1355,16 +1071,13 @@ namespace MP.Data.Controllers
public async Task> ListLinkFiltAsync(string tipoLink)
{
List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = await dbCtx
- .DbSetLinkMenu
- .Where(x => x.TipoLink == tipoLink)
- .AsNoTracking()
- .OrderBy(x => x.Ordine)
- .ToListAsync();
- }
- return dbResult;
+ using var dbCtx = new MoonProContext(options);
+ return await dbCtx
+ .DbSetLinkMenu
+ .Where(x => x.TipoLink == tipoLink)
+ .AsNoTracking()
+ .OrderBy(x => x.Ordine)
+ .ToListAsync();
}
///
@@ -1434,35 +1147,6 @@ namespace MP.Data.Controllers
.ToListAsync();
}
- ///
- /// Elenco PODL per composizione KIT non avviati filtrati x articolo, KeyRich (che contiene stato)
- ///
- /// Solo lanciati (1) o ancora disponibili (0)
- /// KeyRich (parziale) da cercare (es cod stato x yacht)
- /// Macchina
- /// Gruppo
- ///
- public List ListPODL_KitFilt(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo, DateTime startDate, DateTime endDate)
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- var Lanc = new SqlParameter("@Lanciato", lanciato);
- var KeyRich = new SqlParameter("@KeyRich", keyRichPart);
- var CodGrp = new SqlParameter("@CodGruppo", codGruppo);
- var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
- var DateFrom = new SqlParameter("@DtInizio", startDate);
- var DateTo = new SqlParameter("@DtFine", endDate);
-
- dbResult = dbCtx
- .DbSetPODLExp
- .FromSqlRaw("EXEC stp_PODL_getByFiltSpecKit @Lanciato, @KeyRich, @CodGruppo, @IdxMacchina, @DtInizio, @DtFine", Lanc, KeyRich, CodGrp, IdxMacc, DateFrom, DateTo)
- .AsNoTracking()
- .ToList();
- }
- return dbResult;
- }
-
///
/// Elenco PODL per composizione KIT non avviati filtrati x articolo, KeyRich (che contiene stato)
///
@@ -1473,52 +1157,19 @@ namespace MP.Data.Controllers
///
public async Task> ListPODL_KitFiltAsync(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo, DateTime startDate, DateTime endDate)
{
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- var Lanc = new SqlParameter("@Lanciato", lanciato);
- var KeyRich = new SqlParameter("@KeyRich", keyRichPart);
- var CodGrp = new SqlParameter("@CodGruppo", codGruppo);
- var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
- var DateFrom = new SqlParameter("@DtInizio", startDate);
- var DateTo = new SqlParameter("@DtFine", endDate);
+ using var dbCtx = new MoonProContext(options);
+ var Lanc = new SqlParameter("@Lanciato", lanciato);
+ var KeyRich = new SqlParameter("@KeyRich", keyRichPart);
+ var CodGrp = new SqlParameter("@CodGruppo", codGruppo);
+ var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
+ var DateFrom = new SqlParameter("@DtInizio", startDate);
+ var DateTo = new SqlParameter("@DtFine", endDate);
- dbResult = await dbCtx
+ return await dbCtx
.DbSetPODLExp
.FromSqlRaw("EXEC stp_PODL_getByFiltSpecKit @Lanciato, @KeyRich, @CodGruppo, @IdxMacchina, @DtInizio, @DtFine", Lanc, KeyRich, CodGrp, IdxMacc, DateFrom, DateTo)
.AsNoTracking()
.ToListAsync();
- }
- return dbResult;
- }
-
- ///
- /// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato)
- ///
- /// Solo lanciati (1) o ancora disponibili (0)
- /// KeyRich (parziale) da cercare (es cod stato x yacht)
- /// Macchina
- /// Gruppo
- ///
- public List ListPODLFilt(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo, DateTime startDate, DateTime endDate)
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- var Lanc = new SqlParameter("@Lanciato", lanciato);
- var KeyRich = new SqlParameter("@KeyRich", keyRichPart);
- var CodGrp = new SqlParameter("@CodGruppo", codGruppo);
- var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
- var DateFrom = new SqlParameter("@DtInizio", startDate);
- var DateTo = new SqlParameter("@DtFine", endDate);
-
- dbResult = dbCtx
- .DbSetPODLExp
- .FromSqlRaw("EXEC stp_PODL_getByFiltSpec @Lanciato, @KeyRich, @CodGruppo, @IdxMacchina, @DtInizio, @DtFine", Lanc, KeyRich, CodGrp, IdxMacc, DateFrom, DateTo)
- .AsNoTracking()
- .ToList();
- }
- return dbResult;
}
///
@@ -1531,48 +1182,21 @@ namespace MP.Data.Controllers
///
public async Task> ListPODLFiltAsync(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo, DateTime startDate, DateTime endDate)
{
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- var Lanc = new SqlParameter("@Lanciato", lanciato);
- var KeyRich = new SqlParameter("@KeyRich", keyRichPart);
- var CodGrp = new SqlParameter("@CodGruppo", codGruppo);
- var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
- var DateFrom = new SqlParameter("@DtInizio", startDate);
- var DateTo = new SqlParameter("@DtFine", endDate);
+ using var dbCtx = new MoonProContext(options);
+ var Lanc = new SqlParameter("@Lanciato", lanciato);
+ var KeyRich = new SqlParameter("@KeyRich", keyRichPart);
+ var CodGrp = new SqlParameter("@CodGruppo", codGruppo);
+ var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
+ var DateFrom = new SqlParameter("@DtInizio", startDate);
+ var DateTo = new SqlParameter("@DtFine", endDate);
- dbResult = await dbCtx
+ return await dbCtx
.DbSetPODLExp
.FromSqlRaw("EXEC stp_PODL_getByFiltSpec @Lanciato, @KeyRich, @CodGruppo, @IdxMacchina, @DtInizio, @DtFine", Lanc, KeyRich, CodGrp, IdxMacc, DateFrom, DateTo)
.AsNoTracking()
.ToListAsync();
- }
- return dbResult;
}
-#if false
- ///
- /// Elenco valori ammessi x tabella/colonna
- ///
- ///
- ///
- ///
- public List ListValuesFilt(string tabName, string fieldName)
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = dbCtx
- .DbSetListValues
- .Where(x => x.TableName == tabName && x.FieldName == fieldName)
- .AsNoTracking()
- .OrderBy(x => x.ordinal)
- .ToList();
- }
- return dbResult;
- }
-#endif
-
///
/// Elenco valori ammessi x tabella/colonna Async
///
@@ -1581,17 +1205,13 @@ namespace MP.Data.Controllers
///
public async Task> ListValuesFiltAsync(string tabName, string fieldName)
{
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = await dbCtx
- .DbSetListValues
- .Where(x => x.TableName == tabName && x.FieldName == fieldName)
- .AsNoTracking()
- .OrderBy(x => x.ordinal)
- .ToListAsync();
- }
- return dbResult;
+ using var dbCtx = new MoonProContext(options);
+ return await dbCtx
+ .DbSetListValues
+ .Where(x => x.TableName == tabName && x.FieldName == fieldName)
+ .AsNoTracking()
+ .OrderBy(x => x.ordinal)
+ .ToListAsync();
}
///
@@ -1599,92 +1219,38 @@ namespace MP.Data.Controllers
///
///
///
- public List MacchineByMatrOper(int MatrOpr)
+ public async Task> MacchineByMatrOperAsync(int MatrOpr)
{
- List dbResult = new List();
- try
+ using var dbCtx = new MoonProContext(options);
+ if (MatrOpr == 0)
{
- using (var dbCtx = new MoonProContext(options))
- {
- if (MatrOpr == 0)
- {
- dbResult = dbCtx
- .DbSetMacchine
- .AsNoTracking()
- .OrderBy(x => x.IdxMacchina)
- .ToList();
- }
- else
- {
- dbResult = dbCtx
- .DbSetGrp2Oper
- .Where(g => g.MatrOpr == MatrOpr)
- .Join(dbCtx.DbSetGrp2Macc,
- g => g.CodGruppo,
- m => m.CodGruppo,
- (g, m) => m
- )
- .Distinct()
- .Join(dbCtx.DbSetMacchine,
- g => g.IdxMacchina,
- m => m.IdxMacchina,
- (g, m) => m
- )
- .Distinct()
- .AsNoTracking()
- .OrderBy(x => x.IdxMacchina)
- .ToList();
- }
- }
+ return await dbCtx
+ .DbSetMacchine
+ .AsNoTracking()
+ .OrderBy(x => x.IdxMacchina)
+ .ToListAsync();
}
- catch (Exception exc)
+ else
{
- Log.Error($"Eccezione in MacchineByMatrOper{Environment.NewLine}{exc}");
+ return await dbCtx
+ .DbSetGrp2Oper
+ .Where(g => g.MatrOpr == MatrOpr)
+ .Join(dbCtx.DbSetGrp2Macc,
+ g => g.CodGruppo,
+ m => m.CodGruppo,
+ (g, m) => m
+ )
+ .Distinct()
+ .Join(dbCtx.DbSetMacchine,
+ g => g.IdxMacchina,
+ m => m.IdxMacchina,
+ (g, m) => m
+ )
+ .Distinct()
+ .AsNoTracking()
+ .OrderBy(x => x.IdxMacchina)
+ .ToListAsync();
}
- return dbResult;
- }
-
- ///
- /// Elenco da tabella Macchine filtro x gruppo
- ///
- ///
- ///
- public List MacchineGetFilt(string codGruppo)
- {
- List dbResult = new List();
- try
- {
- using (var dbCtx = new MoonProContext(options))
- {
- 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
- )
- .AsNoTracking()
- .OrderBy(x => x.IdxMacchina)
- .ToList();
- }
- }
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione in MacchineGetFilt{Environment.NewLine}{exc}");
- }
- return dbResult;
}
///
@@ -1694,40 +1260,29 @@ namespace MP.Data.Controllers
///
public async Task> MacchineGetFiltAsync(string codGruppo)
{
- List dbResult = new List();
- try
+ using var dbCtx = new MoonProContext(options);
+ if (codGruppo == "*")
{
- using (var dbCtx = new MoonProContext(options))
- {
- if (codGruppo == "*")
- {
- dbResult = await dbCtx
- .DbSetMacchine
- .AsNoTracking()
- .OrderBy(x => x.IdxMacchina)
- .ToListAsync();
- }
- else
- {
- dbResult = await dbCtx
- .DbSetGrp2Macc
- .Where(g => g.CodGruppo == codGruppo)
- .Join(dbCtx.DbSetMacchine,
- g => g.IdxMacchina,
- m => m.IdxMacchina,
- (g, m) => m
- )
- .AsNoTracking()
- .OrderBy(x => x.IdxMacchina)
- .ToListAsync();
- }
- }
+ return await dbCtx
+ .DbSetMacchine
+ .AsNoTracking()
+ .OrderBy(x => x.IdxMacchina)
+ .ToListAsync();
}
- catch (Exception exc)
+ else
{
- Log.Error($"Eccezione in MacchineGetFiltAsync{Environment.NewLine}{exc}");
+ return await dbCtx
+ .DbSetGrp2Macc
+ .Where(g => g.CodGruppo == codGruppo)
+ .Join(dbCtx.DbSetMacchine,
+ g => g.IdxMacchina,
+ m => m.IdxMacchina,
+ (g, m) => m
+ )
+ .AsNoTracking()
+ .OrderBy(x => x.IdxMacchina)
+ .ToListAsync();
}
- return dbResult;
}
///
@@ -1748,41 +1303,6 @@ namespace MP.Data.Controllers
.ToListAsync() ?? new();
}
- ///
- /// Aggiornamento record Microstato macchina
- ///
- ///
- ///
- public async Task MicroStatoMacchinaUpsert(MicroStatoMacchinaModel newRec)
- {
- bool fatto = false;
- using (var dbCtx = new MoonProContext(options))
- {
- var actRec = await dbCtx
- .DbSetMicroStatoMacc
- .Where(x => x.IdxMacchina == newRec.IdxMacchina)
- .AsNoTracking()
- .FirstOrDefaultAsync();
- if (actRec == null)
- {
- dbCtx
- .DbSetMicroStatoMacc
- .Add(newRec);
- }
- else
- {
- actRec.IdxMicroStato = newRec.IdxMicroStato;
- actRec.InizioStato = newRec.InizioStato;
- actRec.Value = newRec.Value;
-
- dbCtx.Entry(actRec).State = EntityState.Modified;
- }
- await dbCtx.SaveChangesAsync();
- fatto = true;
- }
- return fatto;
- }
-
///
/// Elenco da tabella MappaStatoExplModel
///
@@ -1803,35 +1323,6 @@ namespace MP.Data.Controllers
return dbResult;
}
-#if false
- ///
- /// Elenco ODL dato batch selezionato
- ///
- /// Batch richiesto
- ///
- public List OdlByBatch(string batchSel)
- {
- List dbResult = new List();
- using (var dbCtx = new MoonPro_InveContext(_configuration))
- {
- try
- {
- dbResult = dbCtx
- .DbGiacenzeData
- .AsNoTracking()
- .Where(x => x.IdentRG == batchSel)
- .Select(x => x.IdxOdl)
- .ToList();
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione durante OdlByBatch{Environment.NewLine}{exc}");
- }
- }
- return dbResult;
- }
-#endif
-
///
/// Elenco ODL dato batch selezionato
///
@@ -1938,43 +1429,13 @@ namespace MP.Data.Controllers
///
public async Task> OdlGetCurrentAsync()
{
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = await dbCtx
+ using var dbCtx = new MoonProContext(options);
+ return await dbCtx
.DbSetODL
.Where(x => x.DataInizio != null && x.DataFine == null)
.ToListAsync();
- }
- return dbResult;
}
-#if false
- ///
- /// Elenco TUTTI GLI ODL
- ///
- ///
- public List OdlListAll()
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- try
- {
- dbResult = dbCtx
- .DbSetODL
- .AsNoTracking()
- .ToList();
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione durante ListOdlAll{Environment.NewLine}{exc}");
- }
- }
- return dbResult;
- }
-#endif
-
///
/// Statistiche ODL calcolate (da stored stp_STAT_ODL)
///
@@ -2049,26 +1510,6 @@ namespace MP.Data.Controllers
.ToListAsync();
}
- ///
- /// Stato prod macchina
- ///
- ///
- ///
- public PzProdModel PezziProdMacchina(string idxMacchina)
- {
- PzProdModel dbResult = new PzProdModel();
- using (var dbCtx = new MoonProContext(options))
- {
- var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
- dbResult = dbCtx
- .DbSetPzProd
- .FromSqlRaw("EXEC stp_PzProd_getByMacchina @IdxMacchina", IdxMacchina)
- .AsNoTracking()
- .FirstOrDefault();
- }
- return dbResult;
- }
-
///
/// Recupero PODL da chiave
///
@@ -2130,7 +1571,6 @@ namespace MP.Data.Controllers
public async Task PODL_startSetup(PODLExpModel editRec, int matrOpr, double tcRich, int pzPallet, string note, DateTime dtEvent)
{
bool answ = false;
-
PODLModel recPODL = new PODLModel()
{
IdxPromessa = editRec.IdxPromessa,
@@ -2150,39 +1590,29 @@ namespace MP.Data.Controllers
InsertDate = editRec.InsertDate
};
- using (var dbCtx = new MoonProContext(options))
+ using var dbCtx = new MoonProContext(options);
+ var currRec = await dbCtx
+ .DbSetPODL
+ .AsNoTracking()
+ .Where(x => x.IdxPromessa == recPODL.IdxPromessa)
+ .FirstOrDefaultAsync();
+
+ if (currRec != null)
{
- try
- {
- var currRec = dbCtx
- .DbSetPODL
- .AsNoTracking()
- .Where(x => x.IdxPromessa == recPODL.IdxPromessa)
- .FirstOrDefault();
+ // eseguo stored attrezzaggio
+ var IdxPromessa = new SqlParameter("@idxPromessa", recPODL.IdxPromessa);
+ var MatrOpr = new SqlParameter("@MatrOpr", matrOpr);
+ var IdxMacchina = new SqlParameter("@IdxMacchina", recPODL.IdxMacchina);
+ var TCRichAttr = new SqlParameter("@TCRichAttr", tcRich);
+ var PzPallet = new SqlParameter("@PzPallet", pzPallet);
+ var Note = new SqlParameter("@Note", note);
+ var DtEvento = new SqlParameter("@dtEvento", dtEvent);
+ var callResult = await dbCtx
+ .Database
+ .ExecuteSqlRawAsync("EXEC stp_ODL_inizioSetupPromessa @idxPromessa, @MatrOpr, @IdxMacchina, @TCRichAttr, @PzPallet, @Note, @dtEvento", IdxPromessa, MatrOpr, IdxMacchina, TCRichAttr, PzPallet, Note, DtEvento);
- if (currRec != null)
- {
- // eseguo stored attrezzaggio
- var IdxPromessa = new SqlParameter("@idxPromessa", recPODL.IdxPromessa);
- var MatrOpr = new SqlParameter("@MatrOpr", matrOpr);
- var IdxMacchina = new SqlParameter("@IdxMacchina", recPODL.IdxMacchina);
- var TCRichAttr = new SqlParameter("@TCRichAttr", tcRich);
- var PzPallet = new SqlParameter("@PzPallet", pzPallet);
- var Note = new SqlParameter("@Note", note);
- var DtEvento = new SqlParameter("@dtEvento", dtEvent);
- var callResult = await dbCtx
- .Database
- .ExecuteSqlRawAsync("EXEC stp_ODL_inizioSetupPromessa @idxPromessa, @MatrOpr, @IdxMacchina, @TCRichAttr, @PzPallet, @Note, @dtEvento", IdxPromessa, MatrOpr, IdxMacchina, TCRichAttr, PzPallet, Note, DtEvento);
-
- answ = true;
- }
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione durante PODL_doSetup{Environment.NewLine}{exc}");
- }
+ answ = true;
}
- await Task.Delay(1);
return answ;
}
@@ -2195,29 +1625,18 @@ namespace MP.Data.Controllers
public async Task PODL_updateRecipe(int idxPODL, string recipeName)
{
bool answ = false;
- using (var dbCtx = new MoonProContext(options))
- {
- try
- {
- var currRec = dbCtx
- .DbSetPODL
- .Where(x => x.IdxPromessa == idxPODL)
- .FirstOrDefault();
+ using var dbCtx = new MoonProContext(options);
+ var currRec = await dbCtx
+ .DbSetPODL
+ .Where(x => x.IdxPromessa == idxPODL)
+ .FirstOrDefaultAsync();
- if (currRec != null)
- {
- currRec.Recipe = recipeName;
- dbCtx.Entry(currRec).State = EntityState.Modified;
- await dbCtx.SaveChangesAsync();
- answ = true;
- }
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione durante PODL_updateRecipe{Environment.NewLine}{exc}");
- }
+ if (currRec != null)
+ {
+ currRec.Recipe = recipeName;
+ dbCtx.Entry(currRec).State = EntityState.Modified;
+ answ = await dbCtx.SaveChangesAsync() > 0;
}
- await Task.Delay(1);
return answ;
}
@@ -2226,7 +1645,7 @@ namespace MP.Data.Controllers
///
///
///
- public async Task PODLDeleteRecord(PODLExpModel currRec)
+ public async Task PODLDeleteRecordAsync(PODLExpModel currRec)
{
PODLModel recPODL = new PODLModel()
{
@@ -2246,27 +1665,15 @@ namespace MP.Data.Controllers
CodCli = currRec.CodCli,
InsertDate = currRec.InsertDate
};
- bool fatto = false;
- using (var dbCtx = new MoonProContext(options))
- {
- try
- {
- var currVal = dbCtx
- .DbSetPODL
- .Where(x => x.IdxPromessa == recPODL.IdxPromessa)
- .FirstOrDefault();
- dbCtx
- .DbSetPODL
- .Remove(currVal);
- await dbCtx.SaveChangesAsync();
- fatto = true;
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione durante PODLDeleteRecord{Environment.NewLine}{exc}");
- }
- }
- return fatto;
+ using var dbCtx = new MoonProContext(options);
+ var currVal = await dbCtx
+ .DbSetPODL
+ .Where(x => x.IdxPromessa == recPODL.IdxPromessa)
+ .FirstOrDefaultAsync();
+ dbCtx
+ .DbSetPODL
+ .Remove(currVal);
+ return await dbCtx.SaveChangesAsync() > 0;
}
///
@@ -2318,31 +1725,6 @@ namespace MP.Data.Controllers
return await dbCtx.SaveChangesAsync() > 0;
}
- ///
- /// Annulla modifiche su una specifica entity (cancel update)
- ///
- ///
- ///
- public bool RollBackEntity(object item)
- {
- bool answ = false;
- using (var dbCtx = new MoonProContext(options))
- {
- try
- {
- if (dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Deleted || dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Modified)
- {
- dbCtx.Entry(item).Reload();
- }
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
- }
- }
- return answ;
- }
-
///
/// Stato macchina (da key)
///
@@ -2402,56 +1784,51 @@ namespace MP.Data.Controllers
///
///
///
- public bool TemplateKitUpsert(TemplateKitModel editRec, string codAzienda)
+ public async Task TemplateKitUpsertAsync(TemplateKitModel editRec, string codAzienda)
{
- bool fatto = false;
- using (var dbCtx = new MoonProContext(options))
+ using var dbCtx = new MoonProContext(options);
+ // verifico preliminarmente articolo...
+ var recArt = dbCtx
+ .DbSetArticoli
+ .FirstOrDefault(x => x.CodArticolo == editRec.CodArtParent);
+ // se mancasse...
+ if (recArt == null)
{
- // verifico preliminarmente articolo...
- var recArt = dbCtx
- .DbSetArticoli
- .FirstOrDefault(x => x.CodArticolo == editRec.CodArtParent);
- // se mancasse...
- if (recArt == null)
+ // aggiungo!
+ AnagArticoliModel newRecArt = new AnagArticoliModel()
{
- // aggiungo!
- AnagArticoliModel newRecArt = new AnagArticoliModel()
- {
- CodArticolo = editRec.CodArtParent,
- Tipo = "KIT",
- DescArticolo = $"Articolo KIT - {DateTime.Now:yyyy-MM-dd HH:mm:ss}",
- Disegno = "",
- Azienda = codAzienda,
- CurrRev = "",
- ProdRev = ""
- };
- dbCtx
- .DbSetArticoli
- .Add(newRecArt);
- }
-
- // proseguo col KIT
- var actRec = dbCtx
- .DbSetTempKit
- .Where(x => x.CodArtParent == editRec.CodArtParent && x.CodArtChild == editRec.CodArtChild)
- .FirstOrDefault();
-
- // se NON ci fosse aggiungo...
- if (actRec == null)
- {
- dbCtx
- .DbSetTempKit
- .Add(editRec);
- }
- else
- {
- actRec.Qty = editRec.Qty;
- dbCtx.Entry(actRec).State = EntityState.Modified;
- }
- var res = dbCtx.SaveChanges();
- fatto = res != 0;
+ CodArticolo = editRec.CodArtParent,
+ Tipo = "KIT",
+ DescArticolo = $"Articolo KIT - {DateTime.Now:yyyy-MM-dd HH:mm:ss}",
+ Disegno = "",
+ Azienda = codAzienda,
+ CurrRev = "",
+ ProdRev = ""
+ };
+ dbCtx
+ .DbSetArticoli
+ .Add(newRecArt);
}
- return fatto;
+
+ // proseguo col KIT
+ var actRec = await dbCtx
+ .DbSetTempKit
+ .Where(x => x.CodArtParent == editRec.CodArtParent && x.CodArtChild == editRec.CodArtChild)
+ .FirstOrDefaultAsync();
+
+ // se NON ci fosse aggiungo...
+ if (actRec == null)
+ {
+ await dbCtx
+ .DbSetTempKit
+ .AddAsync(editRec);
+ }
+ else
+ {
+ actRec.Qty = editRec.Qty;
+ dbCtx.Entry(actRec).State = EntityState.Modified;
+ }
+ return await dbCtx.SaveChangesAsync() > 0;
}
///
@@ -2477,20 +1854,6 @@ namespace MP.Data.Controllers
return dbResult;
}
- ///
- /// Elenco Vocabolario (completo) async
- ///
- ///
- public async Task> VocabolarioGetAllAsync()
- {
- using var dbCtx = new MoonProContext(options);
- return await dbCtx
- .DbSetVocabolario
- .AsNoTracking()
- .OrderBy(x => x.Lemma)
- .ToListAsync() ?? new();
- }
-
///
/// Elenco Vocabolario di una lingua
///
@@ -2559,32 +1922,6 @@ namespace MP.Data.Controllers
return await dbCtx.SaveChangesAsync() > 0;
}
- ///
- /// Elimina i record associati al KeyFilt indicato
- ///
- ///
- public bool WipKitDeleteGroup(string KeyFilt)
- {
- bool fatto = false;
- using (var dbCtx = new MoonProContext(options))
- {
- var actRec = dbCtx
- .DbSetWipKit
- .Where(x => x.KeyFilt == KeyFilt)
- .ToList();
- // se ci fosse aggiorno...
- if (actRec != null)
- {
- dbCtx
- .DbSetWipKit
- .RemoveRange(actRec);
- }
- var res = dbCtx.SaveChanges();
- fatto = res != 0;
- }
- return fatto;
- }
-
///
/// Elimina record + vecchi della data-ora indicata
///
diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs
index 1a5c469b..0aaa045e 100644
--- a/MP.Data/Controllers/MpTabController.cs
+++ b/MP.Data/Controllers/MpTabController.cs
@@ -1029,7 +1029,7 @@ namespace MP.Data.Controllers
}
catch (Exception exc)
{
- Log.Error($"Eccezione in MacchineByMatrOper{Environment.NewLine}{exc}");
+ Log.Error($"Eccezione in MacchineByMatrOperAsync{Environment.NewLine}{exc}");
}
return dbResult;
}
diff --git a/MP.Data/Services/ListSelectDataSrv.cs b/MP.Data/Services/ListSelectDataSrv.cs
index 80cc2102..0cefec61 100644
--- a/MP.Data/Services/ListSelectDataSrv.cs
+++ b/MP.Data/Services/ListSelectDataSrv.cs
@@ -104,7 +104,7 @@ namespace MP.Data.Services
}
else
{
- result = dbController.ConfigGetAll();
+ result = await dbController.ConfigGetAllAsync();
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
_redisDb.StringSet(currKey, rawData, LongCache);
@@ -114,7 +114,7 @@ namespace MP.Data.Services
result = new List();
}
sw.Stop();
- Log.Debug($"ConfigGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ Log.Debug($"ConfigGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
@@ -160,7 +160,7 @@ namespace MP.Data.Services
}
else
{
- result = await Task.FromResult(dbController.ListLinkAll());
+ result = await dbController.ListLinkAllAsync();
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
await _redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
@@ -170,7 +170,7 @@ namespace MP.Data.Services
result = new List();
}
sw.Stop();
- Log.Debug($"ListLinkAll | tipoLink: * | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ Log.Debug($"ListLinkAllAsync | tipoLink: * | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
@@ -196,7 +196,7 @@ namespace MP.Data.Services
}
else
{
- result = await Task.FromResult(dbController.ListLinkFilt(tipoLink));
+ result = await dbController.ListLinkFiltAsync(tipoLink);
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
await _redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
@@ -232,7 +232,7 @@ namespace MP.Data.Services
}
else
{
- result = await Task.FromResult(dbController.MacchineByMatrOper(MatrOpr));
+ result = await dbController.MacchineByMatrOperAsync(MatrOpr);
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
await _redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
diff --git a/MP.Data/Services/MonDataFeeder.cs b/MP.Data/Services/MonDataFeeder.cs
index 697c0d69..24f9bae8 100644
--- a/MP.Data/Services/MonDataFeeder.cs
+++ b/MP.Data/Services/MonDataFeeder.cs
@@ -113,17 +113,17 @@ namespace MP.Data.Services
if (resto == 0)
{
// invio in channel blink il segnale
- blinkPipe.SendMessageAsync("true");
+ await blinkPipe.SendMessageAsync("true");
Log.Debug("Elapsed Fast Timer Blink");
}
else
{
// invio in channel blink segnale false
- blinkPipe.SendMessageAsync("false");
+ await blinkPipe.SendMessageAsync("false");
// rileggo dati...
var newData = await MseGetAll();
// invio tramite la pipe...
- dataPipe.SendMessageAsync(JsonConvert.SerializeObject(newData));
+ await dataPipe.SendMessageAsync(JsonConvert.SerializeObject(newData));
Log.Debug("Elapsed Fast Timer reload");
}
});
diff --git a/MP.Data/Services/OrderDataSrv.cs b/MP.Data/Services/OrderDataSrv.cs
index e974f441..5daa7858 100644
--- a/MP.Data/Services/OrderDataSrv.cs
+++ b/MP.Data/Services/OrderDataSrv.cs
@@ -66,7 +66,7 @@ namespace MP.Data.Services
}
else
{
- result = dbController.ConfigGetAll();
+ result = await dbController.ConfigGetAllAsync();
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
_redisDb.StringSet(currKey, rawData, LongCache);
@@ -76,7 +76,7 @@ namespace MP.Data.Services
result = new List();
}
sw.Stop();
- Log.Debug($"ConfigGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ Log.Debug($"ConfigGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
diff --git a/MP.Data/Services/StatusData.cs b/MP.Data/Services/StatusData.cs
index 02b0b848..a10ed1c5 100644
--- a/MP.Data/Services/StatusData.cs
+++ b/MP.Data/Services/StatusData.cs
@@ -112,7 +112,7 @@ namespace MP.Data.Services
result = new List();
}
sw.Stop();
- Log.Debug($"ConfigGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ Log.Debug($"ConfigGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
diff --git a/MP.Data/Services/TabDataFeeder.cs b/MP.Data/Services/TabDataFeeder.cs
index f91090de..4282219c 100644
--- a/MP.Data/Services/TabDataFeeder.cs
+++ b/MP.Data/Services/TabDataFeeder.cs
@@ -133,17 +133,17 @@ namespace MP.Data.Services
if (resto == 0)
{
// invio in channel blink il segnale
- blinkPipe.SendMessageAsync("true");
+ await blinkPipe.SendMessageAsync("true");
Log.Trace("Elapsed Fast Timer Blink");
}
else
{
// invio in channel blink segnale false
- blinkPipe.SendMessageAsync("false");
+ await blinkPipe.SendMessageAsync("false");
// rileggo dati...
var newData = await MseGetAll();
// invio tramite la pipe...
- dataPipe.SendMessageAsync(JsonConvert.SerializeObject(newData));
+ await dataPipe.SendMessageAsync(JsonConvert.SerializeObject(newData));
Log.Trace("Elapsed Fast Timer reload");
}
});
diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs
index b1771ed1..948ee410 100644
--- a/MP.Data/Services/TabDataService.cs
+++ b/MP.Data/Services/TabDataService.cs
@@ -505,7 +505,7 @@ namespace MP.Data.Services
result = new List();
}
sw.Stop();
- Log.Debug($"ConfigGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ Log.Debug($"ConfigGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
@@ -1485,7 +1485,7 @@ namespace MP.Data.Services
}
sw.Stop();
- string callName = $"MacchineByMatrOper.{source}";
+ string callName = $"MacchineByMatrOperAsync.{source}";
int numRec = esCollect.RecordCall(callName, sw.Elapsed.TotalMilliseconds);
if (numRec >= nRecLog)
{
diff --git a/MP.Data/Services/TranslateSrv.cs b/MP.Data/Services/TranslateSrv.cs
index 10af4614..d3d37010 100644
--- a/MP.Data/Services/TranslateSrv.cs
+++ b/MP.Data/Services/TranslateSrv.cs
@@ -83,7 +83,7 @@ namespace MP.Data.Services
result = new List();
}
sw.Stop();
- Log.Debug($"ConfigGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ Log.Debug($"ConfigGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj
index c417100a..6df2a809 100644
--- a/MP.INVE/MP.INVE.csproj
+++ b/MP.INVE/MP.INVE.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.INVE
- 8.16.2606.108
+ 8.16.2606.109
diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html
index b1927062..b3fac9ec 100644
--- a/MP.INVE/Resources/ChangeLog.html
+++ b/MP.INVE/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOINVE
- Versione: 8.16.2606.108
+ Versione: 8.16.2606.109
Note di rilascio:
-
diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt
index 39fc2c3d..ce4acb58 100644
--- a/MP.INVE/Resources/VersNum.txt
+++ b/MP.INVE/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.108
+8.16.2606.109
diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml
index b202c947..bbab37fe 100644
--- a/MP.INVE/Resources/manifest.xml
+++ b/MP.INVE/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.108
+ 8.16.2606.109
https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip
https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html
false
diff --git a/MP.IOC/Data/MpDataService.cs b/MP.IOC/Data/MpDataService.cs
index 7c431061..fed66bf3 100644
--- a/MP.IOC/Data/MpDataService.cs
+++ b/MP.IOC/Data/MpDataService.cs
@@ -797,7 +797,6 @@ namespace MP.IOC.Data
else
{
result = await IocDbController.ConfigGetAllAsync();
- //result = await Task.FromResult(SpecDbController.ConfigGetAllAsync());
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(Utils.redisConfKey, rawData, getRandTOut(redisLongTimeCache));
@@ -944,28 +943,6 @@ namespace MP.IOC.Data
return answ;
}
- public List FluxLogDtoGetByFlux(string Valore)
- {
- List answ = new List();
- DossierFluxLogDTO? result = JsonConvert.DeserializeObject(Valore);
- if (result != null)
- {
- if (result.ODL != null)
- {
- answ = result
- .ODL
- .OrderBy(x => x.CodFlux)
- .ToList();
- // inizializzo SE necessario
- foreach (var item in answ)
- {
- item.ValoreEdit = String.IsNullOrEmpty(item.ValoreEdit) ? item.Valore : item.ValoreEdit;
- }
- }
- }
- return answ;
- }
-
///
/// Restituisce il valOut dell'ODL corrente (ODL deve esserci per gestione contapezzi, senza
/// ODL NO invio/gestione ODL)
@@ -1232,7 +1209,7 @@ namespace MP.IOC.Data
}
else
{
- result = await Task.FromResult(SpecDbController.MacchineGetFilt(codGruppo));
+ result = await SpecDbController.MacchineGetFiltAsync(codGruppo);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
diff --git a/MP.IOC/MP.IOC.csproj b/MP.IOC/MP.IOC.csproj
index b8ee4b5e..5936ddb9 100644
--- a/MP.IOC/MP.IOC.csproj
+++ b/MP.IOC/MP.IOC.csproj
@@ -4,7 +4,7 @@
net8.0
enable
enable
- 8.16.2606.108
+ 8.16.2606.109
diff --git a/MP.IOC/Resources/ChangeLog.html b/MP.IOC/Resources/ChangeLog.html
index 45f2d9dc..d2952a57 100644
--- a/MP.IOC/Resources/ChangeLog.html
+++ b/MP.IOC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MP-IOC
-
Versione: 8.16.2606.108
+ Versione: 8.16.2606.109
Note di rilascio:
-
diff --git a/MP.IOC/Resources/VersNum.txt b/MP.IOC/Resources/VersNum.txt
index 39fc2c3d..ce4acb58 100644
--- a/MP.IOC/Resources/VersNum.txt
+++ b/MP.IOC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.108
+8.16.2606.109
diff --git a/MP.IOC/Resources/manifest.xml b/MP.IOC/Resources/manifest.xml
index 11eeec80..b2b0ea2a 100644
--- a/MP.IOC/Resources/manifest.xml
+++ b/MP.IOC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.108
+ 8.16.2606.109
https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip
https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html
false
diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj
index 7c486e88..ee1d9d49 100644
--- a/MP.Land/MP.Land.csproj
+++ b/MP.Land/MP.Land.csproj
@@ -3,7 +3,7 @@
net8.0
MP.Land
- 8.16.2606.0108
+ 8.16.2606.0109
Debug;Release;Debug_LiManDebug
en
True
diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html
index 293c48e3..43b65f99 100644
--- a/MP.Land/Resources/ChangeLog.html
+++ b/MP.Land/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo Tablet MAPO - DotNet6
-
Versione: 8.16.2606.0108
+ Versione: 8.16.2606.0109
Note di rilascio:
diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt
index 83bdfcd4..5304e764 100644
--- a/MP.Land/Resources/VersNum.txt
+++ b/MP.Land/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.0108
+8.16.2606.0109
diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml
index 1ac7b2c6..f5944105 100644
--- a/MP.Land/Resources/manifest.xml
+++ b/MP.Land/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.0108
+ 8.16.2606.0109
https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip
https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html
false
diff --git a/MP.MON/MP.MON.csproj b/MP.MON/MP.MON.csproj
index 9f766193..b94904bf 100644
--- a/MP.MON/MP.MON.csproj
+++ b/MP.MON/MP.MON.csproj
@@ -6,7 +6,7 @@
enable
MP.MON
$(AssemblyName.Replace(' ', '_'))
- 8.16.2606.108
+ 8.16.2606.109
diff --git a/MP.MON/Resources/ChangeLog.html b/MP.MON/Resources/ChangeLog.html
index 87c10ba8..9d115dbc 100644
--- a/MP.MON/Resources/ChangeLog.html
+++ b/MP.MON/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 8.16.2606.108
+ Versione: 8.16.2606.109
Note di rilascio:
-
diff --git a/MP.MON/Resources/VersNum.txt b/MP.MON/Resources/VersNum.txt
index 39fc2c3d..ce4acb58 100644
--- a/MP.MON/Resources/VersNum.txt
+++ b/MP.MON/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.108
+8.16.2606.109
diff --git a/MP.MON/Resources/manifest.xml b/MP.MON/Resources/manifest.xml
index fd37fd54..8ed448e0 100644
--- a/MP.MON/Resources/manifest.xml
+++ b/MP.MON/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.108
+ 8.16.2606.109
https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.MON.zip
https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html
false
diff --git a/MP.Prog/MP.Prog.csproj b/MP.Prog/MP.Prog.csproj
index 9e3d5d0a..cf4430a5 100644
--- a/MP.Prog/MP.Prog.csproj
+++ b/MP.Prog/MP.Prog.csproj
@@ -3,7 +3,7 @@
net8.0
MP.Prog
- 8.16.2606.0108
+ 8.16.2606.0109
True
diff --git a/MP.Prog/Resources/ChangeLog.html b/MP.Prog/Resources/ChangeLog.html
index 62e7c681..2a8036c7 100644
--- a/MP.Prog/Resources/ChangeLog.html
+++ b/MP.Prog/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo gestione Programmi MAPO
-
Versione: 8.16.2606.0108
+ Versione: 8.16.2606.0109
Note di rilascio:
diff --git a/MP.Prog/Resources/VersNum.txt b/MP.Prog/Resources/VersNum.txt
index 83bdfcd4..5304e764 100644
--- a/MP.Prog/Resources/VersNum.txt
+++ b/MP.Prog/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.0108
+8.16.2606.0109
diff --git a/MP.Prog/Resources/manifest.xml b/MP.Prog/Resources/manifest.xml
index 2cd09b01..a8e8f624 100644
--- a/MP.Prog/Resources/manifest.xml
+++ b/MP.Prog/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.0108
+ 8.16.2606.0109
https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip
https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html
false
diff --git a/MP.RIOC/MP.RIOC.csproj b/MP.RIOC/MP.RIOC.csproj
index 0740f8fc..7bdd107f 100644
--- a/MP.RIOC/MP.RIOC.csproj
+++ b/MP.RIOC/MP.RIOC.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.RIOC
- 8.16.2606.108
+ 8.16.2606.109
diff --git a/MP.RIOC/Resources/ChangeLog.html b/MP.RIOC/Resources/ChangeLog.html
index ea962f3b..95f5086b 100644
--- a/MP.RIOC/Resources/ChangeLog.html
+++ b/MP.RIOC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MP-RIOC
-
Versione: 8.16.2606.108
+ Versione: 8.16.2606.109
Note di rilascio:
-
diff --git a/MP.RIOC/Resources/VersNum.txt b/MP.RIOC/Resources/VersNum.txt
index 39fc2c3d..ce4acb58 100644
--- a/MP.RIOC/Resources/VersNum.txt
+++ b/MP.RIOC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.108
+8.16.2606.109
diff --git a/MP.RIOC/Resources/manifest.xml b/MP.RIOC/Resources/manifest.xml
index b67b2eaa..dbf88ce9 100644
--- a/MP.RIOC/Resources/manifest.xml
+++ b/MP.RIOC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.108
+ 8.16.2606.109
https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/MP.RIOC.zip
https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/ChangeLog.html
false
diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs
index 077b7e26..c95bce5c 100644
--- a/MP.SPEC/Data/MpDataService.cs
+++ b/MP.SPEC/Data/MpDataService.cs
@@ -187,7 +187,7 @@ namespace MP.SPEC.Data
using var activity = ActivitySource.StartActivity("AnagGruppiDeleteAsync");
bool result = false;
string source = "DB";
- result = dbController.AnagGruppiDelete(updRec);
+ result = await dbController.AnagGruppiDeleteAsync(updRec);
// elimino cache redis...
await FlushFusionCacheAsync(Utils.redisAnagGruppi);
activity?.SetTag("data.source", source);
@@ -206,7 +206,7 @@ namespace MP.SPEC.Data
using var activity = ActivitySource.StartActivity("AnagGruppiUpsertAsync");
bool result = false;
string source = "DB";
- result = dbController.AnagGruppiUpsert(UpdRec);
+ result = await dbController.AnagGruppiUpsertAsync(UpdRec);
// elimino cache redis...
await FlushFusionCacheAsync(Utils.redisAnagGruppi);
activity?.SetTag("data.source", source);
@@ -252,7 +252,7 @@ namespace MP.SPEC.Data
operationName: "ArticleWithDossierAsync",
cacheKey: Utils.redisArtByDossier,
expiration: GetRandTOut(redisLongTimeCache),
- fetchFunc: async () => await Task.FromResult(dbController.ArticleWithDossier()) ?? new List(),
+ fetchFunc: async () => await dbController.ArticleWithDossierAsync() ?? new List(),
tagList: [Utils.redisArtByDossier]
);
}
@@ -285,13 +285,13 @@ namespace MP.SPEC.Data
///
public async Task ArticoliDeleteRecord(AnagArticoliModel currRec)
{
- using var activity = ActivitySource.StartActivity("ArticoliDeleteRecord");
+ using var activity = ActivitySource.StartActivity("ArticoliDeleteRecordAsync");
string source = "DB";
- bool fatto = await dbController.ArticoliDeleteRecord(currRec);
+ bool fatto = await dbController.ArticoliDeleteRecordAsync(currRec);
await FlushFusionCacheArticoli();
activity?.SetTag("data.source", source);
activity?.Stop();
- LogTrace($"ArticoliDeleteRecord | {source} | {activity?.Duration.TotalMilliseconds}ms");
+ LogTrace($"ArticoliDeleteRecordAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
return fatto;
}
@@ -868,16 +868,16 @@ namespace MP.SPEC.Data
/// def: 10
/// def: 50
///
- public async Task ForceDbMaint(bool doExec = true, bool doUpdStat = true, bool doSave = true, int minPgCnt = 1000, int minAvgFrag = 10, int maxAvgFragReb = 50)
+ public async Task ForceDbMaintAsync(bool doExec = true, bool doUpdStat = true, bool doSave = true, int minPgCnt = 1000, int minAvgFrag = 10, int maxAvgFragReb = 50)
{
- using var activity = ActivitySource.StartActivity("ForceDbMaint");
+ using var activity = ActivitySource.StartActivity("ForceDbMaintAsync");
string source = "DB";
- await dbController.ForceDbMaint(doExec, doUpdStat, doSave, minPgCnt, minAvgFrag, maxAvgFragReb);
+ await dbController.ForceDbMaintAsync(doExec, doUpdStat, doSave, minPgCnt, minAvgFrag, maxAvgFragReb);
// svuoto cache
await FlushFusionCacheFluxLog();
activity?.SetTag("data.source", source);
activity?.Stop();
- LogTrace($"ForceDbMaint | {source} | {activity?.Duration.TotalMilliseconds}ms");
+ LogTrace($"ForceDbMaintAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
// registro statistiche esecuzione
await RecDbMaintStatAsync(activity?.Duration ?? TimeSpan.FromSeconds(1));
}
@@ -1494,7 +1494,7 @@ namespace MP.SPEC.Data
{
using var activity = ActivitySource.StartActivity("POdlDeleteRecord");
string source = "DB+REDIS";
- var dbResult = await dbController.PODLDeleteRecord(currRec);
+ var dbResult = await dbController.PODLDeleteRecordAsync(currRec);
// elimino cache redis...
await FlushFusionCachePOdl();
activity?.SetTag("data.source", source);
@@ -1740,65 +1740,6 @@ namespace MP.SPEC.Data
return answ;
}
- ///
- /// Effettua conteggio chaivi REDIS dato pat2Flush ricerca
- ///
- ///
- ///
- public int RedisCountKey(string keyPattern)
- {
- using var activity = ActivitySource.StartActivity("RedisCountKey");
- string source = "REDIS";
- int num = 0;
- keyPattern = (string.IsNullOrEmpty(keyPattern) ? "**" : keyPattern);
- try
- {
- var listEndpoints = redisConnAdmin.GetEndPoints();
- foreach (var endPoint in listEndpoints)
- {
- var server = redisConnAdmin.GetServer(endPoint);
- foreach (RedisKey item in server.Keys(pattern: keyPattern, database: redisDb.Database, pageSize: 250, cursor: 0L))
- {
- num++;
- }
- }
- }
- catch (Exception arg)
- {
- Log.Error($"Eccezione in RedisCountKey{Environment.NewLine}{arg}");
- }
- activity?.SetTag("data.source", source);
- activity?.Stop();
- LogTrace($"RedisCountKey | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
- return num;
- }
-
- ///
- /// Esegue eliminazione memoria redis keyVal
- ///
- ///
- ///
- public bool RedisDelKey(string keyVal)
- {
- using var activity = ActivitySource.StartActivity("RedisDelKey");
- string source = "REDIS";
- bool answ = false;
- var listEndpoints = redisConnAdmin.GetEndPoints();
- foreach (var endPoint in listEndpoints)
- {
- var server = redisConnAdmin.GetServer(endPoint);
- if (server != null)
- {
- redisDb.KeyDelete((RedisKey)keyVal);
- answ = true;
- }
- }
- activity?.SetTag("data.source", source);
- activity?.Stop();
- LogTrace($"RedisDelKey | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
- return answ;
- }
-
///
/// Reset della cache IO post operazioni come setup ODL...
///
@@ -1887,7 +1828,7 @@ namespace MP.SPEC.Data
string source = "DB";
bool fatto = false;
// salvo
- fatto = dbController.TemplateKitUpsert(currRecord, codAzienda);
+ fatto = await dbController.TemplateKitUpsertAsync(currRecord, codAzienda);
await FlushFusionCacheAsync(Utils.redisKitTempl);
activity?.SetTag("data.source", source);
activity?.Stop();
diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj
index 01d64cb9..2d0f50e7 100644
--- a/MP.SPEC/MP.SPEC.csproj
+++ b/MP.SPEC/MP.SPEC.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.SPEC
- 8.16.2606.108
+ 8.16.2606.109
1800a78a-6ff1-40f9-b490-87fb8bfc1394
en
diff --git a/MP.SPEC/Pages/FluxLogStatus.razor.cs b/MP.SPEC/Pages/FluxLogStatus.razor.cs
index cd472022..3f758d89 100644
--- a/MP.SPEC/Pages/FluxLogStatus.razor.cs
+++ b/MP.SPEC/Pages/FluxLogStatus.razor.cs
@@ -114,7 +114,7 @@ namespace MP.SPEC.Pages
Stopwatch sw = Stopwatch.StartNew();
lastDbMaintTime = "...";
await InvokeAsync(StateHasChanged);
- await MDataServ.ForceDbMaint(true, true, true, 1000, 10, 50);
+ await MDataServ.ForceDbMaintAsync(true, true, true, 1000, 10, 50);
sw.Stop();
lastDbMaintTime = $"{sw.Elapsed.Minutes}m {sw.Elapsed.Seconds}s";
isReindexing = false;
diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html
index 87c10ba8..9d115dbc 100644
--- a/MP.SPEC/Resources/ChangeLog.html
+++ b/MP.SPEC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
-
Versione: 8.16.2606.108
+ Versione: 8.16.2606.109
Note di rilascio:
-
diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt
index 39fc2c3d..ce4acb58 100644
--- a/MP.SPEC/Resources/VersNum.txt
+++ b/MP.SPEC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.108
+8.16.2606.109
diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml
index 60fbae64..1c7d6282 100644
--- a/MP.SPEC/Resources/manifest.xml
+++ b/MP.SPEC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.108
+ 8.16.2606.109
https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip
https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html
false
diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj
index 37a76526..33c7bf24 100644
--- a/MP.Stats/MP.Stats.csproj
+++ b/MP.Stats/MP.Stats.csproj
@@ -4,7 +4,7 @@
net8.0
MP.Stats
826e877c-ba70-4253-84cb-d0b1cafd4440
- 8.16.2606.0108
+ 8.16.2606.0109
true
en
diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html
index 6363d87f..019ad772 100644
--- a/MP.Stats/Resources/ChangeLog.html
+++ b/MP.Stats/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo statistiche MAPO
-
Versione: 8.16.2606.0108
+ Versione: 8.16.2606.0109
Note di rilascio:
diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt
index 83bdfcd4..5304e764 100644
--- a/MP.Stats/Resources/VersNum.txt
+++ b/MP.Stats/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.0108
+8.16.2606.0109
diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml
index 4e89cd4f..15109b0d 100644
--- a/MP.Stats/Resources/manifest.xml
+++ b/MP.Stats/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.0108
+ 8.16.2606.0109
https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip
https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html
false
diff --git a/Refactor_Plan.md b/Refactor_Plan.md
index 89c93421..1aa90a24 100644
--- a/Refactor_Plan.md
+++ b/Refactor_Plan.md
@@ -17,9 +17,9 @@ Migrare la logica di caching manuale (Redis + DB) verso l'utilizzo di `IFusionCa
- Analisi di `MpDataService.cs` effettuata.
- Identificati i metodi con caching manuale (Redis/DB) e quelli già migrati a `GetOrFetchAsync`.
-### Fase 2: Refactoring Metodi di Lettura (Cache-aside) (In corso)
+### Fase 2: Refactoring Metodi di Lettura (Cache-aside) (Completata)
-#### ✅ Metodi Migrati (Usano già `GetOrFetchAsync`, `FusionCache.GetOrSet` o `FlushFusionCacheByTagAsync`)
+#### ✅ Metodi Migrati o Confermati (Pattern corretto per l'uso previsto)
- `AnagEventiGeneralAsync`
- `AnagStatiCommAsync`
- `AnagTipoArtLvAsync`
@@ -77,19 +77,19 @@ Migrare la logica di caching manuale (Redis + DB) verso l'utilizzo di `IFusionCa
- `POdlUpdateRecord` (Migrato con tag invalidazione)
- `POdlGetByKey` (Migrato con FusionCache)
- `POdlListByKitParentAsync` (Migrato con FusionCache)
+- `ActionGetReq` (Pattern Redis/Channels corretto)
+- `ActionSetReq` (Pattern Redis/Channels corretto)
+- `DbDedupStatsAsync` (Pattern Redis persistente corretto)
+- `ProcFLStats` (Pattern Redis persistente corretto)
+- `RecDbMaintStatAsync` (Pattern Redis persistente corretto)
-#### 🛠️ Metodi da Migrare (Usano ancora Redis/DB manuale o pattern non standard per Fusion)
-- [ ] Migrazione di `ActionGetReq` (linea 110: usa `redisDb.StringGetAsync`).
-- [ ] Migrazione di `ActionSetReq` (linea 136: usa `BroadastMsgPipe.saveAndSendMessage`).
-- [ ] Migrazione di `DbDedupStatsAsync` (linea 516: gestione persistente su Redis, valutare se mantenere o cambiare pattern).
-- [ ] Migrazione di `ProcFLStats` (linea 1853: usa `redisDb.StringGet`).
-- [ ] Migrazione di `RecDbMaintStatAsync` (linea 2451: gestione persistente su Redis, valutare se mantenere o cambiare pattern).
+#### 🛠️ Metodi da Migrare (Nessuno)
+- *Nessun metodo residuo richiede migrazione a FusionCache.*
-*(Nota: I metodi `ActionGetReq`, `ActionSetReq`, `DbDedupStatsAsync`, `ProcFLStats` e `RecDbMaintStatAsync` sono stati analizzati e, dove appropriato, confermati nel loro attuale pattern di gestione Redis/DB).*
-
-### Fase 4: Verifica
-- [ ] Verificare la compilazione della soluzione tramite script PowerShell.
-- [ ] Controllare che i log (NLog) continuano a riflettere correttamente le operazioni.
+### Fase 4: Verifica (Completata)
+- [x] Verificare la compilazione della soluzione tramite script PowerShell.
+- [x] Controllare che i log (NLog) continuano a riflettere correttamente le operazioni.
+- [x] Verifica coerenza signature (async/task/sync).
## Rischi e Mitigazioni
- **Rischio**: Discrepanza nelle chiavi di cache tra vecchio e nuovo sistema.
@@ -105,3 +105,4 @@ Migrare la logica di caching manuale (Redis + DB) verso l'utilizzo di `IFusionCa
+