diff --git a/GWMS.Data/DatabaseModels/PlantLogModel.cs b/GWMS.Data/DatabaseModels/PlantLogModel.cs index 6d29a7f..8dd54ac 100644 --- a/GWMS.Data/DatabaseModels/PlantLogModel.cs +++ b/GWMS.Data/DatabaseModels/PlantLogModel.cs @@ -20,7 +20,7 @@ namespace GWMS.Data.DatabaseModels [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int PlantDataId { get; set; } - + public DateTime DtEvent { get; set; } = DateTime.Now; /// 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 5c356e3..afbbb5a 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); } @@ -125,6 +125,9 @@ namespace GWMS.Data modelBuilder.Entity().HasKey(c => new { c.PlantId, c.ParamUid }); + modelBuilder.Entity().HasIndex(c => new { c.PlantId }, "IX_PlantLog_PlantId"); + modelBuilder.Entity().HasIndex(c => new { c.PlantId, c.DtEvent }, "IX_PlantLog_PlantDtEv"); + modelBuilder.Seed(); OnModelCreatingPartial(modelBuilder); 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 c5e28ee..b57dc04 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", "6.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("GWMS.Data.DatabaseModels.AlarmLogModel", b => { @@ -53,22 +55,27 @@ namespace GWMS.Data.Migrations { 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"); @@ -79,19 +86,23 @@ namespace GWMS.Data.Migrations { 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"); @@ -103,23 +114,28 @@ namespace GWMS.Data.Migrations { 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"); @@ -131,26 +147,31 @@ 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"); @@ -333,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" }); }); @@ -361,7 +391,9 @@ namespace GWMS.Data.Migrations b.HasKey("PlantDataId"); - b.HasIndex("PlantId"); + b.HasIndex(new[] { "PlantId", "DtEvent" }, "IX_PlantLog_PlantDtEv"); + + b.HasIndex(new[] { "PlantId" }, "IX_PlantLog_PlantId"); b.ToTable("PlantLog"); }); @@ -497,7 +529,8 @@ namespace GWMS.Data.Migrations { b.Property("WeekPlanId") .ValueGeneratedOnAdd() - .HasColumnType("int"); + .HasColumnType("int") + .HasColumnOrder(0); b.Property("DayNum") .HasColumnType("int"); 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 - 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 510a98d..792cb86 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.0509 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,8 @@ - + + @@ -74,7 +90,15 @@ + + + Always + + + + + - + diff --git a/GWMS.UI/NLog.config b/GWMS.UI/NLog.config index b98c52c..5101299 100644 --- a/GWMS.UI/NLog.config +++ b/GWMS.UI/NLog.config @@ -29,7 +29,7 @@ layout="${longdate} ${uppercase:${level}} ${message}" /> --> - + @@ -39,8 +39,16 @@ Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f" --> - + + + + + + + + - + \ 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..5101299 --- /dev/null +++ b/GWMS.UI/NLog.config.dev @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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..66e2312 --- /dev/null +++ b/GWMS.UI/NLog.config.rel @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GWMS.UI/Program.cs b/GWMS.UI/Program.cs index ff90879..2a86505 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; @@ -23,7 +24,12 @@ namespace GWMS.UI .ConfigureLogging(logging => { logging.ClearProviders(); - logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); +#if DEBUG + //logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Debug); + logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Information); +#else + logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Warning); +#endif }) .UseNLog(); @@ -32,7 +38,19 @@ namespace GWMS.UI // 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 = NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger(); + var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger(); + +#if false + // sistemazione NLog da codice... + LogManager.Setup().LoadConfiguration(builder => + { + 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(); +#endif + try { logger.Info("GMWS.UI Application Starting Up"); @@ -45,7 +63,7 @@ namespace GWMS.UI } finally { - NLog.LogManager.Shutdown(); + LogManager.Shutdown(); } } diff --git a/GWMS.UI/Startup.cs b/GWMS.UI/Startup.cs index ae2c537..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; @@ -20,10 +16,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Hosting; using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Threading.Tasks; namespace GWMS.UI { @@ -49,6 +42,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/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 61ed979..ac3ee02 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,4 @@ Set-Content -Path $FileManOut -Value $manData $clogData = Get-Content $FileCLogIn $clogData = $clogData -replace "{{CURRENT-REL}}", $currRelNum Set-Content -Path $FileCLogOut -Value $clogData + 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 2b35c04..b8aa3be 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.0509


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index c86a490..3a8d22d 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2406.0319 +1.0.2406.0509 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index c954ba8..08d2d29 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2406.0319 + 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