-
- An error has occurred. This application may no longer respond until reloaded.
-
-
- An unhandled exception has occurred. See browser dev tools for details.
-
- Reload
- 🗙
-
-
- An error has occurred. This application may no longer respond until reloaded.
-
-
- An unhandled exception has occurred. See browser dev tools for details.
-
- Reload
- 🗙
-
-
-
-
-
diff --git a/MP-STATS/Program.cs b/MP-STATS/Program.cs
deleted file mode 100644
index 72c1800a..00000000
--- a/MP-STATS/Program.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Logging;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace MP_STATS
-{
- public class Program
- {
- public static void Main(string[] args)
- {
- CreateHostBuilder(args).Build().Run();
- }
-
- public static IHostBuilder CreateHostBuilder(string[] args) =>
- Host.CreateDefaultBuilder(args)
- .ConfigureWebHostDefaults(webBuilder =>
- {
- webBuilder.UseStartup();
- });
- }
-}
diff --git a/MP-STATS/appsettings.Production.json b/MP-STATS/appsettings.Production.json
deleted file mode 100644
index 298577c1..00000000
--- a/MP-STATS/appsettings.Production.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "DetailedErrors": true,
- "Logging": {
- "LogLevel": {
- "Default": "Trace",
- "Microsoft": "Warning",
- "Microsoft.Hosting.Lifetime": "Information"
- }
- },
- "AllowedHosts": "*",
- "SherpaBBM": "Data Source=SQL2012DEV;Initial Catalog=SHERPA.BBM;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=Sherpa.BBM;",
- "SherpaFatt": "Data Source=SQL2012DEV;Initial Catalog=SHERPA.Fatt;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=Sherpa.BBM;"
-}
\ No newline at end of file
diff --git a/MP-STATS/appsettings.Staging.json b/MP-STATS/appsettings.Staging.json
deleted file mode 100644
index 298577c1..00000000
--- a/MP-STATS/appsettings.Staging.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "DetailedErrors": true,
- "Logging": {
- "LogLevel": {
- "Default": "Trace",
- "Microsoft": "Warning",
- "Microsoft.Hosting.Lifetime": "Information"
- }
- },
- "AllowedHosts": "*",
- "SherpaBBM": "Data Source=SQL2012DEV;Initial Catalog=SHERPA.BBM;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=Sherpa.BBM;",
- "SherpaFatt": "Data Source=SQL2012DEV;Initial Catalog=SHERPA.Fatt;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=Sherpa.BBM;"
-}
\ No newline at end of file
diff --git a/MP-STATS/appsettings.json b/MP-STATS/appsettings.json
deleted file mode 100644
index 93a81b25..00000000
--- a/MP-STATS/appsettings.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Trace",
- "Microsoft": "Warning",
- "Microsoft.Hosting.Lifetime": "Information"
- }
- },
- "AllowedHosts": "*",
- "SherpaBBM": "Data Source=SQL2012DEV;Initial Catalog=SHERPA.BBM;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=Sherpa.BBM;",
- "SherpaFatt": "Data Source=SQL2012DEV;Initial Catalog=SHERPA.Fatt;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=Sherpa.BBM;"
-}
\ No newline at end of file
diff --git a/MP-STATS/appsettings.json.bak b/MP-STATS/appsettings.json.bak
deleted file mode 100644
index d9d9a9bf..00000000
--- a/MP-STATS/appsettings.json.bak
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft": "Warning",
- "Microsoft.Hosting.Lifetime": "Information"
- }
- },
- "AllowedHosts": "*"
-}
diff --git a/MP.Data/Constants.cs b/MP.Data/Constants.cs
new file mode 100644
index 00000000..4abf10f1
--- /dev/null
+++ b/MP.Data/Constants.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MP.Data
+{
+ class Constants
+ {
+ }
+}
diff --git a/MP.Data/Controllers/MpStatsController.cs b/MP.Data/Controllers/MpStatsController.cs
new file mode 100644
index 00000000..d02a1c02
--- /dev/null
+++ b/MP.Data/Controllers/MpStatsController.cs
@@ -0,0 +1,305 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Configuration;
+using NLog;
+using Microsoft.Extensions.Configuration;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Data.SqlClient;
+
+namespace MP.Data.Controllers
+{
+ public class MpStatsController : IDisposable
+ {
+ #region Private Fields
+
+ private static IConfiguration _configuration;
+ private static MoonPro_STATSContext dbCtx;
+ private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
+
+ #endregion Private Fields
+
+ #region Public Constructors
+
+ public MpStatsController(IConfiguration configuration)
+ {
+ _configuration = configuration;
+ dbCtx = new MoonPro_STATSContext(configuration);
+ Log.Info("Avviata classe MpStatsController");
+ }
+
+ #endregion Public Constructors
+
+ #region Public Methods
+
+ ///
+ /// Elenco Azioni (decodifica)
+ ///
+ ///
+ public List ActionsGetAll()
+ {
+ List dbResult = new List();
+
+ dbResult = dbCtx
+ .DbSetAzioniUL
+ .ToList();
+
+ return dbResult;
+ }
+
+ ///
+ /// Elenco tabella Articoli da filtro
+ ///
+ ///
+ ///
+ ///
+ public List ArticoliGetSearch(int numRecord, string searchVal = "")
+ {
+ List dbResult = new List();
+
+ dbResult = dbCtx
+ .DbSetArticoli
+ .Where(x => x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
+ .OrderBy(x => x.CodArticolo)
+ .Take(numRecord)
+ .ToList();
+
+ return dbResult;
+ }
+
+ ///
+ /// Elenco tabella Articoli da filtro
+ ///
+ ///
+ ///
+ ///
+ public List CommesseGetSearch(int numRecord, string searchVal = "")
+ {
+ List dbResult = new List();
+
+ dbResult = dbCtx
+ .DbSetODL
+ .Where(x => x.KeyRichiesta.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
+ .OrderBy(x => x.KeyRichiesta)
+ .Take(numRecord)
+ .ToList();
+
+ return dbResult;
+ }
+
+ public void Dispose()
+ {
+ // Clear database context
+ dbCtx.Dispose();
+ }
+
+ ///
+ /// Elenco tabella Macchine
+ ///
+ ///
+ public List MacchineGetAll()
+ {
+ List dbResult = new List();
+
+ dbResult = dbCtx
+ .DbSetMacchine
+ .OrderBy(x => x.IdxMacchina)
+ .ToList();
+
+ return dbResult;
+ }
+
+ public void ResetController()
+ {
+ dbCtx = new MoonPro_STATSContext(_configuration);
+ Log.Info("Effettuato reset MpStatsController");
+ }
+
+ ///
+ /// Annulla modifiche su una specifica entity (cancel update)
+ ///
+ ///
+ ///
+ public bool RollBackEntity(object item)
+ {
+ bool answ = false;
+ try
+ {
+ if (dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Deleted || dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Modified)
+ {
+ dbCtx.Entry(item).Reload();
+ }
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
+ }
+ return answ;
+ }
+
+ ///
+ /// Elenco tabella controlli da filtro
+ ///
+ ///
+ ///
+ ///
+ public List StatControlliGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
+ {
+ List dbResult = new List();
+
+ var dataFrom = new SqlParameter("@dataFrom", DataStart);
+ var dataTo = new SqlParameter("@dataTo", DataEnd);
+ var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
+ var idxODL = new SqlParameter("@IdxODL", IdxODL);
+ var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
+ var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
+
+ dbResult = dbCtx
+ .DbSetControlli
+ .FromSqlRaw("EXEC stp_UI_RC_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
+ .ToList();
+
+ return dbResult;
+ }
+
+ ///
+ /// Elenco tabella DDB da filtro
+ ///
+ ///
+ ///
+ ///
+ public List StatDdbGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
+ {
+ List dbResult = new List();
+
+ var dataFrom = new SqlParameter("@dataFrom", DataStart);
+ var dataTo = new SqlParameter("@dataTo", DataEnd);
+ var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
+ var idxODL = new SqlParameter("@IdxODL", IdxODL);
+ var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
+ var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
+
+ dbResult = dbCtx
+ .DbSetDdbTurni
+ .FromSqlRaw("EXEC stp_UI_DDBTurni_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
+ .ToList();
+
+ return dbResult;
+ }
+
+ ///
+ /// Elenco tabella ODL da filtro
+ ///
+ ///
+ ///
+ ///
+ public List StatOdlGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
+ {
+ List dbResult = new List();
+
+ var dataFrom = new SqlParameter("@dataFrom", DataStart);
+ var dataTo = new SqlParameter("@dataTo", DataEnd);
+ var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
+ var idxODL = new SqlParameter("@IdxODL", IdxODL);
+ var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
+ var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
+
+ dbResult = dbCtx
+ .DbSetODL
+ .FromSqlRaw("EXEC stp_UI_Odl_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
+ .ToList();
+
+ return dbResult;
+ }
+
+ ///
+ /// Elenco tabella scarti da filtro
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public List StatScartiGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
+ {
+ List dbResult = new List();
+
+ var dataFrom = new SqlParameter("@dataFrom", DataStart);
+ var dataTo = new SqlParameter("@dataTo", DataEnd);
+ var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
+ var idxODL = new SqlParameter("@IdxODL", IdxODL);
+ var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
+ var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
+
+ dbResult = dbCtx
+ .DbSetScarti
+ .FromSqlRaw("EXEC stp_UI_RS_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
+ .ToList();
+
+ return dbResult;
+ }
+
+ ///
+ /// Elenco tabella TurniOee da filtro
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public List StatTurniOeeGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
+ {
+ List dbResult = new List();
+
+ var dataFrom = new SqlParameter("@dataFrom", DataStart);
+ var dataTo = new SqlParameter("@dataTo", DataEnd);
+ var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
+ var idxODL = new SqlParameter("@IdxODL", IdxODL);
+ var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
+ var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
+
+ dbResult = dbCtx
+ .DbSetTurniOee
+ .FromSqlRaw("EXEC stp_UI_TurniOee_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
+ .ToList();
+
+ return dbResult;
+ }
+
+ ///
+ /// Elenco tabella UserLog da filtro
+ ///
+ ///
+ ///
+ ///
+ public List StatUserLogGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
+ {
+ List dbResult = new List();
+
+ //dbResult = dbCtx
+ // .DbSetUserLog
+ // .Where(x => x.Valore.Contains(searchVal) || x.Cognome.Contains(searchVal) || x.CodArticolo.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
+ // .OrderByDescending(x => x.DataOraRif)
+ // .Take(numRecord)
+ // .ToList();
+
+ var dataFrom = new SqlParameter("@dataFrom", DataStart);
+ var dataTo = new SqlParameter("@dataTo", DataEnd);
+ var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
+ var idxODL = new SqlParameter("@IdxODL", IdxODL);
+ var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
+ var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
+
+ dbResult = dbCtx
+ .DbSetUserLog
+ .FromSqlRaw("EXEC stp_UI_UL_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
+ .ToList();
+
+ return dbResult;
+ }
+
+ #endregion Public Methods
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/DatabaseModels/AnagArticoli.cs b/MP.Data/DatabaseModels/AnagArticoli.cs
new file mode 100644
index 00000000..0480a0bb
--- /dev/null
+++ b/MP.Data/DatabaseModels/AnagArticoli.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace MP.Data.DatabaseModels
+{
+ public partial class AnagArticoli
+ {
+ #region Public Properties
+
+ public string CodArticolo { get; set; }
+ public string DescArticolo { get; set; }
+ public string Disegno { get; set; }
+ public string Tipo { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/DatabaseModels/AzioniUL.cs b/MP.Data/DatabaseModels/AzioniUL.cs
new file mode 100644
index 00000000..ce81115b
--- /dev/null
+++ b/MP.Data/DatabaseModels/AzioniUL.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace MP.Data.DatabaseModels
+{
+ public partial class AzioniUL
+ {
+ #region Public Properties
+
+ public string Azione { get; set; }
+ public string Class { get; set; }
+ public string Descrizione { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/DatabaseModels/DdbTurni.cs b/MP.Data/DatabaseModels/DdbTurni.cs
new file mode 100644
index 00000000..dbdd1e8e
--- /dev/null
+++ b/MP.Data/DatabaseModels/DdbTurni.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+#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; }
+
+ [NotMapped]
+ [DisplayFormat(DataFormatString = "{0:N2}", ApplyFormatInEditMode = true)]
+ public long DurataMin
+ {
+ get
+ {
+ long answ = (long)(DurataStato != null ? DurataStato : 0);
+ return answ / 60000;
+ }
+ }
+
+ 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/DatabaseModels/Macchine.cs b/MP.Data/DatabaseModels/Macchine.cs
new file mode 100644
index 00000000..f9469bb1
--- /dev/null
+++ b/MP.Data/DatabaseModels/Macchine.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace MP.Data.DatabaseModels
+{
+ public partial class Macchine
+ {
+ #region Public Properties
+
+ public string CodMacchina { get; set; }
+ public string Descrizione { get; set; }
+ public string IdxMacchina { get; set; }
+ public string Nome { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/DatabaseModels/ODL.cs b/MP.Data/DatabaseModels/ODL.cs
new file mode 100644
index 00000000..003e2f8e
--- /dev/null
+++ b/MP.Data/DatabaseModels/ODL.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace MP.Data.DatabaseModels
+{
+ public partial class ODL
+ {
+ #region Public Properties
+
+ public string CodArticolo { get; set; }
+ public string CodArticoloParent { get; set; }
+ public DateTime? DataFine { get; set; }
+ public DateTime? DataInizio { get; set; }
+ public DateTime? DueDate { get; set; }
+ public string IdxMacchina { get; set; }
+ public int IdxOdl { get; set; }
+ public string KeyRichiesta { get; set; }
+ public string KeyRichiestaParent { get; set; }
+ public int NumPezzi { get; set; }
+ public int NumPezziEv { get; set; }
+ public int NumPezziRil { get; set; }
+ public int NumPezziSca { get; set; }
+ public int? PzPallet { get; set; }
+ public decimal Tcassegnato { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/DatabaseModels/ResControlli.cs b/MP.Data/DatabaseModels/ResControlli.cs
new file mode 100644
index 00000000..77f46ee9
--- /dev/null
+++ b/MP.Data/DatabaseModels/ResControlli.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace MP.Data.DatabaseModels
+{
+ public partial class ResControlli
+ {
+ #region Public Properties
+
+ public string CodArticolo { get; set; }
+ public DateTime DataOra { get; set; }
+ public bool EsitoOk { get; set; }
+ public int IdxControllo { get; set; }
+ public string IdxMacchina { get; set; }
+ public int IdxOdl { get; set; }
+ public int MatrOpr { get; set; }
+ public string Note { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/DatabaseModels/ResScarti.cs b/MP.Data/DatabaseModels/ResScarti.cs
new file mode 100644
index 00000000..0bb3b617
--- /dev/null
+++ b/MP.Data/DatabaseModels/ResScarti.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace MP.Data.DatabaseModels
+{
+ public partial class ResScarti
+ {
+ #region Public Properties
+
+ public string Causale { get; set; }
+ public string CodArticolo { get; set; }
+ public string CodMacchina { get; set; }
+ public string Cognome { get; set; }
+ public DateTime DataOraRif { get; set; }
+ public string Descrizione { get; set; }
+ public string IdxMacchina { get; set; }
+ public int IdxOdl { get; set; }
+ public string KeyRichiesta { get; set; }
+ public int MatrOpr { get; set; }
+ public string Nome { get; set; }
+ public string Note { get; set; }
+ public int Qta { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/DatabaseModels/TurniOee.cs b/MP.Data/DatabaseModels/TurniOee.cs
new file mode 100644
index 00000000..8678df21
--- /dev/null
+++ b/MP.Data/DatabaseModels/TurniOee.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+#nullable disable
+
+namespace MP.Data.DatabaseModels
+{
+ public partial class TurniOee
+ {
+ #region Public Properties
+
+ public string ClasseTempo { get; set; }
+ public string CodArticolo { get; set; }
+ public string CodMacchina { get; set; }
+ public DateTime DataRif { get; set; }
+ public string DescArticolo { get; set; }
+ public string IdxMacchina { get; set; }
+
+ [NotMapped]
+ [DisplayFormat(DataFormatString = "{0:N2}", ApplyFormatInEditMode = true)]
+ public double OEE => (double)TotPeriodo / 480;
+
+ [DisplayFormat(DataFormatString = "{0:N2}", ApplyFormatInEditMode = true)]
+ public decimal TotPeriodo { get; set; }
+
+ public int? TotPz { get; set; }
+ public string Turno { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/DatabaseModels/UserActionLog.cs b/MP.Data/DatabaseModels/UserActionLog.cs
new file mode 100644
index 00000000..1b19f596
--- /dev/null
+++ b/MP.Data/DatabaseModels/UserActionLog.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace MP.Data.DatabaseModels
+{
+ public partial class UserActionLog
+ {
+ #region Public Properties
+
+ public string Azione { get; set; }
+ public string CodArticolo { get; set; }
+ public string CodMacchina { get; set; }
+ public string Cognome { get; set; }
+ public DateTime DataOraRif { get; set; }
+ public int IdxLog { get; set; }
+ public string IdxMacchina { get; set; }
+ public int IdxOdl { get; set; }
+ public string KeyRichiesta { get; set; }
+ public int MatrOpr { get; set; }
+ public string Nome { get; set; }
+ public decimal Qta { get; set; }
+ public string Valore { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/Enums.cs b/MP.Data/Enums.cs
new file mode 100644
index 00000000..421dd601
--- /dev/null
+++ b/MP.Data/Enums.cs
@@ -0,0 +1,8 @@
+using System;
+
+namespace MP.Data
+{
+ public class Enums
+ {
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/MP - Backup.Data.csproj b/MP.Data/MP - Backup.Data.csproj
new file mode 100644
index 00000000..0c89b33d
--- /dev/null
+++ b/MP.Data/MP - Backup.Data.csproj
@@ -0,0 +1,19 @@
+
+
+
+ net5.0
+ MP.Data
+ MP.Data
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
\ No newline at end of file
diff --git a/MP.Data/MP.Data.csproj b/MP.Data/MP.Data.csproj
new file mode 100644
index 00000000..f9e16cd0
--- /dev/null
+++ b/MP.Data/MP.Data.csproj
@@ -0,0 +1,25 @@
+
+
+
+ net5.0
+ MP.Data
+ MP.Data
+
+
+
+
+
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
\ No newline at end of file
diff --git a/MP.Data/MoonPro_STATSContext.cs b/MP.Data/MoonPro_STATSContext.cs
new file mode 100644
index 00000000..6f94bd5d
--- /dev/null
+++ b/MP.Data/MoonPro_STATSContext.cs
@@ -0,0 +1,381 @@
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.Extensions.Configuration;
+using MP.Data.DatabaseModels;
+using NLog;
+
+#nullable disable
+
+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 options)
+ : base(options)
+ {
+ }
+
+ #endregion Public Constructors
+
+ #region Public Properties
+
+ public virtual DbSet DbSetArticoli { get; set; }
+ public virtual DbSet DbSetAzioniUL { get; set; }
+ public virtual DbSet DbSetControlli { get; set; }
+ public virtual DbSet DbSetDdbTurni { get; set; }
+ public virtual DbSet DbSetMacchine { get; set; }
+ public virtual DbSet DbSetODL { get; set; }
+ public virtual DbSet DbSetScarti { get; set; }
+ public virtual DbSet DbSetTurniOee { get; set; }
+#if false
+ public virtual DbSet DbSetTurniPareto { get; set; }
+ public virtual DbSet DbSetTurniParetoOdl { get; set; }
+#endif
+ public virtual DbSet DbSetUserLog { 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(_configuration.GetConnectionString("Mp.Stats"));
+ //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(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(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(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(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);
+
+ 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(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(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(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(entity =>
+ {
+ entity.HasKey(e => e.IdxOdl)
+ .HasName("PK_ODL_1");
+
+ entity.ToTable("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
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/Resources/Readme.md b/MP.Data/Resources/Readme.md
new file mode 100644
index 00000000..5e20fed5
--- /dev/null
+++ b/MP.Data/Resources/Readme.md
@@ -0,0 +1,26 @@
+# Appunti gestione MP-STAT DB
+
+
+Per la gestione dell'accesso al DB statistiche si opera con EFCore --> apop blazor server
+
+## Scaffolding
+
+Per generare le classi da un DB esistente con cui operare EFCore CodeFirst usare lo scaffolding coi seguenti comandi.
+Attenzione: la classe DbCOntext viene creata INSIEME alle viste nella folder DatabaseModel (nell'esempio seguente...)
+
+### DB iniziale
+
+ Scaffold-DbContext "Server=SQL2016DEV;Database=MoonPro_STATS;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir DatabaseModels
+
+### SOLO di tabelle/viste selezionate (con force update)
+
+Scaffold-DbContext "Server=SQL2016DEV;Database=MoonPro_STATS;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir DatabaseModels -Tables v_RS, v_TC_Stat, v_TCR, v_TCR_Day, v_UL
+
+## Approfondimenti
+
+Qualche link di approfondimento:
+
+ - https://docs.microsoft.com/en-us/ef/core/
+ - https://docs.microsoft.com/en-us/ef/core/extensions/
+ - https://www.entityframeworktutorial.net/efcore/create-model-for-existing-database-in-ef-core.aspx
+ - https://entityframework.net/ef-code-first
\ No newline at end of file
diff --git a/MP.Data/Resources/Readme.pdf b/MP.Data/Resources/Readme.pdf
new file mode 100644
index 00000000..36045894
Binary files /dev/null and b/MP.Data/Resources/Readme.pdf differ
diff --git a/MP.Data/StatsDbContext.cs b/MP.Data/StatsDbContext.cs
new file mode 100644
index 00000000..e52f398f
--- /dev/null
+++ b/MP.Data/StatsDbContext.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MP.Data
+{
+ public class StatsDbContext
+ {
+ }
+}
\ No newline at end of file
diff --git a/MP.Stats/.config/dotnet-tools.json b/MP.Stats/.config/dotnet-tools.json
new file mode 100644
index 00000000..b0e38abd
--- /dev/null
+++ b/MP.Stats/.config/dotnet-tools.json
@@ -0,0 +1,5 @@
+{
+ "version": 1,
+ "isRoot": true,
+ "tools": {}
+}
\ No newline at end of file
diff --git a/MP-STATS/App.razor b/MP.Stats/App.razor
similarity index 100%
rename from MP-STATS/App.razor
rename to MP.Stats/App.razor
diff --git a/MP.Stats/Components/ChartControlli.razor b/MP.Stats/Components/ChartControlli.razor
new file mode 100644
index 00000000..2f870d3d
--- /dev/null
+++ b/MP.Stats/Components/ChartControlli.razor
@@ -0,0 +1,32 @@
+