Modifica model macchine
This commit is contained in:
@@ -216,9 +216,9 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="codGruppo"></param>
|
||||
/// <returns></returns>
|
||||
public List<Macchine> MacchineGetFilt(string codGruppo)
|
||||
public List<MacchineModel> MacchineGetFilt(string codGruppo)
|
||||
{
|
||||
List<Macchine> dbResult = new List<Macchine>();
|
||||
List<MacchineModel> dbResult = new List<MacchineModel>();
|
||||
try
|
||||
{
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
|
||||
@@ -71,9 +71,9 @@ namespace MP.Data.Controllers
|
||||
/// Elenco da tabella Macchine
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DbModels.Macchine> MacchineGetAll()
|
||||
public List<DbModels.MacchineModel> MacchineGetAll()
|
||||
{
|
||||
List<DbModels.Macchine> dbResult = new List<DbModels.Macchine>();
|
||||
List<DbModels.MacchineModel> dbResult = new List<DbModels.MacchineModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
@@ -90,9 +90,9 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="codGruppo"></param>
|
||||
/// <returns></returns>
|
||||
public List<Macchine> MacchineGetFilt(string codGruppo)
|
||||
public List<MacchineModel> MacchineGetFilt(string codGruppo)
|
||||
{
|
||||
List<Macchine> dbResult = new List<Macchine>();
|
||||
List<MacchineModel> dbResult = new List<MacchineModel>();
|
||||
try
|
||||
{
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
|
||||
@@ -1425,9 +1425,9 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="MatrOpr"></param>
|
||||
/// <returns></returns>
|
||||
public List<Macchine> MacchineByMatrOper(int MatrOpr)
|
||||
public List<MacchineModel> MacchineByMatrOper(int MatrOpr)
|
||||
{
|
||||
List<Macchine> dbResult = new List<Macchine>();
|
||||
List<MacchineModel> dbResult = new List<MacchineModel>();
|
||||
try
|
||||
{
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
@@ -1475,9 +1475,9 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="codGruppo"></param>
|
||||
/// <returns></returns>
|
||||
public List<Macchine> MacchineGetFilt(string codGruppo)
|
||||
public List<MacchineModel> MacchineGetFilt(string codGruppo)
|
||||
{
|
||||
List<Macchine> dbResult = new List<Macchine>();
|
||||
List<MacchineModel> dbResult = new List<MacchineModel>();
|
||||
try
|
||||
{
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
@@ -1514,7 +1514,7 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco id Macchine che abbiano dati FLuxLog, nel periodo indicato
|
||||
/// Elenco id MacchineModel che abbiano dati FLuxLog, nel periodo indicato
|
||||
/// </summary>
|
||||
/// <param name="dtStart"></param>
|
||||
/// <param name="dtEnd"></param>
|
||||
|
||||
@@ -126,9 +126,9 @@ namespace MP.Data.Controllers
|
||||
/// Elenco da tabella Macchine
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Macchine> MacchineGetAll()
|
||||
public List<MacchineModel> MacchineGetAll()
|
||||
{
|
||||
List<Macchine> dbResult = new List<Macchine>();
|
||||
List<MacchineModel> dbResult = new List<MacchineModel>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
|
||||
@@ -936,9 +936,9 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="MatrOpr"></param>
|
||||
/// <returns></returns>
|
||||
public List<Macchine> MacchineByMatrOper(int MatrOpr)
|
||||
public List<MacchineModel> MacchineByMatrOper(int MatrOpr)
|
||||
{
|
||||
List<Macchine> dbResult = new List<Macchine>();
|
||||
List<MacchineModel> dbResult = new List<MacchineModel>();
|
||||
try
|
||||
{
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace MP.Data.DbModels
|
||||
/// Navigazione oggetto Machine
|
||||
/// </summary>
|
||||
[ForeignKey("IdxMacchina")]
|
||||
public virtual Macchine MachineNav { get; set; } = null!;
|
||||
public virtual MacchineModel MachineNav { get; set; } = null!;
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Articolo
|
||||
/// </summary>
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace MP.Data.DbModels
|
||||
/// Navigazione oggetto Machine
|
||||
/// </summary>
|
||||
[ForeignKey("IdxMacchina")]
|
||||
public virtual Macchine MachineNav { get; set; } = null!;
|
||||
public virtual MacchineModel MachineNav { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione oggetto ODL
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace MP.Data.DbModels
|
||||
/// Navigazione oggetto Machine
|
||||
/// </summary>
|
||||
[ForeignKey("IdxMacchina")]
|
||||
public virtual Macchine MachineNav { get; set; } = null!;
|
||||
public virtual MacchineModel MachineNav { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Articolo
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace MP.Data.DbModels
|
||||
/// Navigazione oggetto Machine
|
||||
/// </summary>
|
||||
[ForeignKey("IdxMacchina")]
|
||||
public virtual Macchine MachineNav { get; set; } = null!;
|
||||
public virtual MacchineModel MachineNav { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Machine
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace MP.Data.DbModels
|
||||
/// Navigazione oggetto Machine
|
||||
/// </summary>
|
||||
[ForeignKey("IdxMacchina")]
|
||||
public virtual Macchine MachineNav { get; set; } = null!;
|
||||
public virtual MacchineModel MachineNav { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Articolo
|
||||
|
||||
@@ -10,8 +10,8 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
// </Auto-Generated>
|
||||
namespace MP.Data.DbModels
|
||||
{
|
||||
[Table("Macchine")]
|
||||
public partial class Macchine
|
||||
[Table("MacchineModel")]
|
||||
public partial class MacchineModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace MP.Data.DbModels
|
||||
/// Navigazione oggetto Machine
|
||||
/// </summary>
|
||||
[ForeignKey("IdxMacchina")]
|
||||
public virtual Macchine MachineNav { get; set; } = null!;
|
||||
public virtual MacchineModel MachineNav { get; set; } = null!;
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Articolo
|
||||
/// </summary>
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace MP.Data.DbModels
|
||||
/// Navigazione oggetto Machine
|
||||
/// </summary>
|
||||
[ForeignKey("IdxMacchina")]
|
||||
public virtual Macchine MachineNav { get; set; } = null!;
|
||||
public virtual MacchineModel MachineNav { get; set; } = null!;
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Articolo
|
||||
/// </summary>
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace MP.Data.DbModels
|
||||
/// Navigazione oggetto Machine
|
||||
/// </summary>
|
||||
[ForeignKey("IdxMacchina")]
|
||||
public virtual Macchine MachineNav { get; set; } = null!;
|
||||
public virtual MacchineModel MachineNav { get; set; } = null!;
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Articolo
|
||||
/// </summary>
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace MP.Data.DbModels
|
||||
/// Navigazione oggetto Machine
|
||||
/// </summary>
|
||||
[ForeignKey("IdxMacchina")]
|
||||
public virtual Macchine MachineNav { get; set; } = null!;
|
||||
public virtual MacchineModel MachineNav { get; set; } = null!;
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Articolo
|
||||
/// </summary>
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace MP.Data.DbModels
|
||||
/// Navigazione oggetto Machine
|
||||
/// </summary>
|
||||
[ForeignKey("IdxMacchina")]
|
||||
public virtual Macchine MachineNav { get; set; } = null!;
|
||||
public virtual MacchineModel MachineNav { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace MP.Data
|
||||
public virtual DbSet<ConfigModel> DbSetConfig { get; set; }
|
||||
public virtual DbSet<LinkMenuModel> DbSetLinkMenu { get; set; }
|
||||
public virtual DbSet<ListValuesModel> DbSetListValues { get; set; }
|
||||
public virtual DbSet<Macchine> DbSetMacchine { get; set; }
|
||||
public virtual DbSet<MacchineModel> DbSetMacchine { get; set; }
|
||||
public virtual DbSet<MappaStatoExplModel> DbSetMSE { get; set; }
|
||||
public virtual DbSet<ODLModel> DbSetODL { get; set; }
|
||||
public virtual DbSet<ODLExpModel> DbSetODLExp { get; set; }
|
||||
@@ -190,7 +190,7 @@ namespace MP.Data
|
||||
.HasMaxLength(50);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Macchine>(entity =>
|
||||
modelBuilder.Entity<MacchineModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxMacchina);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace MP.Data
|
||||
|
||||
|
||||
public virtual DbSet<AnagArticoliModel> DbSetArticoli { get; set; }
|
||||
public virtual DbSet<Macchine> DbSetMacchine { get; set; }
|
||||
public virtual DbSet<MacchineModel> DbSetMacchine { get; set; }
|
||||
public virtual DbSet<FluxLogModel> DbSetFluxLog { get; set; }
|
||||
public virtual DbSet<DossierModel> DbSetDossiers { get; set; }
|
||||
public virtual DbSet<ParetoFluxLogDTO> DbSetParetoFluxLog { get; set; }
|
||||
@@ -111,7 +111,7 @@ namespace MP.Data
|
||||
.HasMaxLength(50);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Macchine>(entity =>
|
||||
modelBuilder.Entity<MacchineModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxMacchina);
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace MP.Data
|
||||
public virtual DbSet<ResControlli> DbSetControlli { get; set; }
|
||||
public virtual DbSet<DdbTurni> DbSetDdbTurni { get; set; }
|
||||
public virtual DbSet<FLModel> DbSetFL { get; set; }
|
||||
public virtual DbSet<Macchine> DbSetMacchine { get; set; }
|
||||
public virtual DbSet<MacchineModel> DbSetMacchine { get; set; }
|
||||
public virtual DbSet<StatsODL> DbSetODL { get; set; }
|
||||
public virtual DbSet<OdlEnergyModel> DbSetOdlEnergy { get; set; }
|
||||
public virtual DbSet<ResScarti> DbSetScarti { get; set; }
|
||||
@@ -159,7 +159,7 @@ namespace MP.Data
|
||||
.HasMaxLength(50);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Macchine>(entity =>
|
||||
modelBuilder.Entity<MacchineModel>(entity =>
|
||||
{
|
||||
entity.HasNoKey();
|
||||
|
||||
|
||||
@@ -234,19 +234,19 @@ namespace MP.Data.Services
|
||||
/// </summary>
|
||||
/// <param name="MatrOpr"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<Macchine>> MacchineByMatrOper(int MatrOpr)
|
||||
public async Task<List<MacchineModel>> MacchineByMatrOper(int MatrOpr)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<Macchine>? result = new List<Macchine>();
|
||||
List<MacchineModel>? result = new List<MacchineModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:Macc:{MatrOpr}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
//if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<Macchine>>($"{rawData}");
|
||||
result = JsonConvert.DeserializeObject<List<MacchineModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
@@ -258,7 +258,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<Macchine>();
|
||||
result = new List<MacchineModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"MacchineGetFilt | MatrOpr: {MatrOpr} | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
|
||||
@@ -125,14 +125,14 @@ namespace MP.Data.Services
|
||||
/// <summary>
|
||||
/// Cache elenco macchine abilitate all'utente, vuoto se scaduto reload
|
||||
/// </summary>
|
||||
public List<Macchine>? ListMachineEnabled
|
||||
public List<MacchineModel>? ListMachineEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
List<Macchine>? answ = userListMachine;
|
||||
List<MacchineModel>? answ = userListMachine;
|
||||
if (DateTime.Now.Subtract(lastUserUpd).TotalSeconds > 30)
|
||||
{
|
||||
answ = new List<Macchine>();
|
||||
answ = new List<MacchineModel>();
|
||||
Log.Debug("ListMachineEnabled unvalidated");
|
||||
}
|
||||
return answ;
|
||||
@@ -710,7 +710,7 @@ namespace MP.Data.Services
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private List<Macchine>? userListMachine { get; set; } = null;
|
||||
private List<MacchineModel>? userListMachine { get; set; } = null;
|
||||
private Dictionary<string, string> UserPrefs { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
@@ -167,18 +167,18 @@ namespace MP.Data.Services
|
||||
return outVal;
|
||||
}
|
||||
|
||||
public async Task<List<Macchine>> MacchineGetAll()
|
||||
public async Task<List<MacchineModel>> MacchineGetAll()
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
string source = "DB";
|
||||
sw.Start();
|
||||
List<Macchine>? result = new List<Macchine>();
|
||||
List<MacchineModel>? result = new List<MacchineModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{Constants.redisMacchine}:ALL";
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<Macchine>>($"{rawData}");
|
||||
result = JsonConvert.DeserializeObject<List<MacchineModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
@@ -190,7 +190,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<Macchine>();
|
||||
result = new List<MacchineModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"MacchineGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
@@ -198,18 +198,18 @@ namespace MP.Data.Services
|
||||
//return Task.FromResult(dbController.MacchineGetAll());
|
||||
}
|
||||
|
||||
public async Task<List<Macchine>> MacchineGetByGruppo(string CodGruppo)
|
||||
public async Task<List<MacchineModel>> MacchineGetByGruppo(string CodGruppo)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
string source = "DB";
|
||||
sw.Start();
|
||||
List<Macchine>? result = new List<Macchine>();
|
||||
List<MacchineModel>? result = new List<MacchineModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{Constants.redisMacchine}:{CodGruppo}";
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<Macchine>>($"{rawData}");
|
||||
result = JsonConvert.DeserializeObject<List<MacchineModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
@@ -222,7 +222,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<Macchine>();
|
||||
result = new List<MacchineModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"MacchineGetByGruppo | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
|
||||
@@ -1246,7 +1246,43 @@ namespace MP.Data.Services
|
||||
/// </summary>
|
||||
/// <param name="IdxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IOB_data> IobInfo(string IdxMacchina)
|
||||
public IOB_data IobInfo(string IdxMacchina)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
IOB_data? result = new IOB_data();
|
||||
// cerco in redis...
|
||||
string currKey = redHashMpIO($"hM2IOB:{IdxMacchina}");
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
//if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<IOB_data>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error($"Errore: non trovato valore <IOB_data> valido in REDIS | key: {currKey}");
|
||||
Log.Info($"REDIS | conf: {redisConn.Configuration}");
|
||||
Log.Info($" --> Valore trovato:{Environment.NewLine}{rawData}");
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new IOB_data();
|
||||
Log.Debug($"Init valore default <IOB_data> | IdxMacchina: {IdxMacchina}");
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"IobInfo per {IdxMacchina} | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero info IOB x TAB (da info registrate IOB-WIN--> MP-IO)
|
||||
/// </summary>
|
||||
/// <param name="IdxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IOB_data> IobInfoAsync(string IdxMacchina)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
@@ -1273,7 +1309,7 @@ namespace MP.Data.Services
|
||||
Log.Debug($"Init valore default <IOB_data> | IdxMacchina: {IdxMacchina}");
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"IobInfo per {IdxMacchina} | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
Log.Debug($"IobInfoAsync per {IdxMacchina} | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1431,11 +1467,11 @@ namespace MP.Data.Services
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Macchine dato operatore secondo gruppi (macchine/operatore)
|
||||
/// Elenco MacchineModel dato operatore secondo gruppi (macchine/operatore)
|
||||
/// </summary>
|
||||
/// <param name="MatrOpr"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<Macchine>> MacchineByMatrOper(int MatrOpr)
|
||||
public async Task<List<MacchineModel>> MacchineByMatrOper(int MatrOpr)
|
||||
{
|
||||
int rndWait = rnd.Next(0, 2);
|
||||
await Task.Delay(rndWait);
|
||||
@@ -1443,14 +1479,14 @@ namespace MP.Data.Services
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<Macchine> result = new List<Macchine>();
|
||||
List<MacchineModel> result = new List<MacchineModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:MachByMatOp:{MatrOpr}";
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
//if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<Macchine>>($"{rawData}");
|
||||
result = JsonConvert.DeserializeObject<List<MacchineModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
@@ -1462,7 +1498,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<Macchine>();
|
||||
result = new List<MacchineModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user