From bf029c44df4a30d13a7ee5e2bbd489fb73b7663a Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 7 Jul 2025 18:13:16 +0200 Subject: [PATCH] Fix dataseed + migrationz --- .../20250707161305_InitDb.Designer.cs | 1693 +++++++++++++++++ Lux.Data/Migrations/20250707161305_InitDb.cs | 929 +++++++++ .../DataLayerContextModelSnapshot.cs | 1690 ++++++++++++++++ Lux.Data/ModelBuilderExtensions.cs | 188 +- 4 files changed, 4404 insertions(+), 96 deletions(-) create mode 100644 Lux.Data/Migrations/20250707161305_InitDb.Designer.cs create mode 100644 Lux.Data/Migrations/20250707161305_InitDb.cs create mode 100644 Lux.Data/Migrations/DataLayerContextModelSnapshot.cs diff --git a/Lux.Data/Migrations/20250707161305_InitDb.Designer.cs b/Lux.Data/Migrations/20250707161305_InitDb.Designer.cs new file mode 100644 index 00000000..4fad5a82 --- /dev/null +++ b/Lux.Data/Migrations/20250707161305_InitDb.Designer.cs @@ -0,0 +1,1693 @@ +// +using System; +using Lux.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Lux.Data.Migrations +{ + [DbContext(typeof(DataLayerContext))] + [Migration("20250707161305_InitDb")] + partial class InitDb + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.17") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Lux.Data.DbModel.CustomerModel", b => + { + b.Property("CustomerID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CustomerID")); + + b.Property("CompanyName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VAT") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("CustomerID"); + + b.ToTable("RegCustomer"); + + b.HasData( + new + { + CustomerID = 1, + CompanyName = "", + FirstName = "Customer A", + LastName = "Egalware", + VAT = "1234567890123456" + }, + new + { + CustomerID = 2, + CompanyName = "", + FirstName = "Customer B", + LastName = "User", + VAT = "1234567890123456" + }, + new + { + CustomerID = 3, + CompanyName = "", + FirstName = "Customer C", + LastName = "User Test", + VAT = "1234567890123456" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.DealerModel", b => + { + b.Property("DealerID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DealerID")); + + b.Property("CompanyName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VAT") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("DealerID"); + + b.ToTable("RegDealer"); + + b.HasData( + new + { + DealerID = 1, + CompanyName = "Company First", + FirstName = "Dealer A", + LastName = "Egalware", + VAT = "9587362514671527" + }, + new + { + DealerID = 2, + CompanyName = "Company First", + FirstName = "Dealer B", + LastName = "User", + VAT = "9587362514671527" + }, + new + { + DealerID = 3, + CompanyName = "Company Second", + FirstName = "Dealer C", + LastName = "User Test", + VAT = "9587362514671527" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.ItemModel", b => + { + b.Property("ItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemID")); + + b.Property("Cost") + .HasColumnType("double"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ExtItemCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsService") + .HasColumnType("tinyint(1)"); + + b.Property("ItemCode") + .HasColumnType("int"); + + b.Property("Margin") + .HasColumnType("double"); + + b.Property("SupplCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UM") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("ItemID"); + + b.ToTable("RegItem"); + + b.HasData( + new + { + ItemID = 1, + Cost = 20.0, + Description = "BARRA-60x80 generica", + ExtItemCode = "", + IsService = false, + ItemCode = 1001, + Margin = 0.29999999999999999, + SupplCode = "BARR.001", + UM = "#" + }, + new + { + ItemID = 2, + Cost = 16.5, + Description = "Barra 60x80, lunghezza 12m", + ExtItemCode = "BARRA-60x80x12000", + IsService = false, + ItemCode = 1002, + Margin = 0.20999999999999999, + SupplCode = "ABC.00123.12000", + UM = "#" + }, + new + { + ItemID = 3, + Cost = 17.5, + Description = "Barra 60x80, lunghezza 8m", + ExtItemCode = "BARRA-60x80x8000", + IsService = false, + ItemCode = 1003, + Margin = 0.22, + SupplCode = "ABC.00123.8000", + UM = "#" + }, + new + { + ItemID = 4, + Cost = 15.5, + Description = "Barra 60x80, lunghezza 16m", + ExtItemCode = "BARRA-60x80x16000", + IsService = false, + ItemCode = 1004, + Margin = 0.20000000000000001, + SupplCode = "ABC.00123.16000", + UM = "#" + }, + new + { + ItemID = 5, + Cost = 300.0, + Description = "Vetro triplo, basso indice termico, 800x1000", + ExtItemCode = "VETRO-3L-THERMO-800x1000", + IsService = false, + ItemCode = 2001, + Margin = 0.20000000000000001, + SupplCode = "V3T.800.1000", + UM = "m2" + }, + new + { + ItemID = 6, + Cost = 200.0, + Description = "Vetro doppio, 800x1000", + ExtItemCode = "VETRO-2L-800x1000", + IsService = false, + ItemCode = 2002, + Margin = 0.14999999999999999, + SupplCode = "V2.800.1000", + UM = "m2" + }, + new + { + ItemID = 7, + Cost = 250.0, + Description = "Vetro triplo, 800x1000", + ExtItemCode = "VETRO-3L-800x1000", + IsService = false, + ItemCode = 2003, + Margin = 0.17999999999999999, + SupplCode = "V3.800.1000", + UM = "m2" + }, + new + { + ItemID = 8, + Cost = 20.0, + Description = "Vernice trasparente", + ExtItemCode = "VERN-TRASP", + IsService = false, + ItemCode = 3001, + Margin = 0.20000000000000001, + SupplCode = "VT.STD", + UM = "l" + }, + new + { + ItemID = 9, + Cost = 65.0, + Description = "Kit standard completo AGB tipo 001", + ExtItemCode = "KIT-001", + IsService = false, + ItemCode = 5001, + Margin = 0.20000000000000001, + SupplCode = "AGB-KIT-001", + UM = "#" + }, + new + { + ItemID = 10, + Cost = 10.0, + Description = "Cerniera AGB tipo 001", + ExtItemCode = "CERN-001", + IsService = false, + ItemCode = 5002, + Margin = 0.20000000000000001, + SupplCode = "AGB-CERN-001", + UM = "#" + }, + new + { + ItemID = 11, + Cost = 15.0, + Description = "Serratura AGB tipo 001", + ExtItemCode = "SERR-001", + IsService = false, + ItemCode = 5003, + Margin = 0.20000000000000001, + SupplCode = "AGB-SERR-001", + UM = "#" + }, + new + { + ItemID = 12, + Cost = 25.0, + Description = "Maniglia AGB tipo 001", + ExtItemCode = "MAN-001", + IsService = false, + ItemCode = 5004, + Margin = 0.20000000000000001, + SupplCode = "AGB-MAN-001", + UM = "#" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.JobModel", b => + { + b.Property("JobID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("JobID"); + + b.ToTable("JobList"); + + b.HasData( + new + { + JobID = 1, + Description = "Rivendita / servizi" + }, + new + { + JobID = 2, + Description = "Serramento Completo Legno su linea Saomad e installatore interno" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.JobRowItemModel", b => + { + b.Property("JobRowItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobRowItemID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("ItemID") + .HasColumnType("int"); + + b.Property("JobRowID") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("double"); + + b.HasKey("JobRowItemID"); + + b.HasIndex("ItemID"); + + b.HasIndex("JobRowID"); + + b.ToTable("JobRowItemList"); + + b.HasData( + new + { + JobRowItemID = 1, + Description = "Grezzo legno abete", + Index = 1, + ItemID = 1, + JobRowID = 1, + Qty = 1.0 + }, + new + { + JobRowItemID = 2, + Description = "Vernice trasparente standard 1L", + Index = 2, + ItemID = 8, + JobRowID = 3, + Qty = 0.10000000000000001 + }, + new + { + JobRowItemID = 3, + Description = "Ferramenta AGB - rif. AGFD.00000.00000", + Index = 3, + ItemID = 9, + JobRowID = 4, + Qty = 1.0 + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.JobRowModel", b => + { + b.Property("JobRowID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobRowID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("JobID") + .HasColumnType("int"); + + b.Property("PhaseID") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("double"); + + b.Property("ResourceID") + .HasColumnType("int"); + + b.HasKey("JobRowID"); + + b.HasIndex("JobID"); + + b.HasIndex("PhaseID"); + + b.HasIndex("ResourceID"); + + b.ToTable("JobRowList"); + + b.HasData( + new + { + JobRowID = 1, + Description = "", + Index = 1, + JobID = 2, + PhaseID = 1, + Qty = 1.0, + ResourceID = 1 + }, + new + { + JobRowID = 2, + Description = "", + Index = 2, + JobID = 2, + PhaseID = 2, + Qty = 1.0, + ResourceID = 2 + }, + new + { + JobRowID = 3, + Description = "", + Index = 3, + JobID = 2, + PhaseID = 3, + Qty = 1.0, + ResourceID = 4 + }, + new + { + JobRowID = 4, + Description = "", + Index = 4, + JobID = 2, + PhaseID = 4, + Qty = 1.0, + ResourceID = 6 + }, + new + { + JobRowID = 5, + Description = "", + Index = 5, + JobID = 2, + PhaseID = 6, + Qty = 1.0, + ResourceID = 7 + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OfferModel", b => + { + b.Property("OfferID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OfferID")); + + b.Property("CustomerID") + .HasColumnType("int"); + + b.Property("DealerID") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Inserted") + .HasColumnType("datetime(6)"); + + b.Property("Modified") + .HasColumnType("datetime(6)"); + + b.Property("OffertState") + .HasColumnType("int"); + + b.Property("RefNum") + .HasColumnType("int"); + + b.Property("RefRev") + .HasColumnType("int"); + + b.Property("RefYear") + .HasColumnType("int"); + + b.Property("ValidUntil") + .HasColumnType("datetime(6)"); + + b.HasKey("OfferID"); + + b.HasIndex("CustomerID"); + + b.HasIndex("DealerID"); + + b.ToTable("Offer"); + + b.HasData( + new + { + OfferID = 1, + CustomerID = 2, + DealerID = 2, + Description = "Offerta per tre serramenti", + Inserted = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8097), + Modified = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8099), + OffertState = 0, + RefNum = 1, + RefRev = 1, + RefYear = 2024, + ValidUntil = new DateTime(2025, 8, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8094) + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OfferRowModel", b => + { + b.Property("OfferRowID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OfferRowID")); + + b.Property("Cost") + .HasColumnType("double"); + + b.Property("Inserted") + .HasColumnType("datetime(6)"); + + b.Property("ItemSPP") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Modified") + .HasColumnType("datetime(6)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OfferID") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("double"); + + b.Property("RowNum") + .HasColumnType("int"); + + b.Property("SellingItemID") + .HasColumnType("int"); + + b.Property("SerStruct") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("OfferRowID"); + + b.HasIndex("OfferID"); + + b.HasIndex("SellingItemID"); + + b.ToTable("OfferRowList"); + + b.HasData( + new + { + OfferRowID = 1, + Cost = 950.0, + Inserted = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8123), + ItemSPP = "{}", + Modified = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8125), + Note = "Finestra anta singola 2025", + OfferID = 1, + Qty = 3.0, + RowNum = 1, + SellingItemID = 1, + SerStruct = "{}" + }, + new + { + OfferRowID = 2, + Cost = 160.0, + Inserted = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8137), + ItemSPP = "{}", + Modified = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8138), + Note = "Persiana per Finestra anta singola 2025", + OfferID = 1, + Qty = 3.0, + RowNum = 1, + SellingItemID = 2, + SerStruct = "{}" + }, + new + { + OfferRowID = 3, + Cost = 200.0, + Inserted = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8144), + ItemSPP = "{}", + Modified = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8145), + Note = "Installazione serramento", + OfferID = 1, + Qty = 3.0, + RowNum = 1, + SellingItemID = 3, + SerStruct = "{}" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OrderModel", b => + { + b.Property("OrderID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OrderID")); + + b.Property("CustomerID") + .HasColumnType("int"); + + b.Property("DealerID") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Inserted") + .HasColumnType("datetime(6)"); + + b.Property("Modified") + .HasColumnType("datetime(6)"); + + b.Property("OfferID") + .HasColumnType("int"); + + b.Property("OffertState") + .HasColumnType("int"); + + b.Property("RefNum") + .HasColumnType("int"); + + b.Property("RefRev") + .HasColumnType("int"); + + b.Property("RefYear") + .HasColumnType("int"); + + b.Property("ValidUntil") + .HasColumnType("datetime(6)"); + + b.HasKey("OrderID"); + + b.HasIndex("CustomerID"); + + b.HasIndex("DealerID"); + + b.HasIndex("OfferID"); + + b.ToTable("Order"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OrderRowModel", b => + { + b.Property("OrderRowID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OrderRowID")); + + b.Property("Cost") + .HasColumnType("double"); + + b.Property("Inserted") + .HasColumnType("datetime(6)"); + + b.Property("ItemSPP") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Modified") + .HasColumnType("datetime(6)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OrderID") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("double"); + + b.Property("RowNum") + .HasColumnType("int"); + + b.Property("SellingItemID") + .HasColumnType("int"); + + b.Property("SerStruct") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("OrderRowID"); + + b.HasIndex("OrderID"); + + b.HasIndex("SellingItemID"); + + b.ToTable("OrderRowList"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.PhaseModel", b => + { + b.Property("PhaseID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PhaseID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("PhaseID"); + + b.ToTable("RegPhase"); + + b.HasData( + new + { + PhaseID = 1, + Description = "Taglio tronchetti" + }, + new + { + PhaseID = 2, + Description = "Lavorazione pezzi serramento" + }, + new + { + PhaseID = 3, + Description = "Verniciatura" + }, + new + { + PhaseID = 4, + Description = "Assemblaggio completo" + }, + new + { + PhaseID = 5, + Description = "Assemblaggio Ferramenta" + }, + new + { + PhaseID = 6, + Description = "Installazione e posa in opera" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.ProductionBatchModel", b => + { + b.Property("ProductionBatchID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductionBatchID")); + + b.Property("DateEnd") + .HasColumnType("datetime(6)"); + + b.Property("DateStart") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DueDate") + .HasColumnType("datetime(6)"); + + b.HasKey("ProductionBatchID"); + + b.ToTable("ProductionBatch"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.ProductionItemModel", b => + { + b.Property("ProdItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemID")); + + b.Property("ExtItemCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ItemCode") + .HasColumnType("int"); + + b.Property("OrderRowID") + .HasColumnType("int"); + + b.Property("ProductionBatchID") + .HasColumnType("int"); + + b.HasKey("ProdItemID"); + + b.HasIndex("OrderRowID"); + + b.HasIndex("ProductionBatchID"); + + b.ToTable("ProductionItem"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.ProductionItemRowModel", b => + { + b.Property("ProdItemRowID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemRowID")); + + b.Property("DateEnd") + .HasColumnType("datetime(6)"); + + b.Property("DateStart") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("PhaseID") + .HasColumnType("int"); + + b.Property("ProdItemID") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("double"); + + b.Property("ResourceID") + .HasColumnType("int"); + + b.Property("WorkTime") + .HasColumnType("double"); + + b.HasKey("ProdItemRowID"); + + b.HasIndex("PhaseID"); + + b.HasIndex("ProdItemID"); + + b.HasIndex("ResourceID"); + + b.ToTable("ProductionItemRowList"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.ResourceModel", b => + { + b.Property("ResourceID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ResourceID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsAsset") + .HasColumnType("tinyint(1)"); + + b.Property("IsHuman") + .HasColumnType("tinyint(1)"); + + b.Property("UmFix") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UmProp") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UnitCostFix") + .HasColumnType("double"); + + b.Property("UnitCostProp") + .HasColumnType("double"); + + b.HasKey("ResourceID"); + + b.ToTable("RegResource"); + + b.HasData( + new + { + ResourceID = 1, + Description = "Sezionatrice", + IsAsset = true, + IsHuman = false, + UmFix = "€/h", + UmProp = "", + UnitCostFix = 15.0, + UnitCostProp = 0.0 + }, + new + { + ResourceID = 2, + Description = "Linea SAOMAD WoodPecker Just 3500", + IsAsset = true, + IsHuman = false, + UmFix = "€/h", + UmProp = "€/m", + UnitCostFix = 540.0, + UnitCostProp = 1.8999999999999999 + }, + new + { + ResourceID = 3, + Description = "Linea Pantografo", + IsAsset = true, + IsHuman = false, + UmFix = "€/h", + UmProp = "", + UnitCostFix = 250.0, + UnitCostProp = 0.0 + }, + new + { + ResourceID = 4, + Description = "Stazione Verniciatura", + IsAsset = true, + IsHuman = false, + UmFix = "€/h", + UmProp = "€/m", + UnitCostFix = 10.0, + UnitCostProp = 1.8999999999999999 + }, + new + { + ResourceID = 5, + Description = "Verniciatura Manuale", + IsAsset = false, + IsHuman = true, + UmFix = "€/h", + UmProp = "€/m", + UnitCostFix = 40.0, + UnitCostProp = 1.8999999999999999 + }, + new + { + ResourceID = 6, + Description = "Montaggio Manuale", + IsAsset = false, + IsHuman = true, + UmFix = "", + UmProp = "€/h", + UnitCostFix = 0.0, + UnitCostProp = 40.0 + }, + new + { + ResourceID = 7, + Description = "Installatore", + IsAsset = false, + IsHuman = true, + UmFix = "", + UmProp = "€/h", + UnitCostFix = 0.0, + UnitCostProp = 40.0 + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.SellingItemModel", b => + { + b.Property("SellingItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SellingItemID")); + + b.Property("Cost") + .HasColumnType("double"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ExtItemCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsService") + .HasColumnType("tinyint(1)"); + + b.Property("ItemCode") + .HasColumnType("int"); + + b.Property("ItemSPP") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("JobID") + .HasColumnType("int"); + + b.Property("Margin") + .HasColumnType("double"); + + b.Property("SerStruct") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("SupplCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UM") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("SellingItemID"); + + b.HasIndex("JobID"); + + b.ToTable("SellingItem"); + + b.HasData( + new + { + SellingItemID = 1, + Cost = 820.0, + Description = "Finestra anta Singola", + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSPP = "", + JobID = 2, + Margin = 0.20000000000000001, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 2, + Cost = 150.0, + Description = "Persiana anta singola", + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSPP = "", + JobID = 1, + Margin = 0.10000000000000001, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 3, + Cost = 200.0, + Description = "Installazione", + ExtItemCode = "", + IsService = true, + ItemCode = 0, + ItemSPP = "", + JobID = 1, + Margin = 0.29999999999999999, + SerStruct = "", + SupplCode = "", + UM = "#" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.StockMovModel", b => + { + b.Property("StockMovID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("StockMovID")); + + b.Property("DtRec") + .HasColumnType("datetime(6)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("QtyRec") + .HasColumnType("double"); + + b.Property("StockStatusId") + .HasColumnType("int"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("StockMovID"); + + b.HasIndex("StockStatusId"); + + b.ToTable("StockMov"); + + b.HasData( + new + { + StockMovID = 1, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7890), + Note = "DEMO", + QtyRec = 5.0, + StockStatusId = 1, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 2, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7895), + Note = "DEMO", + QtyRec = 8.0, + StockStatusId = 2, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 3, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7899), + Note = "DEMO", + QtyRec = 5.0, + StockStatusId = 3, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 4, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7903), + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 4, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 5, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7906), + Note = "DEMO", + QtyRec = 10.0, + StockStatusId = 5, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 6, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7910), + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 6, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 7, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7914), + Note = "DEMO", + QtyRec = 50.0, + StockStatusId = 7, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 8, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7917), + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 8, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 9, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7921), + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 9, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 10, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7925), + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 10, + UserId = "samuele.locatelli@egalware.com" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.StockStatusModel", b => + { + b.Property("StockStatusId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("StockStatusId")); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("IsRemn") + .HasColumnType("tinyint(1)"); + + b.Property("ItemID") + .HasColumnType("int"); + + b.Property("Location") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("QtyAvail") + .HasColumnType("double"); + + b.HasKey("StockStatusId"); + + b.HasIndex("ItemID"); + + b.ToTable("StockStatus"); + + b.HasData( + new + { + StockStatusId = 1, + IsDeleted = false, + IsRemn = false, + ItemID = 1, + Location = "B001-001-003", + QtyAvail = 5.0 + }, + new + { + StockStatusId = 2, + IsDeleted = false, + IsRemn = false, + ItemID = 2, + Location = "B001-001-002", + QtyAvail = 8.0 + }, + new + { + StockStatusId = 3, + IsDeleted = false, + IsRemn = false, + ItemID = 3, + Location = "B001-001-001", + QtyAvail = 5.0 + }, + new + { + StockStatusId = 4, + IsDeleted = false, + IsRemn = false, + ItemID = 4, + Location = "V002-001-001", + QtyAvail = 1.0 + }, + new + { + StockStatusId = 5, + IsDeleted = false, + IsRemn = false, + ItemID = 5, + Location = "V001-001-002", + QtyAvail = 10.0 + }, + new + { + StockStatusId = 6, + IsDeleted = false, + IsRemn = false, + ItemID = 6, + Location = "V001-001-003", + QtyAvail = 1.0 + }, + new + { + StockStatusId = 7, + IsDeleted = false, + IsRemn = false, + ItemID = 7, + Location = "V001-001-003", + QtyAvail = 50.0 + }, + new + { + StockStatusId = 8, + IsDeleted = false, + IsRemn = false, + ItemID = 8, + Location = "S001-002-001", + QtyAvail = 1.0 + }, + new + { + StockStatusId = 9, + IsDeleted = false, + IsRemn = false, + ItemID = 9, + Location = "S001-002-001", + QtyAvail = 1.0 + }, + new + { + StockStatusId = 10, + IsDeleted = false, + IsRemn = false, + ItemID = 10, + Location = "S001-001-001", + QtyAvail = 1.0 + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.SupplierModel", b => + { + b.Property("SupplierID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SupplierID")); + + b.Property("CompanyName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VAT") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("SupplierID"); + + b.ToTable("RegSupplier"); + + b.HasData( + new + { + SupplierID = 1, + CompanyName = "Company One", + FirstName = "Supplier A", + LastName = "Egalware", + VAT = "7294857103879254" + }, + new + { + SupplierID = 2, + CompanyName = "Company Two", + FirstName = "Supplier B", + LastName = "User", + VAT = "7294857103879254" + }, + new + { + SupplierID = 3, + CompanyName = "Company Two", + FirstName = "Supplier C", + LastName = "User Test", + VAT = "7294857103879254" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.TagsModel", b => + { + b.Property("TagID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TagID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("TagID"); + + b.ToTable("RegTags"); + + b.HasData( + new + { + TagID = 1, + Description = "Tag 01" + }, + new + { + TagID = 2, + Description = "Tag 02" + }, + new + { + TagID = 3, + Description = "Tag 03" + }, + new + { + TagID = 4, + Description = "Tag 04" + }, + new + { + TagID = 5, + Description = "Tag 05" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.JobRowItemModel", b => + { + b.HasOne("Lux.Data.DbModel.ItemModel", "ItemNav") + .WithMany() + .HasForeignKey("ItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.JobRowModel", "JobRowNav") + .WithMany() + .HasForeignKey("JobRowID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ItemNav"); + + b.Navigation("JobRowNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.JobRowModel", b => + { + b.HasOne("Lux.Data.DbModel.JobModel", "JobNav") + .WithMany() + .HasForeignKey("JobID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.PhaseModel", "PhaseNav") + .WithMany() + .HasForeignKey("PhaseID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.ResourceModel", "ResourceNav") + .WithMany() + .HasForeignKey("ResourceID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("JobNav"); + + b.Navigation("PhaseNav"); + + b.Navigation("ResourceNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OfferModel", b => + { + b.HasOne("Lux.Data.DbModel.CustomerModel", "CustomerNav") + .WithMany() + .HasForeignKey("CustomerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.DealerModel", "DealerNav") + .WithMany() + .HasForeignKey("DealerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CustomerNav"); + + b.Navigation("DealerNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OfferRowModel", b => + { + b.HasOne("Lux.Data.DbModel.OfferModel", "OfferNav") + .WithMany() + .HasForeignKey("OfferID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.SellingItemModel", "SellingItemNav") + .WithMany() + .HasForeignKey("SellingItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OfferNav"); + + b.Navigation("SellingItemNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OrderModel", b => + { + b.HasOne("Lux.Data.DbModel.CustomerModel", "CustomerNav") + .WithMany() + .HasForeignKey("CustomerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.DealerModel", "DealerNav") + .WithMany() + .HasForeignKey("DealerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.OfferModel", "OfferNav") + .WithMany() + .HasForeignKey("OfferID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CustomerNav"); + + b.Navigation("DealerNav"); + + b.Navigation("OfferNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OrderRowModel", b => + { + b.HasOne("Lux.Data.DbModel.OrderModel", "OrderNav") + .WithMany() + .HasForeignKey("OrderID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.SellingItemModel", "SellingItemNav") + .WithMany() + .HasForeignKey("SellingItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OrderNav"); + + b.Navigation("SellingItemNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.ProductionItemModel", b => + { + b.HasOne("Lux.Data.DbModel.OrderRowModel", "OrderRowNav") + .WithMany() + .HasForeignKey("OrderRowID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.ProductionBatchModel", "ProductionBatchNav") + .WithMany() + .HasForeignKey("ProductionBatchID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OrderRowNav"); + + b.Navigation("ProductionBatchNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.ProductionItemRowModel", b => + { + b.HasOne("Lux.Data.DbModel.PhaseModel", "PhaseNav") + .WithMany() + .HasForeignKey("PhaseID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.ProductionItemModel", "ProdItemNav") + .WithMany() + .HasForeignKey("ProdItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.ResourceModel", "ResourceNav") + .WithMany() + .HasForeignKey("ResourceID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("PhaseNav"); + + b.Navigation("ProdItemNav"); + + b.Navigation("ResourceNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.SellingItemModel", b => + { + b.HasOne("Lux.Data.DbModel.JobModel", "JobNav") + .WithMany() + .HasForeignKey("JobID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("JobNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.StockMovModel", b => + { + b.HasOne("Lux.Data.DbModel.StockStatusModel", "StockStatusNav") + .WithMany() + .HasForeignKey("StockStatusId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("StockStatusNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.StockStatusModel", b => + { + b.HasOne("Lux.Data.DbModel.ItemModel", "ItemNav") + .WithMany() + .HasForeignKey("ItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ItemNav"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Lux.Data/Migrations/20250707161305_InitDb.cs b/Lux.Data/Migrations/20250707161305_InitDb.cs new file mode 100644 index 00000000..3c89208e --- /dev/null +++ b/Lux.Data/Migrations/20250707161305_InitDb.cs @@ -0,0 +1,929 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace Lux.Data.Migrations +{ + /// + public partial class InitDb : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterDatabase() + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "JobList", + columns: table => new + { + JobID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_JobList", x => x.JobID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ProductionBatch", + columns: table => new + { + ProductionBatchID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + DueDate = table.Column(type: "datetime(6)", nullable: false), + DateStart = table.Column(type: "datetime(6)", nullable: true), + DateEnd = table.Column(type: "datetime(6)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductionBatch", x => x.ProductionBatchID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "RegCustomer", + columns: table => new + { + CustomerID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CompanyName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + FirstName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + LastName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + VAT = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_RegCustomer", x => x.CustomerID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "RegDealer", + columns: table => new + { + DealerID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CompanyName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + FirstName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + LastName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + VAT = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_RegDealer", x => x.DealerID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "RegItem", + columns: table => new + { + ItemID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + IsService = table.Column(type: "tinyint(1)", nullable: false), + ItemCode = table.Column(type: "int", nullable: false), + ExtItemCode = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + SupplCode = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Cost = table.Column(type: "double", nullable: false), + Margin = table.Column(type: "double", nullable: false), + UM = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_RegItem", x => x.ItemID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "RegPhase", + columns: table => new + { + PhaseID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_RegPhase", x => x.PhaseID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "RegResource", + columns: table => new + { + ResourceID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + IsAsset = table.Column(type: "tinyint(1)", nullable: false), + IsHuman = table.Column(type: "tinyint(1)", nullable: false), + UnitCostFix = table.Column(type: "double", nullable: false), + UmFix = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + UnitCostProp = table.Column(type: "double", nullable: false), + UmProp = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_RegResource", x => x.ResourceID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "RegSupplier", + columns: table => new + { + SupplierID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + CompanyName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + FirstName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + LastName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + VAT = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_RegSupplier", x => x.SupplierID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "RegTags", + columns: table => new + { + TagID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_RegTags", x => x.TagID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "SellingItem", + columns: table => new + { + SellingItemID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + IsService = table.Column(type: "tinyint(1)", nullable: false), + JobID = table.Column(type: "int", nullable: false), + ItemCode = table.Column(type: "int", nullable: false), + ExtItemCode = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + SupplCode = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Cost = table.Column(type: "double", nullable: false), + Margin = table.Column(type: "double", nullable: false), + UM = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + SerStruct = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ItemSPP = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_SellingItem", x => x.SellingItemID); + table.ForeignKey( + name: "FK_SellingItem_JobList_JobID", + column: x => x.JobID, + principalTable: "JobList", + principalColumn: "JobID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Offer", + columns: table => new + { + OfferID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + RefYear = table.Column(type: "int", nullable: false), + RefNum = table.Column(type: "int", nullable: false), + RefRev = table.Column(type: "int", nullable: false), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CustomerID = table.Column(type: "int", nullable: false), + DealerID = table.Column(type: "int", nullable: false), + ValidUntil = table.Column(type: "datetime(6)", nullable: false), + Inserted = table.Column(type: "datetime(6)", nullable: false), + Modified = table.Column(type: "datetime(6)", nullable: false), + OffertState = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Offer", x => x.OfferID); + table.ForeignKey( + name: "FK_Offer_RegCustomer_CustomerID", + column: x => x.CustomerID, + principalTable: "RegCustomer", + principalColumn: "CustomerID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Offer_RegDealer_DealerID", + column: x => x.DealerID, + principalTable: "RegDealer", + principalColumn: "DealerID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "StockStatus", + columns: table => new + { + StockStatusId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ItemID = table.Column(type: "int", nullable: false), + QtyAvail = table.Column(type: "double", nullable: false), + IsDeleted = table.Column(type: "tinyint(1)", nullable: false), + IsRemn = table.Column(type: "tinyint(1)", nullable: false), + Location = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_StockStatus", x => x.StockStatusId); + table.ForeignKey( + name: "FK_StockStatus_RegItem_ItemID", + column: x => x.ItemID, + principalTable: "RegItem", + principalColumn: "ItemID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "JobRowList", + columns: table => new + { + JobRowID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + JobID = table.Column(type: "int", nullable: false), + Index = table.Column(type: "int", nullable: false), + PhaseID = table.Column(type: "int", nullable: false), + ResourceID = table.Column(type: "int", nullable: false), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Qty = table.Column(type: "double", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_JobRowList", x => x.JobRowID); + table.ForeignKey( + name: "FK_JobRowList_JobList_JobID", + column: x => x.JobID, + principalTable: "JobList", + principalColumn: "JobID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_JobRowList_RegPhase_PhaseID", + column: x => x.PhaseID, + principalTable: "RegPhase", + principalColumn: "PhaseID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_JobRowList_RegResource_ResourceID", + column: x => x.ResourceID, + principalTable: "RegResource", + principalColumn: "ResourceID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "OfferRowList", + columns: table => new + { + OfferRowID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + OfferID = table.Column(type: "int", nullable: false), + RowNum = table.Column(type: "int", nullable: false), + SellingItemID = table.Column(type: "int", nullable: false), + Cost = table.Column(type: "double", nullable: false), + Qty = table.Column(type: "double", nullable: false), + SerStruct = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ItemSPP = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Note = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Inserted = table.Column(type: "datetime(6)", nullable: false), + Modified = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_OfferRowList", x => x.OfferRowID); + table.ForeignKey( + name: "FK_OfferRowList_Offer_OfferID", + column: x => x.OfferID, + principalTable: "Offer", + principalColumn: "OfferID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_OfferRowList_SellingItem_SellingItemID", + column: x => x.SellingItemID, + principalTable: "SellingItem", + principalColumn: "SellingItemID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Order", + columns: table => new + { + OrderID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + OfferID = table.Column(type: "int", nullable: false), + RefYear = table.Column(type: "int", nullable: false), + RefNum = table.Column(type: "int", nullable: false), + RefRev = table.Column(type: "int", nullable: false), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CustomerID = table.Column(type: "int", nullable: false), + DealerID = table.Column(type: "int", nullable: false), + ValidUntil = table.Column(type: "datetime(6)", nullable: false), + Inserted = table.Column(type: "datetime(6)", nullable: false), + Modified = table.Column(type: "datetime(6)", nullable: false), + OffertState = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Order", x => x.OrderID); + table.ForeignKey( + name: "FK_Order_Offer_OfferID", + column: x => x.OfferID, + principalTable: "Offer", + principalColumn: "OfferID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Order_RegCustomer_CustomerID", + column: x => x.CustomerID, + principalTable: "RegCustomer", + principalColumn: "CustomerID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Order_RegDealer_DealerID", + column: x => x.DealerID, + principalTable: "RegDealer", + principalColumn: "DealerID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "StockMov", + columns: table => new + { + StockMovID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + StockStatusId = table.Column(type: "int", nullable: false), + DtRec = table.Column(type: "datetime(6)", nullable: false), + QtyRec = table.Column(type: "double", nullable: false), + UserId = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Note = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_StockMov", x => x.StockMovID); + table.ForeignKey( + name: "FK_StockMov_StockStatus_StockStatusId", + column: x => x.StockStatusId, + principalTable: "StockStatus", + principalColumn: "StockStatusId", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "JobRowItemList", + columns: table => new + { + JobRowItemID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + JobRowID = table.Column(type: "int", nullable: false), + Index = table.Column(type: "int", nullable: false), + ItemID = table.Column(type: "int", nullable: false), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Qty = table.Column(type: "double", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_JobRowItemList", x => x.JobRowItemID); + table.ForeignKey( + name: "FK_JobRowItemList_JobRowList_JobRowID", + column: x => x.JobRowID, + principalTable: "JobRowList", + principalColumn: "JobRowID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_JobRowItemList_RegItem_ItemID", + column: x => x.ItemID, + principalTable: "RegItem", + principalColumn: "ItemID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "OrderRowList", + columns: table => new + { + OrderRowID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + OrderID = table.Column(type: "int", nullable: false), + RowNum = table.Column(type: "int", nullable: false), + SellingItemID = table.Column(type: "int", nullable: false), + Cost = table.Column(type: "double", nullable: false), + Qty = table.Column(type: "double", nullable: false), + SerStruct = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ItemSPP = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Note = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Inserted = table.Column(type: "datetime(6)", nullable: false), + Modified = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_OrderRowList", x => x.OrderRowID); + table.ForeignKey( + name: "FK_OrderRowList_Order_OrderID", + column: x => x.OrderID, + principalTable: "Order", + principalColumn: "OrderID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_OrderRowList_SellingItem_SellingItemID", + column: x => x.SellingItemID, + principalTable: "SellingItem", + principalColumn: "SellingItemID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ProductionItem", + columns: table => new + { + ProdItemID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + OrderRowID = table.Column(type: "int", nullable: false), + ItemCode = table.Column(type: "int", nullable: false), + ExtItemCode = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ProductionBatchID = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductionItem", x => x.ProdItemID); + table.ForeignKey( + name: "FK_ProductionItem_OrderRowList_OrderRowID", + column: x => x.OrderRowID, + principalTable: "OrderRowList", + principalColumn: "OrderRowID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_ProductionItem_ProductionBatch_ProductionBatchID", + column: x => x.ProductionBatchID, + principalTable: "ProductionBatch", + principalColumn: "ProductionBatchID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ProductionItemRowList", + columns: table => new + { + ProdItemRowID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ProdItemID = table.Column(type: "int", nullable: false), + Index = table.Column(type: "int", nullable: false), + PhaseID = table.Column(type: "int", nullable: false), + ResourceID = table.Column(type: "int", nullable: false), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Qty = table.Column(type: "double", nullable: false), + DateStart = table.Column(type: "datetime(6)", nullable: true), + DateEnd = table.Column(type: "datetime(6)", nullable: true), + WorkTime = table.Column(type: "double", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductionItemRowList", x => x.ProdItemRowID); + table.ForeignKey( + name: "FK_ProductionItemRowList_ProductionItem_ProdItemID", + column: x => x.ProdItemID, + principalTable: "ProductionItem", + principalColumn: "ProdItemID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_ProductionItemRowList_RegPhase_PhaseID", + column: x => x.PhaseID, + principalTable: "RegPhase", + principalColumn: "PhaseID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_ProductionItemRowList_RegResource_ResourceID", + column: x => x.ResourceID, + principalTable: "RegResource", + principalColumn: "ResourceID", + onDelete: ReferentialAction.Restrict); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.InsertData( + table: "JobList", + columns: new[] { "JobID", "Description" }, + values: new object[,] + { + { 1, "Rivendita / servizi" }, + { 2, "Serramento Completo Legno su linea Saomad e installatore interno" } + }); + + migrationBuilder.InsertData( + table: "RegCustomer", + columns: new[] { "CustomerID", "CompanyName", "FirstName", "LastName", "VAT" }, + values: new object[,] + { + { 1, "", "Customer A", "Egalware", "1234567890123456" }, + { 2, "", "Customer B", "User", "1234567890123456" }, + { 3, "", "Customer C", "User Test", "1234567890123456" } + }); + + migrationBuilder.InsertData( + table: "RegDealer", + columns: new[] { "DealerID", "CompanyName", "FirstName", "LastName", "VAT" }, + values: new object[,] + { + { 1, "Company First", "Dealer A", "Egalware", "9587362514671527" }, + { 2, "Company First", "Dealer B", "User", "9587362514671527" }, + { 3, "Company Second", "Dealer C", "User Test", "9587362514671527" } + }); + + migrationBuilder.InsertData( + table: "RegItem", + columns: new[] { "ItemID", "Cost", "Description", "ExtItemCode", "IsService", "ItemCode", "Margin", "SupplCode", "UM" }, + values: new object[,] + { + { 1, 20.0, "BARRA-60x80 generica", "", false, 1001, 0.29999999999999999, "BARR.001", "#" }, + { 2, 16.5, "Barra 60x80, lunghezza 12m", "BARRA-60x80x12000", false, 1002, 0.20999999999999999, "ABC.00123.12000", "#" }, + { 3, 17.5, "Barra 60x80, lunghezza 8m", "BARRA-60x80x8000", false, 1003, 0.22, "ABC.00123.8000", "#" }, + { 4, 15.5, "Barra 60x80, lunghezza 16m", "BARRA-60x80x16000", false, 1004, 0.20000000000000001, "ABC.00123.16000", "#" }, + { 5, 300.0, "Vetro triplo, basso indice termico, 800x1000", "VETRO-3L-THERMO-800x1000", false, 2001, 0.20000000000000001, "V3T.800.1000", "m2" }, + { 6, 200.0, "Vetro doppio, 800x1000", "VETRO-2L-800x1000", false, 2002, 0.14999999999999999, "V2.800.1000", "m2" }, + { 7, 250.0, "Vetro triplo, 800x1000", "VETRO-3L-800x1000", false, 2003, 0.17999999999999999, "V3.800.1000", "m2" }, + { 8, 20.0, "Vernice trasparente", "VERN-TRASP", false, 3001, 0.20000000000000001, "VT.STD", "l" }, + { 9, 65.0, "Kit standard completo AGB tipo 001", "KIT-001", false, 5001, 0.20000000000000001, "AGB-KIT-001", "#" }, + { 10, 10.0, "Cerniera AGB tipo 001", "CERN-001", false, 5002, 0.20000000000000001, "AGB-CERN-001", "#" }, + { 11, 15.0, "Serratura AGB tipo 001", "SERR-001", false, 5003, 0.20000000000000001, "AGB-SERR-001", "#" }, + { 12, 25.0, "Maniglia AGB tipo 001", "MAN-001", false, 5004, 0.20000000000000001, "AGB-MAN-001", "#" } + }); + + migrationBuilder.InsertData( + table: "RegPhase", + columns: new[] { "PhaseID", "Description" }, + values: new object[,] + { + { 1, "Taglio tronchetti" }, + { 2, "Lavorazione pezzi serramento" }, + { 3, "Verniciatura" }, + { 4, "Assemblaggio completo" }, + { 5, "Assemblaggio Ferramenta" }, + { 6, "Installazione e posa in opera" } + }); + + migrationBuilder.InsertData( + table: "RegResource", + columns: new[] { "ResourceID", "Description", "IsAsset", "IsHuman", "UmFix", "UmProp", "UnitCostFix", "UnitCostProp" }, + values: new object[,] + { + { 1, "Sezionatrice", true, false, "€/h", "", 15.0, 0.0 }, + { 2, "Linea SAOMAD WoodPecker Just 3500", true, false, "€/h", "€/m", 540.0, 1.8999999999999999 }, + { 3, "Linea Pantografo", true, false, "€/h", "", 250.0, 0.0 }, + { 4, "Stazione Verniciatura", true, false, "€/h", "€/m", 10.0, 1.8999999999999999 }, + { 5, "Verniciatura Manuale", false, true, "€/h", "€/m", 40.0, 1.8999999999999999 }, + { 6, "Montaggio Manuale", false, true, "", "€/h", 0.0, 40.0 }, + { 7, "Installatore", false, true, "", "€/h", 0.0, 40.0 } + }); + + migrationBuilder.InsertData( + table: "RegSupplier", + columns: new[] { "SupplierID", "CompanyName", "FirstName", "LastName", "VAT" }, + values: new object[,] + { + { 1, "Company One", "Supplier A", "Egalware", "7294857103879254" }, + { 2, "Company Two", "Supplier B", "User", "7294857103879254" }, + { 3, "Company Two", "Supplier C", "User Test", "7294857103879254" } + }); + + migrationBuilder.InsertData( + table: "RegTags", + columns: new[] { "TagID", "Description" }, + values: new object[,] + { + { 1, "Tag 01" }, + { 2, "Tag 02" }, + { 3, "Tag 03" }, + { 4, "Tag 04" }, + { 5, "Tag 05" } + }); + + migrationBuilder.InsertData( + table: "JobRowList", + columns: new[] { "JobRowID", "Description", "Index", "JobID", "PhaseID", "Qty", "ResourceID" }, + values: new object[,] + { + { 1, "", 1, 2, 1, 1.0, 1 }, + { 2, "", 2, 2, 2, 1.0, 2 }, + { 3, "", 3, 2, 3, 1.0, 4 }, + { 4, "", 4, 2, 4, 1.0, 6 }, + { 5, "", 5, 2, 6, 1.0, 7 } + }); + + migrationBuilder.InsertData( + table: "Offer", + columns: new[] { "OfferID", "CustomerID", "DealerID", "Description", "Inserted", "Modified", "OffertState", "RefNum", "RefRev", "RefYear", "ValidUntil" }, + values: new object[] { 1, 2, 2, "Offerta per tre serramenti", new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8097), new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8099), 0, 1, 1, 2024, new DateTime(2025, 8, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8094) }); + + migrationBuilder.InsertData( + table: "SellingItem", + columns: new[] { "SellingItemID", "Cost", "Description", "ExtItemCode", "IsService", "ItemCode", "ItemSPP", "JobID", "Margin", "SerStruct", "SupplCode", "UM" }, + values: new object[,] + { + { 1, 820.0, "Finestra anta Singola", "", false, 0, "", 2, 0.20000000000000001, "", "", "#" }, + { 2, 150.0, "Persiana anta singola", "", false, 0, "", 1, 0.10000000000000001, "", "", "#" }, + { 3, 200.0, "Installazione", "", true, 0, "", 1, 0.29999999999999999, "", "", "#" } + }); + + migrationBuilder.InsertData( + table: "StockStatus", + columns: new[] { "StockStatusId", "IsDeleted", "IsRemn", "ItemID", "Location", "QtyAvail" }, + values: new object[,] + { + { 1, false, false, 1, "B001-001-003", 5.0 }, + { 2, false, false, 2, "B001-001-002", 8.0 }, + { 3, false, false, 3, "B001-001-001", 5.0 }, + { 4, false, false, 4, "V002-001-001", 1.0 }, + { 5, false, false, 5, "V001-001-002", 10.0 }, + { 6, false, false, 6, "V001-001-003", 1.0 }, + { 7, false, false, 7, "V001-001-003", 50.0 }, + { 8, false, false, 8, "S001-002-001", 1.0 }, + { 9, false, false, 9, "S001-002-001", 1.0 }, + { 10, false, false, 10, "S001-001-001", 1.0 } + }); + + migrationBuilder.InsertData( + table: "JobRowItemList", + columns: new[] { "JobRowItemID", "Description", "Index", "ItemID", "JobRowID", "Qty" }, + values: new object[,] + { + { 1, "Grezzo legno abete", 1, 1, 1, 1.0 }, + { 2, "Vernice trasparente standard 1L", 2, 8, 3, 0.10000000000000001 }, + { 3, "Ferramenta AGB - rif. AGFD.00000.00000", 3, 9, 4, 1.0 } + }); + + migrationBuilder.InsertData( + table: "OfferRowList", + columns: new[] { "OfferRowID", "Cost", "Inserted", "ItemSPP", "Modified", "Note", "OfferID", "Qty", "RowNum", "SellingItemID", "SerStruct" }, + values: new object[,] + { + { 1, 950.0, new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8123), "{}", new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8125), "Finestra anta singola 2025", 1, 3.0, 1, 1, "{}" }, + { 2, 160.0, new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8137), "{}", new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8138), "Persiana per Finestra anta singola 2025", 1, 3.0, 1, 2, "{}" }, + { 3, 200.0, new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8144), "{}", new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8145), "Installazione serramento", 1, 3.0, 1, 3, "{}" } + }); + + migrationBuilder.InsertData( + table: "StockMov", + columns: new[] { "StockMovID", "DtRec", "Note", "QtyRec", "StockStatusId", "UserId" }, + values: new object[,] + { + { 1, new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7890), "DEMO", 5.0, 1, "samuele.locatelli@egalware.com" }, + { 2, new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7895), "DEMO", 8.0, 2, "samuele.locatelli@egalware.com" }, + { 3, new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7899), "DEMO", 5.0, 3, "samuele.locatelli@egalware.com" }, + { 4, new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7903), "DEMO", 1.0, 4, "samuele.locatelli@egalware.com" }, + { 5, new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7906), "DEMO", 10.0, 5, "samuele.locatelli@egalware.com" }, + { 6, new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7910), "DEMO", 1.0, 6, "samuele.locatelli@egalware.com" }, + { 7, new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7914), "DEMO", 50.0, 7, "samuele.locatelli@egalware.com" }, + { 8, new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7917), "DEMO", 1.0, 8, "samuele.locatelli@egalware.com" }, + { 9, new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7921), "DEMO", 1.0, 9, "samuele.locatelli@egalware.com" }, + { 10, new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7925), "DEMO", 1.0, 10, "samuele.locatelli@egalware.com" } + }); + + migrationBuilder.CreateIndex( + name: "IX_JobRowItemList_ItemID", + table: "JobRowItemList", + column: "ItemID"); + + migrationBuilder.CreateIndex( + name: "IX_JobRowItemList_JobRowID", + table: "JobRowItemList", + column: "JobRowID"); + + migrationBuilder.CreateIndex( + name: "IX_JobRowList_JobID", + table: "JobRowList", + column: "JobID"); + + migrationBuilder.CreateIndex( + name: "IX_JobRowList_PhaseID", + table: "JobRowList", + column: "PhaseID"); + + migrationBuilder.CreateIndex( + name: "IX_JobRowList_ResourceID", + table: "JobRowList", + column: "ResourceID"); + + migrationBuilder.CreateIndex( + name: "IX_Offer_CustomerID", + table: "Offer", + column: "CustomerID"); + + migrationBuilder.CreateIndex( + name: "IX_Offer_DealerID", + table: "Offer", + column: "DealerID"); + + migrationBuilder.CreateIndex( + name: "IX_OfferRowList_OfferID", + table: "OfferRowList", + column: "OfferID"); + + migrationBuilder.CreateIndex( + name: "IX_OfferRowList_SellingItemID", + table: "OfferRowList", + column: "SellingItemID"); + + migrationBuilder.CreateIndex( + name: "IX_Order_CustomerID", + table: "Order", + column: "CustomerID"); + + migrationBuilder.CreateIndex( + name: "IX_Order_DealerID", + table: "Order", + column: "DealerID"); + + migrationBuilder.CreateIndex( + name: "IX_Order_OfferID", + table: "Order", + column: "OfferID"); + + migrationBuilder.CreateIndex( + name: "IX_OrderRowList_OrderID", + table: "OrderRowList", + column: "OrderID"); + + migrationBuilder.CreateIndex( + name: "IX_OrderRowList_SellingItemID", + table: "OrderRowList", + column: "SellingItemID"); + + migrationBuilder.CreateIndex( + name: "IX_ProductionItem_OrderRowID", + table: "ProductionItem", + column: "OrderRowID"); + + migrationBuilder.CreateIndex( + name: "IX_ProductionItem_ProductionBatchID", + table: "ProductionItem", + column: "ProductionBatchID"); + + migrationBuilder.CreateIndex( + name: "IX_ProductionItemRowList_PhaseID", + table: "ProductionItemRowList", + column: "PhaseID"); + + migrationBuilder.CreateIndex( + name: "IX_ProductionItemRowList_ProdItemID", + table: "ProductionItemRowList", + column: "ProdItemID"); + + migrationBuilder.CreateIndex( + name: "IX_ProductionItemRowList_ResourceID", + table: "ProductionItemRowList", + column: "ResourceID"); + + migrationBuilder.CreateIndex( + name: "IX_SellingItem_JobID", + table: "SellingItem", + column: "JobID"); + + migrationBuilder.CreateIndex( + name: "IX_StockMov_StockStatusId", + table: "StockMov", + column: "StockStatusId"); + + migrationBuilder.CreateIndex( + name: "IX_StockStatus_ItemID", + table: "StockStatus", + column: "ItemID"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "JobRowItemList"); + + migrationBuilder.DropTable( + name: "OfferRowList"); + + migrationBuilder.DropTable( + name: "ProductionItemRowList"); + + migrationBuilder.DropTable( + name: "RegSupplier"); + + migrationBuilder.DropTable( + name: "RegTags"); + + migrationBuilder.DropTable( + name: "StockMov"); + + migrationBuilder.DropTable( + name: "JobRowList"); + + migrationBuilder.DropTable( + name: "ProductionItem"); + + migrationBuilder.DropTable( + name: "StockStatus"); + + migrationBuilder.DropTable( + name: "RegPhase"); + + migrationBuilder.DropTable( + name: "RegResource"); + + migrationBuilder.DropTable( + name: "OrderRowList"); + + migrationBuilder.DropTable( + name: "ProductionBatch"); + + migrationBuilder.DropTable( + name: "RegItem"); + + migrationBuilder.DropTable( + name: "Order"); + + migrationBuilder.DropTable( + name: "SellingItem"); + + migrationBuilder.DropTable( + name: "Offer"); + + migrationBuilder.DropTable( + name: "JobList"); + + migrationBuilder.DropTable( + name: "RegCustomer"); + + migrationBuilder.DropTable( + name: "RegDealer"); + } + } +} diff --git a/Lux.Data/Migrations/DataLayerContextModelSnapshot.cs b/Lux.Data/Migrations/DataLayerContextModelSnapshot.cs new file mode 100644 index 00000000..626162b7 --- /dev/null +++ b/Lux.Data/Migrations/DataLayerContextModelSnapshot.cs @@ -0,0 +1,1690 @@ +// +using System; +using Lux.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Lux.Data.Migrations +{ + [DbContext(typeof(DataLayerContext))] + partial class DataLayerContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.17") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Lux.Data.DbModel.CustomerModel", b => + { + b.Property("CustomerID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CustomerID")); + + b.Property("CompanyName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VAT") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("CustomerID"); + + b.ToTable("RegCustomer"); + + b.HasData( + new + { + CustomerID = 1, + CompanyName = "", + FirstName = "Customer A", + LastName = "Egalware", + VAT = "1234567890123456" + }, + new + { + CustomerID = 2, + CompanyName = "", + FirstName = "Customer B", + LastName = "User", + VAT = "1234567890123456" + }, + new + { + CustomerID = 3, + CompanyName = "", + FirstName = "Customer C", + LastName = "User Test", + VAT = "1234567890123456" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.DealerModel", b => + { + b.Property("DealerID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DealerID")); + + b.Property("CompanyName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VAT") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("DealerID"); + + b.ToTable("RegDealer"); + + b.HasData( + new + { + DealerID = 1, + CompanyName = "Company First", + FirstName = "Dealer A", + LastName = "Egalware", + VAT = "9587362514671527" + }, + new + { + DealerID = 2, + CompanyName = "Company First", + FirstName = "Dealer B", + LastName = "User", + VAT = "9587362514671527" + }, + new + { + DealerID = 3, + CompanyName = "Company Second", + FirstName = "Dealer C", + LastName = "User Test", + VAT = "9587362514671527" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.ItemModel", b => + { + b.Property("ItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemID")); + + b.Property("Cost") + .HasColumnType("double"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ExtItemCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsService") + .HasColumnType("tinyint(1)"); + + b.Property("ItemCode") + .HasColumnType("int"); + + b.Property("Margin") + .HasColumnType("double"); + + b.Property("SupplCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UM") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("ItemID"); + + b.ToTable("RegItem"); + + b.HasData( + new + { + ItemID = 1, + Cost = 20.0, + Description = "BARRA-60x80 generica", + ExtItemCode = "", + IsService = false, + ItemCode = 1001, + Margin = 0.29999999999999999, + SupplCode = "BARR.001", + UM = "#" + }, + new + { + ItemID = 2, + Cost = 16.5, + Description = "Barra 60x80, lunghezza 12m", + ExtItemCode = "BARRA-60x80x12000", + IsService = false, + ItemCode = 1002, + Margin = 0.20999999999999999, + SupplCode = "ABC.00123.12000", + UM = "#" + }, + new + { + ItemID = 3, + Cost = 17.5, + Description = "Barra 60x80, lunghezza 8m", + ExtItemCode = "BARRA-60x80x8000", + IsService = false, + ItemCode = 1003, + Margin = 0.22, + SupplCode = "ABC.00123.8000", + UM = "#" + }, + new + { + ItemID = 4, + Cost = 15.5, + Description = "Barra 60x80, lunghezza 16m", + ExtItemCode = "BARRA-60x80x16000", + IsService = false, + ItemCode = 1004, + Margin = 0.20000000000000001, + SupplCode = "ABC.00123.16000", + UM = "#" + }, + new + { + ItemID = 5, + Cost = 300.0, + Description = "Vetro triplo, basso indice termico, 800x1000", + ExtItemCode = "VETRO-3L-THERMO-800x1000", + IsService = false, + ItemCode = 2001, + Margin = 0.20000000000000001, + SupplCode = "V3T.800.1000", + UM = "m2" + }, + new + { + ItemID = 6, + Cost = 200.0, + Description = "Vetro doppio, 800x1000", + ExtItemCode = "VETRO-2L-800x1000", + IsService = false, + ItemCode = 2002, + Margin = 0.14999999999999999, + SupplCode = "V2.800.1000", + UM = "m2" + }, + new + { + ItemID = 7, + Cost = 250.0, + Description = "Vetro triplo, 800x1000", + ExtItemCode = "VETRO-3L-800x1000", + IsService = false, + ItemCode = 2003, + Margin = 0.17999999999999999, + SupplCode = "V3.800.1000", + UM = "m2" + }, + new + { + ItemID = 8, + Cost = 20.0, + Description = "Vernice trasparente", + ExtItemCode = "VERN-TRASP", + IsService = false, + ItemCode = 3001, + Margin = 0.20000000000000001, + SupplCode = "VT.STD", + UM = "l" + }, + new + { + ItemID = 9, + Cost = 65.0, + Description = "Kit standard completo AGB tipo 001", + ExtItemCode = "KIT-001", + IsService = false, + ItemCode = 5001, + Margin = 0.20000000000000001, + SupplCode = "AGB-KIT-001", + UM = "#" + }, + new + { + ItemID = 10, + Cost = 10.0, + Description = "Cerniera AGB tipo 001", + ExtItemCode = "CERN-001", + IsService = false, + ItemCode = 5002, + Margin = 0.20000000000000001, + SupplCode = "AGB-CERN-001", + UM = "#" + }, + new + { + ItemID = 11, + Cost = 15.0, + Description = "Serratura AGB tipo 001", + ExtItemCode = "SERR-001", + IsService = false, + ItemCode = 5003, + Margin = 0.20000000000000001, + SupplCode = "AGB-SERR-001", + UM = "#" + }, + new + { + ItemID = 12, + Cost = 25.0, + Description = "Maniglia AGB tipo 001", + ExtItemCode = "MAN-001", + IsService = false, + ItemCode = 5004, + Margin = 0.20000000000000001, + SupplCode = "AGB-MAN-001", + UM = "#" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.JobModel", b => + { + b.Property("JobID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("JobID"); + + b.ToTable("JobList"); + + b.HasData( + new + { + JobID = 1, + Description = "Rivendita / servizi" + }, + new + { + JobID = 2, + Description = "Serramento Completo Legno su linea Saomad e installatore interno" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.JobRowItemModel", b => + { + b.Property("JobRowItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobRowItemID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("ItemID") + .HasColumnType("int"); + + b.Property("JobRowID") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("double"); + + b.HasKey("JobRowItemID"); + + b.HasIndex("ItemID"); + + b.HasIndex("JobRowID"); + + b.ToTable("JobRowItemList"); + + b.HasData( + new + { + JobRowItemID = 1, + Description = "Grezzo legno abete", + Index = 1, + ItemID = 1, + JobRowID = 1, + Qty = 1.0 + }, + new + { + JobRowItemID = 2, + Description = "Vernice trasparente standard 1L", + Index = 2, + ItemID = 8, + JobRowID = 3, + Qty = 0.10000000000000001 + }, + new + { + JobRowItemID = 3, + Description = "Ferramenta AGB - rif. AGFD.00000.00000", + Index = 3, + ItemID = 9, + JobRowID = 4, + Qty = 1.0 + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.JobRowModel", b => + { + b.Property("JobRowID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobRowID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("JobID") + .HasColumnType("int"); + + b.Property("PhaseID") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("double"); + + b.Property("ResourceID") + .HasColumnType("int"); + + b.HasKey("JobRowID"); + + b.HasIndex("JobID"); + + b.HasIndex("PhaseID"); + + b.HasIndex("ResourceID"); + + b.ToTable("JobRowList"); + + b.HasData( + new + { + JobRowID = 1, + Description = "", + Index = 1, + JobID = 2, + PhaseID = 1, + Qty = 1.0, + ResourceID = 1 + }, + new + { + JobRowID = 2, + Description = "", + Index = 2, + JobID = 2, + PhaseID = 2, + Qty = 1.0, + ResourceID = 2 + }, + new + { + JobRowID = 3, + Description = "", + Index = 3, + JobID = 2, + PhaseID = 3, + Qty = 1.0, + ResourceID = 4 + }, + new + { + JobRowID = 4, + Description = "", + Index = 4, + JobID = 2, + PhaseID = 4, + Qty = 1.0, + ResourceID = 6 + }, + new + { + JobRowID = 5, + Description = "", + Index = 5, + JobID = 2, + PhaseID = 6, + Qty = 1.0, + ResourceID = 7 + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OfferModel", b => + { + b.Property("OfferID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OfferID")); + + b.Property("CustomerID") + .HasColumnType("int"); + + b.Property("DealerID") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Inserted") + .HasColumnType("datetime(6)"); + + b.Property("Modified") + .HasColumnType("datetime(6)"); + + b.Property("OffertState") + .HasColumnType("int"); + + b.Property("RefNum") + .HasColumnType("int"); + + b.Property("RefRev") + .HasColumnType("int"); + + b.Property("RefYear") + .HasColumnType("int"); + + b.Property("ValidUntil") + .HasColumnType("datetime(6)"); + + b.HasKey("OfferID"); + + b.HasIndex("CustomerID"); + + b.HasIndex("DealerID"); + + b.ToTable("Offer"); + + b.HasData( + new + { + OfferID = 1, + CustomerID = 2, + DealerID = 2, + Description = "Offerta per tre serramenti", + Inserted = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8097), + Modified = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8099), + OffertState = 0, + RefNum = 1, + RefRev = 1, + RefYear = 2024, + ValidUntil = new DateTime(2025, 8, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8094) + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OfferRowModel", b => + { + b.Property("OfferRowID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OfferRowID")); + + b.Property("Cost") + .HasColumnType("double"); + + b.Property("Inserted") + .HasColumnType("datetime(6)"); + + b.Property("ItemSPP") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Modified") + .HasColumnType("datetime(6)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OfferID") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("double"); + + b.Property("RowNum") + .HasColumnType("int"); + + b.Property("SellingItemID") + .HasColumnType("int"); + + b.Property("SerStruct") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("OfferRowID"); + + b.HasIndex("OfferID"); + + b.HasIndex("SellingItemID"); + + b.ToTable("OfferRowList"); + + b.HasData( + new + { + OfferRowID = 1, + Cost = 950.0, + Inserted = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8123), + ItemSPP = "{}", + Modified = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8125), + Note = "Finestra anta singola 2025", + OfferID = 1, + Qty = 3.0, + RowNum = 1, + SellingItemID = 1, + SerStruct = "{}" + }, + new + { + OfferRowID = 2, + Cost = 160.0, + Inserted = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8137), + ItemSPP = "{}", + Modified = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8138), + Note = "Persiana per Finestra anta singola 2025", + OfferID = 1, + Qty = 3.0, + RowNum = 1, + SellingItemID = 2, + SerStruct = "{}" + }, + new + { + OfferRowID = 3, + Cost = 200.0, + Inserted = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8144), + ItemSPP = "{}", + Modified = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(8145), + Note = "Installazione serramento", + OfferID = 1, + Qty = 3.0, + RowNum = 1, + SellingItemID = 3, + SerStruct = "{}" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OrderModel", b => + { + b.Property("OrderID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OrderID")); + + b.Property("CustomerID") + .HasColumnType("int"); + + b.Property("DealerID") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Inserted") + .HasColumnType("datetime(6)"); + + b.Property("Modified") + .HasColumnType("datetime(6)"); + + b.Property("OfferID") + .HasColumnType("int"); + + b.Property("OffertState") + .HasColumnType("int"); + + b.Property("RefNum") + .HasColumnType("int"); + + b.Property("RefRev") + .HasColumnType("int"); + + b.Property("RefYear") + .HasColumnType("int"); + + b.Property("ValidUntil") + .HasColumnType("datetime(6)"); + + b.HasKey("OrderID"); + + b.HasIndex("CustomerID"); + + b.HasIndex("DealerID"); + + b.HasIndex("OfferID"); + + b.ToTable("Order"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OrderRowModel", b => + { + b.Property("OrderRowID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OrderRowID")); + + b.Property("Cost") + .HasColumnType("double"); + + b.Property("Inserted") + .HasColumnType("datetime(6)"); + + b.Property("ItemSPP") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Modified") + .HasColumnType("datetime(6)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OrderID") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("double"); + + b.Property("RowNum") + .HasColumnType("int"); + + b.Property("SellingItemID") + .HasColumnType("int"); + + b.Property("SerStruct") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("OrderRowID"); + + b.HasIndex("OrderID"); + + b.HasIndex("SellingItemID"); + + b.ToTable("OrderRowList"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.PhaseModel", b => + { + b.Property("PhaseID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PhaseID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("PhaseID"); + + b.ToTable("RegPhase"); + + b.HasData( + new + { + PhaseID = 1, + Description = "Taglio tronchetti" + }, + new + { + PhaseID = 2, + Description = "Lavorazione pezzi serramento" + }, + new + { + PhaseID = 3, + Description = "Verniciatura" + }, + new + { + PhaseID = 4, + Description = "Assemblaggio completo" + }, + new + { + PhaseID = 5, + Description = "Assemblaggio Ferramenta" + }, + new + { + PhaseID = 6, + Description = "Installazione e posa in opera" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.ProductionBatchModel", b => + { + b.Property("ProductionBatchID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductionBatchID")); + + b.Property("DateEnd") + .HasColumnType("datetime(6)"); + + b.Property("DateStart") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DueDate") + .HasColumnType("datetime(6)"); + + b.HasKey("ProductionBatchID"); + + b.ToTable("ProductionBatch"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.ProductionItemModel", b => + { + b.Property("ProdItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemID")); + + b.Property("ExtItemCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ItemCode") + .HasColumnType("int"); + + b.Property("OrderRowID") + .HasColumnType("int"); + + b.Property("ProductionBatchID") + .HasColumnType("int"); + + b.HasKey("ProdItemID"); + + b.HasIndex("OrderRowID"); + + b.HasIndex("ProductionBatchID"); + + b.ToTable("ProductionItem"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.ProductionItemRowModel", b => + { + b.Property("ProdItemRowID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemRowID")); + + b.Property("DateEnd") + .HasColumnType("datetime(6)"); + + b.Property("DateStart") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("PhaseID") + .HasColumnType("int"); + + b.Property("ProdItemID") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("double"); + + b.Property("ResourceID") + .HasColumnType("int"); + + b.Property("WorkTime") + .HasColumnType("double"); + + b.HasKey("ProdItemRowID"); + + b.HasIndex("PhaseID"); + + b.HasIndex("ProdItemID"); + + b.HasIndex("ResourceID"); + + b.ToTable("ProductionItemRowList"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.ResourceModel", b => + { + b.Property("ResourceID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ResourceID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsAsset") + .HasColumnType("tinyint(1)"); + + b.Property("IsHuman") + .HasColumnType("tinyint(1)"); + + b.Property("UmFix") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UmProp") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UnitCostFix") + .HasColumnType("double"); + + b.Property("UnitCostProp") + .HasColumnType("double"); + + b.HasKey("ResourceID"); + + b.ToTable("RegResource"); + + b.HasData( + new + { + ResourceID = 1, + Description = "Sezionatrice", + IsAsset = true, + IsHuman = false, + UmFix = "€/h", + UmProp = "", + UnitCostFix = 15.0, + UnitCostProp = 0.0 + }, + new + { + ResourceID = 2, + Description = "Linea SAOMAD WoodPecker Just 3500", + IsAsset = true, + IsHuman = false, + UmFix = "€/h", + UmProp = "€/m", + UnitCostFix = 540.0, + UnitCostProp = 1.8999999999999999 + }, + new + { + ResourceID = 3, + Description = "Linea Pantografo", + IsAsset = true, + IsHuman = false, + UmFix = "€/h", + UmProp = "", + UnitCostFix = 250.0, + UnitCostProp = 0.0 + }, + new + { + ResourceID = 4, + Description = "Stazione Verniciatura", + IsAsset = true, + IsHuman = false, + UmFix = "€/h", + UmProp = "€/m", + UnitCostFix = 10.0, + UnitCostProp = 1.8999999999999999 + }, + new + { + ResourceID = 5, + Description = "Verniciatura Manuale", + IsAsset = false, + IsHuman = true, + UmFix = "€/h", + UmProp = "€/m", + UnitCostFix = 40.0, + UnitCostProp = 1.8999999999999999 + }, + new + { + ResourceID = 6, + Description = "Montaggio Manuale", + IsAsset = false, + IsHuman = true, + UmFix = "", + UmProp = "€/h", + UnitCostFix = 0.0, + UnitCostProp = 40.0 + }, + new + { + ResourceID = 7, + Description = "Installatore", + IsAsset = false, + IsHuman = true, + UmFix = "", + UmProp = "€/h", + UnitCostFix = 0.0, + UnitCostProp = 40.0 + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.SellingItemModel", b => + { + b.Property("SellingItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SellingItemID")); + + b.Property("Cost") + .HasColumnType("double"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ExtItemCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsService") + .HasColumnType("tinyint(1)"); + + b.Property("ItemCode") + .HasColumnType("int"); + + b.Property("ItemSPP") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("JobID") + .HasColumnType("int"); + + b.Property("Margin") + .HasColumnType("double"); + + b.Property("SerStruct") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("SupplCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UM") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("SellingItemID"); + + b.HasIndex("JobID"); + + b.ToTable("SellingItem"); + + b.HasData( + new + { + SellingItemID = 1, + Cost = 820.0, + Description = "Finestra anta Singola", + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSPP = "", + JobID = 2, + Margin = 0.20000000000000001, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 2, + Cost = 150.0, + Description = "Persiana anta singola", + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSPP = "", + JobID = 1, + Margin = 0.10000000000000001, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 3, + Cost = 200.0, + Description = "Installazione", + ExtItemCode = "", + IsService = true, + ItemCode = 0, + ItemSPP = "", + JobID = 1, + Margin = 0.29999999999999999, + SerStruct = "", + SupplCode = "", + UM = "#" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.StockMovModel", b => + { + b.Property("StockMovID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("StockMovID")); + + b.Property("DtRec") + .HasColumnType("datetime(6)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("QtyRec") + .HasColumnType("double"); + + b.Property("StockStatusId") + .HasColumnType("int"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("StockMovID"); + + b.HasIndex("StockStatusId"); + + b.ToTable("StockMov"); + + b.HasData( + new + { + StockMovID = 1, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7890), + Note = "DEMO", + QtyRec = 5.0, + StockStatusId = 1, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 2, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7895), + Note = "DEMO", + QtyRec = 8.0, + StockStatusId = 2, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 3, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7899), + Note = "DEMO", + QtyRec = 5.0, + StockStatusId = 3, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 4, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7903), + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 4, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 5, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7906), + Note = "DEMO", + QtyRec = 10.0, + StockStatusId = 5, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 6, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7910), + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 6, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 7, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7914), + Note = "DEMO", + QtyRec = 50.0, + StockStatusId = 7, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 8, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7917), + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 8, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 9, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7921), + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 9, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 10, + DtRec = new DateTime(2025, 7, 7, 18, 13, 5, 424, DateTimeKind.Local).AddTicks(7925), + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 10, + UserId = "samuele.locatelli@egalware.com" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.StockStatusModel", b => + { + b.Property("StockStatusId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("StockStatusId")); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("IsRemn") + .HasColumnType("tinyint(1)"); + + b.Property("ItemID") + .HasColumnType("int"); + + b.Property("Location") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("QtyAvail") + .HasColumnType("double"); + + b.HasKey("StockStatusId"); + + b.HasIndex("ItemID"); + + b.ToTable("StockStatus"); + + b.HasData( + new + { + StockStatusId = 1, + IsDeleted = false, + IsRemn = false, + ItemID = 1, + Location = "B001-001-003", + QtyAvail = 5.0 + }, + new + { + StockStatusId = 2, + IsDeleted = false, + IsRemn = false, + ItemID = 2, + Location = "B001-001-002", + QtyAvail = 8.0 + }, + new + { + StockStatusId = 3, + IsDeleted = false, + IsRemn = false, + ItemID = 3, + Location = "B001-001-001", + QtyAvail = 5.0 + }, + new + { + StockStatusId = 4, + IsDeleted = false, + IsRemn = false, + ItemID = 4, + Location = "V002-001-001", + QtyAvail = 1.0 + }, + new + { + StockStatusId = 5, + IsDeleted = false, + IsRemn = false, + ItemID = 5, + Location = "V001-001-002", + QtyAvail = 10.0 + }, + new + { + StockStatusId = 6, + IsDeleted = false, + IsRemn = false, + ItemID = 6, + Location = "V001-001-003", + QtyAvail = 1.0 + }, + new + { + StockStatusId = 7, + IsDeleted = false, + IsRemn = false, + ItemID = 7, + Location = "V001-001-003", + QtyAvail = 50.0 + }, + new + { + StockStatusId = 8, + IsDeleted = false, + IsRemn = false, + ItemID = 8, + Location = "S001-002-001", + QtyAvail = 1.0 + }, + new + { + StockStatusId = 9, + IsDeleted = false, + IsRemn = false, + ItemID = 9, + Location = "S001-002-001", + QtyAvail = 1.0 + }, + new + { + StockStatusId = 10, + IsDeleted = false, + IsRemn = false, + ItemID = 10, + Location = "S001-001-001", + QtyAvail = 1.0 + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.SupplierModel", b => + { + b.Property("SupplierID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SupplierID")); + + b.Property("CompanyName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VAT") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("SupplierID"); + + b.ToTable("RegSupplier"); + + b.HasData( + new + { + SupplierID = 1, + CompanyName = "Company One", + FirstName = "Supplier A", + LastName = "Egalware", + VAT = "7294857103879254" + }, + new + { + SupplierID = 2, + CompanyName = "Company Two", + FirstName = "Supplier B", + LastName = "User", + VAT = "7294857103879254" + }, + new + { + SupplierID = 3, + CompanyName = "Company Two", + FirstName = "Supplier C", + LastName = "User Test", + VAT = "7294857103879254" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.TagsModel", b => + { + b.Property("TagID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TagID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("TagID"); + + b.ToTable("RegTags"); + + b.HasData( + new + { + TagID = 1, + Description = "Tag 01" + }, + new + { + TagID = 2, + Description = "Tag 02" + }, + new + { + TagID = 3, + Description = "Tag 03" + }, + new + { + TagID = 4, + Description = "Tag 04" + }, + new + { + TagID = 5, + Description = "Tag 05" + }); + }); + + modelBuilder.Entity("Lux.Data.DbModel.JobRowItemModel", b => + { + b.HasOne("Lux.Data.DbModel.ItemModel", "ItemNav") + .WithMany() + .HasForeignKey("ItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.JobRowModel", "JobRowNav") + .WithMany() + .HasForeignKey("JobRowID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ItemNav"); + + b.Navigation("JobRowNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.JobRowModel", b => + { + b.HasOne("Lux.Data.DbModel.JobModel", "JobNav") + .WithMany() + .HasForeignKey("JobID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.PhaseModel", "PhaseNav") + .WithMany() + .HasForeignKey("PhaseID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.ResourceModel", "ResourceNav") + .WithMany() + .HasForeignKey("ResourceID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("JobNav"); + + b.Navigation("PhaseNav"); + + b.Navigation("ResourceNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OfferModel", b => + { + b.HasOne("Lux.Data.DbModel.CustomerModel", "CustomerNav") + .WithMany() + .HasForeignKey("CustomerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.DealerModel", "DealerNav") + .WithMany() + .HasForeignKey("DealerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CustomerNav"); + + b.Navigation("DealerNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OfferRowModel", b => + { + b.HasOne("Lux.Data.DbModel.OfferModel", "OfferNav") + .WithMany() + .HasForeignKey("OfferID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.SellingItemModel", "SellingItemNav") + .WithMany() + .HasForeignKey("SellingItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OfferNav"); + + b.Navigation("SellingItemNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OrderModel", b => + { + b.HasOne("Lux.Data.DbModel.CustomerModel", "CustomerNav") + .WithMany() + .HasForeignKey("CustomerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.DealerModel", "DealerNav") + .WithMany() + .HasForeignKey("DealerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.OfferModel", "OfferNav") + .WithMany() + .HasForeignKey("OfferID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CustomerNav"); + + b.Navigation("DealerNav"); + + b.Navigation("OfferNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.OrderRowModel", b => + { + b.HasOne("Lux.Data.DbModel.OrderModel", "OrderNav") + .WithMany() + .HasForeignKey("OrderID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.SellingItemModel", "SellingItemNav") + .WithMany() + .HasForeignKey("SellingItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OrderNav"); + + b.Navigation("SellingItemNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.ProductionItemModel", b => + { + b.HasOne("Lux.Data.DbModel.OrderRowModel", "OrderRowNav") + .WithMany() + .HasForeignKey("OrderRowID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.ProductionBatchModel", "ProductionBatchNav") + .WithMany() + .HasForeignKey("ProductionBatchID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OrderRowNav"); + + b.Navigation("ProductionBatchNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.ProductionItemRowModel", b => + { + b.HasOne("Lux.Data.DbModel.PhaseModel", "PhaseNav") + .WithMany() + .HasForeignKey("PhaseID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.ProductionItemModel", "ProdItemNav") + .WithMany() + .HasForeignKey("ProdItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Lux.Data.DbModel.ResourceModel", "ResourceNav") + .WithMany() + .HasForeignKey("ResourceID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("PhaseNav"); + + b.Navigation("ProdItemNav"); + + b.Navigation("ResourceNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.SellingItemModel", b => + { + b.HasOne("Lux.Data.DbModel.JobModel", "JobNav") + .WithMany() + .HasForeignKey("JobID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("JobNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.StockMovModel", b => + { + b.HasOne("Lux.Data.DbModel.StockStatusModel", "StockStatusNav") + .WithMany() + .HasForeignKey("StockStatusId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("StockStatusNav"); + }); + + modelBuilder.Entity("Lux.Data.DbModel.StockStatusModel", b => + { + b.HasOne("Lux.Data.DbModel.ItemModel", "ItemNav") + .WithMany() + .HasForeignKey("ItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ItemNav"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Lux.Data/ModelBuilderExtensions.cs b/Lux.Data/ModelBuilderExtensions.cs index be67f1ae..307ec3a7 100644 --- a/Lux.Data/ModelBuilderExtensions.cs +++ b/Lux.Data/ModelBuilderExtensions.cs @@ -46,111 +46,27 @@ namespace Lux.Data new SupplierModel { SupplierID = 3, CompanyName = "Company Two", FirstName = "Supplier C", LastName = "User Test", VAT = "7294857103879254" } ); - // inizializzazione dei valori di default x Item - modelBuilder.Entity().HasData( - new ItemModel { ItemID = 1, IsService = false, Description = "Barra di legno 80x120", Cost = 50, Margin = 0.3 }, - new ItemModel { ItemID = 2, IsService = false, Description = "Vernice trasparente", Cost = 35, Margin = 0.3 }, - new ItemModel { ItemID = 3, IsService = false, Description = "Ferramenta", Cost = 1, Margin = 0.3 } - ); - - - // inizializzazione risorse - modelBuilder.Entity().HasData( - new ResourceModel { ResourceID = 1, Description = "Sezionatrice", IsAsset = true, IsHuman = false, UnitCost = 15, UM = "€/h" }, - new ResourceModel { ResourceID = 2, Description = "Linea SAOMAD WoodPecker Just 3500", IsAsset = true, IsHuman = false, UnitCost = 540, UM = "€/h" }, - new ResourceModel { ResourceID = 3, Description = "Linea Pantografo", IsAsset = true, IsHuman = false, UnitCost = 250, UM = "€/h" }, - new ResourceModel { ResourceID = 4, Description = "Stazione Verniciatura", IsAsset = true, IsHuman = false, UnitCost = 10, UM = "€/h" }, - new ResourceModel { ResourceID = 5, Description = "Verniciatura Manuale", IsAsset = false, IsHuman = true, UnitCost = 40, UM = "€/h" }, - new ResourceModel { ResourceID = 6, Description = "Montaggio Manuale", IsAsset = false, IsHuman = true, UnitCost = 40, UM = "€/h" }, - new ResourceModel { ResourceID = 7, Description = "Installatore", IsAsset = false, IsHuman = true, UnitCost = 40, UM = "€/h" } - ); - - // inizializzazione fasi - modelBuilder.Entity().HasData( - new PhaseModel { PhaseID = 1, Description = "Taglio tronchetti" }, - new PhaseModel { PhaseID = 2, Description = "Lavorazione pezzi serramento" }, - new PhaseModel { PhaseID = 3, Description = "Verniciatura" }, - new PhaseModel { PhaseID = 4, Description = "Assemblaggio completo" }, - new PhaseModel { PhaseID = 5, Description = "Assemblaggio Ferramenta" }, - new PhaseModel { PhaseID = 6, Description = "Installazione e posa in opera" } - - ); - - // inizializzazione cicli di lavoro - modelBuilder.Entity().HasData( - new JobModel { JobID = 1, Description = "Rivendita / servizi" }, - new JobModel { JobID = 2, Description = "Serramento Completo Legno su linea Saomad e installatore interno" }//, - //new JobModel { JobID = 2, Description = "Serramento Completo Legno/Alluminio" }, - //new JobModel { JobID = 3, Description = "Persiana Legno" }, - //new JobModel { JobID = 4, Description = "restauro Persiana Esistente" } - ); - - // init righe ciclo (fasi di ciclo) - modelBuilder.Entity().HasData( - // per fare 1 finestra singola/semplice taglio 4 tronchetti telaio + 4 tronchetti finestra, considero 1 perché mi arriva dal sistema preventivo/motore - new JobRowModel { JobRowID = 1, JobID = 2, Index = 1, PhaseID = 1, Qty = 1, ResourceID = 1 }, - // taglio profilo su linea saomad, considero 1 perché mi arriva dal sistema preventivo/motore - new JobRowModel { JobRowID = 2, JobID = 2, Index = 2, PhaseID = 2, Qty = 1, ResourceID = 2 }, - // verniciatura automatica, considero 1 perché mi arriva dal sistema preventivo/motore - new JobRowModel { JobRowID = 3, JobID = 2, Index = 3, PhaseID = 3, Qty = 1, ResourceID = 4 }, - // assemblaggio - new JobRowModel { JobRowID = 4, JobID = 2, Index = 4, PhaseID = 4, Qty = 1, ResourceID = 6 }, - // installazione - new JobRowModel { JobRowID = 5, JobID = 2, Index = 5, PhaseID = 6, Qty = 1, ResourceID = 7 } - ); - - // init item righe ciclo (articoli + prodotti delle fasi del ciclo) - modelBuilder.Entity().HasData( - // eventuale scarto del materiale tra grezzo e finito--> porta ad un numero >1 (QUI NON USATO, ho il valore calcolato dal motore) - new JobRowItemModel { JobRowItemID = 1, JobRowID = 1, Index = 1, ItemID = 1, Qty = 1, Description = "Grezzo legno abete" }, - // 1/10 litro di vernice per metro lineare prodotto - new JobRowItemModel { JobRowItemID = 2, JobRowID = 3, Index = 2, ItemID = 2, Qty = 0.1, Description = "Vernice trasparente standard 1L" }, - // uso un KIT intero (vs specifico n prodotti singoli) x questo modello; se dal preventivo arrivano n pezzi spcifici, qui li esplodiamo - new JobRowItemModel { JobRowItemID = 3, JobRowID = 4, Index = 3, ItemID = 3, Qty = 1, Description = "Ferramenta AGB - rif. AGFD.00000.00000" } - ); - - - // inizializzazione dei valori di default x SellingItem - modelBuilder.Entity().HasData( - new SellingItemModel { SellingItemID = 1, IsService = false, Description = "Finestra anta Singola", Cost = 820, Margin = 0.2, JobID = 2 }, - new SellingItemModel { SellingItemID = 2, IsService = false, Description = "Persiana anta singola", Cost = 150, Margin = 0.1, JobID = 1 }, - new SellingItemModel { SellingItemID = 3, IsService = true, Description = "Installazione", Cost = 200, Margin = 0.3, JobID = 1 } - ); - - // inizializzazione dei valori di default x Offer - modelBuilder.Entity().HasData( - new OfferModel { OfferID = 1, RefYear = 2024, RefNum = 1, RefRev = 1, Description = "Offerta per tre serramenti", CustomerID = 2, DealerID = 2 } - //new OfferModel { OfferID = 2, RefYear = 2025, RefNum = 2, RefRev = 1, Description = "Offerta per un serramento + installazione", CustomerID = 1, DealerID = 1 }, - //new OfferModel { OfferID = 3, RefYear = 2025, RefNum = 3, RefRev = 1, Description = "Offerta per tre serramenti", CustomerID = 2, DealerID = 1 }, - //new OfferModel { OfferID = 5, RefYear = 2025, RefNum = 4, RefRev = 2, Description = "Offerta per cinque serramenti + installazione", CustomerID = 3, DealerID = 2 } - ); - - // inizializzazione dei valori di default x OfferRow - modelBuilder.Entity().HasData( - new OfferRowModel { OfferRowID = 1, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 950, SellingItemID = 1, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Finestra anta singola 2025", ItemSPP = "{}" }, - new OfferRowModel { OfferRowID = 2, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 160, SellingItemID = 2, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Persiana per Finestra anta singola 2025", ItemSPP = "{}" }, - new OfferRowModel { OfferRowID = 3, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 200, SellingItemID = 3, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Installazione serramento", ItemSPP = "{}" } - ); - // inizializzazione dei valori di default x Item di magazzino modelBuilder.Entity().HasData( // barre grezzo - new ItemModel { ItemID = 1, IsService = false, ItemCode = 1000, ExtItemCode = "BARRA-60x80x16000", SupplCode = "ABC.00123.16000", Description = "Barra 60x80, lunghezza 16m", Cost = 15.5, Margin = 0.2, UM = "#" }, - new ItemModel { ItemID = 2, IsService = false, ItemCode = 1001, ExtItemCode = "BARRA-60x80x12000", SupplCode = "ABC.00123.12000", Description = "Barra 60x80, lunghezza 12m", Cost = 16.5, Margin = 0.21, UM = "#" }, - new ItemModel { ItemID = 3, IsService = false, ItemCode = 1002, ExtItemCode = "BARRA-60x80x8000", SupplCode = "ABC.00123.8000", Description = "Barra 60x80, lunghezza 8m", Cost = 17.5, Margin = 0.22, UM = "#" }, + new ItemModel { ItemID = 1, IsService = false, ItemCode = 1001, Description = "BARRA-60x80 generica", SupplCode = "BARR.001", Cost = 20, Margin = 0.3, UM = "#" }, + new ItemModel { ItemID = 2, IsService = false, ItemCode = 1002, ExtItemCode = "BARRA-60x80x12000", SupplCode = "ABC.00123.12000", Description = "Barra 60x80, lunghezza 12m", Cost = 16.5, Margin = 0.21, UM = "#" }, + new ItemModel { ItemID = 3, IsService = false, ItemCode = 1003, ExtItemCode = "BARRA-60x80x8000", SupplCode = "ABC.00123.8000", Description = "Barra 60x80, lunghezza 8m", Cost = 17.5, Margin = 0.22, UM = "#" }, + new ItemModel { ItemID = 4, IsService = false, ItemCode = 1004, ExtItemCode = "BARRA-60x80x16000", SupplCode = "ABC.00123.16000", Description = "Barra 60x80, lunghezza 16m", Cost = 15.5, Margin = 0.2, UM = "#" }, // vetri - new ItemModel { ItemID = 4, IsService = false, ItemCode = 2001, ExtItemCode = "VETRO-2L-800x1000", SupplCode = "V2.800.1000", Description = "Vetro doppio, 800x1000", Cost = 200, Margin = 0.15, UM = "m2" }, - new ItemModel { ItemID = 5, IsService = false, ItemCode = 2002, ExtItemCode = "VETRO-3L-800x1000", SupplCode = "V3.800.1000", Description = "Vetro triplo, 800x1000", Cost = 250, Margin = 0.18, UM = "m2" }, - new ItemModel { ItemID = 6, IsService = false, ItemCode = 2003, ExtItemCode = "VETRO-3L-THERMO-800x1000", SupplCode = "V3T.800.1000", Description = "Vetro triplo, basso indice termico, 800x1000", Cost = 300, Margin = 0.20, UM = "m2" }, + new ItemModel { ItemID = 5, IsService = false, ItemCode = 2001, ExtItemCode = "VETRO-3L-THERMO-800x1000", SupplCode = "V3T.800.1000", Description = "Vetro triplo, basso indice termico, 800x1000", Cost = 300, Margin = 0.20, UM = "m2" }, + new ItemModel { ItemID = 6, IsService = false, ItemCode = 2002, ExtItemCode = "VETRO-2L-800x1000", SupplCode = "V2.800.1000", Description = "Vetro doppio, 800x1000", Cost = 200, Margin = 0.15, UM = "m2" }, + new ItemModel { ItemID = 7, IsService = false, ItemCode = 2003, ExtItemCode = "VETRO-3L-800x1000", SupplCode = "V3.800.1000", Description = "Vetro triplo, 800x1000", Cost = 250, Margin = 0.18, UM = "m2" }, // vernici - new ItemModel { ItemID = 7, IsService = false, ItemCode = 3001, ExtItemCode = "VERN-TRASP", SupplCode = "VT.STD", Description = "Vernice trasparente", Cost = 20, Margin = 0.20, UM = "l" }, + new ItemModel { ItemID = 8, IsService = false, ItemCode = 3001, ExtItemCode = "VERN-TRASP", SupplCode = "VT.STD", Description = "Vernice trasparente", Cost = 20, Margin = 0.20, UM = "l" }, // ferramenta - new ItemModel { ItemID = 8, IsService = false, ItemCode = 5001, ExtItemCode = "SERR-001", SupplCode = "AGB-SERR-001", Description = "Serratura AGB tipo 001", Cost = 15, Margin = 0.20, UM = "#" }, - new ItemModel { ItemID = 9, IsService = false, ItemCode = 5002, ExtItemCode = "MAN-001", SupplCode = "AGB-MAN-001", Description = "Maniglia AGB tipo 001", Cost = 25, Margin = 0.20, UM = "#" }, - new ItemModel { ItemID = 10, IsService = false, ItemCode = 5003, ExtItemCode = "CERN-001", SupplCode = "AGB-CERN-001", Description = "Cerniera AGB tipo 001", Cost = 10, Margin = 0.20, UM = "#" } + new ItemModel { ItemID = 9, IsService = false, ItemCode = 5001, ExtItemCode = "KIT-001", SupplCode = "AGB-KIT-001", Description = "Kit standard completo AGB tipo 001", Cost = 65, Margin = 0.20, UM = "#" }, + new ItemModel { ItemID = 10, IsService = false, ItemCode = 5002, ExtItemCode = "CERN-001", SupplCode = "AGB-CERN-001", Description = "Cerniera AGB tipo 001", Cost = 10, Margin = 0.20, UM = "#" }, + new ItemModel { ItemID = 11, IsService = false, ItemCode = 5003, ExtItemCode = "SERR-001", SupplCode = "AGB-SERR-001", Description = "Serratura AGB tipo 001", Cost = 15, Margin = 0.20, UM = "#" }, + new ItemModel { ItemID = 12, IsService = false, ItemCode = 5004, ExtItemCode = "MAN-001", SupplCode = "AGB-MAN-001", Description = "Maniglia AGB tipo 001", Cost = 25, Margin = 0.20, UM = "#" } ); // inizializzazione dei valori di default x Item di giacenza @@ -194,6 +110,86 @@ namespace Lux.Data new StockMovModel { StockMovID = 9, StockStatusId = 9, DtRec = DateTime.Now, QtyRec = 1, UserId = "samuele.locatelli@egalware.com", Note = "DEMO" }, new StockMovModel { StockMovID = 10, StockStatusId = 10, DtRec = DateTime.Now, QtyRec = 1, UserId = "samuele.locatelli@egalware.com", Note = "DEMO" } ); + + + // inizializzazione risorse + modelBuilder.Entity().HasData( + new ResourceModel { ResourceID = 1, Description = "Sezionatrice", IsAsset = true, IsHuman = false, UnitCostFix = 15, UmFix = "€/h" }, + new ResourceModel { ResourceID = 2, Description = "Linea SAOMAD WoodPecker Just 3500", IsAsset = true, IsHuman = false, UnitCostFix = 540, UmFix = "€/h", UnitCostProp = 1.9, UmProp = "€/m" }, + new ResourceModel { ResourceID = 3, Description = "Linea Pantografo", IsAsset = true, IsHuman = false, UnitCostFix = 250, UmFix = "€/h" }, + new ResourceModel { ResourceID = 4, Description = "Stazione Verniciatura", IsAsset = true, IsHuman = false, UnitCostFix = 10, UmFix = "€/h", UnitCostProp = 1.9, UmProp = "€/m" }, + new ResourceModel { ResourceID = 5, Description = "Verniciatura Manuale", IsAsset = false, IsHuman = true, UnitCostFix = 40, UmFix = "€/h", UnitCostProp = 1.9, UmProp = "€/m" }, + new ResourceModel { ResourceID = 6, Description = "Montaggio Manuale", IsAsset = false, IsHuman = true, UnitCostProp = 40, UmProp = "€/h" }, + new ResourceModel { ResourceID = 7, Description = "Installatore", IsAsset = false, IsHuman = true, UnitCostProp = 40, UmProp = "€/h" } + ); + + // inizializzazione fasi + modelBuilder.Entity().HasData( + new PhaseModel { PhaseID = 1, Description = "Taglio tronchetti" }, + new PhaseModel { PhaseID = 2, Description = "Lavorazione pezzi serramento" }, + new PhaseModel { PhaseID = 3, Description = "Verniciatura" }, + new PhaseModel { PhaseID = 4, Description = "Assemblaggio completo" }, + new PhaseModel { PhaseID = 5, Description = "Assemblaggio Ferramenta" }, + new PhaseModel { PhaseID = 6, Description = "Installazione e posa in opera" } + + ); + + // inizializzazione cicli di lavoro + modelBuilder.Entity().HasData( + new JobModel { JobID = 1, Description = "Rivendita / servizi" }, + new JobModel { JobID = 2, Description = "Serramento Completo Legno su linea Saomad e installatore interno" }//, + //new JobModel { JobID = 2, Description = "Serramento Completo Legno/Alluminio" }, + //new JobModel { JobID = 3, Description = "Persiana Legno" }, + //new JobModel { JobID = 4, Description = "restauro Persiana Esistente" } + ); + + // init righe ciclo (fasi di ciclo) + modelBuilder.Entity().HasData( + // per fare 1 finestra singola/semplice taglio 4 tronchetti telaio + 4 tronchetti finestra, considero 1 perché mi arriva dal sistema preventivo/motore + new JobRowModel { JobRowID = 1, JobID = 2, Index = 1, PhaseID = 1, Qty = 1, ResourceID = 1 }, + // taglio profilo su linea saomad, considero 1 perché mi arriva dal sistema preventivo/motore + new JobRowModel { JobRowID = 2, JobID = 2, Index = 2, PhaseID = 2, Qty = 1, ResourceID = 2 }, + // verniciatura automatica, considero 1 perché mi arriva dal sistema preventivo/motore + new JobRowModel { JobRowID = 3, JobID = 2, Index = 3, PhaseID = 3, Qty = 1, ResourceID = 4 }, + // assemblaggio + new JobRowModel { JobRowID = 4, JobID = 2, Index = 4, PhaseID = 4, Qty = 1, ResourceID = 6 }, + // installazione + new JobRowModel { JobRowID = 5, JobID = 2, Index = 5, PhaseID = 6, Qty = 1, ResourceID = 7 } + ); + + // init item righe ciclo (articoli + prodotti delle fasi del ciclo) + modelBuilder.Entity().HasData( + // eventuale scarto del materiale tra grezzo e finito--> porta ad un numero >1 (QUI NON USATO, ho il valore calcolato dal motore) + new JobRowItemModel { JobRowItemID = 1, JobRowID = 1, Index = 1, ItemID = 1, Qty = 1, Description = "Grezzo legno abete" }, + // 1/10 litro di vernice per metro lineare prodotto + new JobRowItemModel { JobRowItemID = 2, JobRowID = 3, Index = 2, ItemID = 8, Qty = 0.1, Description = "Vernice trasparente standard 1L" }, + // uso un KIT intero (vs specifico n prodotti singoli) x questo modello; se dal preventivo arrivano n pezzi spcifici, qui li esplodiamo + new JobRowItemModel { JobRowItemID = 3, JobRowID = 4, Index = 3, ItemID = 9, Qty = 1, Description = "Ferramenta AGB - rif. AGFD.00000.00000" } + ); + + + // inizializzazione dei valori di default x SellingItem + modelBuilder.Entity().HasData( + new SellingItemModel { SellingItemID = 1, IsService = false, Description = "Finestra anta Singola", Cost = 820, Margin = 0.2, JobID = 2 }, + new SellingItemModel { SellingItemID = 2, IsService = false, Description = "Persiana anta singola", Cost = 150, Margin = 0.1, JobID = 1 }, + new SellingItemModel { SellingItemID = 3, IsService = true, Description = "Installazione", Cost = 200, Margin = 0.3, JobID = 1 } + ); + + // inizializzazione dei valori di default x Offer + modelBuilder.Entity().HasData( + new OfferModel { OfferID = 1, RefYear = 2024, RefNum = 1, RefRev = 1, Description = "Offerta per tre serramenti", CustomerID = 2, DealerID = 2 } + //new OfferModel { OfferID = 2, RefYear = 2025, RefNum = 2, RefRev = 1, Description = "Offerta per un serramento + installazione", CustomerID = 1, DealerID = 1 }, + //new OfferModel { OfferID = 3, RefYear = 2025, RefNum = 3, RefRev = 1, Description = "Offerta per tre serramenti", CustomerID = 2, DealerID = 1 }, + //new OfferModel { OfferID = 5, RefYear = 2025, RefNum = 4, RefRev = 2, Description = "Offerta per cinque serramenti + installazione", CustomerID = 3, DealerID = 2 } + ); + + // inizializzazione dei valori di default x OfferRow + modelBuilder.Entity().HasData( + new OfferRowModel { OfferRowID = 1, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 950, SellingItemID = 1, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Finestra anta singola 2025", ItemSPP = "{}" }, + new OfferRowModel { OfferRowID = 2, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 160, SellingItemID = 2, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Persiana per Finestra anta singola 2025", ItemSPP = "{}" }, + new OfferRowModel { OfferRowID = 3, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 200, SellingItemID = 3, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Installazione serramento", ItemSPP = "{}" } + ); + } } }