Merge branch 'Release/AggiuntaMetodiIoc_03'
This commit is contained in:
@@ -62,6 +62,7 @@ namespace MP.Core
|
||||
|
||||
public const string redisParetoFLKey = redisBaseAddr + "Cache:ParetoFL";
|
||||
public const string redisPOdlByCodArt = redisXdlData + "POdlByCodArt";
|
||||
public const string redisPOdlByMaccArt = redisXdlData + "POdlByMaccArt";
|
||||
public const string redisPOdlByOdl = redisXdlData + "POdlByOdl";
|
||||
public const string redisPOdlByPOdl = redisXdlData + "POdlByPOdl";
|
||||
public const string redisPOdlList = redisXdlData + "POdlList";
|
||||
|
||||
@@ -73,6 +73,29 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restitusice elenco ultimi articoli per macchina
|
||||
/// </summary>
|
||||
/// <param name="tipo"></param>
|
||||
/// <param name="azienda"></param>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<AnagArticoliModel>> ArticoliGetLastByMaccAsync(string idxMacc)
|
||||
{
|
||||
List<AnagArticoliModel> dbResult = new List<AnagArticoliModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacc);
|
||||
|
||||
dbResult = await dbCtx
|
||||
.DbSetArticoli
|
||||
.FromSqlRaw("exec dbo.stp_ART_getLastByMacch @idxMacchina", IdxMacchina)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Record ConfFlux dato macchina (oppure tutti se vuoto)
|
||||
/// </summary>
|
||||
@@ -189,17 +212,17 @@ namespace MP.Data.Controllers
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@pIdxMacchina", idxMacchina);
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var InizioStato = new SqlParameter("@InizioStato", inizioStato);
|
||||
var IdxStato = new SqlParameter("@IdxStato", idxStato);
|
||||
var CodArticolo = new SqlParameter("@CodArticolo", codArt);
|
||||
var CodArticolo = new SqlParameter("@codArticolo", codArt);
|
||||
var Value = new SqlParameter("@Value", value);
|
||||
var MatrOpr = new SqlParameter("@MatrOpr", matrOpr);
|
||||
var Pallet = new SqlParameter("@pallet", pallet);
|
||||
|
||||
var result = dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRaw("exec dbo.stp_DDB_InsStatoBatch @pIdxMacchina, @InizioStato, @IdxStato, @CodArticolo, @Value, @MatrOpr, @pallet", IdxMacchina, InizioStato, IdxStato, CodArticolo, Value, MatrOpr, Pallet);
|
||||
.ExecuteSqlRaw("exec dbo.stp_DDB_InsStatoBatch @IdxMacchina, @InizioStato, @IdxStato, @codArticolo, @Value, @MatrOpr, @pallet", IdxMacchina, InizioStato, IdxStato, CodArticolo, Value, MatrOpr, Pallet);
|
||||
|
||||
// indico eseguito!
|
||||
fatto = result > 0;
|
||||
@@ -245,7 +268,6 @@ namespace MP.Data.Controllers
|
||||
using (var dbCtx = new MoonPro_FluxContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacc);
|
||||
|
||||
dbResult = await dbCtx
|
||||
.DbSetDossiers
|
||||
.FromSqlRaw("exec dbo.stp_DOSS_getLastByMacch @idxMacchina", IdxMacchina)
|
||||
@@ -507,6 +529,31 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco valori ammessi x tabella/colonna con filtro parametrico
|
||||
/// </summary>
|
||||
/// <param name="tabName">Filtro tabella (se "" tutto)</param>
|
||||
/// <param name="fieldName">Filtro colonna (se "" tutto)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ListValuesModel>> ListValuesFilt(string tabName, string fieldName)
|
||||
{
|
||||
List<ListValuesModel> dbResult = new List<ListValuesModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var query = dbCtx.DbSetListValues
|
||||
.AsNoTracking()
|
||||
.AsQueryable();
|
||||
|
||||
if (!string.IsNullOrEmpty(tabName))
|
||||
query = query.Where(x => x.TableName == tabName);
|
||||
if (!string.IsNullOrEmpty(fieldName))
|
||||
query = query.Where(x => x.FieldName == fieldName);
|
||||
|
||||
dbResult = await query.ToListAsync();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Intera tabella relazione master/slave in machine (gestione setup master --> slave)
|
||||
/// </summary>
|
||||
@@ -784,11 +831,11 @@ namespace MP.Data.Controllers
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var DataInizio = new SqlParameter("@DataInizio", dataInizio);
|
||||
var DataFine = new SqlParameter("@DataFine", dataFine);
|
||||
var CodArticolo = new SqlParameter("@CodArticolo", codArticolo);
|
||||
var CodArticolo = new SqlParameter("@codArticolo", codArticolo);
|
||||
|
||||
var result = dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRaw("EXEC stp_ODL_AutoDayGener @IdxMacchina, @DataInizio, @DataFine, @CodArticolo", IdxMacchina, DataInizio, DataFine, CodArticolo);
|
||||
.ExecuteSqlRaw("EXEC stp_ODL_AutoDayGener @IdxMacchina, @DataInizio, @DataFine, @codArticolo", IdxMacchina, DataInizio, DataFine, CodArticolo);
|
||||
|
||||
// indico eseguito!
|
||||
answ = result > 0;
|
||||
@@ -816,18 +863,18 @@ namespace MP.Data.Controllers
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var DataInizio = new SqlParameter("@DataInizio", dataInizio);
|
||||
var DataFine = new SqlParameter("@DataFine", dataFine);
|
||||
var CodArticolo = new SqlParameter("@CodArticolo", codArticolo);
|
||||
var CodArticolo = new SqlParameter("@codArticolo", codArticolo);
|
||||
var PzPODL = new SqlParameter("@PzPODL", pzPODL);
|
||||
var PzPallet = new SqlParameter("@PzPallet", pzPallet);
|
||||
var KeyRichiesta = new SqlParameter("@KeyRichiesta", keyRichiesta);
|
||||
var TCAssegnato = new SqlParameter("@TCAssegnato", tcAssegnato);
|
||||
var CodGruppo = new SqlParameter("@CodGruppo", codGruppo);
|
||||
var CodGruppo = new SqlParameter("@codGruppo", codGruppo);
|
||||
var FlgCreaPODL = new SqlParameter("@flgCreaPODL", flgCreaPODL);
|
||||
var FlgCheckTC = new SqlParameter("@flgCheckTC", flgCheckTC);
|
||||
|
||||
var result = dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRaw("EXEC stp_ODL_AutoDayGenerFull @IdxMacchina, @DataInizio, @DataFine, @CodArticolo, @PzPODL, @PzPallet, @KeyRichiesta, @TCAssegnato, @CodGruppo, @flgCreaPODL, @flgCheckTC", IdxMacchina, DataInizio, DataFine, CodArticolo, PzPODL, PzPallet, KeyRichiesta, TCAssegnato, CodGruppo, FlgCreaPODL, FlgCheckTC);
|
||||
.ExecuteSqlRaw("EXEC stp_ODL_AutoDayGenerFull @IdxMacchina, @DataInizio, @DataFine, @codArticolo, @PzPODL, @PzPallet, @KeyRichiesta, @TCAssegnato, @codGruppo, @flgCreaPODL, @flgCheckTC", IdxMacchina, DataInizio, DataFine, CodArticolo, PzPODL, PzPallet, KeyRichiesta, TCAssegnato, CodGruppo, FlgCreaPODL, FlgCheckTC);
|
||||
|
||||
// indico eseguito!
|
||||
answ = result > 0;
|
||||
@@ -940,12 +987,12 @@ namespace MP.Data.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@pIdxMacchina", idxMacchina);
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var DataFrom = new SqlParameter("@dataFrom", dtStart);
|
||||
var DataTo = new SqlParameter("@dataTo", dtEnd);
|
||||
dbResult = dbCtx
|
||||
.DbSetODLExp
|
||||
.FromSqlRaw("EXEC stp_ODL_getByMacchinaPeriodo @pIdxMacchina, @dataFrom, @dataTo", IdxMacchina, DataFrom, DataTo)
|
||||
.FromSqlRaw("EXEC stp_ODL_getByMacchinaPeriodo @IdxMacchina, @dataFrom, @dataTo", IdxMacchina, DataFrom, DataTo)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
@@ -999,6 +1046,33 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero elenco PODL EXPL filtrati x macchina, articolo...
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="codArticolo"></param>
|
||||
/// <param name="codGruppo"></param>
|
||||
/// <param name="onlyFree">True = aperti (=senza ODL)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<PODLExpModel>> POdlGetByMaccArtAsync(string idxMacchina, string codArticolo, string codGruppo, bool onlyFree)
|
||||
{
|
||||
List<PODLExpModel> dbResult = new List<PODLExpModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var pIdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var pCodArticolo = new SqlParameter("@CodArticolo", codArticolo);
|
||||
var pCodGruppo = new SqlParameter("@CodGruppo", codGruppo);
|
||||
var pOnlyFree = new SqlParameter("@onlyFree", onlyFree);
|
||||
|
||||
dbResult = await dbCtx
|
||||
.DbSetPODLExp
|
||||
.FromSqlRaw("EXEC stp_PODL_getByMaccArt @IdxMacchina, @CodArticolo, @CodGruppo, @onlyFree", pIdxMacchina, pCodArticolo, pCodGruppo, pOnlyFree)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua ricalcolo MSE x macchina indicata
|
||||
/// </summary>
|
||||
@@ -1295,11 +1369,11 @@ namespace MP.Data.Controllers
|
||||
List<TransizioneStatiModel> dbResult = new List<TransizioneStatiModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@pIdxMacchina", idxMacchina);
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var IdxTipo = new SqlParameter("@IdxTipo", idxTipo);
|
||||
dbResult = dbCtx
|
||||
.DbSetSMES
|
||||
.FromSqlRaw("exec dbo.stp_TS_getByIdxMacchIdxTipoEv @pIdxMacchina, @IdxTipo", IdxMacchina, IdxTipo)
|
||||
.FromSqlRaw("exec dbo.stp_TS_getByIdxMacchIdxTipoEv @IdxMacchina, @IdxTipo", IdxMacchina, IdxTipo)
|
||||
.AsNoTracking()
|
||||
.AsEnumerable()
|
||||
.ToList();
|
||||
@@ -1317,11 +1391,11 @@ namespace MP.Data.Controllers
|
||||
List<TransizioneStatiModel> dbResult = new List<TransizioneStatiModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@pIdxMacchina", idxMacchina);
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var IdxTipo = new SqlParameter("@IdxTipo", idxTipo);
|
||||
dbResult = dbCtx
|
||||
.DbSetSMES
|
||||
.FromSqlRaw("exec dbo.stp_TS_getUserForcedTrans @pIdxMacchina, @IdxTipo", IdxMacchina, IdxTipo)
|
||||
.FromSqlRaw("exec dbo.stp_TS_getUserForcedTrans @IdxMacchina, @IdxTipo", IdxMacchina, IdxTipo)
|
||||
.AsNoTracking()
|
||||
.AsEnumerable()
|
||||
.ToList();
|
||||
@@ -1360,11 +1434,11 @@ namespace MP.Data.Controllers
|
||||
StatoProdModel dbResult = new StatoProdModel();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@pIdxMacchina", idxMacchina);
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var DataOra = new SqlParameter("@DataOra ", dtReq);
|
||||
var rawData = dbCtx
|
||||
.DbSetStatoProd
|
||||
.FromSqlRaw("EXEC stp_StatoProd_getByMacchina @pIdxMacchina, @DataOra ", IdxMacchina, DataOra)
|
||||
.FromSqlRaw("EXEC stp_StatoProd_getByMacchina @IdxMacchina, @DataOra ", IdxMacchina, DataOra)
|
||||
.AsNoTracking()
|
||||
.AsEnumerable()
|
||||
.ToList();
|
||||
@@ -1385,11 +1459,11 @@ namespace MP.Data.Controllers
|
||||
StatoProdModel dbResult = new StatoProdModel();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@pIdxMacchina", idxMacchina);
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var DataOra = new SqlParameter("@DataOra ", dtReq);
|
||||
dbResult = (await dbCtx
|
||||
.DbSetStatoProd
|
||||
.FromSqlRaw("EXEC stp_StatoProd_getByMacchina @pIdxMacchina, @DataOra ", IdxMacchina, DataOra)
|
||||
.FromSqlRaw("EXEC stp_StatoProd_getByMacchina @IdxMacchina, @DataOra ", IdxMacchina, DataOra)
|
||||
.AsNoTracking()
|
||||
.ToListAsync())
|
||||
.FirstOrDefault();
|
||||
@@ -1415,6 +1489,30 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Intera vista v_MSFD in modo ASYNC
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<VMSFDModel>> VMSFDGetAllAsync()
|
||||
{
|
||||
List<VMSFDModel> dbResult = new List<VMSFDModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
dbResult = await dbCtx
|
||||
.DbSetMSFD
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.IdxMacchina)
|
||||
.ToListAsync();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Vista v_MSFD x singola macchina (da stored) - singolo record
|
||||
/// </summary>
|
||||
@@ -1425,11 +1523,11 @@ namespace MP.Data.Controllers
|
||||
List<VMSFDModel> dbResult = new List<VMSFDModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@pIdxMacchina", idxMacc);
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacc);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetMSFD
|
||||
.FromSqlRaw("exec dbo.stp_MSFD_getMacc @pIdxMacchina", IdxMacchina)
|
||||
.FromSqlRaw("exec dbo.stp_MSFD_getMacc @IdxMacchina", IdxMacchina)
|
||||
.AsNoTracking()
|
||||
.AsEnumerable()
|
||||
.ToList();
|
||||
@@ -1447,13 +1545,18 @@ namespace MP.Data.Controllers
|
||||
List<VMSFDModel> dbResult = new List<VMSFDModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@pIdxMacchina", idxMacc);
|
||||
|
||||
dbResult = await dbCtx
|
||||
.DbSetMSFD
|
||||
.FromSqlRaw("exec dbo.stp_MSFD_getMacc @pIdxMacchina", IdxMacchina)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacc);
|
||||
try
|
||||
{
|
||||
dbResult = await dbCtx
|
||||
.DbSetMSFD
|
||||
.FromSqlRaw("exec dbo.stp_MSFD_getMacc @IdxMacchina", IdxMacchina)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
@@ -1468,11 +1571,11 @@ namespace MP.Data.Controllers
|
||||
List<VMSFDModel> dbResult = new List<VMSFDModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@pIdxMacchina", idxMacc);
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacc);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetMSFD
|
||||
.FromSqlRaw("exec dbo.stp_MSFD_getMulti @pIdxMacchina", IdxMacchina)
|
||||
.FromSqlRaw("exec dbo.stp_MSFD_getMulti @IdxMacchina", IdxMacchina)
|
||||
.AsNoTracking()
|
||||
.AsEnumerable()
|
||||
.ToList();
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace MP.Data.DbModels.Anag
|
||||
{
|
||||
[Table("AlarmLog")]
|
||||
[Table("DecNumArticoli")]
|
||||
public class DecNumArticoliModel
|
||||
{
|
||||
[Key]
|
||||
|
||||
@@ -14,6 +14,9 @@ namespace MP.Data.DbModels
|
||||
public string CodArticolo { get; set; }
|
||||
public string DescArticolo { get; set; }
|
||||
public string Disegno { get; set; }
|
||||
public string CurrRev { get; set; }
|
||||
public string ProdRev { get; set; }
|
||||
public bool FlagIsNew { get; set; }
|
||||
public string Tipo { get; set; }
|
||||
public string Azienda { get; set; }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace MP.Data.DbModels
|
||||
{
|
||||
@@ -8,31 +8,51 @@ namespace MP.Data.DbModels
|
||||
// </Auto-Generated>
|
||||
public partial class VMSFDModel
|
||||
{
|
||||
[Column("idxmacchina")]
|
||||
public string IdxMacchina { get; set; } = "ND";
|
||||
[Column("codmacchina")]
|
||||
public string Codmacchina { get; set; } = "000";
|
||||
[Column("palletChange")]
|
||||
public bool PalletChange { get; set; } = false;
|
||||
[Column("CodArticolo_A"), MaxLength(50)]
|
||||
public string CodArticoloA { get; set; } = "ND";
|
||||
[Column("CodArticolo_B"), MaxLength(50)]
|
||||
public string CodArticoloB { get; set; } = "ND";
|
||||
[Column("simplePallet")]
|
||||
public bool SimplePallet { get; set; } = true;
|
||||
[Column("insEnabled")]
|
||||
public bool InsEnabled { get; set; } = true;
|
||||
[Column("sLogEnabled")]
|
||||
public bool SLogEnabled { get; set; } = false;
|
||||
|
||||
public int IsManual { get; set; } = 0;
|
||||
public int IdxFamigliaIngresso { get; set; }
|
||||
public int Multi { get; set; }
|
||||
public int BitFilt { get; set; }
|
||||
public int MaxVal { get; set; }
|
||||
|
||||
[Column("BSR")]
|
||||
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; }
|
||||
|
||||
[Column("lastVal")]
|
||||
public string LastVal { get; set; }
|
||||
[MaxLength(50)]
|
||||
public string CodArticolo { get; set; }
|
||||
public double TempoCicloBase { get; set; }
|
||||
public int PzPalletProd { get; set; }
|
||||
public int MatrOpr { get; set; }
|
||||
|
||||
[Column("pallet")]
|
||||
public string Pallet { get; set; }
|
||||
|
||||
[MaxLength(250)]
|
||||
public string CodMaccArticolo { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,54 +448,6 @@ namespace MP.Data
|
||||
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 =>
|
||||
|
||||
@@ -140,6 +140,13 @@ namespace MP.Data
|
||||
entity.HasKey(e => new { e.IdxMacchina, e.CodFlux });
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ConfFluxModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.IdxMacchina, e.CodFlux });
|
||||
|
||||
});
|
||||
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
|
||||
@@ -564,6 +564,159 @@ namespace MP.IOC.Controllers
|
||||
return Ok(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera elenco articoli USATI per ultimi:
|
||||
/// - quelli dei PODL correnti
|
||||
/// - quelli degli ultimi n (DOSS_LastArt in config) ODL lavorati
|
||||
///
|
||||
/// GET: IOB/getArtByMacc
|
||||
/// </summary>
|
||||
/// <returns>Json contenente lista oggetti ARTICOLI serializzati</returns>
|
||||
[HttpGet("getLastArtByMacc/{id}")]
|
||||
public async Task<IActionResult> GetLastArtByMacc(string id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
|
||||
// Multi: gestione carattere "|" trasformato in "#"
|
||||
id = id.Replace("|", "#");
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
// recupero dati macchina...
|
||||
var elencoArt = await DService.ArticoliGetLastByMaccAsync(id);
|
||||
answ = JsonConvert.SerializeObject(elencoArt);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in GetLastArtByMacc{Environment.NewLine}{exc}");
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, "NO");
|
||||
}
|
||||
return Ok(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera DATI dell'ultimo dossier dato articolo:
|
||||
///
|
||||
/// GET: IOB/getLastDossArt/cod_articolo
|
||||
/// </summary>
|
||||
/// <param name="id">codice articolo, se vuoto --> non fa nulla</param>
|
||||
/// <returns>Json contenente lista oggetti DOSSIER serializzati</returns>
|
||||
[HttpGet("getLastDossByMacc/{id}")]
|
||||
public async Task<IActionResult> GetLastDossByMacc(string id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
|
||||
// Multi: gestione carattere "|" trasformato in "#"
|
||||
id = id.Replace("|", "#");
|
||||
string answ = "";
|
||||
|
||||
try
|
||||
{
|
||||
// recupero dati macchina...
|
||||
var elencoDoss = await DService.DossierLastByMachAsync(id);
|
||||
answ = JsonConvert.SerializeObject(elencoDoss);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in GetLastDossByMacc{Environment.NewLine}{exc}");
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, "NO");
|
||||
}
|
||||
return Ok(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera elenco ListValues data tabella: ///
|
||||
/// GET: IOB/getListValByTable
|
||||
/// </summary>
|
||||
/// <param name="id">nome tabella x cui filtrare risultati, se "" mostra tutto</param>
|
||||
/// <returns>Json contenente lista oggetti ListValue serializzati</returns>
|
||||
[HttpGet("getListValByTable/{id}")]
|
||||
public async Task<IActionResult> GetListValByTable(string id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
|
||||
// Multi: gestione carattere "|" trasformato in "#"
|
||||
id = id.Replace("|", "#");
|
||||
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
// recupero dati macchina...
|
||||
var elencoOdl = DService.ListValuesFilt(id, "");
|
||||
answ = JsonConvert.SerializeObject(elencoOdl);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in GetListValByTable{Environment.NewLine}{exc}");
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, "NO");
|
||||
}
|
||||
return Ok(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// restituisce elenco parametri correnti come una List Json di oggetti objItem
|
||||
/// GET: IOB/getObjItems/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">ID dell'IOB</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getObjItems/{id}")]
|
||||
public async Task<IActionResult> GetObjItems(string id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
|
||||
// Multi: gestione carattere "|" trasformato in "#"
|
||||
id = id.Replace("|", "#");
|
||||
|
||||
string answ = "";
|
||||
|
||||
// procedo a recuperare l'oggetto...
|
||||
List<ObjItemDTO> currParams = new List<ObjItemDTO>();
|
||||
try
|
||||
{
|
||||
// deserializzo
|
||||
var rawData = await DService.MachineParamListAsync(id);
|
||||
currParams = rawData.OrderBy(x => x.displOrdinal)
|
||||
.ThenBy(x => x.description)
|
||||
.ToList();
|
||||
// se != null --> salvo!
|
||||
if (currParams != null)
|
||||
{
|
||||
answ = JsonConvert.SerializeObject(currParams);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in GetObjItems{Environment.NewLine}{exc}");
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, "NO");
|
||||
}
|
||||
return Ok(answ);
|
||||
}
|
||||
|
||||
[HttpGet("getObjItems2Write/{id}")]
|
||||
public async Task<IActionResult> GetObjItems2Write(string id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
|
||||
// Multi: gestione carattere "|" trasformato in "#"
|
||||
id = id.Replace("|", "#");
|
||||
|
||||
string answ = "";
|
||||
|
||||
// procedo a recuperare l'oggetto...
|
||||
List<ObjItemDTO> currParams = new List<ObjItemDTO>();
|
||||
try
|
||||
{
|
||||
// deserializzo
|
||||
currParams = await DService.MachineParamListPendingWriteAsync(id);
|
||||
// se != null --> salvo!
|
||||
if (currParams != null)
|
||||
{
|
||||
answ = JsonConvert.SerializeObject(currParams);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in GetObjItems2Write{Environment.NewLine}{exc}");
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, "NO");
|
||||
}
|
||||
return Ok(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera TASK richiesto x macchina:
|
||||
/// GET: IOB/getOptPar/SIMUL_03
|
||||
@@ -591,6 +744,28 @@ namespace MP.IOC.Controllers
|
||||
return Ok(answ);
|
||||
}
|
||||
|
||||
[HttpGet("getPOdlNext/{id}")]
|
||||
public async Task<IActionResult> GetPOdlNext(string id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
|
||||
// Multi: gestione carattere "|" trasformato in "#"
|
||||
id = id.Replace("|", "#");
|
||||
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
// recupero dati macchina...
|
||||
var elencoOdl = await DService.POdlGetByMaccArtAsync(id, "", "", true);
|
||||
answ = JsonConvert.SerializeObject(elencoOdl);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in GetPOdlNext{Environment.NewLine}{exc}");
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, "NO");
|
||||
}
|
||||
return Ok(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera TASK richiesto x macchina:
|
||||
/// GET: IOB/getTask2Exe/SIMUL_03
|
||||
@@ -1044,6 +1219,120 @@ namespace MP.IOC.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processa una chiamata POST per l'invio di una List Json di oggetti objItem
|
||||
/// POST: IOB/setObjItems/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">ID dell'IOB</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("setObjItems/{id}")]
|
||||
public async Task<IActionResult> SetObjItems(string id, [FromBody] List<ObjItemDTO> currParams)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
|
||||
|
||||
// Multi: gestione carattere "|" trasformato in "#"
|
||||
id = id.Replace("|", "#");
|
||||
|
||||
string answ = "";
|
||||
|
||||
try
|
||||
{
|
||||
// se != null --> salvo!
|
||||
if (currParams != null)
|
||||
{
|
||||
bool fatto = await DService.MachineParamListSetAsync(id, currParams);
|
||||
answ = fatto ? "OK" : "KO";
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in GetObjItems2Write{Environment.NewLine}{exc}");
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, "NO");
|
||||
}
|
||||
return Ok(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// restituisce elenco parametri CHE RICHIEDONO scrittura su PLC come una List Json di
|
||||
/// oggetti objItem
|
||||
/// GET: IOB/getObjItems2Write/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">ID dell'IOB</param>
|
||||
/// <returns></returns>
|
||||
/// <summary>
|
||||
/// Recupera DATI PODL NEXT (=NON AVVIATI) x macchina: (copia di getCurrPODL)
|
||||
///
|
||||
/// GET: IOB/getPOdlNext/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">id macchina, se "" mostra tutto</param>
|
||||
/// <returns>Json contenente lista oggetti PODL serializzati</returns>
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Recupera DATI PODL x macchina e codice PODL:
|
||||
///
|
||||
/// GET: IOB/getPODL/SIMUL_03?idxPODL=123
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="idxPODL">idx del PDL da avviare</param>
|
||||
/// <returns>Json contenente lista oggetti PODL serializzati</returns>
|
||||
public string getPODL(string id, int idxPODL)
|
||||
{
|
||||
// attenzione! poiché nell'URL il carattere "#" viene filtrato ci aspettiamo il
|
||||
// carattere "|" che poi trasformiamo ora in "#"
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
id = id.Replace("|", "#");
|
||||
}
|
||||
string answ = "";
|
||||
|
||||
// init obj DataLayer
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
try
|
||||
{
|
||||
// recupero dati da chaive, ignorando info macchina...
|
||||
var elencoOdl = DataLayerObj.taPODL.getByKey(idxPODL);
|
||||
answ = JsonConvert.SerializeObject(elencoOdl);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera DATI PODL Running/Actual (AVVIATO e in corso) x macchina:
|
||||
///
|
||||
/// GET: IOB/getPOdlAct/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">id macchina, se "" mostra tutto</param>
|
||||
/// <returns>Json contenente lista 1 oggetto PODL serializzato, se presente</returns>
|
||||
public string getPOdlAct(string id)
|
||||
{
|
||||
// attenzione! poiché nell'URL il carattere "#" viene filtrato ci aspettiamo il
|
||||
// carattere "|" che poi trasformiamo ora in "#"
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
id = id.Replace("|", "#");
|
||||
}
|
||||
string answ = "";
|
||||
|
||||
// init obj DataLayer
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
try
|
||||
{
|
||||
// recupero IdxOdl corrente
|
||||
string sIdxOdl = DataLayerObj.currODL(id);
|
||||
int IdxOdl = 0;
|
||||
int.TryParse(sIdxOdl, out IdxOdl);
|
||||
// recupero Podl running x macchina ...
|
||||
DS_ProdTempi.PromesseODLDataTable elencoOdl = DataLayerObj.taPODL.getByIdxOdl(IdxOdl);
|
||||
answ = JsonConvert.SerializeObject(elencoOdl);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Processa una chiamata GET x salvare UserLog
|
||||
/// GET: IOB/ulog/SIMUL_03?flux=PROG&valore=P0001&dtEve=20161223180600000&dtCurr=20161223180600000&cnt=999&matrOpr=0=0&label=&valNum
|
||||
@@ -1276,7 +1565,7 @@ namespace MP.IOC.Controllers
|
||||
DateTime adesso = DateTime.Now;
|
||||
try
|
||||
{
|
||||
List<ObjItemDTO> currParams = DService.MachineParamList(idxMacc);
|
||||
List<ObjItemDTO> currParams = await DService.MachineParamListAsync(idxMacc);
|
||||
// ora per ogni valore RICEVUTO costruisco un oggetto in innovazioni da
|
||||
// inviare...x salvare in stato parametri...
|
||||
List<ObjItemDTO> innovazioni = new List<ObjItemDTO>();
|
||||
|
||||
+172
-47
@@ -396,6 +396,42 @@ namespace MP.IOC.Data
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ultimi articoli data amcchina
|
||||
/// </summary>
|
||||
/// <param name="idxMacc"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<AnagArticoliModel>> ArticoliGetLastByMaccAsync(string idxMacc)
|
||||
{
|
||||
List<AnagArticoliModel>? result = new List<AnagArticoliModel>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
string currKey = $"{Utils.redisArtList}:Last:{idxMacc}";
|
||||
// cerco in redis dato valore sel macchina...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<AnagArticoliModel>>($"{rawData}");
|
||||
readType = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await IocDbController.ArticoliGetLastByMaccAsync(idxMacc);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<AnagArticoliModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"ArticoliGetLastByMaccAsync | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restitusice elenco articoli cercati
|
||||
/// </summary>
|
||||
@@ -745,6 +781,69 @@ namespace MP.IOC.Data
|
||||
redisConn.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce l'elenco delle date dei dossier x una macchina (se presenti) Impiegata anche
|
||||
/// cache redis
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<DossierModel>> DossierLastByMachAsync(string idxMacchina)
|
||||
{
|
||||
List<DossierModel> result = new List<DossierModel>();
|
||||
|
||||
var currKey = $"{Utils.redisDossByMacLast}:{idxMacchina}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<DossierModel>>($"{rawData}") ?? new();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await IocDbController.DossGetLastByMaccAsync(idxMacchina);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<DossierModel>();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<List<PODLExpModel>> POdlGetByMaccArtAsync(string idxMacchina, string codArticolo, string codGruppo, bool onlyFree)
|
||||
{
|
||||
List<PODLExpModel> result = new List<PODLExpModel>();
|
||||
|
||||
var currKey = $"{Utils.redisPOdlByMaccArt}:{idxMacchina}";
|
||||
if (!string.IsNullOrEmpty(codArticolo))
|
||||
{
|
||||
currKey += $":A{codArticolo}";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(codGruppo))
|
||||
{
|
||||
currKey += $":G{codGruppo}";
|
||||
}
|
||||
currKey += onlyFree ? $":FREE" : ":ALL";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<PODLExpModel>>($"{rawData}") ?? new();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await IocDbController.POdlGetByMaccArtAsync(idxMacchina, codArticolo, codGruppo, onlyFree);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<PODLExpModel>();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione di un dossier
|
||||
/// </summary>
|
||||
@@ -966,7 +1065,11 @@ namespace MP.IOC.Data
|
||||
if (listaDoss.Count > 0)
|
||||
{
|
||||
// primo giorno DOPO ultima registrazione
|
||||
dtFrom = listaDoss.OrderByDescending(x => x).FirstOrDefault().AddDays(1);
|
||||
dtFrom = listaDoss
|
||||
.Select(x => x.DtRif)
|
||||
.OrderByDescending(x => x)
|
||||
.FirstOrDefault()
|
||||
.AddDays(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -975,7 +1078,10 @@ namespace MP.IOC.Data
|
||||
if (listaFL.Count > 0)
|
||||
{
|
||||
// giorno successivo a prima registrazione
|
||||
dtFrom = listaFL.OrderBy(x => x).FirstOrDefault().AddDays(1);
|
||||
dtFrom = listaFL
|
||||
.OrderBy(x => x)
|
||||
.FirstOrDefault()
|
||||
.AddDays(1);
|
||||
}
|
||||
}
|
||||
string caller = $"takeFlogSnapshot({idxMacc})";
|
||||
@@ -1297,6 +1403,7 @@ namespace MP.IOC.Data
|
||||
// 2. Se non c'è in cache, carichiamo/resettiamo tutto
|
||||
if (val == null)
|
||||
{
|
||||
//var data = ResetDatiMacchina(idxMacchina);
|
||||
var data = await ResetDatiMacchinaAsync(idxMacchina);
|
||||
data.TryGetValue("insEnabled", out val);
|
||||
}
|
||||
@@ -1374,6 +1481,7 @@ namespace MP.IOC.Data
|
||||
Log.Debug($"Macchine2SlaveGetAll | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco completo valori Macchine 2 Slave
|
||||
/// </summary>
|
||||
@@ -1623,6 +1731,20 @@ namespace MP.IOC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista parametri correnti che necessitano di write della macchina (ex getCurrObjItems)
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ObjItemDTO>> MachineParamListPendingWriteAsync(string idxMacchina)
|
||||
{
|
||||
List<ObjItemDTO>? result = new List<ObjItemDTO>();
|
||||
// recupero tutti i parametri
|
||||
var allData = await MachineParamListAsync(idxMacchina);
|
||||
result = allData.Where(x => x.writable && !string.IsNullOrEmpty(x.reqValue)).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue aggiornamento MachineParamList (ex CurrObjItems)
|
||||
/// </summary>
|
||||
@@ -4049,35 +4171,28 @@ namespace MP.IOC.Data
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce l'elenco delle date dei dossier x una macchina (se presenti) Impiegata anche
|
||||
/// cache redis
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<List<DateTime>> DossierLastByMachAsync(string idxMacchina)
|
||||
public async Task<List<ListValuesModel>> ListValuesFilt(string tabName, string fieldName)
|
||||
{
|
||||
List<DateTime> resultList = new List<DateTime>();
|
||||
|
||||
var currKey = $"{Utils.redisDossByMacLast}:{idxMacchina}";
|
||||
List<ListValuesModel> resultList = new List<ListValuesModel>();
|
||||
string tag = "";
|
||||
tag += string.IsNullOrEmpty(tabName) ? "" : $"{tabName}:";
|
||||
tag += string.IsNullOrEmpty(fieldName) ? "" : $"{fieldName}:";
|
||||
var currKey = $"{Utils.redisConfFlux}:{tag}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
resultList = JsonConvert.DeserializeObject<List<DateTime>>($"{rawData}") ?? new();
|
||||
resultList = JsonConvert.DeserializeObject<List<ListValuesModel>>($"{rawData}") ?? new();
|
||||
}
|
||||
else
|
||||
{
|
||||
var dbData = await IocDbController.DossGetLastByMaccAsync(idxMacchina);
|
||||
resultList = dbData
|
||||
.Select(x => x.DtRif)
|
||||
.ToList();
|
||||
resultList = await IocDbController.ListValuesFilt(tabName, fieldName);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(resultList);
|
||||
await redisDb.StringSetAsync(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (resultList == null)
|
||||
{
|
||||
resultList = new List<DateTime>();
|
||||
resultList = new();
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@@ -4347,38 +4462,50 @@ namespace MP.IOC.Data
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
|
||||
var dbResults = await IocDbController.VMSFDGetByMaccAsync(idxMacc);
|
||||
#if false
|
||||
// recupero tutte e filtro a mano...
|
||||
var dbResults = await IocDbController.VMSFDGetAllAsync();
|
||||
#endif
|
||||
// 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}");
|
||||
//var rowResult = dbResults[0];
|
||||
var rowResult = dbResults.FirstOrDefault();
|
||||
#if false
|
||||
var rowResult = dbResults.FirstOrDefault(x => x.IdxMacchina == idxMacc);
|
||||
#endif
|
||||
if (rowResult != null)
|
||||
{
|
||||
// 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}");
|
||||
//...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 = await Macchine2SlaveGetAllAsync();
|
||||
@@ -4402,8 +4529,6 @@ namespace MP.IOC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resetta (rileggendo) i dati della State Machine ingressi nel formato
|
||||
/// currKey: cState_nVal (current MICRO-STATE + "_" + new Value)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>6.16.2604.1608</Version>
|
||||
<Version>6.16.2604.1612</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MP-IOC </i>
|
||||
<h4>Versione: 6.16.2604.1608</h4>
|
||||
<h4>Versione: 6.16.2604.1612</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2604.1608
|
||||
6.16.2604.1612
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2604.1608</version>
|
||||
<version>6.16.2604.1612</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user