429 lines
14 KiB
C#
429 lines
14 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using MP.Data.DbModels;
|
|
using MP.Data.DbModels.Energy;
|
|
using NLog;
|
|
|
|
#nullable disable
|
|
// <Auto-Generated>
|
|
// This is here so CodeMaid doesn't reorganize this document
|
|
// </Auto-Generated>
|
|
namespace MP.Data
|
|
{
|
|
public partial class MoonPro_STATSContext : DbContext
|
|
{
|
|
#region Private Fields
|
|
|
|
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
|
|
|
private IConfiguration _configuration;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Public Constructors
|
|
|
|
public MoonPro_STATSContext(IConfiguration configuration)
|
|
{
|
|
_configuration = configuration;
|
|
}
|
|
|
|
public MoonPro_STATSContext(DbContextOptions<MoonPro_STATSContext> options) : base(options)
|
|
{
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Properties
|
|
|
|
public virtual DbSet<DbSizeModel> DbSetDbSize { get; set; }
|
|
public virtual DbSet<AnagFLTransModel> DbSetAnagFLTrans { get; set; }
|
|
public virtual DbSet<StatsAnagArticoli> DbSetArticoli { get; set; }
|
|
public virtual DbSet<AzioniUL> DbSetAzioniUL { get; set; }
|
|
public virtual DbSet<ConfigModel> DbSetConfig { get; set; }
|
|
public virtual DbSet<ResControlli> DbSetControlli { get; set; }
|
|
public virtual DbSet<DdbTurni> DbSetDdbTurni { get; set; }
|
|
public virtual DbSet<FLModel> DbSetFL { get; set; }
|
|
public virtual DbSet<MacchineModel> DbSetMacchine { get; set; }
|
|
public virtual DbSet<MaccEnergyCheckModel> DbSetMacchineCheck { get; set; }
|
|
|
|
public virtual DbSet<StatsODL> DbSetODL { get; set; }
|
|
public virtual DbSet<OdlEnergyModel> DbSetOdlEnergy { get; set; }
|
|
public virtual DbSet<ResScarti> DbSetScarti { get; set; }
|
|
public virtual DbSet<TurniOee> DbSetTurniOee { get; set; }
|
|
public virtual DbSet<UserActionLog> DbSetUserLog { get; set; }
|
|
public virtual DbSet<VocabolarioModel> DbSetVocabolario { get; set; }
|
|
public virtual DbSet<MacchineStatModel> DbSetMaccStat { get; set; }
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Private Methods
|
|
|
|
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (!optionsBuilder.IsConfigured)
|
|
{
|
|
string connString = _configuration.GetConnectionString("MP.Stats");
|
|
|
|
optionsBuilder.UseSqlServer(connString);
|
|
//optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro_STATS;Trusted_Connection=True;");
|
|
}
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
|
|
|
|
modelBuilder.Entity<ConfigModel>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Chiave);
|
|
|
|
entity.ToTable("Config");
|
|
|
|
entity.Property(e => e.Chiave)
|
|
.HasMaxLength(50)
|
|
.HasColumnName("chiave");
|
|
|
|
entity.Property(e => e.Note).HasColumnName("note");
|
|
|
|
entity.Property(e => e.Valore).HasColumnName("valore");
|
|
|
|
entity.Property(e => e.ValoreStd)
|
|
.HasColumnName("valoreStd")
|
|
.HasComment("Valore di default/riferimento per la variabile");
|
|
});
|
|
|
|
modelBuilder.Entity<FLModel>(entity =>
|
|
{
|
|
entity.HasKey(e => new { e.IdxMacchina, e.dtEvento, e.CodFlux });
|
|
|
|
});
|
|
|
|
modelBuilder.Entity<VocabolarioModel>(entity =>
|
|
{
|
|
entity.HasKey(e => new { e.Lingua, e.Lemma });
|
|
|
|
});
|
|
|
|
modelBuilder.Entity<TurniOee>(entity =>
|
|
{
|
|
entity.HasNoKey();
|
|
|
|
entity.ToView("v_UI_OEE_Turni");
|
|
|
|
entity.Property(e => e.ClasseTempo).HasMaxLength(50);
|
|
|
|
entity.Property(e => e.CodArticolo)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.CodMacchina).HasMaxLength(50);
|
|
|
|
entity.Property(e => e.DataRif).HasColumnType("datetime");
|
|
|
|
entity.Property(e => e.DescArticolo).HasMaxLength(250);
|
|
|
|
entity.Property(e => e.IdxMacchina)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.TotPeriodo).HasColumnName("totPeriodo");
|
|
|
|
entity.Property(e => e.Turno)
|
|
.IsRequired()
|
|
.HasMaxLength(5);
|
|
});
|
|
|
|
modelBuilder.Entity<MaccEnergyCheckModel>(entity =>
|
|
{
|
|
entity.HasNoKey();
|
|
|
|
entity.ToView("v_UI_MaccEnergyCheck");
|
|
});
|
|
|
|
modelBuilder.Entity<StatsAnagArticoli>(entity =>
|
|
{
|
|
entity.HasNoKey();
|
|
|
|
entity.ToView("v_UI_AnagArticoli");
|
|
|
|
entity.Property(e => e.CodArticolo)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.DescArticolo)
|
|
.IsRequired()
|
|
.HasMaxLength(250);
|
|
|
|
entity.Property(e => e.Disegno)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.Tipo)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
});
|
|
|
|
modelBuilder.Entity<MacchineModel>(entity =>
|
|
{
|
|
entity.HasNoKey();
|
|
|
|
entity.ToView("v_UI_Macchine");
|
|
|
|
entity.Property(e => e.CodMacchina).HasMaxLength(50);
|
|
|
|
entity.Property(e => e.Descrizione).HasMaxLength(50);
|
|
|
|
entity.Property(e => e.IdxMacchina)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.Nome).HasMaxLength(50);
|
|
});
|
|
|
|
modelBuilder.Entity<MacchineStatModel>(entity =>
|
|
{
|
|
entity.ToView("v_UI_MaccEnergy");
|
|
});
|
|
|
|
modelBuilder.Entity<DdbTurni>(entity =>
|
|
{
|
|
entity.HasNoKey();
|
|
|
|
entity.ToView("v_UI_DDB_Turni");
|
|
|
|
entity.Property(e => e.ClasseTempo).HasMaxLength(50);
|
|
|
|
entity.Property(e => e.CodArticolo)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.CodMacchina).HasMaxLength(50);
|
|
|
|
entity.Property(e => e.DataRif).HasColumnType("datetime");
|
|
|
|
entity.Property(e => e.DataTurnoFine).HasColumnType("datetime");
|
|
|
|
entity.Property(e => e.DataTurnoInizio).HasColumnType("datetime");
|
|
|
|
entity.Property(e => e.Descrizione).HasMaxLength(50);
|
|
|
|
entity.Property(e => e.FinePeriodo).HasColumnType("datetime");
|
|
|
|
entity.Property(e => e.FineStato).HasColumnType("datetime");
|
|
|
|
entity.Property(e => e.IdxMacchina)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.IdxOdl).HasColumnName("IdxODL");
|
|
|
|
entity.Property(e => e.InizioPeriodo).HasColumnType("datetime");
|
|
|
|
entity.Property(e => e.InizioStato).HasColumnType("datetime");
|
|
|
|
entity.Property(e => e.KeyRichiesta).HasMaxLength(50);
|
|
|
|
entity.Property(e => e.Pallet)
|
|
.HasMaxLength(20)
|
|
.HasColumnName("pallet");
|
|
|
|
entity.Property(e => e.TempoCicloBase).HasColumnType("decimal(18, 8)");
|
|
|
|
entity.Property(e => e.Turno)
|
|
.IsRequired()
|
|
.HasMaxLength(5);
|
|
});
|
|
|
|
modelBuilder.Entity<AzioniUL>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Azione);
|
|
|
|
entity.ToTable("AAUL");
|
|
|
|
entity.Property(e => e.Azione)
|
|
.HasMaxLength(50)
|
|
.HasDefaultValueSql("('ND')")
|
|
.HasComment("Azione dell'operatore");
|
|
|
|
entity.Property(e => e.Class)
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasDefaultValueSql("('')");
|
|
|
|
entity.Property(e => e.Descrizione)
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasDefaultValueSql("('')");
|
|
});
|
|
|
|
modelBuilder.Entity<ResScarti>(entity =>
|
|
{
|
|
entity.HasNoKey();
|
|
|
|
entity.ToView("v_UI_RS");
|
|
|
|
entity.Property(e => e.Causale)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.CodArticolo)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.CodMacchina).HasMaxLength(50);
|
|
|
|
entity.Property(e => e.Cognome)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.DataOraRif).HasColumnType("datetime");
|
|
|
|
entity.Property(e => e.Descrizione)
|
|
.IsRequired()
|
|
.HasMaxLength(250);
|
|
|
|
entity.Property(e => e.IdxMacchina)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.IdxOdl).HasColumnName("IdxODL");
|
|
|
|
entity.Property(e => e.KeyRichiesta)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.Nome)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.Note)
|
|
.IsRequired()
|
|
.HasMaxLength(250);
|
|
});
|
|
|
|
modelBuilder.Entity<ResControlli>(entity =>
|
|
{
|
|
entity.HasNoKey();
|
|
|
|
entity.ToView("vRC");
|
|
|
|
entity.Property(e => e.CodArticolo)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.DataOra).HasColumnType("datetime");
|
|
|
|
entity.Property(e => e.EsitoOk).HasColumnName("EsitoOK");
|
|
|
|
entity.Property(e => e.IdxControllo).ValueGeneratedOnAdd();
|
|
|
|
entity.Property(e => e.IdxMacchina)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.IdxOdl).HasColumnName("IdxODL");
|
|
|
|
entity.Property(e => e.Note)
|
|
.IsRequired()
|
|
.HasMaxLength(250);
|
|
});
|
|
|
|
modelBuilder.Entity<UserActionLog>(entity =>
|
|
{
|
|
entity.HasNoKey();
|
|
|
|
entity.ToView("v_UI_UL");
|
|
|
|
entity.Property(e => e.Azione)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.CodArticolo)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.CodMacchina).HasMaxLength(50);
|
|
|
|
entity.Property(e => e.Cognome)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.DataOraRif).HasColumnType("datetime");
|
|
|
|
entity.Property(e => e.IdxMacchina)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.IdxOdl).HasColumnName("IdxODL");
|
|
|
|
entity.Property(e => e.KeyRichiesta)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.Nome)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.Qta).HasColumnType("decimal(18, 8)");
|
|
|
|
entity.Property(e => e.Valore)
|
|
.IsRequired()
|
|
.HasMaxLength(250);
|
|
});
|
|
|
|
modelBuilder.Entity<StatsODL>(entity =>
|
|
{
|
|
entity.HasKey(e => e.IdxOdl)
|
|
.HasName("PK_ODL_1");
|
|
|
|
entity.ToTable("v_UI_ODL");
|
|
|
|
entity.Property(e => e.IdxOdl)
|
|
.ValueGeneratedNever()
|
|
.HasColumnName("IdxODL");
|
|
|
|
entity.Property(e => e.CodArticolo)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.CodArticoloParent)
|
|
.IsRequired()
|
|
.HasDefaultValueSql("('')");
|
|
|
|
entity.Property(e => e.DataFine).HasColumnType("datetime");
|
|
|
|
entity.Property(e => e.DataInizio).HasColumnType("datetime");
|
|
|
|
entity.Property(e => e.DueDate).HasColumnType("datetime");
|
|
|
|
entity.Property(e => e.IdxMacchina).HasMaxLength(50);
|
|
|
|
entity.Property(e => e.KeyRichiesta)
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasComment("Chiave: Ordine esterno o KIT");
|
|
|
|
entity.Property(e => e.KeyRichiestaParent)
|
|
.IsRequired()
|
|
.HasDefaultValueSql("('')")
|
|
.HasComment("Chiave: Ordine esterno o KIT");
|
|
|
|
entity.Property(e => e.PzPallet).HasDefaultValueSql("((1))");
|
|
|
|
entity.Property(e => e.Tcassegnato)
|
|
.HasColumnType("decimal(18, 8)")
|
|
.HasColumnName("TCAssegnato");
|
|
});
|
|
|
|
OnModelCreatingPartial(modelBuilder);
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |