diff --git a/MP.Data/DatabaseModels/DdbTurni.cs b/MP.Data/DatabaseModels/DdbTurni.cs new file mode 100644 index 00000000..5a14c106 --- /dev/null +++ b/MP.Data/DatabaseModels/DdbTurni.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; + +#nullable disable + +namespace MP.Data.DatabaseModels +{ + public partial class DdbTurni + { + #region Public Properties + + public string ClasseTempo { get; set; } + public string CodArticolo { get; set; } + public string CodMacchina { get; set; } + public DateTime DataRif { get; set; } + public DateTime? DataTurnoFine { get; set; } + public DateTime? DataTurnoInizio { get; set; } + public string Descrizione { get; set; } + public long? DurataPeriodo { get; set; } + public long? DurataStato { get; set; } + public DateTime? FinePeriodo { get; set; } + public DateTime FineStato { get; set; } + public string IdxMacchina { get; set; } + public int? IdxOdl { get; set; } + public int IdxStato { get; set; } + public DateTime InizioPeriodo { get; set; } + public DateTime InizioStato { get; set; } + public string KeyRichiesta { get; set; } + public string Pallet { get; set; } + public int? PzPalletProd { get; set; } + public decimal? TempoCicloBase { get; set; } + public int TotPzProd { get; set; } + public string Turno { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/MoonPro_STATSContext.cs b/MP.Data/MoonPro_STATSContext.cs index 079efed5..f84e76fb 100644 --- a/MP.Data/MoonPro_STATSContext.cs +++ b/MP.Data/MoonPro_STATSContext.cs @@ -35,8 +35,9 @@ namespace MP.Data #region Public Properties - public virtual DbSet DbSetActions { get; set; } + public virtual DbSet DbSetAzioniUL { get; set; } public virtual DbSet DbSetControlli { get; set; } + public virtual DbSet DbSetDdbTurni { get; set; } public virtual DbSet DbSetScarti { get; set; } public virtual DbSet DbSetUserLog { get; set; } @@ -57,8 +58,6 @@ namespace MP.Data string connString = _configuration.GetConnectionString("Mp.Stats"); optionsBuilder.UseSqlServer(_configuration.GetConnectionString("Mp.Stats")); - -#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. //optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro_STATS;Trusted_Connection=True;"); } } @@ -67,7 +66,56 @@ namespace MP.Data { modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS"); - modelBuilder.Entity(entity => + modelBuilder.Entity(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(entity => { entity.HasKey(e => e.Azione); diff --git a/MP.Stats/Data/MpStatsService.cs b/MP.Stats/Data/MpStatsService.cs index ee17cadd..85a9053d 100644 --- a/MP.Stats/Data/MpStatsService.cs +++ b/MP.Stats/Data/MpStatsService.cs @@ -17,7 +17,7 @@ namespace MP.Stats.Data private static IConfiguration _configuration; private static ILogger _logger; - private static List ActionsList = new List(); + private static List ActionsList = new List(); #endregion Private Fields @@ -59,7 +59,7 @@ namespace MP.Stats.Data #region Public Methods - public Task ActionsGetAll() + public Task ActionsGetAll() { return Task.FromResult(dbController.ActionsGetAll().ToArray()); } diff --git a/MP.Stats/Pages/Diario.razor b/MP.Stats/Pages/Diario.razor index 0bfda3cf..54e6fa6f 100644 --- a/MP.Stats/Pages/Diario.razor +++ b/MP.Stats/Pages/Diario.razor @@ -4,7 +4,7 @@ @using MP.Stats.Data
-
Controlli
+
Diario Produzione
@if (currRecord != null) { diff --git a/MP.Stats/Pages/Diario.razor.cs b/MP.Stats/Pages/Diario.razor.cs index 2bbe8d86..4e407d62 100644 --- a/MP.Stats/Pages/Diario.razor.cs +++ b/MP.Stats/Pages/Diario.razor.cs @@ -10,9 +10,9 @@ namespace MP.Stats.Pages { #region Private Fields - private MP.Data.DatabaseModels.ResControlli currRecord = null; + private MP.Data.DatabaseModels.DdbTurni currRecord = null; - private MP.Data.DatabaseModels.ResControlli[] ListRecords; + private MP.Data.DatabaseModels.DdbTurni[] ListRecords; #endregion Private Fields @@ -43,7 +43,7 @@ namespace MP.Stats.Pages protected async Task ForceReload(int newNum) { numRecord = newNum; - ListRecords = await StatService.StatControlliGetAll(numRecord, MessageService.SearchVal); + ListRecords = await StatService.StatDdbGetAll(numRecord, MessageService.SearchVal); } protected override async Task OnInitializedAsync() @@ -51,7 +51,7 @@ namespace MP.Stats.Pages numRecord = 10; MessageService.ShowSearch = true; MessageService.EA_SearchUpdated += OnSeachUpdated; - ListRecords = await StatService.StatControlliGetAll(numRecord, MessageService.SearchVal); + ListRecords = await StatService.StatDdbGetAll(numRecord, MessageService.SearchVal); } protected void ResetData() @@ -63,21 +63,21 @@ namespace MP.Stats.Pages protected async Task UpdateData() { currRecord = null; - ListRecords = await StatService.StatControlliGetAll(numRecord, MessageService.SearchVal); + ListRecords = await StatService.StatDdbGetAll(numRecord, MessageService.SearchVal); } #endregion Protected Methods #region Public Methods - public string checkSelect(int IdxControllo) + public string checkSelect(string IdxMacchina, string CodArticolo, DateTime InizioStato) { string answ = ""; if (currRecord != null) { try { - answ = (currRecord.IdxControllo == IdxControllo) ? "table-info" : ""; + answ = (currRecord.IdxMacchina == IdxMacchina && currRecord.CodArticolo == CodArticolo && currRecord.InizioStato == InizioStato) ? "table-info" : ""; } catch { } diff --git a/MP.Stats/Pages/UserLog.razor.cs b/MP.Stats/Pages/UserLog.razor.cs index 9084314a..3c87c098 100644 --- a/MP.Stats/Pages/UserLog.razor.cs +++ b/MP.Stats/Pages/UserLog.razor.cs @@ -11,7 +11,7 @@ namespace MP.Stats.Pages { #region Private Fields - private MP.Data.DatabaseModels.Actions[] ActionsList; + private MP.Data.DatabaseModels.AzioniUL[] ActionsList; private MP.Data.DatabaseModels.UserActionLog currRecord = null; private MP.Data.DatabaseModels.UserActionLog[] ListRecords; @@ -97,13 +97,13 @@ namespace MP.Stats.Pages return answ; } - public MP.Data.DatabaseModels.Actions decodeAction(string azione) + public MP.Data.DatabaseModels.AzioniUL decodeAction(string azione) { // cerco - MP.Data.DatabaseModels.Actions data = ActionsList + MP.Data.DatabaseModels.AzioniUL data = ActionsList .Where(x => x.Azione == azione) .FirstOrDefault(); - data = data != null ? data : new MP.Data.DatabaseModels.Actions() { Azione = "ND", Class = "", Descrizione = "ND" }; + data = data != null ? data : new MP.Data.DatabaseModels.AzioniUL() { Azione = "ND", Class = "", Descrizione = "ND" }; return data; }