From eee32daf4b0c8e6696b3a2ce32ffdf05f96d73d3 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 3 Jun 2024 20:15:50 +0200 Subject: [PATCH 1/6] Bozza indice x dt + plantlog --- GWMS.Data/DatabaseModels/PlantLogModel.cs | 4 ++- GWMS.Data/GWMSContext.cs | 2 +- .../Migrations/GWMSContextModelSnapshot.cs | 36 ++++++++++--------- GWMS.UI/GWMS.UI.csproj | 2 +- Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/GWMS.Data/DatabaseModels/PlantLogModel.cs b/GWMS.Data/DatabaseModels/PlantLogModel.cs index 6d29a7f..892e8da 100644 --- a/GWMS.Data/DatabaseModels/PlantLogModel.cs +++ b/GWMS.Data/DatabaseModels/PlantLogModel.cs @@ -20,7 +20,8 @@ namespace GWMS.Data.DatabaseModels [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int PlantDataId { get; set; } - + + //[Index("IX_PlantLog_PlantDt", 2)] public DateTime DtEvent { get; set; } = DateTime.Now; /// @@ -29,6 +30,7 @@ namespace GWMS.Data.DatabaseModels [MaxLength(250)] public string FluxType { get; set; } = "ND"; + //[Index("IX_PlantLog_PlantDt", 1)] public int PlantId { get; set; } public double ValNumber { get; set; } = 0; diff --git a/GWMS.Data/GWMSContext.cs b/GWMS.Data/GWMSContext.cs index 5c356e3..2b19288 100644 --- a/GWMS.Data/GWMSContext.cs +++ b/GWMS.Data/GWMSContext.cs @@ -100,7 +100,7 @@ namespace GWMS.Data { } if (!optionsBuilder.IsConfigured) { - //connString = "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;"; + connString = "Server=localhost;port=3306;database=GWMS_PZZFRR;user=user_PZZFRR;pwd=pwd_M3T@n0;sslmode=None;"; var serverVersion = ServerVersion.AutoDetect(connString); optionsBuilder.UseMySql(connString, serverVersion); } diff --git a/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs b/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs index c5e28ee..49d5614 100644 --- a/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs +++ b/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs @@ -5,6 +5,8 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +#nullable disable + namespace GWMS.Data.Migrations { [DbContext(typeof(GWMSContext))] @@ -14,8 +16,8 @@ namespace GWMS.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 64) - .HasAnnotation("ProductVersion", "5.0.10"); + .HasAnnotation("ProductVersion", "5.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b => { @@ -46,7 +48,7 @@ namespace GWMS.Data.Migrations b.HasIndex("PlantId"); - b.ToTable("AlarmLog"); + b.ToTable("AlarmLog", (string)null); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b => @@ -72,7 +74,7 @@ namespace GWMS.Data.Migrations b.HasKey("KeyName"); - b.ToTable("AnKeyVal"); + b.ToTable("AnKeyVal", (string)null); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b => @@ -96,7 +98,7 @@ namespace GWMS.Data.Migrations b.HasKey("KeyName"); - b.ToTable("Config"); + b.ToTable("Config", (string)null); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b => @@ -123,7 +125,7 @@ namespace GWMS.Data.Migrations b.HasKey("ItemId"); - b.ToTable("Items"); + b.ToTable("Items", (string)null); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b => @@ -154,7 +156,7 @@ namespace GWMS.Data.Migrations b.HasKey("TabName", "FieldName", "Val"); - b.ToTable("ListVal"); + b.ToTable("ListVal", (string)null); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b => @@ -212,7 +214,7 @@ namespace GWMS.Data.Migrations b.HasIndex("TransporterId"); - b.ToTable("Order"); + b.ToTable("Order", (string)null); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSendModel", b => @@ -240,7 +242,7 @@ namespace GWMS.Data.Migrations b.HasKey("PlantId", "ParamUid"); - b.ToTable("ParamSend"); + b.ToTable("ParamSend", (string)null); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSetModel", b => @@ -267,7 +269,7 @@ namespace GWMS.Data.Migrations b.HasKey("ParamSetId"); - b.ToTable("ParamSet"); + b.ToTable("ParamSet", (string)null); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b => @@ -295,7 +297,7 @@ namespace GWMS.Data.Migrations b.HasKey("PlantId"); - b.ToTable("PlantDetail"); + b.ToTable("PlantDetail", (string)null); b.HasData( new @@ -363,7 +365,7 @@ namespace GWMS.Data.Migrations b.HasIndex("PlantId"); - b.ToTable("PlantLog"); + b.ToTable("PlantLog", (string)null); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => @@ -387,7 +389,7 @@ namespace GWMS.Data.Migrations b.HasKey("PlantId", "FluxType"); - b.ToTable("PlantStatus"); + b.ToTable("PlantStatus", (string)null); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.RebootLogModel", b => @@ -409,7 +411,7 @@ namespace GWMS.Data.Migrations b.HasKey("RecordId"); - b.ToTable("RebootLog"); + b.ToTable("RebootLog", (string)null); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b => @@ -428,7 +430,7 @@ namespace GWMS.Data.Migrations b.HasKey("SupplierId"); - b.ToTable("Supplier"); + b.ToTable("Supplier", (string)null); b.HasData( new @@ -470,7 +472,7 @@ namespace GWMS.Data.Migrations b.HasKey("TransporterId"); - b.ToTable("Transporter"); + b.ToTable("Transporter", (string)null); b.HasData( new @@ -526,7 +528,7 @@ namespace GWMS.Data.Migrations b.HasIndex("TransporterId"); - b.ToTable("WeekPlan"); + b.ToTable("WeekPlan", (string)null); b.HasData( new diff --git a/GWMS.UI/GWMS.UI.csproj b/GWMS.UI/GWMS.UI.csproj index 510a98d..4d64e83 100644 --- a/GWMS.UI/GWMS.UI.csproj +++ b/GWMS.UI/GWMS.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 1.0.2406.0319 + 1.0.2406.0320 95c9f021-52d1-4390-a670-5810b7b777b0 true true diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 2b35c04..4a90658 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GWMS - Gas Warehouse Management System -

Versione: 1.0.2406.0319

+

Versione: 1.0.2406.0320


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index c86a490..b035a4c 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2406.0319 +1.0.2406.0320 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index c954ba8..ce58e97 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2406.0319 + 1.0.2406.0320 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false From c64efc5aca9d80f39d537bb0ad2b662d80c2ed88 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 4 Jun 2024 12:18:48 +0200 Subject: [PATCH 2/6] =?UTF-8?q?Modifica=20gestione=20NLog:=20-=20test=20se?= =?UTF-8?q?nza=20file=20esterno=20ma=20da=20codice=20(cos=C3=AC=20da=20dis?= =?UTF-8?q?tinguere=20Debug/Release...)=20-=20test=20deploy=20ps1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GWMS.Data/DatabaseModels/PlantLogModel.cs | 2 - GWMS.Data/GWMS.Data.csproj | 2 +- GWMS.Data/GWMSContext.cs | 2 + GWMS.UI/GWMS.UI.csproj | 21 +++++++++-- GWMS.UI/NLog.config | 2 +- GWMS.UI/NLog.config.dev | 46 +++++++++++++++++++++++ GWMS.UI/NLog.config.rel | 46 +++++++++++++++++++++++ GWMS.UI/Program.cs | 16 +++++++- GWMS.UI/Startup.cs | 2 + GWMS.UI/post-build.ps1 | 16 +++++++- Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 13 files changed, 148 insertions(+), 13 deletions(-) create mode 100644 GWMS.UI/NLog.config.dev create mode 100644 GWMS.UI/NLog.config.rel diff --git a/GWMS.Data/DatabaseModels/PlantLogModel.cs b/GWMS.Data/DatabaseModels/PlantLogModel.cs index 892e8da..8dd54ac 100644 --- a/GWMS.Data/DatabaseModels/PlantLogModel.cs +++ b/GWMS.Data/DatabaseModels/PlantLogModel.cs @@ -21,7 +21,6 @@ namespace GWMS.Data.DatabaseModels [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int PlantDataId { get; set; } - //[Index("IX_PlantLog_PlantDt", 2)] public DateTime DtEvent { get; set; } = DateTime.Now; /// @@ -30,7 +29,6 @@ namespace GWMS.Data.DatabaseModels [MaxLength(250)] public string FluxType { get; set; } = "ND"; - //[Index("IX_PlantLog_PlantDt", 1)] public int PlantId { get; set; } public double ValNumber { get; set; } = 0; diff --git a/GWMS.Data/GWMS.Data.csproj b/GWMS.Data/GWMS.Data.csproj index d7a4625..9363158 100644 --- a/GWMS.Data/GWMS.Data.csproj +++ b/GWMS.Data/GWMS.Data.csproj @@ -26,7 +26,7 @@ - + \ No newline at end of file diff --git a/GWMS.Data/GWMSContext.cs b/GWMS.Data/GWMSContext.cs index 2b19288..a6734df 100644 --- a/GWMS.Data/GWMSContext.cs +++ b/GWMS.Data/GWMSContext.cs @@ -125,6 +125,8 @@ namespace GWMS.Data modelBuilder.Entity().HasKey(c => new { c.PlantId, c.ParamUid }); + modelBuilder.Entity().HasIndex(c => new { c.PlantId, c.DtEvent}, "IX_PlantLog_PlantDt"); + modelBuilder.Seed(); OnModelCreatingPartial(modelBuilder); diff --git a/GWMS.UI/GWMS.UI.csproj b/GWMS.UI/GWMS.UI.csproj index 4d64e83..fabb2d6 100644 --- a/GWMS.UI/GWMS.UI.csproj +++ b/GWMS.UI/GWMS.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 1.0.2406.0320 + 1.0.2406.0412 95c9f021-52d1-4390-a670-5810b7b777b0 true true @@ -24,6 +24,12 @@ + + + + + + <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" /> <_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfile.pubxml" /> @@ -32,6 +38,15 @@ <_WebToolingArtifacts Remove="Properties\PublishProfiles\W2019-IIS-DEV.pubxml" /> + + + Never + + + Never + + + @@ -54,7 +69,7 @@ - + @@ -75,6 +90,6 @@ - + diff --git a/GWMS.UI/NLog.config b/GWMS.UI/NLog.config index b98c52c..ab08a88 100644 --- a/GWMS.UI/NLog.config +++ b/GWMS.UI/NLog.config @@ -41,6 +41,6 @@ --> - + \ No newline at end of file diff --git a/GWMS.UI/NLog.config.dev b/GWMS.UI/NLog.config.dev new file mode 100644 index 0000000..ab08a88 --- /dev/null +++ b/GWMS.UI/NLog.config.dev @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GWMS.UI/NLog.config.rel b/GWMS.UI/NLog.config.rel new file mode 100644 index 0000000..8fc7637 --- /dev/null +++ b/GWMS.UI/NLog.config.rel @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GWMS.UI/Program.cs b/GWMS.UI/Program.cs index ff90879..4c2591f 100644 --- a/GWMS.UI/Program.cs +++ b/GWMS.UI/Program.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; +using NLog; using NLog.Web; using System; using System.Collections.Generic; @@ -29,10 +30,21 @@ namespace GWMS.UI public static void Main(string[] args) { +#if false // inclusione NLog: // https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-5 // https://codewithmukesh.com/blog/logging-with-nlog-in-aspnet-core/ - var logger = NLog.Web.NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger(); + var logger = NLog.Web.NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger(); +#endif + + // sistemazione NLog da codice... + LogManager.Setup().LoadConfiguration(builder => { + builder.ForLogger().FilterMinLevel(NLog.LogLevel.Trace).WriteToConsole(layout: "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}"); + builder.ForLogger().FilterMinLevel(NLog.LogLevel.Debug).WriteToFile(layout: "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}", fileName: "${basedir}/logs/App_${shortdate}.log"); + }); + + var logger = LogManager.GetCurrentClassLogger(); + try { logger.Info("GMWS.UI Application Starting Up"); @@ -45,7 +57,7 @@ namespace GWMS.UI } finally { - NLog.LogManager.Shutdown(); + LogManager.Shutdown(); } } diff --git a/GWMS.UI/Startup.cs b/GWMS.UI/Startup.cs index ae2c537..16b2cec 100644 --- a/GWMS.UI/Startup.cs +++ b/GWMS.UI/Startup.cs @@ -19,6 +19,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Hosting; +using NLog; using System; using System.Collections.Generic; using System.Globalization; @@ -49,6 +50,7 @@ namespace GWMS.UI // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { + if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); diff --git a/GWMS.UI/post-build.ps1 b/GWMS.UI/post-build.ps1 index 61ed979..f63c8b6 100644 --- a/GWMS.UI/post-build.ps1 +++ b/GWMS.UI/post-build.ps1 @@ -1,4 +1,7 @@ -param([string]$ProjectDir, [string]$ProjectPath); +param([string]$ProjectDir, [string]$ProjectPath, [string]$Config); + +# rif esempi parametri: https://learn.microsoft.com/en-us/visualstudio/ide/how-to-specify-build-events-csharp?view=vs-2022 + $FileVers="..\Resources\VersNum.txt" $FileManIn="..\Resources\manifest-original.xml" @@ -29,3 +32,14 @@ Set-Content -Path $FileManOut -Value $manData $clogData = Get-Content $FileCLogIn $clogData = $clogData -replace "{{CURRENT-REL}}", $currRelNum Set-Content -Path $FileCLogOut -Value $clogData + +# selezione corretto NLof.config secondo config corrente +cd $ProjectDir +if ( $Config -eq "Debug" ) +{ + Copy-Item "NLog.config.dev" -Destination "NLog.config" -Force +} +else +{ + Copy-Item "NLog.config.rel" -Destination "NLog.config" -Force +} diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 4a90658..009b4f3 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GWMS - Gas Warehouse Management System -

    Versione: 1.0.2406.0320

    +

    Versione: 1.0.2406.0412


    Note di rilascio:
    • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index b035a4c..38aaee0 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2406.0320 +1.0.2406.0412 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index ce58e97..39c2371 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2406.0320 + 1.0.2406.0412 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false From f9068995a83e9104f70e15477e93076e127fd4c6 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 4 Jun 2024 12:21:57 +0200 Subject: [PATCH 3/6] Completata review gestione file conf x log --- GWMS.UI/Program.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/GWMS.UI/Program.cs b/GWMS.UI/Program.cs index 4c2591f..230618d 100644 --- a/GWMS.UI/Program.cs +++ b/GWMS.UI/Program.cs @@ -30,20 +30,21 @@ namespace GWMS.UI public static void Main(string[] args) { -#if false // inclusione NLog: // https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-5 // https://codewithmukesh.com/blog/logging-with-nlog-in-aspnet-core/ - var logger = NLog.Web.NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger(); -#endif + //var logger = NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger(); + var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger(); +#if false // sistemazione NLog da codice... - LogManager.Setup().LoadConfiguration(builder => { + LogManager.Setup().LoadConfiguration(builder => + { builder.ForLogger().FilterMinLevel(NLog.LogLevel.Trace).WriteToConsole(layout: "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}"); builder.ForLogger().FilterMinLevel(NLog.LogLevel.Debug).WriteToFile(layout: "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}", fileName: "${basedir}/logs/App_${shortdate}.log"); - }); - + }); var logger = LogManager.GetCurrentClassLogger(); +#endif try { From 14fb396c00ac322d14452b001888b68978e62548 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 4 Jun 2024 17:52:54 +0200 Subject: [PATCH 4/6] Aggiunta migrazione con indice doppio x PlantLog --- GWMS.Data/GWMSContext.cs | 3 +- ...40604150033_AddPlantLogDtEvIdx.Designer.cs | 748 ++++++++++++++++++ .../20240604150033_AddPlantLogDtEvIdx.cs | 541 +++++++++++++ .../Migrations/GWMSContextModelSnapshot.cs | 101 ++- 4 files changed, 1357 insertions(+), 36 deletions(-) create mode 100644 GWMS.Data/Migrations/20240604150033_AddPlantLogDtEvIdx.Designer.cs create mode 100644 GWMS.Data/Migrations/20240604150033_AddPlantLogDtEvIdx.cs diff --git a/GWMS.Data/GWMSContext.cs b/GWMS.Data/GWMSContext.cs index a6734df..afbbb5a 100644 --- a/GWMS.Data/GWMSContext.cs +++ b/GWMS.Data/GWMSContext.cs @@ -125,7 +125,8 @@ namespace GWMS.Data modelBuilder.Entity().HasKey(c => new { c.PlantId, c.ParamUid }); - modelBuilder.Entity().HasIndex(c => new { c.PlantId, c.DtEvent}, "IX_PlantLog_PlantDt"); + modelBuilder.Entity().HasIndex(c => new { c.PlantId }, "IX_PlantLog_PlantId"); + modelBuilder.Entity().HasIndex(c => new { c.PlantId, c.DtEvent }, "IX_PlantLog_PlantDtEv"); modelBuilder.Seed(); diff --git a/GWMS.Data/Migrations/20240604150033_AddPlantLogDtEvIdx.Designer.cs b/GWMS.Data/Migrations/20240604150033_AddPlantLogDtEvIdx.Designer.cs new file mode 100644 index 0000000..118646a --- /dev/null +++ b/GWMS.Data/Migrations/20240604150033_AddPlantLogDtEvIdx.Designer.cs @@ -0,0 +1,748 @@ +// +using System; +using GWMS.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace GWMS.Data.Migrations +{ + [DbContext(typeof(GWMSContext))] + [Migration("20240604150033_AddPlantLogDtEvIdx")] + partial class AddPlantLogDtEvIdx + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b => + { + b.Property("AlarmLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DtEvent") + .HasColumnType("datetime(6)"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("MemAddress") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("PlantId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int unsigned"); + + b.Property("ValDecoded") + .HasColumnType("longtext"); + + b.HasKey("AlarmLogId"); + + b.HasIndex("PlantId"); + + b.ToTable("AlarmLog"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b => + { + b.Property("KeyName") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnOrder(0); + + b.Property("Descript") + .HasMaxLength(250) + .HasColumnType("varchar(250)") + .HasColumnOrder(4) + .HasComment("Descrizione dell'item"); + + b.Property("ValFloat") + .HasColumnType("int") + .HasColumnOrder(2); + + b.Property("ValInt") + .HasColumnType("int") + .HasColumnOrder(1); + + b.Property("ValString") + .HasMaxLength(250) + .HasColumnType("varchar(250)") + .HasColumnOrder(3); + + b.HasKey("KeyName"); + + b.ToTable("AnKeyVal"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b => + { + b.Property("KeyName") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnOrder(0); + + b.Property("Note") + .HasMaxLength(250) + .HasColumnType("varchar(250)") + .HasColumnOrder(3); + + b.Property("Val") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnOrder(1); + + b.Property("ValStd") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnOrder(2) + .HasComment("Valore di default/riferimento per la variabile"); + + b.HasKey("KeyName"); + + b.ToTable("Config"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b => + { + b.Property("ItemId") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasColumnOrder(0); + + b.Property("ItemCode") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1); + + b.Property("ItemDesc") + .HasMaxLength(250) + .HasColumnType("varchar(250)") + .HasColumnOrder(2); + + b.Property("ItemType") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnOrder(3); + + b.Property("UM") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnOrder(4); + + b.HasKey("ItemId"); + + b.ToTable("Items"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b => + { + b.Property("TabName") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnName("TabName") + .HasColumnOrder(0); + + b.Property("FieldName") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnName("FieldName") + .HasColumnOrder(1); + + b.Property("Val") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnName("Val") + .HasColumnOrder(2); + + b.Property("Descript") + .HasMaxLength(250) + .HasColumnType("varchar(250)") + .HasColumnName("Descript") + .HasColumnOrder(3); + + b.Property("Ordinal") + .HasColumnType("int") + .HasColumnName("Ordinal") + .HasColumnOrder(4); + + b.HasKey("TabName", "FieldName", "Val"); + + b.ToTable("ListVal"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b => + { + b.Property("OrderId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DtETA") + .HasColumnType("datetime(6)"); + + b.Property("DtExecEnd") + .HasColumnType("datetime(6)"); + + b.Property("DtExecStart") + .HasColumnType("datetime(6)"); + + b.Property("DtOrder") + .HasColumnType("datetime(6)"); + + b.Property("ExecutionQty") + .HasColumnType("double"); + + b.Property("LevelEnd") + .HasColumnType("double"); + + b.Property("LevelStart") + .HasColumnType("double"); + + b.Property("OrderCode") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("OrderDesc") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("OrderQty") + .HasColumnType("double"); + + b.Property("PlantId") + .HasColumnType("int"); + + b.Property("SupplierId") + .HasColumnType("int"); + + b.Property("TransporterId") + .HasColumnType("int"); + + b.HasKey("OrderId"); + + b.HasIndex("PlantId"); + + b.HasIndex("SupplierId"); + + b.HasIndex("TransporterId"); + + b.ToTable("Order"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSendModel", b => + { + b.Property("PlantId") + .HasColumnType("int"); + + b.Property("ParamUid") + .HasColumnType("varchar(255)"); + + b.Property("LastSend") + .HasColumnType("datetime(6)"); + + b.Property("VetoSend") + .HasColumnType("datetime(6)"); + + b.Property("enabled") + .HasColumnType("tinyint(1)"); + + b.Property("windEnd") + .HasColumnType("int"); + + b.Property("windStart") + .HasColumnType("int"); + + b.HasKey("PlantId", "ParamUid"); + + b.ToTable("ParamSend"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSetModel", b => + { + b.Property("ParamSetId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Note") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("ParamUid") + .HasColumnType("longtext"); + + b.Property("PlantId") + .HasColumnType("int"); + + b.Property("Scadenza") + .HasColumnType("datetime(6)"); + + b.Property("TargetVal") + .HasColumnType("decimal(65,30)"); + + b.HasKey("ParamSetId"); + + b.ToTable("ParamSet"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b => + { + b.Property("PlantId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("LevelMax") + .HasColumnType("double"); + + b.Property("LevelReorder") + .HasColumnType("double"); + + b.Property("OrderQtyStd") + .HasColumnType("double"); + + b.Property("PlantCode") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("PlantDesc") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("PlantId"); + + b.ToTable("PlantDetail"); + + b.HasData( + new + { + PlantId = 1, + LevelMax = 26000.0, + LevelReorder = 15000.0, + OrderQtyStd = 18000.0, + PlantCode = "PIZ03", + PlantDesc = "Collecchio" + }, + new + { + PlantId = 2, + LevelMax = 28000.0, + LevelReorder = 15000.0, + OrderQtyStd = 18000.0, + PlantCode = "PIZ04", + PlantDesc = "Noceto" + }, + new + { + PlantId = 3, + LevelMax = 24000.0, + LevelReorder = 15000.0, + OrderQtyStd = 18000.0, + PlantCode = "PIZ05", + PlantDesc = "Baganzola" + }, + new + { + PlantId = 4, + LevelMax = 26000.0, + LevelReorder = 15000.0, + OrderQtyStd = 18000.0, + PlantCode = "PIZ08", + PlantDesc = "Pilastrello" + }, + new + { + PlantId = 5, + LevelMax = 26000.0, + LevelReorder = 15000.0, + OrderQtyStd = 18000.0, + PlantCode = "PIZ09", + PlantDesc = "Guardamiglio" + }); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b => + { + b.Property("PlantDataId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DtEvent") + .HasColumnType("datetime(6)"); + + b.Property("FluxType") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("PlantId") + .HasColumnType("int"); + + b.Property("ValNumber") + .HasColumnType("double"); + + b.Property("ValString") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("PlantDataId"); + + b.HasIndex(new[] { "PlantId", "DtEvent" }, "IX_PlantLog_PlantDtEv"); + + b.HasIndex(new[] { "PlantId" }, "IX_PlantLog_PlantId"); + + b.ToTable("PlantLog"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => + { + b.Property("PlantId") + .HasColumnType("int"); + + b.Property("FluxType") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("DtEvent") + .HasColumnType("datetime(6)"); + + b.Property("ValNumber") + .HasColumnType("double"); + + b.Property("ValString") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("PlantId", "FluxType"); + + b.ToTable("PlantStatus"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.RebootLogModel", b => + { + b.Property("RecordId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DtEvent") + .HasColumnType("datetime(6)"); + + b.Property("Item") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Payload") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("RecordId"); + + b.ToTable("RebootLog"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b => + { + b.Property("SupplierId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("SupplierCode") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("SupplierDesc") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("SupplierId"); + + b.ToTable("Supplier"); + + b.HasData( + new + { + SupplierId = 1, + SupplierCode = "LIQUIGAS", + SupplierDesc = "Liquigas" + }, + new + { + SupplierId = 2, + SupplierCode = "VULKANGAS", + SupplierDesc = "Vulkangas" + }); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.TransporterModel", b => + { + b.Property("TransporterId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("PositionLatitude") + .HasColumnType("double"); + + b.Property("PositionLongitude") + .HasColumnType("double"); + + b.Property("PositionUpdated") + .HasColumnType("datetime(6)"); + + b.Property("TransporterCode") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("TransporterDesc") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("TransporterId"); + + b.ToTable("Transporter"); + + b.HasData( + new + { + TransporterId = 1, + PositionLatitude = 0.0, + PositionLongitude = 0.0, + PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + TransporterCode = "LEVO", + TransporterDesc = "Levorato" + }, + new + { + TransporterId = 2, + PositionLatitude = 0.0, + PositionLongitude = 0.0, + PositionUpdated = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + TransporterCode = "TRAF", + TransporterDesc = "Traffik" + }); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b => + { + b.Property("WeekPlanId") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasColumnOrder(0); + + b.Property("DayNum") + .HasColumnType("int"); + + b.Property("DeliveryHour") + .HasColumnType("int"); + + b.Property("Note") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("PlantId") + .HasColumnType("int"); + + b.Property("SupplierId") + .HasColumnType("int"); + + b.Property("TransporterId") + .HasColumnType("int"); + + b.HasKey("WeekPlanId"); + + b.HasIndex("PlantId"); + + b.HasIndex("SupplierId"); + + b.HasIndex("TransporterId"); + + b.ToTable("WeekPlan"); + + b.HasData( + new + { + WeekPlanId = 1, + DayNum = 1, + DeliveryHour = 20, + Note = "18K", + PlantId = 2, + SupplierId = 1, + TransporterId = 1 + }, + new + { + WeekPlanId = 2, + DayNum = 2, + DeliveryHour = 20, + Note = "18K", + PlantId = 2, + SupplierId = 1, + TransporterId = 1 + }, + new + { + WeekPlanId = 3, + DayNum = 3, + DeliveryHour = 20, + Note = "18K", + PlantId = 2, + SupplierId = 1, + TransporterId = 2 + }, + new + { + WeekPlanId = 4, + DayNum = 4, + DeliveryHour = 15, + Note = "9K", + PlantId = 2, + SupplierId = 1, + TransporterId = 1 + }, + new + { + WeekPlanId = 5, + DayNum = 4, + DeliveryHour = 20, + Note = "18K", + PlantId = 2, + SupplierId = 1, + TransporterId = 1 + }, + new + { + WeekPlanId = 6, + DayNum = 6, + DeliveryHour = 20, + Note = "18K", + PlantId = 2, + SupplierId = 1, + TransporterId = 1 + }, + new + { + WeekPlanId = 7, + DayNum = 2, + DeliveryHour = 14, + Note = "3K", + PlantId = 3, + SupplierId = 1, + TransporterId = 1 + }, + new + { + WeekPlanId = 8, + DayNum = 2, + DeliveryHour = 15, + Note = "15K", + PlantId = 4, + SupplierId = 1, + TransporterId = 1 + }, + new + { + WeekPlanId = 9, + DayNum = 2, + DeliveryHour = 17, + Note = "18K", + PlantId = 1, + SupplierId = 2, + TransporterId = 2 + }); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b => + { + b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") + .WithMany() + .HasForeignKey("PlantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Plant"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b => + { + b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") + .WithMany() + .HasForeignKey("PlantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") + .WithMany() + .HasForeignKey("SupplierId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter") + .WithMany() + .HasForeignKey("TransporterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Plant"); + + b.Navigation("Supplier"); + + b.Navigation("Transporter"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantLogModel", b => + { + b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") + .WithMany() + .HasForeignKey("PlantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Plant"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => + { + b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") + .WithMany() + .HasForeignKey("PlantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Plant"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.WeekPlanModel", b => + { + b.HasOne("GWMS.Data.DatabaseModels.PlantDetailModel", "Plant") + .WithMany() + .HasForeignKey("PlantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("GWMS.Data.DatabaseModels.SupplierModel", "Supplier") + .WithMany() + .HasForeignKey("SupplierId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("GWMS.Data.DatabaseModels.TransporterModel", "Transporter") + .WithMany() + .HasForeignKey("TransporterId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Plant"); + + b.Navigation("Supplier"); + + b.Navigation("Transporter"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/GWMS.Data/Migrations/20240604150033_AddPlantLogDtEvIdx.cs b/GWMS.Data/Migrations/20240604150033_AddPlantLogDtEvIdx.cs new file mode 100644 index 0000000..8cc025a --- /dev/null +++ b/GWMS.Data/Migrations/20240604150033_AddPlantLogDtEvIdx.cs @@ -0,0 +1,541 @@ +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace GWMS.Data.Migrations +{ + public partial class AddPlantLogDtEvIdx : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "WeekPlanId", + table: "WeekPlan", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + .Annotation("Relational:ColumnOrder", 0) + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Ordinal", + table: "ListVal", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("Relational:ColumnOrder", 4); + + migrationBuilder.AlterColumn( + name: "Descript", + table: "ListVal", + type: "varchar(250)", + maxLength: 250, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(250)", + oldMaxLength: 250, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 3) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "Val", + table: "ListVal", + type: "varchar(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 2) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "FieldName", + table: "ListVal", + type: "varchar(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 1) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "TabName", + table: "ListVal", + type: "varchar(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 0) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "UM", + table: "Items", + type: "varchar(50)", + maxLength: 50, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 4) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "ItemType", + table: "Items", + type: "varchar(50)", + maxLength: 50, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 3) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "ItemDesc", + table: "Items", + type: "varchar(250)", + maxLength: 250, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(250)", + oldMaxLength: 250, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 2) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "ItemCode", + table: "Items", + type: "varchar(100)", + maxLength: 100, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(100)", + oldMaxLength: 100, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 1) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "ItemId", + table: "Items", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + .Annotation("Relational:ColumnOrder", 0) + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "ValStd", + table: "Config", + type: "varchar(50)", + maxLength: 50, + nullable: true, + comment: "Valore di default/riferimento per la variabile", + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50, + oldNullable: true, + oldComment: "Valore di default/riferimento per la variabile") + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 2) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "Val", + table: "Config", + type: "varchar(50)", + maxLength: 50, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 1) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "Note", + table: "Config", + type: "varchar(250)", + maxLength: 250, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(250)", + oldMaxLength: 250, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 3) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "KeyName", + table: "Config", + type: "varchar(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 0) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "ValString", + table: "AnKeyVal", + type: "varchar(250)", + maxLength: 250, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(250)", + oldMaxLength: 250, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 3) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "ValInt", + table: "AnKeyVal", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("Relational:ColumnOrder", 1); + + migrationBuilder.AlterColumn( + name: "ValFloat", + table: "AnKeyVal", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("Relational:ColumnOrder", 2); + + migrationBuilder.AlterColumn( + name: "Descript", + table: "AnKeyVal", + type: "varchar(250)", + maxLength: 250, + nullable: true, + comment: "Descrizione dell'item", + oldClrType: typeof(string), + oldType: "varchar(250)", + oldMaxLength: 250, + oldNullable: true, + oldComment: "Descrizione dell'item") + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 4) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "KeyName", + table: "AnKeyVal", + type: "varchar(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50) + .Annotation("MySql:CharSet", "utf8mb4") + .Annotation("Relational:ColumnOrder", 0) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_PlantLog_PlantDtEv", + table: "PlantLog", + columns: new[] { "PlantId", "DtEvent" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_PlantLog_PlantDtEv", + table: "PlantLog"); + + migrationBuilder.AlterColumn( + name: "WeekPlanId", + table: "WeekPlan", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + .OldAnnotation("Relational:ColumnOrder", 0); + + migrationBuilder.AlterColumn( + name: "Ordinal", + table: "ListVal", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .OldAnnotation("Relational:ColumnOrder", 4); + + migrationBuilder.AlterColumn( + name: "Descript", + table: "ListVal", + type: "varchar(250)", + maxLength: 250, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(250)", + oldMaxLength: 250, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 3); + + migrationBuilder.AlterColumn( + name: "Val", + table: "ListVal", + type: "varchar(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 2); + + migrationBuilder.AlterColumn( + name: "FieldName", + table: "ListVal", + type: "varchar(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 1); + + migrationBuilder.AlterColumn( + name: "TabName", + table: "ListVal", + type: "varchar(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 0); + + migrationBuilder.AlterColumn( + name: "UM", + table: "Items", + type: "varchar(50)", + maxLength: 50, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 4); + + migrationBuilder.AlterColumn( + name: "ItemType", + table: "Items", + type: "varchar(50)", + maxLength: 50, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 3); + + migrationBuilder.AlterColumn( + name: "ItemDesc", + table: "Items", + type: "varchar(250)", + maxLength: 250, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(250)", + oldMaxLength: 250, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 2); + + migrationBuilder.AlterColumn( + name: "ItemCode", + table: "Items", + type: "varchar(100)", + maxLength: 100, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(100)", + oldMaxLength: 100, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 1); + + migrationBuilder.AlterColumn( + name: "ItemId", + table: "Items", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + .OldAnnotation("Relational:ColumnOrder", 0); + + migrationBuilder.AlterColumn( + name: "ValStd", + table: "Config", + type: "varchar(50)", + maxLength: 50, + nullable: true, + comment: "Valore di default/riferimento per la variabile", + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50, + oldNullable: true, + oldComment: "Valore di default/riferimento per la variabile") + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 2); + + migrationBuilder.AlterColumn( + name: "Val", + table: "Config", + type: "varchar(50)", + maxLength: 50, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 1); + + migrationBuilder.AlterColumn( + name: "Note", + table: "Config", + type: "varchar(250)", + maxLength: 250, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(250)", + oldMaxLength: 250, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 3); + + migrationBuilder.AlterColumn( + name: "KeyName", + table: "Config", + type: "varchar(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 0); + + migrationBuilder.AlterColumn( + name: "ValString", + table: "AnKeyVal", + type: "varchar(250)", + maxLength: 250, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(250)", + oldMaxLength: 250, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 3); + + migrationBuilder.AlterColumn( + name: "ValInt", + table: "AnKeyVal", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .OldAnnotation("Relational:ColumnOrder", 1); + + migrationBuilder.AlterColumn( + name: "ValFloat", + table: "AnKeyVal", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .OldAnnotation("Relational:ColumnOrder", 2); + + migrationBuilder.AlterColumn( + name: "Descript", + table: "AnKeyVal", + type: "varchar(250)", + maxLength: 250, + nullable: true, + comment: "Descrizione dell'item", + oldClrType: typeof(string), + oldType: "varchar(250)", + oldMaxLength: 250, + oldNullable: true, + oldComment: "Descrizione dell'item") + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 4); + + migrationBuilder.AlterColumn( + name: "KeyName", + table: "AnKeyVal", + type: "varchar(50)", + maxLength: 50, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(50)", + oldMaxLength: 50) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("Relational:ColumnOrder", 0); + } + } +} diff --git a/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs b/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs index 49d5614..b57dc04 100644 --- a/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs +++ b/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs @@ -16,7 +16,7 @@ namespace GWMS.Data.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "5.0.10") + .HasAnnotation("ProductVersion", "6.0.2") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b => @@ -48,84 +48,98 @@ namespace GWMS.Data.Migrations b.HasIndex("PlantId"); - b.ToTable("AlarmLog", (string)null); + b.ToTable("AlarmLog"); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b => { b.Property("KeyName") .HasMaxLength(50) - .HasColumnType("varchar(50)"); + .HasColumnType("varchar(50)") + .HasColumnOrder(0); b.Property("Descript") .HasMaxLength(250) .HasColumnType("varchar(250)") + .HasColumnOrder(4) .HasComment("Descrizione dell'item"); b.Property("ValFloat") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnOrder(2); b.Property("ValInt") - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnOrder(1); b.Property("ValString") .HasMaxLength(250) - .HasColumnType("varchar(250)"); + .HasColumnType("varchar(250)") + .HasColumnOrder(3); b.HasKey("KeyName"); - b.ToTable("AnKeyVal", (string)null); + b.ToTable("AnKeyVal"); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b => { b.Property("KeyName") .HasMaxLength(50) - .HasColumnType("varchar(50)"); + .HasColumnType("varchar(50)") + .HasColumnOrder(0); b.Property("Note") .HasMaxLength(250) - .HasColumnType("varchar(250)"); + .HasColumnType("varchar(250)") + .HasColumnOrder(3); b.Property("Val") .HasMaxLength(50) - .HasColumnType("varchar(50)"); + .HasColumnType("varchar(50)") + .HasColumnOrder(1); b.Property("ValStd") .HasMaxLength(50) .HasColumnType("varchar(50)") + .HasColumnOrder(2) .HasComment("Valore di default/riferimento per la variabile"); b.HasKey("KeyName"); - b.ToTable("Config", (string)null); + b.ToTable("Config"); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.ItemModel", b => { b.Property("ItemId") .ValueGeneratedOnAdd() - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnOrder(0); b.Property("ItemCode") .HasMaxLength(100) - .HasColumnType("varchar(100)"); + .HasColumnType("varchar(100)") + .HasColumnOrder(1); b.Property("ItemDesc") .HasMaxLength(250) - .HasColumnType("varchar(250)"); + .HasColumnType("varchar(250)") + .HasColumnOrder(2); b.Property("ItemType") .HasMaxLength(50) - .HasColumnType("varchar(50)"); + .HasColumnType("varchar(50)") + .HasColumnOrder(3); b.Property("UM") .HasMaxLength(50) - .HasColumnType("varchar(50)"); + .HasColumnType("varchar(50)") + .HasColumnOrder(4); b.HasKey("ItemId"); - b.ToTable("Items", (string)null); + b.ToTable("Items"); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b => @@ -133,30 +147,35 @@ namespace GWMS.Data.Migrations b.Property("TabName") .HasMaxLength(50) .HasColumnType("varchar(50)") - .HasColumnName("TabName"); + .HasColumnName("TabName") + .HasColumnOrder(0); b.Property("FieldName") .HasMaxLength(50) .HasColumnType("varchar(50)") - .HasColumnName("FieldName"); + .HasColumnName("FieldName") + .HasColumnOrder(1); b.Property("Val") .HasMaxLength(50) .HasColumnType("varchar(50)") - .HasColumnName("Val"); + .HasColumnName("Val") + .HasColumnOrder(2); b.Property("Descript") .HasMaxLength(250) .HasColumnType("varchar(250)") - .HasColumnName("Descript"); + .HasColumnName("Descript") + .HasColumnOrder(3); b.Property("Ordinal") .HasColumnType("int") - .HasColumnName("Ordinal"); + .HasColumnName("Ordinal") + .HasColumnOrder(4); b.HasKey("TabName", "FieldName", "Val"); - b.ToTable("ListVal", (string)null); + b.ToTable("ListVal"); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.OrderModel", b => @@ -214,7 +233,7 @@ namespace GWMS.Data.Migrations b.HasIndex("TransporterId"); - b.ToTable("Order", (string)null); + b.ToTable("Order"); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSendModel", b => @@ -242,7 +261,7 @@ namespace GWMS.Data.Migrations b.HasKey("PlantId", "ParamUid"); - b.ToTable("ParamSend", (string)null); + b.ToTable("ParamSend"); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.ParamSetModel", b => @@ -269,7 +288,7 @@ namespace GWMS.Data.Migrations b.HasKey("ParamSetId"); - b.ToTable("ParamSet", (string)null); + b.ToTable("ParamSet"); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantDetailModel", b => @@ -297,7 +316,7 @@ namespace GWMS.Data.Migrations b.HasKey("PlantId"); - b.ToTable("PlantDetail", (string)null); + b.ToTable("PlantDetail"); b.HasData( new @@ -335,6 +354,15 @@ namespace GWMS.Data.Migrations OrderQtyStd = 18000.0, PlantCode = "PIZ08", PlantDesc = "Pilastrello" + }, + new + { + PlantId = 5, + LevelMax = 26000.0, + LevelReorder = 15000.0, + OrderQtyStd = 18000.0, + PlantCode = "PIZ09", + PlantDesc = "Guardamiglio" }); }); @@ -363,9 +391,11 @@ namespace GWMS.Data.Migrations b.HasKey("PlantDataId"); - b.HasIndex("PlantId"); + b.HasIndex(new[] { "PlantId", "DtEvent" }, "IX_PlantLog_PlantDtEv"); - b.ToTable("PlantLog", (string)null); + b.HasIndex(new[] { "PlantId" }, "IX_PlantLog_PlantId"); + + b.ToTable("PlantLog"); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.PlantStatusModel", b => @@ -389,7 +419,7 @@ namespace GWMS.Data.Migrations b.HasKey("PlantId", "FluxType"); - b.ToTable("PlantStatus", (string)null); + b.ToTable("PlantStatus"); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.RebootLogModel", b => @@ -411,7 +441,7 @@ namespace GWMS.Data.Migrations b.HasKey("RecordId"); - b.ToTable("RebootLog", (string)null); + b.ToTable("RebootLog"); }); modelBuilder.Entity("GWMS.Data.DatabaseModels.SupplierModel", b => @@ -430,7 +460,7 @@ namespace GWMS.Data.Migrations b.HasKey("SupplierId"); - b.ToTable("Supplier", (string)null); + b.ToTable("Supplier"); b.HasData( new @@ -472,7 +502,7 @@ namespace GWMS.Data.Migrations b.HasKey("TransporterId"); - b.ToTable("Transporter", (string)null); + b.ToTable("Transporter"); b.HasData( new @@ -499,7 +529,8 @@ namespace GWMS.Data.Migrations { b.Property("WeekPlanId") .ValueGeneratedOnAdd() - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnOrder(0); b.Property("DayNum") .HasColumnType("int"); @@ -528,7 +559,7 @@ namespace GWMS.Data.Migrations b.HasIndex("TransporterId"); - b.ToTable("WeekPlan", (string)null); + b.ToTable("WeekPlan"); b.HasData( new From 6bbc8b6fa01fb72fecb87c6ccf68f756206a85d9 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 4 Jun 2024 17:53:00 +0200 Subject: [PATCH 5/6] Update livello minimo log a debug --- GWMS.UI/Controllers/IOBController.cs | 6 ++-- GWMS.UI/Controllers/PlantDataController.cs | 4 +-- GWMS.UI/Data/GWMSDataService.cs | 38 +++++++++++----------- GWMS.UI/GWMS.UI.csproj | 2 +- GWMS.UI/NLog.config | 4 +-- GWMS.UI/NLog.config.dev | 4 +-- GWMS.UI/NLog.config.rel | 4 +-- GWMS.UI/Program.cs | 5 +-- GWMS.UI/Startup.cs | 8 ----- Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 12 files changed, 37 insertions(+), 44 deletions(-) diff --git a/GWMS.UI/Controllers/IOBController.cs b/GWMS.UI/Controllers/IOBController.cs index 6263802..08f683b 100644 --- a/GWMS.UI/Controllers/IOBController.cs +++ b/GWMS.UI/Controllers/IOBController.cs @@ -348,14 +348,14 @@ namespace GWMS.UI.Controllers { // conversione dati List plData = rawData.fluxData.Select(jpl => _DataService.convertFluxToPL(currPlant.PlantId, jpl)).ToList(); - Log.Trace($"flogJson | {id} | Convertiti {plData.Count} record"); + Log.Debug($"flogJson | {id} | Convertiti {plData.Count} record"); // insert! fatto = await _DataService.PlantLogInsert(plData); - Log.Trace($"flogJson | {id} | PlantLogInsert --> esito: {fatto}"); + Log.Debug($"flogJson | {id} | PlantLogInsert --> esito: {fatto}"); // effettuo SEMPRE verifica per ricalcolo ordini... await _DataService.checkLevels(); - Log.Trace($"flogJson | {id} | chiamata checkLevels"); + Log.Debug($"flogJson | {id} | chiamata checkLevels"); // leggo parametri correnti... try { diff --git a/GWMS.UI/Controllers/PlantDataController.cs b/GWMS.UI/Controllers/PlantDataController.cs index c5fe329..cb21d37 100644 --- a/GWMS.UI/Controllers/PlantDataController.cs +++ b/GWMS.UI/Controllers/PlantDataController.cs @@ -54,7 +54,7 @@ namespace GWMS.UI.Controllers [HttpGet] public async Task> Get() { - Log.Trace("PlantData: Chiamata Get"); + Log.Debug("PlantData: Chiamata Get"); // serializzo i dati di PlantDTO dell'impianto richiesto List ListRecords = await _DataService.PlantDtoGetAll(); return ListRecords; @@ -64,7 +64,7 @@ namespace GWMS.UI.Controllers [HttpGet("{id}")] public async Task Get(int id) { - Log.Trace($"PlantData: Chiamata Get | id: {id}"); + Log.Debug($"PlantData: Chiamata Get | id: {id}"); // serializzo i dati di PlantDTO dell'impianto richiesto var ListRecords = await _DataService.PlantDtoGetAll(); //seleziono plant... diff --git a/GWMS.UI/Data/GWMSDataService.cs b/GWMS.UI/Data/GWMSDataService.cs index 6c44e2c..d9d7fc7 100644 --- a/GWMS.UI/Data/GWMSDataService.cs +++ b/GWMS.UI/Data/GWMSDataService.cs @@ -218,7 +218,7 @@ namespace GWMS.UI.Data var dbResult = dbController.AlarmLogGetFilt(PlantId, skipRec, numRec); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB AlarmLogGetFilt: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB AlarmLogGetFilt: {ts.TotalMilliseconds} ms"); return await Task.FromResult(dbResult); } @@ -342,7 +342,7 @@ namespace GWMS.UI.Data await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false)); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB + caching per ConfigGetAll: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB + caching per ConfigGetAll: {ts.TotalMilliseconds} ms"); } return await Task.FromResult(dbResult); } @@ -505,7 +505,7 @@ namespace GWMS.UI.Data await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false)); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB + caching per ItemsGetAll: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB + caching per ItemsGetAll: {ts.TotalMilliseconds} ms"); } return await Task.FromResult(dbResult); } @@ -621,7 +621,7 @@ namespace GWMS.UI.Data dbResult = dbController.GetOrderByCode(OrderCode); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB per OrderGetByCode: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB per OrderGetByCode: {ts.TotalMilliseconds} ms"); return await Task.FromResult(dbResult); } @@ -635,7 +635,7 @@ namespace GWMS.UI.Data dbResult = dbController.GetOrderById(OrderId); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB per OrderGetById: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB per OrderGetById: {ts.TotalMilliseconds} ms"); return await Task.FromResult(dbResult); } @@ -649,7 +649,7 @@ namespace GWMS.UI.Data dbResult = dbController.GetOrdersFilt(CurrFilter.PlantId, CurrFilter.SupplierId, CurrFilter.TransporterId, CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.ShowClosed); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB per OrdersGetFilt: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB per OrdersGetFilt: {ts.TotalMilliseconds} ms"); return await Task.FromResult(dbResult); } @@ -668,7 +668,7 @@ namespace GWMS.UI.Data dbResult = dbController.GetOrdersOpen(PlantId); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB per OrdersGetOpen | PlantId: {PlantId} | {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB per OrdersGetOpen | PlantId: {PlantId} | {ts.TotalMilliseconds} ms"); return await Task.FromResult(dbResult); } @@ -728,7 +728,7 @@ namespace GWMS.UI.Data await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false)); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB + caching per ParamSendGetAll: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB + caching per ParamSendGetAll: {ts.TotalMilliseconds} ms"); } return await Task.FromResult(dbResult); } @@ -818,7 +818,7 @@ namespace GWMS.UI.Data dbResult = dbController.ParamSetGet(PlantId, ParamUid); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB per ParamSetGetByPlant: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB per ParamSetGetByPlant: {ts.TotalMilliseconds} ms"); return await Task.FromResult(dbResult); } @@ -938,7 +938,7 @@ namespace GWMS.UI.Data } else { - Log.Trace($"Veto attivo per PlantDtoGetAll: salto!"); + Log.Debug($"Veto attivo per PlantDtoGetAll: salto!"); // controllo se ci sia semaforo lettura redVeto = await distributedCache.GetAsync(cacheVetoKey); // se scaduto da oltre 10 sec --> tolgo @@ -958,7 +958,7 @@ namespace GWMS.UI.Data { rawData = Encoding.UTF8.GetString(redisDataList); dbResult = JsonConvert.DeserializeObject>(rawData); - Log.Trace($"PlantDtoGetAll: lettura da cache REDIS"); + Log.Debug($"PlantDtoGetAll: lettura da cache REDIS"); } else { @@ -1013,7 +1013,7 @@ namespace GWMS.UI.Data await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true)); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB + caching per PlantLogGetFilt: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB + caching per PlantLogGetFilt: {ts.TotalMilliseconds} ms"); } return await Task.FromResult(dbResult); } @@ -1074,7 +1074,7 @@ namespace GWMS.UI.Data // invalido i vari valori in cache await distributedCache.RemoveAsync($"DATA:PLANTS:LastFlux:{PlantId}"); await distributedCache.RemoveAsync($"DATA:PLANTS:ListDTO"); - Log.Trace($"PlantLogInsert | PlantId: {PlantId} | Completato insert {item2insert.Count} rec"); + Log.Debug($"PlantLogInsert | PlantId: {PlantId} | Completato insert {item2insert.Count} rec"); } // restituisco @@ -1102,7 +1102,7 @@ namespace GWMS.UI.Data await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true)); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB + caching per PlantsAnalisysGetByCode: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB + caching per PlantsAnalisysGetByCode: {ts.TotalMilliseconds} ms"); } return await Task.FromResult(dbResult); } @@ -1149,7 +1149,7 @@ namespace GWMS.UI.Data await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true)); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB + caching per PlantsList: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB + caching per PlantsList: {ts.TotalMilliseconds} ms"); } return await Task.FromResult(dbResult); } @@ -1352,7 +1352,7 @@ namespace GWMS.UI.Data await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true)); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB + caching per PlantDtoGetAll: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB + caching per PlantDtoGetAll: {ts.TotalMilliseconds} ms"); } return await Task.FromResult(dbResult); } @@ -1392,7 +1392,7 @@ namespace GWMS.UI.Data await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true)); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB + caching per PlantDtoGetAll: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB + caching per PlantDtoGetAll: {ts.TotalMilliseconds} ms"); } return await Task.FromResult(dbResult); } @@ -1551,7 +1551,7 @@ namespace GWMS.UI.Data dbResult = dbController.GetWeekPlan(); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB per WeekPlanGet: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB per WeekPlanGet: {ts.TotalMilliseconds} ms"); return await Task.FromResult(dbResult); } @@ -1749,7 +1749,7 @@ namespace GWMS.UI.Data await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true)); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB + caching per PlantLogGetLastByFlux: {ts.TotalMilliseconds} ms"); + Log.Debug($"Effettuata lettura da DB + caching per PlantLogGetLastByFlux: {ts.TotalMilliseconds} ms"); } return await Task.FromResult(lastValues); } diff --git a/GWMS.UI/GWMS.UI.csproj b/GWMS.UI/GWMS.UI.csproj index fabb2d6..9f7f766 100644 --- a/GWMS.UI/GWMS.UI.csproj +++ b/GWMS.UI/GWMS.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 1.0.2406.0412 + 1.0.2406.0417 95c9f021-52d1-4390-a670-5810b7b777b0 true true diff --git a/GWMS.UI/NLog.config b/GWMS.UI/NLog.config index ab08a88..fbea809 100644 --- a/GWMS.UI/NLog.config +++ b/GWMS.UI/NLog.config @@ -29,7 +29,7 @@ layout="${longdate} ${uppercase:${level}} ${message}" /> --> - + @@ -39,7 +39,7 @@ Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f" --> - + diff --git a/GWMS.UI/NLog.config.dev b/GWMS.UI/NLog.config.dev index ab08a88..fbea809 100644 --- a/GWMS.UI/NLog.config.dev +++ b/GWMS.UI/NLog.config.dev @@ -29,7 +29,7 @@ layout="${longdate} ${uppercase:${level}} ${message}" /> --> - + @@ -39,7 +39,7 @@ Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f" --> - + diff --git a/GWMS.UI/NLog.config.rel b/GWMS.UI/NLog.config.rel index 8fc7637..c82b88a 100644 --- a/GWMS.UI/NLog.config.rel +++ b/GWMS.UI/NLog.config.rel @@ -29,7 +29,7 @@ layout="${longdate} ${uppercase:${level}} ${message}" /> --> - + @@ -39,7 +39,7 @@ Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f" --> - + diff --git a/GWMS.UI/Program.cs b/GWMS.UI/Program.cs index 230618d..1a42dc3 100644 --- a/GWMS.UI/Program.cs +++ b/GWMS.UI/Program.cs @@ -24,7 +24,8 @@ namespace GWMS.UI .ConfigureLogging(logging => { logging.ClearProviders(); - logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); + logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Information); + //logging.AddConsole(); }) .UseNLog(); @@ -40,7 +41,7 @@ namespace GWMS.UI // sistemazione NLog da codice... LogManager.Setup().LoadConfiguration(builder => { - builder.ForLogger().FilterMinLevel(NLog.LogLevel.Trace).WriteToConsole(layout: "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}"); + builder.ForLogger().FilterMinLevel(NLog.LogLevel.Debug).WriteToConsole(layout: "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}"); builder.ForLogger().FilterMinLevel(NLog.LogLevel.Debug).WriteToFile(layout: "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}", fileName: "${basedir}/logs/App_${shortdate}.log"); }); var logger = LogManager.GetCurrentClassLogger(); diff --git a/GWMS.UI/Startup.cs b/GWMS.UI/Startup.cs index 16b2cec..4b759ee 100644 --- a/GWMS.UI/Startup.cs +++ b/GWMS.UI/Startup.cs @@ -2,16 +2,12 @@ using GWMS.Data; using GWMS.UI.Areas.Identity; using GWMS.UI.Data; using HealthChecks.UI.Client; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpOverrides; -using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Identity.UI; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Localization; using Microsoft.EntityFrameworkCore; @@ -19,12 +15,8 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Hosting; -using NLog; using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Threading.Tasks; namespace GWMS.UI { diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 009b4f3..6bb283c 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GWMS - Gas Warehouse Management System -

      Versione: 1.0.2406.0412

      +

      Versione: 1.0.2406.0417


      Note di rilascio:
      • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 38aaee0..34a6dd6 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2406.0412 +1.0.2406.0417 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 39c2371..9fa21e8 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2406.0412 + 1.0.2406.0417 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false From ea2d912e05941a6a91d4a90a93399ff3bd15ed13 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 5 Jun 2024 09:37:02 +0200 Subject: [PATCH 6/6] Fix loglevel: ready x install --- GWMS.UI/GWMS - Backup.UI.csproj | 97 ++++++++++++++++++++++++++++++++ GWMS.UI/GWMS.UI.csproj | 11 +++- GWMS.UI/NLog.config | 8 +++ GWMS.UI/NLog.config.dev | 8 +++ GWMS.UI/NLog.config.rel | 7 +++ GWMS.UI/Program.cs | 6 +- GWMS.UI/appsettings.Staging.json | 2 +- GWMS.UI/appsettings.json | 7 --- GWMS.UI/post-build.ps1 | 10 ---- GWMS.UI/pre-build.ps1 | 14 +++++ Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 13 files changed, 153 insertions(+), 23 deletions(-) create mode 100644 GWMS.UI/GWMS - Backup.UI.csproj create mode 100644 GWMS.UI/pre-build.ps1 diff --git a/GWMS.UI/GWMS - Backup.UI.csproj b/GWMS.UI/GWMS - Backup.UI.csproj new file mode 100644 index 0000000..eb2098f --- /dev/null +++ b/GWMS.UI/GWMS - Backup.UI.csproj @@ -0,0 +1,97 @@ + + + + net6.0 + 1.0.2406.0417 + 95c9f021-52d1-4390-a670-5810b7b777b0 + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS02.pubxml" /> + <_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfile.pubxml" /> + <_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfileLinux.pubxml" /> + <_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfileWin.pubxml" /> + <_WebToolingArtifacts Remove="Properties\PublishProfiles\W2019-IIS-DEV.pubxml" /> + + + + + Never + + + Never + + + + + + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + ParamEditor.razor.cs + + + Transporters - Copy.razor.cs + + + Transporters.razor.cs + + + + + + + + + diff --git a/GWMS.UI/GWMS.UI.csproj b/GWMS.UI/GWMS.UI.csproj index 9f7f766..792cb86 100644 --- a/GWMS.UI/GWMS.UI.csproj +++ b/GWMS.UI/GWMS.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 1.0.2406.0417 + 1.0.2406.0509 95c9f021-52d1-4390-a670-5810b7b777b0 true true @@ -69,6 +69,7 @@ + @@ -89,6 +90,14 @@ + + + Always + + + + + diff --git a/GWMS.UI/NLog.config b/GWMS.UI/NLog.config index fbea809..5101299 100644 --- a/GWMS.UI/NLog.config +++ b/GWMS.UI/NLog.config @@ -39,6 +39,14 @@ Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f" --> + + + + + + + diff --git a/GWMS.UI/NLog.config.dev b/GWMS.UI/NLog.config.dev index fbea809..5101299 100644 --- a/GWMS.UI/NLog.config.dev +++ b/GWMS.UI/NLog.config.dev @@ -39,6 +39,14 @@ Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f" --> + + + + + + + diff --git a/GWMS.UI/NLog.config.rel b/GWMS.UI/NLog.config.rel index c82b88a..66e2312 100644 --- a/GWMS.UI/NLog.config.rel +++ b/GWMS.UI/NLog.config.rel @@ -39,6 +39,13 @@ Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f" --> + + + + + + + diff --git a/GWMS.UI/Program.cs b/GWMS.UI/Program.cs index 1a42dc3..2a86505 100644 --- a/GWMS.UI/Program.cs +++ b/GWMS.UI/Program.cs @@ -24,8 +24,12 @@ namespace GWMS.UI .ConfigureLogging(logging => { logging.ClearProviders(); +#if DEBUG + //logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Debug); logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Information); - //logging.AddConsole(); +#else + logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Warning); +#endif }) .UseNLog(); diff --git a/GWMS.UI/appsettings.Staging.json b/GWMS.UI/appsettings.Staging.json index fb99726..98ae7c9 100644 --- a/GWMS.UI/appsettings.Staging.json +++ b/GWMS.UI/appsettings.Staging.json @@ -1,7 +1,7 @@ { "Logging": { "LogLevel": { - "Default": "Trace", + "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } diff --git a/GWMS.UI/appsettings.json b/GWMS.UI/appsettings.json index d16a2a9..d18514e 100644 --- a/GWMS.UI/appsettings.json +++ b/GWMS.UI/appsettings.json @@ -5,13 +5,6 @@ "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } - //"LogLevel": { - // "Default": "Debug", - // "System": "Information", - // "Microsoft": "Information", - // "Microsoft.AspNetCore.SignalR": "Debug", - // "Microsoft.AspNetCore.Http.Connections": "Debug" - //} }, "AllowedHosts": "*", "ConnectionStrings": { diff --git a/GWMS.UI/post-build.ps1 b/GWMS.UI/post-build.ps1 index f63c8b6..ac3ee02 100644 --- a/GWMS.UI/post-build.ps1 +++ b/GWMS.UI/post-build.ps1 @@ -33,13 +33,3 @@ $clogData = Get-Content $FileCLogIn $clogData = $clogData -replace "{{CURRENT-REL}}", $currRelNum Set-Content -Path $FileCLogOut -Value $clogData -# selezione corretto NLof.config secondo config corrente -cd $ProjectDir -if ( $Config -eq "Debug" ) -{ - Copy-Item "NLog.config.dev" -Destination "NLog.config" -Force -} -else -{ - Copy-Item "NLog.config.rel" -Destination "NLog.config" -Force -} diff --git a/GWMS.UI/pre-build.ps1 b/GWMS.UI/pre-build.ps1 new file mode 100644 index 0000000..dab26d1 --- /dev/null +++ b/GWMS.UI/pre-build.ps1 @@ -0,0 +1,14 @@ +param([string]$ProjectDir, [string]$ProjectPath, [string]$Config); + +# rif esempi parametri: https://learn.microsoft.com/en-us/visualstudio/ide/how-to-specify-build-events-csharp?view=vs-2022 + +# selezione corretto NLof.config secondo config corrente +cd $ProjectDir +if ( $Config -eq "Debug" ) +{ + Copy-Item "NLog.config.dev" -Destination "NLog.config" -Force +} +else +{ + Copy-Item "NLog.config.rel" -Destination "NLog.config" -Force +} diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 6bb283c..b8aa3be 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GWMS - Gas Warehouse Management System -

        Versione: 1.0.2406.0417

        +

        Versione: 1.0.2406.0509


        Note di rilascio:
        • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 34a6dd6..3a8d22d 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2406.0417 +1.0.2406.0509 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 9fa21e8..08d2d29 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2406.0417 + 1.0.2406.0509 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false