estensione metodi bench post comparison
This commit is contained in:
@@ -294,6 +294,81 @@ namespace MP.Data.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Intera tab dati macchina
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatiMacchineModel> DatiMacchineGetAll()
|
||||
{
|
||||
List<DatiMacchineModel> dbResult = new List<DatiMacchineModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetDatiMacchine
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.IdxMacchina)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// Intera vista v_MSFD
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<VMSFDModel> VMSFDGetAll()
|
||||
{
|
||||
List<VMSFDModel> dbResult = new List<VMSFDModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetMSFD
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.IdxMacchina)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Vista v_MSFD CALCOALTA x singola macchina (da stored) - singolo record
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<VMSFDModel> VMSFDGetByMacc(string idxMacc)
|
||||
{
|
||||
List<VMSFDModel> dbResult = new List<VMSFDModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacc);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetMSFD
|
||||
.FromSqlRaw("exec dbo.stp_MSFD_getMacc @IdxMacchina", IdxMacchina)
|
||||
.AsNoTracking()
|
||||
.AsEnumerable()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Intera tabella relazione master/slave in machine (gestione setup master --> slave)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Macchine2SlaveModel> Macchine2Slave()
|
||||
{
|
||||
List<Macchine2SlaveModel> dbResult = new List<Macchine2SlaveModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetM2S
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.IdxMacchina)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_configuration = null;
|
||||
@@ -727,7 +802,7 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception exc)
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in MacchineGetFilt{Environment.NewLine}{exc}");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
public partial class DatiMacchineModel
|
||||
{
|
||||
public string IdxMacchina { get; set; }
|
||||
public bool? PalletChange { get; set; }
|
||||
public string CodArticoloA { get; set; }
|
||||
public string CodArticoloB { get; set; }
|
||||
public string SerialPort { get; set; }
|
||||
public int? RefreshPeriod { get; set; }
|
||||
public bool? Simulazione { get; set; }
|
||||
public bool? SimplePallet { get; set; }
|
||||
/// <summary>
|
||||
/// definisce se l'INSERT sia abilitato per la macchina (disabilitato in fase di ricostruzione batch...)
|
||||
/// </summary>
|
||||
public bool? InsEnabled { get; set; }
|
||||
/// <summary>
|
||||
/// definisce se sia abilitata la registrazione di TUTTI gli invii di dati in ingresso da questa specifica macchina
|
||||
/// </summary>
|
||||
public bool SLogEnabled { get; set; }
|
||||
/// <summary>
|
||||
/// Abilita o meno il trigger su DiarioDiBordo x ricalcolo eventi
|
||||
/// </summary>
|
||||
public bool? IsTrigerDbon { get; set; }
|
||||
/// <summary>
|
||||
/// Indica se la macchina abbia un COUNTER (assoluto) o meno, tipicamente true x IOB-WIN, false per IOB-PI
|
||||
/// </summary>
|
||||
public bool HasCounter { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
public partial class Macchine2SlaveModel
|
||||
{
|
||||
public string IdxMacchina { get; set; }
|
||||
public string IdxMacchinaSlave { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
public partial class VMSFDModel
|
||||
{
|
||||
public string IdxMacchina { get; set; }
|
||||
public string Codmacchina { get; set; }
|
||||
public bool PalletChange { get; set; }
|
||||
public string CodArticoloA { get; set; }
|
||||
public string CodArticoloB { get; set; }
|
||||
public bool SimplePallet { get; set; }
|
||||
public bool InsEnabled { get; set; }
|
||||
public bool SLogEnabled { get; set; }
|
||||
public int IdxFamigliaIngresso { get; set; }
|
||||
public int Multi { get; set; }
|
||||
public int BitFilt { get; set; }
|
||||
public int MaxVal { get; set; }
|
||||
public int Bsr { get; set; }
|
||||
public bool ExplodeBit { get; set; }
|
||||
public int NumBit { get; set; }
|
||||
public int IdxMicroStato { get; set; }
|
||||
public int IdxFamiglia { get; set; }
|
||||
public int IdxStato { get; set; }
|
||||
public string LastVal { get; set; }
|
||||
public string CodArticolo { get; set; }
|
||||
public double TempoCicloBase { get; set; }
|
||||
public int PzPalletProd { get; set; }
|
||||
public int MatrOpr { get; set; }
|
||||
public string Pallet { get; set; }
|
||||
public string CodMaccArticolo { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,9 @@ namespace MP.Data
|
||||
public virtual DbSet<VocabolarioModel> DbSetVocabolario { get; set; }
|
||||
public virtual DbSet<AnagOperatoriModel> DbOperatori { get; set; }
|
||||
public virtual DbSet<Gruppi2MaccModel> DbSetGrp2Macc { get; set; }
|
||||
public virtual DbSet<DatiMacchineModel> DbSetDatiMacchine { get; set; }
|
||||
public virtual DbSet<VMSFDModel> DbSetMSFD { get; set; }
|
||||
public virtual DbSet<Macchine2SlaveModel> DbSetM2S { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -322,6 +325,125 @@ namespace MP.Data
|
||||
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DatiMacchineModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxMacchina);
|
||||
|
||||
entity.ToTable("DatiMacchine");
|
||||
|
||||
entity.Property(e => e.IdxMacchina)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("idxMacchina");
|
||||
|
||||
entity.Property(e => e.CodArticoloA)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("CodArticolo_A");
|
||||
|
||||
entity.Property(e => e.CodArticoloB)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("CodArticolo_B");
|
||||
|
||||
entity.Property(e => e.HasCounter)
|
||||
.HasColumnName("hasCounter")
|
||||
.HasComment("Indica se la macchina abbia un COUNTER (assoluto) o meno, tipicamente true x IOB-WIN, false per IOB-PI");
|
||||
|
||||
entity.Property(e => e.InsEnabled)
|
||||
.HasColumnName("insEnabled")
|
||||
.HasDefaultValueSql("((1))")
|
||||
.HasComment("definisce se l'INSERT sia abilitato per la macchina (disabilitato in fase di ricostruzione batch...)");
|
||||
|
||||
entity.Property(e => e.IsTrigerDbon)
|
||||
.IsRequired()
|
||||
.HasColumnName("isTrigerDBOn")
|
||||
.HasDefaultValueSql("((1))")
|
||||
.HasComment("Abilita o meno il trigger su DiarioDiBordo x ricalcolo eventi");
|
||||
|
||||
entity.Property(e => e.PalletChange).HasColumnName("palletChange");
|
||||
|
||||
entity.Property(e => e.RefreshPeriod).HasColumnName("refreshPeriod");
|
||||
|
||||
entity.Property(e => e.SLogEnabled)
|
||||
.HasColumnName("sLogEnabled")
|
||||
.HasComment("definisce se sia abilitata la registrazione di TUTTI gli invii di dati in ingresso da questa specifica macchina");
|
||||
|
||||
entity.Property(e => e.SerialPort)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("serialPort");
|
||||
|
||||
entity.Property(e => e.SimplePallet).HasColumnName("simplePallet");
|
||||
|
||||
entity.Property(e => e.Simulazione).HasColumnName("simulazione");
|
||||
});
|
||||
|
||||
|
||||
modelBuilder.Entity<VMSFDModel>(entity =>
|
||||
{
|
||||
entity.HasNoKey();
|
||||
|
||||
entity.ToView("v_MSFD");
|
||||
|
||||
entity.Property(e => e.Bsr).HasColumnName("BSR");
|
||||
|
||||
entity.Property(e => e.CodArticolo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.CodArticoloA)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("CodArticolo_A");
|
||||
|
||||
entity.Property(e => e.CodArticoloB)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("CodArticolo_B");
|
||||
|
||||
entity.Property(e => e.CodMaccArticolo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(103);
|
||||
|
||||
entity.Property(e => e.Codmacchina)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("codmacchina");
|
||||
|
||||
entity.Property(e => e.IdxMacchina)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("idxmacchina");
|
||||
|
||||
entity.Property(e => e.InsEnabled).HasColumnName("insEnabled");
|
||||
|
||||
entity.Property(e => e.LastVal)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("lastVal");
|
||||
|
||||
entity.Property(e => e.Pallet)
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnName("pallet");
|
||||
|
||||
entity.Property(e => e.PalletChange).HasColumnName("palletChange");
|
||||
|
||||
entity.Property(e => e.SLogEnabled).HasColumnName("sLogEnabled");
|
||||
|
||||
entity.Property(e => e.SimplePallet).HasColumnName("simplePallet");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Macchine2SlaveModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.IdxMacchina, e.IdxMacchinaSlave })
|
||||
.HasName("PK_Macc2Slave");
|
||||
|
||||
entity.ToTable("Macchine2Slave");
|
||||
|
||||
entity.Property(e => e.IdxMacchina).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.IdxMacchinaSlave).HasMaxLength(50);
|
||||
});
|
||||
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,344 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.IOC.Data;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using NLog.Fluent;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MP.IOC.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class BenchController : ControllerBase
|
||||
{
|
||||
public BenchController(IConfiguration configuration, MpDataService DataService)
|
||||
{
|
||||
Log.Info("Starting MpDataService INIT");
|
||||
_configuration = configuration;
|
||||
DService = DataService;
|
||||
Log.Info("Avviata classe Recipe");
|
||||
}
|
||||
|
||||
private static IConfiguration _configuration = null!;
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
/// <summary>
|
||||
/// Dataservice x accesso DB
|
||||
/// </summary>
|
||||
protected MpDataService DService { get; set; }
|
||||
|
||||
//// GET: IOB (è un check alive)
|
||||
//public string Index()
|
||||
//{
|
||||
// return "OK";
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// pulizia dati
|
||||
/// api/Bench/RClean?id=100
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("RClean")]
|
||||
public string RCLEAN(int? id)
|
||||
{
|
||||
string answ = "ND";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
// se id nullo --> KO!
|
||||
if (id == null)
|
||||
{
|
||||
answ = "KO";
|
||||
}
|
||||
else
|
||||
{
|
||||
string chiave;
|
||||
KeyValuePair<string, string>[] valori = new KeyValuePair<string, string>[2];
|
||||
try
|
||||
{
|
||||
// svuoto i precedenti hash... CICLO!
|
||||
for (int i = 0; i < id; i++)
|
||||
{
|
||||
chiave = string.Format("test:{0}", i);
|
||||
DService.RedisDelKey(chiave);
|
||||
}
|
||||
answ = "OK";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
stopWatch.Stop();
|
||||
// Get the elapsed time as a TimeSpan value.
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
// accodo tempo!
|
||||
answ += $"Elapsed: {ts.TotalMilliseconds}ms";
|
||||
// ritorno
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Setup dati di test hash
|
||||
/// api/Bench/RSetup?id=100
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("RSetup")]
|
||||
public string RSETUP(int? id)
|
||||
{
|
||||
string answ = "ND";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
// se id nullo --> KO!
|
||||
if (id == null)
|
||||
{
|
||||
answ = "KO";
|
||||
}
|
||||
else
|
||||
{
|
||||
string chiave;
|
||||
KeyValuePair<string, string>[] valori = new KeyValuePair<string, string>[2];
|
||||
try
|
||||
{
|
||||
// salvo il datasetet come insieme di hash in redis...
|
||||
for (int i = 0; i < id; i++)
|
||||
{
|
||||
chiave = string.Format("test:{0}", i);
|
||||
valori[0] = new KeyValuePair<string, string>("numero", i.ToString());
|
||||
valori[1] = new KeyValuePair<string, string>("doppio", (i * 2).ToString());
|
||||
DService.RedisSetHash(chiave, valori);
|
||||
}
|
||||
answ = "OK";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
stopWatch.Stop();
|
||||
// Get the elapsed time as a TimeSpan value.
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
// accodo tempo!
|
||||
answ += $"Elapsed: {ts.TotalMilliseconds}ms";
|
||||
// ritorno
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupero singolo valore hash
|
||||
/// api/Bench/RSingleHash?id=50
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("RSingleHash")]
|
||||
public string RSH(int? id)
|
||||
{
|
||||
string answ = "ND";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
// se id nullo --> KO!
|
||||
if (id == null)
|
||||
{
|
||||
answ = "KO";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "";
|
||||
string chiave;
|
||||
KeyValuePair<string, string>[] valori = new KeyValuePair<string, string>[2];
|
||||
try
|
||||
{
|
||||
// ora restituisco record completo dell'hash con ID indicato
|
||||
chiave = string.Format("test:{0}", id);
|
||||
valori = DService.RedisGetHash(chiave);
|
||||
foreach (var item in valori)
|
||||
{
|
||||
answ += string.Format("{0}|{1}<br/>", item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
stopWatch.Stop();
|
||||
// Get the elapsed time as a TimeSpan value.
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
// accodo tempo!
|
||||
answ += $"Elapsed: {ts.TotalMilliseconds}ms";
|
||||
// ritorno
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Bench recupero dati macchina
|
||||
/// api/Bench/DtMac?id=SIMUL_01
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("DtMac")]
|
||||
public string DTMAC(string id)
|
||||
{
|
||||
string answ = "ND";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
// se id nullo --> KO!
|
||||
if (id == null)
|
||||
{
|
||||
answ = "KO";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "";
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> valori = DService.GetCurrMSFDMacc(id);
|
||||
foreach (var item in valori)
|
||||
{
|
||||
answ += $"{item.Key}|{item.Value}{Environment.NewLine}";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
stopWatch.Stop();
|
||||
// Get the elapsed time as a TimeSpan value.
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
// accodo tempo!
|
||||
answ += $"Elapsed: {ts.TotalMilliseconds}ms";
|
||||
// ritorno
|
||||
return answ;
|
||||
}
|
||||
//// GET BENCH/CNTKEY/KEY_NAME
|
||||
//public string CNTKEY(string id)
|
||||
//{
|
||||
// string answ = "ND";
|
||||
// if (id == null) id = "";
|
||||
// Stopwatch stopWatch = new Stopwatch();
|
||||
// stopWatch.Start();
|
||||
// // conto quanti oggetti DTMac ho in memoria...
|
||||
// string groupHash = DataLayer.mHash("");
|
||||
// if (id.Length > 0)
|
||||
// {
|
||||
// groupHash += id + ":";
|
||||
// }
|
||||
// groupHash += "*";
|
||||
// answ = string.Format("Trovate {0} Hash per {1}", memLayer.ML.redCountKey(groupHash), groupHash);
|
||||
// stopWatch.Stop();
|
||||
// // Get the elapsed time as a TimeSpan value.
|
||||
// TimeSpan ts = stopWatch.Elapsed;
|
||||
// // accodo tempo!
|
||||
// answ += $"Elapsed: {ts.TotalMilliseconds}ms";
|
||||
// // ritorno
|
||||
// return answ;
|
||||
//}
|
||||
//// GET BENCH/tSMI/1
|
||||
//public string tSMI(int? id)
|
||||
//{
|
||||
// string answ = "ND";
|
||||
// long splitTime = 0;
|
||||
// Stopwatch stopWatch = new Stopwatch();
|
||||
// stopWatch.Start();
|
||||
// // se id nullo --> KO!
|
||||
// if (id == null)
|
||||
// {
|
||||
// answ = "KO";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// int idxFamIn = Convert.ToInt32(id);
|
||||
// answ = "";
|
||||
// try
|
||||
// {
|
||||
// KeyValuePair<string, string>[] valori = DataLayerObj.mTabSMI(idxFamIn);
|
||||
// splitTime = stopWatch.ElapsedMilliseconds;
|
||||
// foreach (var item in valori)
|
||||
// {
|
||||
// answ += string.Format("{0}|{1}<br/>", item.Key, item.Value);
|
||||
// }
|
||||
// }
|
||||
// catch
|
||||
// { }
|
||||
// }
|
||||
// stopWatch.Stop();
|
||||
// // Get the elapsed time as a TimeSpan value.
|
||||
// TimeSpan ts = stopWatch.Elapsed;
|
||||
// // accodo tempo!
|
||||
// answ += string.Format("<hr/>ReadTime: {0}ms<br>Total Time Elapsed: {1}ms", splitTime, ts.TotalMilliseconds);
|
||||
// // ritorno
|
||||
// return answ;
|
||||
//}
|
||||
//// GET BENCH/fSMI/18?idxMS=1&valore=1
|
||||
//public string fSMI(int? id, int? idxMS, int? valore)
|
||||
//{
|
||||
// string answ = "ND";
|
||||
// Stopwatch stopWatch = new Stopwatch();
|
||||
// stopWatch.Start();
|
||||
// // se id nullo --> KO!
|
||||
// if (id == null)
|
||||
// {
|
||||
// answ = "KO";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // recupero dati x sapere quale famiglia SMI è necessaria e quale stato / segnale si sia ricevuto
|
||||
// int idxFamIn = Convert.ToInt32(id);
|
||||
// int idxMicroStato = Convert.ToInt32(idxMS);
|
||||
// int valIOB = Convert.ToInt32(valore);
|
||||
// // recupero microstato macchina da chiave relativa
|
||||
// answ = "";
|
||||
// try
|
||||
// {
|
||||
// // verifico se ci sia in memoria tab della fam macchina relativa (sennò carico)
|
||||
// string fiHASH = DataLayer.hSMI(idxFamIn);
|
||||
// string outVal = "";
|
||||
// bool trovato = memLayer.ML.redHashPresentSz(fiHASH);
|
||||
// if (!trovato)
|
||||
// {
|
||||
// // ricarico tabella!
|
||||
// KeyValuePair<string, string>[] valori = DataLayerObj.mTabSMI(idxFamIn);
|
||||
// answ = string.Format("Ricaricata SMI per famiglia {0}<br/>", fiHASH);
|
||||
// }
|
||||
// answ += string.Format("Trovata {0} Hash per {1}<br />", memLayer.ML.redCountKey(fiHASH), fiHASH);
|
||||
// // recupero singolo valore (stringa) x chiave
|
||||
// outVal = DataLayerObj.valoreSMI(idxFamIn, idxMicroStato, valIOB);
|
||||
// // mostro output
|
||||
// answ += string.Format("idxFamIN: {0} | idxMS: {1} | valIOB: {2} | out: {3} <br/>", idxFamIn, idxMicroStato, valIOB, outVal);
|
||||
// }
|
||||
// catch
|
||||
// { }
|
||||
// }
|
||||
// stopWatch.Stop();
|
||||
// // Get the elapsed time as a TimeSpan value.
|
||||
// TimeSpan ts = stopWatch.Elapsed;
|
||||
// // accodo tempo!
|
||||
// answ += string.Format("<hr/>Total Time Elapsed: {0}ms", ts.TotalMilliseconds);
|
||||
// // ritorno
|
||||
// return answ;
|
||||
//}
|
||||
//// GET BENCH/INSEN/2004
|
||||
//public string INSEN(string id)
|
||||
//{
|
||||
// string answ = "ND";
|
||||
// Stopwatch stopWatch = new Stopwatch();
|
||||
// stopWatch.Start();
|
||||
// // se id nullo --> KO!
|
||||
// if (id == null)
|
||||
// {
|
||||
// answ = "KO";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // recupero microstato macchina da chiave relativa
|
||||
// answ = "";
|
||||
// try
|
||||
// {
|
||||
// answ += string.Format("Macchina {0}, insEnabled {1}<br />", id, DataLayerObj.insEnab(id));
|
||||
// }
|
||||
// catch
|
||||
// { }
|
||||
// }
|
||||
// stopWatch.Stop();
|
||||
// // Get the elapsed time as a TimeSpan value.
|
||||
// TimeSpan ts = stopWatch.Elapsed;
|
||||
// // accodo tempo!
|
||||
// answ += string.Format("<hr/>Total Time Elapsed: {0}ms", ts.TotalMilliseconds);
|
||||
// // ritorno
|
||||
// return answ;
|
||||
//}
|
||||
}
|
||||
}
|
||||
+323
-90
@@ -71,52 +71,6 @@ namespace MP.IOC.Data
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Init ricetta
|
||||
/// </summary>
|
||||
/// <param name="confPath"></param>
|
||||
/// <param name="idxPODL"></param>
|
||||
/// <param name="CalcArgs"></param>
|
||||
/// <returns></returns>
|
||||
public RecipeModel InitRecipe(string confPath, int idxPODL, Dictionary<string, string> CalcArgs)
|
||||
{
|
||||
return mongoController.InitRecipe(confPath, idxPODL, CalcArgs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva ricetta su MongoDB
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> RecipeSetByPODL(RecipeModel currRecord)
|
||||
{
|
||||
bool answ = false;
|
||||
answ = await mongoController.RecipeSetByPODL(currRecord);
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Ricerca ricetta su MongoDB dato PODL
|
||||
/// </summary>
|
||||
/// <param name="idxPODL"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RecipeModel?> RecipeGetByPODL(int idxPODL)
|
||||
{
|
||||
RecipeModel? result = null;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "MongoDB";
|
||||
result = await mongoController.RecipeGetByPODL(idxPODL);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"RecipeGetByPODL | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
public string CalcRecipe(RecipeModel currRecipe)
|
||||
{
|
||||
return mongoController.CalcRecipe(currRecipe);
|
||||
}
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -390,6 +344,11 @@ namespace MP.IOC.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
public string CalcRecipe(RecipeModel currRecipe)
|
||||
{
|
||||
return mongoController.CalcRecipe(currRecipe);
|
||||
}
|
||||
|
||||
public async Task<List<ConfigModel>> ConfigGetAll()
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
@@ -439,6 +398,41 @@ namespace MP.IOC.Data
|
||||
return await Task.FromResult(dbController.ConfigUpdate(updRec));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco completo valori DatiMacchine
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<DatiMacchineModel>> DatiMacchineGetAll()
|
||||
{
|
||||
List<DatiMacchineModel>? result = new List<DatiMacchineModel>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
string currKey = $"{redisBaseAddr}:TabDatiMacchine:ALL";
|
||||
// cerco in redis dato valore sel macchina...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<DatiMacchineModel>>($"{rawData}");
|
||||
readType = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.DatiMacchineGetAll());
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<DatiMacchineModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"DatiMacchineGetAll | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose del connettore ai dati
|
||||
/// </summary>
|
||||
@@ -463,7 +457,7 @@ namespace MP.IOC.Data
|
||||
result = await dbController.DossiersDeleteRecord(selRecord);
|
||||
// elimino cache redis...
|
||||
RedisValue pattern = new RedisValue($"{redisDossByMac}:*");
|
||||
bool answ = await ExecFlushRedisPattern(pattern);
|
||||
bool answ = await RedisFlushPatternAsync(pattern);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"DossiersDeleteRecord | IdxMacchina {selRecord.IdxMacchina} | DtRif {selRecord.DtRif} | IdxODL {selRecord.IdxODL} | {ts.TotalMilliseconds}ms");
|
||||
@@ -538,7 +532,7 @@ namespace MP.IOC.Data
|
||||
dbController.DossiersTakeParamsSnapshotLast(IdxMacchina, dtMin, dtMax);
|
||||
// elimino cache redis...
|
||||
RedisValue pattern = new RedisValue($"{redisDossByMac}:*");
|
||||
answ = await ExecFlushRedisPattern(pattern);
|
||||
answ = await RedisFlushPatternAsync(pattern);
|
||||
Log.Info($"Svuotata cache dossier | {pattern}");
|
||||
return answ;
|
||||
}
|
||||
@@ -654,12 +648,20 @@ namespace MP.IOC.Data
|
||||
{
|
||||
await Task.Delay(1);
|
||||
RedisValue pattern = new RedisValue($"{redisBaseAddrSpec}*");
|
||||
bool answ = await ExecFlushRedisPattern(pattern);
|
||||
bool answ = await RedisFlushPatternAsync(pattern);
|
||||
// rileggo vocabolario.,..
|
||||
ObjVocabolario = VocabolarioGetAll();
|
||||
return answ;
|
||||
}
|
||||
|
||||
public async Task<bool> FlushRedisKey(string redKey)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
RedisValue pattern = new RedisValue($"{redisBaseAddrSpec}:{redKey}");
|
||||
bool answ = await RedisFlushPatternAsync(pattern);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione)
|
||||
/// </summary>
|
||||
@@ -716,6 +718,84 @@ namespace MP.IOC.Data
|
||||
return Task.FromResult(currTagConf);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restitusice elenco KVP dei campi DatiMacchine + StatoMacchine per l'impianto indicato
|
||||
/// </summary>
|
||||
/// <param name="idxMacc"></param>
|
||||
/// <returns></returns>
|
||||
public Dictionary<string, string> GetCurrMSFDMacc(string idxMacc)
|
||||
{
|
||||
Dictionary<string, string>? result = new Dictionary<string, string>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
string currKey = $"{redisBaseAddr}:DSMacc:{idxMacc}";
|
||||
// cerco in redis dato valore sel macchina...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<Dictionary<string, string>>($"{rawData}");
|
||||
readType = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
var dbResults = dbController.VMSFDGetByMacc(idxMacc);
|
||||
// converto in formato dizionario...
|
||||
if (dbResults != null && dbResults.Count > 0)
|
||||
{
|
||||
var rowResult = dbResults[0];
|
||||
// salvo 1:1 i valori... STATO
|
||||
result.Add("IdxMicroStato", $"{rowResult.IdxMicroStato}");
|
||||
result.Add("IdxStato", $"{rowResult.IdxStato}");
|
||||
result.Add("CodArticolo", $"{rowResult.CodArticolo}");
|
||||
result.Add("insEnabled", $"{rowResult.InsEnabled}");
|
||||
result.Add("sLogEnabled", $"{rowResult.SLogEnabled}");
|
||||
result.Add("pallet", $"{rowResult.Pallet}");
|
||||
result.Add("CodArticolo_A", $"{rowResult.CodArticoloA}");
|
||||
result.Add("CodArticolo_B", $"{rowResult.CodArticoloB}");
|
||||
result.Add("TempoCicloBase", $"{rowResult.TempoCicloBase}");
|
||||
result.Add("PzPalletProd", $"{rowResult.PzPalletProd}");
|
||||
result.Add("MatrOpr", $"{rowResult.MatrOpr}");
|
||||
result.Add("lastVal", $"{rowResult.LastVal}");
|
||||
result.Add("TCBase", $"{rowResult.TempoCicloBase}");
|
||||
|
||||
//...e SETUP
|
||||
result.Add("CodMacc", $"{rowResult.Codmacchina}");
|
||||
result.Add("IdxFamIn", $"{rowResult.IdxFamigliaIngresso}");
|
||||
result.Add("Multi", $"{rowResult.Multi}");
|
||||
result.Add("BitFilt", $"{rowResult.BitFilt}");
|
||||
result.Add("MaxVal", $"{rowResult.MaxVal}");
|
||||
result.Add("BSR", $"{rowResult.Bsr}");
|
||||
result.Add("ExplodeBit", $"{rowResult.ExplodeBit}");
|
||||
result.Add("NumBit", $"{rowResult.NumBit}");
|
||||
result.Add("IdxFamMacc", $"{rowResult.IdxFamiglia}");
|
||||
result.Add("simplePallet", $"{rowResult.SimplePallet}");
|
||||
result.Add("palletChange", $"{rowResult.PalletChange}");
|
||||
}
|
||||
// cerco info Master/slave...
|
||||
var m2sTab = Macchine2SlaveGetAll();
|
||||
string isMaster = m2sTab.Where(x => x.IdxMacchina == idxMacc).Count() > 0 ? "1" : "0";
|
||||
string isSlave = m2sTab.Where(x => x.IdxMacchinaSlave == idxMacc).Count() > 0 ? "1" : "0";
|
||||
result.Add("Master", isMaster);
|
||||
result.Add("Slave", isSlave);
|
||||
|
||||
// serializzo
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
// durata cache secondo valore insEnabled...
|
||||
double numMinCache = (result["insEnabled"].ToLower() == "true") ? redisShortTimeCache / 4 : redisShortTimeCache;
|
||||
// ...e salvo...
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(numMinCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new Dictionary<string, string>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"GetCurrMSFDMacc | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<FluxLogDTO> getFluxLog(string Valore)
|
||||
{
|
||||
List<FluxLogDTO> answ = new List<FluxLogDTO>();
|
||||
@@ -755,6 +835,18 @@ namespace MP.IOC.Data
|
||||
return outVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init ricetta
|
||||
/// </summary>
|
||||
/// <param name="confPath"></param>
|
||||
/// <param name="idxPODL"></param>
|
||||
/// <param name="CalcArgs"></param>
|
||||
/// <returns></returns>
|
||||
public RecipeModel InitRecipe(string confPath, int idxPODL, Dictionary<string, string> CalcArgs)
|
||||
{
|
||||
return mongoController.InitRecipe(confPath, idxPODL, CalcArgs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="IdxOdl">id odl da cercare</param>
|
||||
@@ -913,6 +1005,41 @@ namespace MP.IOC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco completo valori Macchine 2 Slave
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Macchine2SlaveModel> Macchine2SlaveGetAll()
|
||||
{
|
||||
List<Macchine2SlaveModel>? result = new List<Macchine2SlaveModel>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
string currKey = $"{redisBaseAddr}:M2STab";
|
||||
// cerco in redis dato valore sel macchina...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<Macchine2SlaveModel>>($"{rawData}");
|
||||
readType = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbController.Macchine2Slave();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<Macchine2SlaveModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"Macchine2SlaveGetAll | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco di tutte le macchine gestite
|
||||
/// </summary>
|
||||
@@ -1322,7 +1449,7 @@ namespace MP.IOC.Data
|
||||
var dbResult = await dbController.PODLDeleteRecord(currRec);
|
||||
// elimino cache redis...
|
||||
RedisValue pattern = new RedisValue($"{redisXdlData}:*");
|
||||
bool answ = await ExecFlushRedisPattern(pattern);
|
||||
bool answ = await RedisFlushPatternAsync(pattern);
|
||||
await Task.Delay(1);
|
||||
return dbResult;
|
||||
}
|
||||
@@ -1337,7 +1464,7 @@ namespace MP.IOC.Data
|
||||
var dbResult = await dbController.PODL_startSetup(currRec, 0, 1, 1, "");
|
||||
// elimino cache redis...
|
||||
RedisValue pattern = new RedisValue($"{redisXdlData}:*");
|
||||
bool answ = await ExecFlushRedisPattern(pattern);
|
||||
bool answ = await RedisFlushPatternAsync(pattern);
|
||||
await Task.Delay(1);
|
||||
return dbResult;
|
||||
}
|
||||
@@ -1352,11 +1479,149 @@ namespace MP.IOC.Data
|
||||
var dbResult = await dbController.PODLUpdateRecord(currRec);
|
||||
// elimino cache redis...
|
||||
RedisValue pattern = new RedisValue($"{redisXdlData}:*");
|
||||
bool answ = await ExecFlushRedisPattern(pattern);
|
||||
bool answ = await RedisFlushPatternAsync(pattern);
|
||||
await Task.Delay(1);
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ricerca ricetta su MongoDB dato PODL
|
||||
/// </summary>
|
||||
/// <param name="idxPODL"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RecipeModel?> RecipeGetByPODL(int idxPODL)
|
||||
{
|
||||
RecipeModel? result = null;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "MongoDB";
|
||||
result = await mongoController.RecipeGetByPODL(idxPODL);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"RecipeGetByPODL | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva ricetta su MongoDB
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> RecipeSetByPODL(RecipeModel currRecord)
|
||||
{
|
||||
bool answ = false;
|
||||
answ = await mongoController.RecipeSetByPODL(currRecord);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue eliminazione memoria redis keyVal
|
||||
/// </summary>
|
||||
/// <param name="keyVal"></param>
|
||||
/// <returns></returns>
|
||||
public bool RedisDelKey(string keyVal)
|
||||
{
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConnAdmin.GetEndPoints();
|
||||
foreach (var endPoint in listEndpoints)
|
||||
{
|
||||
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
|
||||
var server = redisConnAdmin.GetServer(endPoint);
|
||||
if (server != null)
|
||||
{
|
||||
redisDb.KeyDelete((RedisKey)keyVal);
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue flush memoria redis dato keyVal
|
||||
/// </summary>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
public bool RedisFlushPattern(RedisValue pattern)
|
||||
{
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConnAdmin.GetEndPoints();
|
||||
foreach (var endPoint in listEndpoints)
|
||||
{
|
||||
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
|
||||
var server = redisConnAdmin.GetServer(endPoint);
|
||||
if (server != null)
|
||||
{
|
||||
var keyList = server.Keys(redisDb.Database, pattern);
|
||||
foreach (var item in keyList)
|
||||
{
|
||||
redisDb.KeyDelete(item);
|
||||
}
|
||||
// brutalmente rimuovo intero contenuto DB... DANGER
|
||||
//await server.FlushDatabaseAsync();
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue flush memoria redis dato keyVal, async
|
||||
/// </summary>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> RedisFlushPatternAsync(RedisValue pattern)
|
||||
{
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConnAdmin.GetEndPoints();
|
||||
foreach (var endPoint in listEndpoints)
|
||||
{
|
||||
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
|
||||
var server = redisConnAdmin.GetServer(endPoint);
|
||||
if (server != null)
|
||||
{
|
||||
var keyList = server.Keys(redisDb.Database, pattern);
|
||||
foreach (var item in keyList)
|
||||
{
|
||||
await redisDb.KeyDeleteAsync(item);
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public KeyValuePair<string, string>[] RedisGetHash(string redKey)
|
||||
{
|
||||
HashEntry[] rawData = redisDb.HashGetAll($"{redisBaseAddrSpec}:{redKey}");
|
||||
var result = rawData.Where(x => !x.Name.IsNull).Select(x => new KeyValuePair<string, string>(x.Name, x.Value)).ToArray();
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<KeyValuePair<string, string>[]> RedisGetHashAsync(string redKey)
|
||||
{
|
||||
HashEntry[] rawData = await redisDb.HashGetAllAsync($"{redisBaseAddrSpec}:{redKey}");
|
||||
var result = rawData.Where(x => !x.Name.IsNull).Select(x => new KeyValuePair<string, string>(x.Name, x.Value)).ToArray();
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool RedisSetHash(string redKey, KeyValuePair<string, string>[] valori)
|
||||
{
|
||||
bool answ = false;
|
||||
string rKey = $"{redisBaseAddrSpec}:{redKey}";
|
||||
HashEntry[] redHash = valori.Select(x => new HashEntry(x.Key, x.Value)).ToArray();
|
||||
redisDb.HashSet(rKey, redHash);
|
||||
answ = true;
|
||||
return answ;
|
||||
}
|
||||
|
||||
public async Task<bool> SetRedisKey(string redKey, string redVal)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
RedisValue pattern = new RedisValue($"{redisBaseAddrSpec}:{redKey}");
|
||||
bool answ = redisDb.StringSet(redKey, redVal);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Statistiche ODL calcolate (da stored stp_STAT_ODL)
|
||||
/// </summary>
|
||||
@@ -1503,9 +1768,9 @@ namespace MP.IOC.Data
|
||||
/// </summary>
|
||||
/// <param name="stdMinutes"></param>
|
||||
/// <returns></returns>
|
||||
protected TimeSpan getRandTOut(int stdMinutes)
|
||||
protected TimeSpan getRandTOut(double stdMinutes)
|
||||
{
|
||||
double rndValue = (double)stdMinutes + (double)rand.Next(1, 60) / 60;
|
||||
double rndValue = stdMinutes + (double)rand.Next(1, 60) / 60;
|
||||
return TimeSpan.FromMinutes(rndValue);
|
||||
}
|
||||
|
||||
@@ -1544,14 +1809,11 @@ namespace MP.IOC.Data
|
||||
private const string redisPOdlByOdl = redisXdlData + "POdlByOdl";
|
||||
private const string redisPOdlByPOdl = redisXdlData + "POdlByPOdl";
|
||||
private const string redisPOdlList = redisXdlData + "POdlList";
|
||||
private const string redisRecipeConf = redisBaseAddrSpec + "Cache:Recipe:Conf";
|
||||
private const string redisStatoCom = redisBaseAddrSpec + "Cache:StatoCom";
|
||||
private const string redisTipoArt = redisBaseAddrSpec + "Cache:TipoArt";
|
||||
private const string redisVocabolario = redisBaseAddrSpec + "Cache:Vocabolario";
|
||||
private const string redisXdlData = redisBaseAddrSpec + "Cache:XDL:";
|
||||
|
||||
private const string redisRecipeConf = redisBaseAddrSpec + "Cache:Recipe:Conf";
|
||||
|
||||
|
||||
private static IConfiguration _configuration = null!;
|
||||
private static ILogger<MpDataService> _logger = null!;
|
||||
|
||||
@@ -1578,47 +1840,18 @@ namespace MP.IOC.Data
|
||||
private IDatabase redisDb = null!;
|
||||
|
||||
private int redisLongTimeCache = 5;
|
||||
private int redisShortTimeCache = 4;
|
||||
private int redisShortTimeCache = 2;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Esegue flush memoria redis dato pattern
|
||||
/// </summary>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<bool> ExecFlushRedisPattern(RedisValue pattern)
|
||||
{
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConnAdmin.GetEndPoints();
|
||||
foreach (var endPoint in listEndpoints)
|
||||
{
|
||||
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
|
||||
var server = redisConnAdmin.GetServer(endPoint);
|
||||
if (server != null)
|
||||
{
|
||||
var keyList = server.Keys(redisDb.Database, pattern);
|
||||
foreach (var item in keyList)
|
||||
{
|
||||
await redisDb.KeyDeleteAsync(item);
|
||||
}
|
||||
// brutalmente rimuovo intero contenuto DB... DANGER
|
||||
//await server.FlushDatabaseAsync();
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
private async Task resetCacheArticoli()
|
||||
{
|
||||
RedisValue pattern = new RedisValue($"{redisArtByDossier}:*");
|
||||
await ExecFlushRedisPattern(pattern);
|
||||
await RedisFlushPatternAsync(pattern);
|
||||
pattern = new RedisValue($"{redisArtList}:*");
|
||||
await ExecFlushRedisPattern(pattern);
|
||||
await RedisFlushPatternAsync(pattern);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS03.pubxml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="wwwroot\images\LogoBlu.svg" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.1.1" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.6.90" />
|
||||
|
||||
@@ -33,6 +33,10 @@ app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
// aggiunta x index.html
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MP-IOC </i>
|
||||
<h4>Versione: 6.16.2302.1417</h4>
|
||||
<h4>Versione: 6.16.2302.1513</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2302.1417
|
||||
6.16.2302.1513
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2302.1417</version>
|
||||
<version>6.16.2302.1513</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>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"defaultProvider": "cdnjs",
|
||||
"libraries": [
|
||||
{
|
||||
"provider": "cdnjs",
|
||||
"library": "font-awesome@6.1.1",
|
||||
"destination": "wwwroot/lib/font-awesome/"
|
||||
},
|
||||
{
|
||||
"provider": "cdnjs",
|
||||
"library": "bootstrap@5.2.3",
|
||||
"destination": "wwwroot/lib/bootstrap/"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user