From a52ee34f4fec1950ca6c5e32f5b1af3bc9c1bcfd Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 27 Oct 2021 19:29:40 +0200 Subject: [PATCH] migrazioni update x gestione parameteres send --- .../20211027172923_ParamSendTable.Designer.cs | 672 ++++++++++++++++++ .../20211027172923_ParamSendTable.cs | 36 + .../Migrations/GWMSContextModelSnapshot.cs | 28 + 3 files changed, 736 insertions(+) create mode 100644 GWMS.Data/Migrations/20211027172923_ParamSendTable.Designer.cs create mode 100644 GWMS.Data/Migrations/20211027172923_ParamSendTable.cs diff --git a/GWMS.Data/Migrations/20211027172923_ParamSendTable.Designer.cs b/GWMS.Data/Migrations/20211027172923_ParamSendTable.Designer.cs new file mode 100644 index 0000000..0a02656 --- /dev/null +++ b/GWMS.Data/Migrations/20211027172923_ParamSendTable.Designer.cs @@ -0,0 +1,672 @@ +// +using System; +using GWMS.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace GWMS.Data.Migrations +{ + [DbContext(typeof(GWMSContext))] + [Migration("20211027172923_ParamSendTable")] + partial class ParamSendTable + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 64) + .HasAnnotation("ProductVersion", "5.0.10"); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.AnKeyValModel", b => + { + b.Property("KeyName") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Descript") + .HasMaxLength(250) + .HasColumnType("varchar(250)") + .HasComment("Descrizione dell'item"); + + b.Property("ValFloat") + .HasColumnType("int"); + + b.Property("ValInt") + .HasColumnType("int"); + + b.Property("ValString") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("KeyName"); + + b.ToTable("AnKeyVal"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.ConfigModel", b => + { + b.Property("KeyName") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Note") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Val") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ValStd") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .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"); + + b.Property("ItemCode") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("ItemDesc") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("ItemType") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("UM") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("ItemId"); + + b.ToTable("Items"); + }); + + modelBuilder.Entity("GWMS.Data.DatabaseModels.ListValModel", b => + { + b.Property("TabName") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnName("TabName"); + + b.Property("FieldName") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnName("FieldName"); + + b.Property("Val") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnName("Val"); + + b.Property("Descript") + .HasMaxLength(250) + .HasColumnType("varchar(250)") + .HasColumnName("Descript"); + + b.Property("Ordinal") + .HasColumnType("int") + .HasColumnName("Ordinal"); + + 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" + }); + }); + + 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("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"); + + 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.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/20211027172923_ParamSendTable.cs b/GWMS.Data/Migrations/20211027172923_ParamSendTable.cs new file mode 100644 index 0000000..ffc62ed --- /dev/null +++ b/GWMS.Data/Migrations/20211027172923_ParamSendTable.cs @@ -0,0 +1,36 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace GWMS.Data.Migrations +{ + public partial class ParamSendTable : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "ParamSend", + columns: table => new + { + PlantId = table.Column(type: "int", nullable: false), + ParamUid = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + LastSend = table.Column(type: "datetime(6)", nullable: false), + VetoSend = table.Column(type: "datetime(6)", nullable: false), + enabled = table.Column(type: "tinyint(1)", nullable: false), + windStart = table.Column(type: "int", nullable: false), + windEnd = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ParamSend", x => new { x.PlantId, x.ParamUid }); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ParamSend"); + } + } +} diff --git a/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs b/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs index 6f961d4..68b5c47 100644 --- a/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs +++ b/GWMS.Data/Migrations/GWMSContextModelSnapshot.cs @@ -183,6 +183,34 @@ namespace GWMS.Data.Migrations 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")