From a6b72068f4e7456434a3bf3e9cb9ca850f6b171b Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 2 Oct 2025 15:48:48 +0200 Subject: [PATCH] Aggiunta modelli e migrazioni x confdata --- .../Controllers/LuxController.cs | 73 + EgwCoreLib.Lux.Data/DataLayerContext.cs | 15 +- .../DbModel/Config/GlassModel .cs | 21 + .../DbModel/Config/HardwareModel.cs | 21 + .../DbModel/Config/ProfileModel.cs | 21 + .../DbModel/Config/WoodModel.cs | 21 + .../EgwCoreLib.Lux.Data.csproj | 3 +- ...0251002110150_AddConfTables_01.Designer.cs | 2324 ++++++++++++++++ .../20251002110150_AddConfTables_01.cs | 279 ++ .../20251002134750_AddInitConfVal.Designer.cs | 2400 +++++++++++++++++ .../20251002134750_AddInitConfVal.cs | 298 ++ .../DataLayerContextModelSnapshot.cs | 200 +- EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs | 20 +- .../Services/DataLayerServices.cs | 132 +- 14 files changed, 5781 insertions(+), 47 deletions(-) create mode 100644 EgwCoreLib.Lux.Data/DbModel/Config/GlassModel .cs create mode 100644 EgwCoreLib.Lux.Data/DbModel/Config/HardwareModel.cs create mode 100644 EgwCoreLib.Lux.Data/DbModel/Config/ProfileModel.cs create mode 100644 EgwCoreLib.Lux.Data/DbModel/Config/WoodModel.cs create mode 100644 EgwCoreLib.Lux.Data/Migrations/20251002110150_AddConfTables_01.Designer.cs create mode 100644 EgwCoreLib.Lux.Data/Migrations/20251002110150_AddConfTables_01.cs create mode 100644 EgwCoreLib.Lux.Data/Migrations/20251002134750_AddInitConfVal.Designer.cs create mode 100644 EgwCoreLib.Lux.Data/Migrations/20251002134750_AddInitConfVal.cs diff --git a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs index 71f87b10..50bb4c04 100644 --- a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs +++ b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs @@ -8,6 +8,7 @@ using NLog; using NLog.LayoutRenderers; using static EgwCoreLib.Lux.Core.Enums; using EgwCoreLib.Lux.Data.DbModel.Items; +using EgwCoreLib.Lux.Data.DbModel.Config; namespace EgwCoreLib.Lux.Data.Controllers { @@ -17,6 +18,78 @@ namespace EgwCoreLib.Lux.Data.Controllers #region Internal Methods + /// + /// Elenco completo Config Glass + /// + /// + internal async Task> ConfGlassGetAllAsync() + { + List dbResult = new List(); + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + dbResult = await dbCtx + .DbSetConfGlass + .ToListAsync(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ConfGlassGetAllAsync{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + + /// + /// Elenco completo Config Profile + /// + /// + internal async Task> ConfProfileGetAllAsync() + { + List dbResult = new List(); + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + dbResult = await dbCtx + .DbSetConfProfile + .ToListAsync(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ConfProfileGetAllAsync{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + + /// + /// Elenco completo Config Wood + /// + /// + internal async Task> ConfWoodGetAllAsync() + { + List dbResult = new List(); + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + dbResult = await dbCtx + .DbSetConfWood + .ToListAsync(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ConfWoodGetAllAsync{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + /// /// Elenco completo Customers da DB /// diff --git a/EgwCoreLib.Lux.Data/DataLayerContext.cs b/EgwCoreLib.Lux.Data/DataLayerContext.cs index e6268c2f..87568d8b 100644 --- a/EgwCoreLib.Lux.Data/DataLayerContext.cs +++ b/EgwCoreLib.Lux.Data/DataLayerContext.cs @@ -1,4 +1,5 @@ -using EgwCoreLib.Lux.Data.DbModel.Cost; +using EgwCoreLib.Lux.Data.DbModel.Config; +using EgwCoreLib.Lux.Data.DbModel.Cost; using EgwCoreLib.Lux.Data.DbModel.Items; using EgwCoreLib.Lux.Data.DbModel.Production; using EgwCoreLib.Lux.Data.DbModel.Sales; @@ -46,7 +47,10 @@ namespace EgwCoreLib.Lux.Data } public virtual DbSet DbSetCounters { get; set; } - + public virtual DbSet DbSetConfGlass { get; set; } + public virtual DbSet DbSetConfProfile { get; set; } + public virtual DbSet DbSetConfWood { get; set; } + public virtual DbSet DbSetItemGroup { get; set; } public virtual DbSet DbSetItem { get; set; } public virtual DbSet DbSetSellItem { get; set; } @@ -113,6 +117,13 @@ namespace EgwCoreLib.Lux.Data modelBuilder.Entity() .HasKey(c => new { c.RefYear, c.CountName}); + modelBuilder.Entity() + .HasKey(c => new { c.GlassID }); + modelBuilder.Entity() + .HasKey(c => new { c.ProfileID }); + modelBuilder.Entity() + .HasKey(c => new { c.WoodID }); + // fix valori timestamp modelBuilder.Entity(entity => { diff --git a/EgwCoreLib.Lux.Data/DbModel/Config/GlassModel .cs b/EgwCoreLib.Lux.Data/DbModel/Config/GlassModel .cs new file mode 100644 index 00000000..1bab5f49 --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Config/GlassModel .cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Config +{ + /// + /// Risorsa tipo di Glass x EF + /// + [Table("conf_glass")] + public class GlassModel : Egw.Window.Data.Glass + { + } +} diff --git a/EgwCoreLib.Lux.Data/DbModel/Config/HardwareModel.cs b/EgwCoreLib.Lux.Data/DbModel/Config/HardwareModel.cs new file mode 100644 index 00000000..91f6b7bd --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Config/HardwareModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Config +{ + /// + /// Risorsa tipo di Hardware x EF + /// + [Table("conf_Hardware")] + public class HardwareModel : Egw.Window.Data.Hardware + { + } +} diff --git a/EgwCoreLib.Lux.Data/DbModel/Config/ProfileModel.cs b/EgwCoreLib.Lux.Data/DbModel/Config/ProfileModel.cs new file mode 100644 index 00000000..e6a9db9a --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Config/ProfileModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Config +{ + /// + /// Risorsa tipo di Wood x EF + /// + [Table("conf_profile")] + public class ProfileModel : Egw.Window.Data.Profile + { + } +} diff --git a/EgwCoreLib.Lux.Data/DbModel/Config/WoodModel.cs b/EgwCoreLib.Lux.Data/DbModel/Config/WoodModel.cs new file mode 100644 index 00000000..cd2aa5d7 --- /dev/null +++ b/EgwCoreLib.Lux.Data/DbModel/Config/WoodModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace EgwCoreLib.Lux.Data.DbModel.Config +{ + /// + /// Risorsa tipo di Wood x EF + /// + [Table("conf_wood")] + public class WoodModel : Egw.Window.Data.Wood + { + } +} diff --git a/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj b/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj index 0566e374..12d05bf1 100644 --- a/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj +++ b/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj @@ -17,6 +17,7 @@ + @@ -41,7 +42,7 @@ - + diff --git a/EgwCoreLib.Lux.Data/Migrations/20251002110150_AddConfTables_01.Designer.cs b/EgwCoreLib.Lux.Data/Migrations/20251002110150_AddConfTables_01.Designer.cs new file mode 100644 index 00000000..dda2af9b --- /dev/null +++ b/EgwCoreLib.Lux.Data/Migrations/20251002110150_AddConfTables_01.Designer.cs @@ -0,0 +1,2324 @@ +// +using System; +using EgwCoreLib.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 EgwCoreLib.Lux.Data.Migrations +{ + [DbContext(typeof(DataLayerContext))] + [Migration("20251002110150_AddConfTables_01")] + partial class AddConfTables_01 + { + /// + 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("EgwCoreLib.Lux.Data.DbModel.Config.GlassModel", b => + { + b.Property("GlassID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GlassID")); + + b.Property("Code") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Thickness") + .HasColumnType("double"); + + b.HasKey("GlassID"); + + b.ToTable("conf_glass"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.ProfileModel", b => + { + b.Property("ProfileID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProfileID")); + + b.Property("Code") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Thickness") + .HasColumnType("double"); + + b.HasKey("ProfileID"); + + b.ToTable("conf_profile"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.WoodModel", b => + { + b.Property("WoodID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("WoodID")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("ExtId") + .HasColumnType("longtext"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("WoodID"); + + b.ToTable("conf_wood"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Cost.CostDriverModel", b => + { + b.Property("CostDriverID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CostDriverID")); + + b.Property("Descript") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Unit") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("CostDriverID"); + + b.ToTable("cost_driver"); + + b.HasData( + new + { + CostDriverID = 1, + Descript = "Ore lavorate per step/fase", + Name = "WorkHour", + Unit = "h" + }, + new + { + CostDriverID = 2, + Descript = "Metri prodotti per step/fase", + Name = "Meter", + Unit = "m" + }, + new + { + CostDriverID = 3, + Descript = "Numero unità prodotte (lavorate) per step/fase", + Name = "Unit", + Unit = "#" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", b => + { + b.Property("ResourceID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ResourceID")); + + b.Property("CostDriverBudget") + .HasColumnType("decimal(65,30)"); + + b.Property("CostDriverID") + .HasColumnType("int"); + + b.Property("EBTPerc") + .HasColumnType("decimal(65,30)"); + + b.Property("FixedCost") + .HasColumnType("decimal(65,30)"); + + b.Property("LaborCost") + .HasColumnType("decimal(65,30)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OverHeadCost") + .HasColumnType("decimal(65,30)"); + + b.Property("OverHeadPerc") + .HasColumnType("decimal(65,30)"); + + b.Property("PriceMargin") + .HasColumnType("decimal(65,30)"); + + b.Property("VariableCost") + .HasColumnType("decimal(65,30)"); + + b.HasKey("ResourceID"); + + b.HasIndex("CostDriverID"); + + b.ToTable("cost_resource"); + + b.HasData( + new + { + ResourceID = 1, + CostDriverBudget = 880m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 12000m, + LaborCost = 30m, + Name = "Sezionatrice", + OverHeadCost = 5000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 6000m + }, + new + { + ResourceID = 2, + CostDriverBudget = 1760m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 100000m, + LaborCost = 40m, + Name = "Linea SAOMAD WoodPecker Just 3500", + OverHeadCost = 15000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 30000m + }, + new + { + ResourceID = 3, + CostDriverBudget = 1760m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 24000m, + LaborCost = 35m, + Name = "Linea Pantografo", + OverHeadCost = 5000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 6000m + }, + new + { + ResourceID = 4, + CostDriverBudget = 880m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 24000m, + LaborCost = 30m, + Name = "Stazione Verniciatura", + OverHeadCost = 3000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 6000m + }, + new + { + ResourceID = 5, + CostDriverBudget = 220m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 6000m, + LaborCost = 30m, + Name = "Verniciatura Manuale", + OverHeadCost = 3000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 2000m + }, + new + { + ResourceID = 6, + CostDriverBudget = 3520m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 500m, + LaborCost = 30m, + Name = "Montaggio Manuale", + OverHeadCost = 500m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 500m + }, + new + { + ResourceID = 7, + CostDriverBudget = 3520m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 0m, + LaborCost = 40m, + Name = "Installatore", + OverHeadCost = 0m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 3000m + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.ItemGroupModel", b => + { + b.Property("CodGroup") + .HasColumnType("varchar(255)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("CodGroup"); + + b.ToTable("item_group"); + + b.HasData( + new + { + CodGroup = "WindowTrunk", + Description = "Barre legno per lavorazione" + }, + new + { + CodGroup = "WindowGlass", + Description = "Vetri serramento" + }, + new + { + CodGroup = "WindowVarnish", + Description = "Vernici per legno" + }, + new + { + CodGroup = "WindowHardware", + Description = "Ferramenta serramento" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", b => + { + b.Property("ItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemID")); + + b.Property("CodGroup") + .IsRequired() + .HasColumnType("varchar(255)"); + + 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("ItemIDParent") + .HasColumnType("int"); + + b.Property("ItemType") + .HasColumnType("int"); + + b.Property("Margin") + .HasColumnType("double"); + + b.Property("QtyMax") + .HasColumnType("double"); + + b.Property("QtyMin") + .HasColumnType("double"); + + b.Property("SupplCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UM") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("ItemID"); + + b.HasIndex("CodGroup"); + + b.ToTable("item_item"); + + b.HasData( + new + { + ItemID = 1, + CodGroup = "WindowTrunk", + Cost = 20.0, + Description = "BARRA-60x80 generica", + ExtItemCode = "", + IsService = false, + ItemCode = 1001, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.29999999999999999, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "BARR.001", + UM = "#" + }, + new + { + ItemID = 2, + CodGroup = "WindowTrunk", + Cost = 16.5, + Description = "Barra 60x80, lunghezza 12m", + ExtItemCode = "BARRA-60x80x12000", + IsService = false, + ItemCode = 1002, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20999999999999999, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "ABC.00123.12000", + UM = "#" + }, + new + { + ItemID = 3, + CodGroup = "WindowTrunk", + Cost = 17.5, + Description = "Barra 60x80, lunghezza 8m", + ExtItemCode = "BARRA-60x80x8000", + IsService = false, + ItemCode = 1003, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.22, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "ABC.00123.8000", + UM = "#" + }, + new + { + ItemID = 4, + CodGroup = "WindowTrunk", + Cost = 15.5, + Description = "Barra 60x80, lunghezza 16m", + ExtItemCode = "BARRA-60x80x16000", + IsService = false, + ItemCode = 1004, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20000000000000001, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "ABC.00123.16000", + UM = "#" + }, + new + { + ItemID = 5, + CodGroup = "WindowGlass", + Cost = 300.0, + Description = "Vetro triplo, basso indice termico, 800x1000", + ExtItemCode = "VETRO-3L-THERMO-800x1000", + IsService = false, + ItemCode = 2001, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20000000000000001, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "V3T.800.1000", + UM = "m2" + }, + new + { + ItemID = 6, + CodGroup = "WindowGlass", + Cost = 200.0, + Description = "Vetro doppio, 800x1000", + ExtItemCode = "VETRO-2L-800x1000", + IsService = false, + ItemCode = 2002, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.14999999999999999, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "V2.800.1000", + UM = "m2" + }, + new + { + ItemID = 7, + CodGroup = "WindowGlass", + Cost = 250.0, + Description = "Vetro triplo, 800x1000", + ExtItemCode = "VETRO-3L-800x1000", + IsService = false, + ItemCode = 2003, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.17999999999999999, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "V3.800.1000", + UM = "m2" + }, + new + { + ItemID = 8, + CodGroup = "WindowVarnish", + Cost = 20.0, + Description = "Vernice trasparente", + ExtItemCode = "VERN-TRASP", + IsService = false, + ItemCode = 3001, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20000000000000001, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "VT.STD", + UM = "l" + }, + new + { + ItemID = 9, + CodGroup = "WindowHardware", + Cost = 65.0, + Description = "Kit standard completo AGB tipo 001", + ExtItemCode = "KIT-001", + IsService = false, + ItemCode = 5001, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20000000000000001, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "AGB-KIT-001", + UM = "#" + }, + new + { + ItemID = 10, + CodGroup = "WindowHardware", + Cost = 10.0, + Description = "Cerniera AGB tipo 001", + ExtItemCode = "CERN-001", + IsService = false, + ItemCode = 5002, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20000000000000001, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "AGB-CERN-001", + UM = "#" + }, + new + { + ItemID = 11, + CodGroup = "WindowHardware", + Cost = 15.0, + Description = "Serratura AGB tipo 001", + ExtItemCode = "SERR-001", + IsService = false, + ItemCode = 5003, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20000000000000001, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "AGB-SERR-001", + UM = "#" + }, + new + { + ItemID = 12, + CodGroup = "WindowHardware", + Cost = 25.0, + Description = "Maniglia AGB tipo 001", + ExtItemCode = "MAN-001", + IsService = false, + ItemCode = 5004, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20000000000000001, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "AGB-MAN-001", + UM = "#" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.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("ItemSteps") + .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("item_selling_item"); + + b.HasData( + new + { + SellingItemID = 1, + Cost = 820.0, + Description = "Finestra anta Singola", + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 2, + Margin = 0.20000000000000001, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 2, + Cost = 150.0, + Description = "Persiana anta singola", + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 1, + Margin = 0.10000000000000001, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 3, + Cost = 200.0, + Description = "Installazione", + ExtItemCode = "", + IsService = true, + ItemCode = 0, + ItemSteps = "", + JobID = 1, + Margin = 0.29999999999999999, + SerStruct = "", + SupplCode = "", + UM = "#" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.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("item_supplier"); + + 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("EgwCoreLib.Lux.Data.DbModel.Production.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("production_batch"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.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("production_item"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemStepModel", b => + { + b.Property("ProdItemStepID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemStepID")); + + 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("ProdItemStepID"); + + b.HasIndex("PhaseID"); + + b.HasIndex("ProdItemID"); + + b.HasIndex("ResourceID"); + + b.ToTable("production_item_step"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.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("sales_customer"); + + 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("EgwCoreLib.Lux.Data.DbModel.Sales.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("sales_dealer"); + + 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("EgwCoreLib.Lux.Data.DbModel.Sales.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("Discount") + .HasColumnType("double"); + + b.Property("Envir") + .HasColumnType("int"); + + 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("sales_offer"); + + b.HasData( + new + { + OfferID = 1, + CustomerID = 2, + DealerID = 2, + Description = "Offerta per tre serramenti", + Discount = 0.0, + Envir = 1, + Inserted = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4627), + Modified = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4629), + OffertState = 0, + RefNum = 1, + RefRev = 1, + RefYear = 2024, + ValidUntil = new DateTime(2025, 11, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4624) + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferRowModel", b => + { + b.Property("OfferRowID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OfferRowID")); + + b.Property("AwaitBom") + .HasColumnType("tinyint(1)"); + + b.Property("AwaitPrice") + .HasColumnType("tinyint(1)"); + + b.Property("BomCost") + .HasColumnType("double"); + + b.Property("BomOk") + .HasColumnType("tinyint(1)"); + + b.Property("BomPrice") + .HasColumnType("double"); + + b.Property("Envir") + .HasColumnType("int"); + + b.Property("Inserted") + .HasColumnType("datetime(6)"); + + b.Property("ItemBOM") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ItemOk") + .HasColumnType("tinyint(1)"); + + b.Property("ItemSteps") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Modified") + .HasColumnType("datetime(6)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OfferID") + .HasColumnType("int"); + + b.Property("OfferRowUID") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Qty") + .HasColumnType("double"); + + b.Property("RowNum") + .HasColumnType("int"); + + b.Property("SellingItemID") + .HasColumnType("int"); + + b.Property("SerStruct") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StepCost") + .HasColumnType("double"); + + b.Property("StepPrice") + .HasColumnType("double"); + + b.HasKey("OfferRowID"); + + b.HasIndex("OfferID"); + + b.HasIndex("SellingItemID"); + + b.ToTable("sales_offer_row"); + + b.HasData( + new + { + OfferRowID = 1, + AwaitBom = false, + AwaitPrice = false, + BomCost = 900.0, + BomOk = true, + BomPrice = 950.0, + Envir = 1, + Inserted = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4753), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4755), + Note = "Finestra anta singola 2025", + OfferID = 1, + OfferRowUID = "OFF250000000001", + Qty = 3.0, + RowNum = 1, + SellingItemID = 1, + SerStruct = "{}", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 2, + AwaitBom = false, + AwaitPrice = false, + BomCost = 160.0, + BomOk = true, + BomPrice = 200.0, + Envir = 1, + Inserted = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4768), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4770), + Note = "Persiana per Finestra anta singola 2025", + OfferID = 1, + OfferRowUID = "OFF250000000002", + Qty = 3.0, + RowNum = 2, + SellingItemID = 2, + SerStruct = "{}", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 3, + AwaitBom = false, + AwaitPrice = false, + BomCost = 200.0, + BomOk = true, + BomPrice = 250.0, + Envir = 1, + Inserted = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4780), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4782), + Note = "Installazione serramento", + OfferID = 1, + OfferRowUID = "OFF250000000003", + Qty = 3.0, + RowNum = 3, + SellingItemID = 3, + SerStruct = "{}", + StepCost = 0.0, + StepPrice = 0.0 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.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("sales_order"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OrderRowModel", b => + { + b.Property("OrderRowID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OrderRowID")); + + b.Property("BomCost") + .HasColumnType("double"); + + b.Property("BomPrice") + .HasColumnType("double"); + + b.Property("Inserted") + .HasColumnType("datetime(6)"); + + b.Property("ItemSteps") + .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.Property("StepCost") + .HasColumnType("double"); + + b.Property("StepPrice") + .HasColumnType("double"); + + b.HasKey("OrderRowID"); + + b.HasIndex("OrderID"); + + b.HasIndex("SellingItemID"); + + b.ToTable("sales_order_row"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.StockMovModel", b => + { + b.Property("StockMovID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("StockMovID")); + + b.Property("CodDoc") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DtCreate") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("DtMod") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("timestamp") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("DtMod")); + + b.Property("MovCod") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("QtyRec") + .HasColumnType("double"); + + b.Property("StockStatusId") + .HasColumnType("int"); + + b.Property("UnitVal") + .HasColumnType("double"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("StockMovID"); + + b.HasIndex("MovCod"); + + b.HasIndex("StockStatusId"); + + b.ToTable("stock_mov"); + + b.HasData( + new + { + StockMovID = 1, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4289), + DtMod = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4360), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 5.0, + StockStatusId = 1, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 2, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4363), + DtMod = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4364), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 8.0, + StockStatusId = 2, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 3, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4367), + DtMod = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4368), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 5.0, + StockStatusId = 3, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 4, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4370), + DtMod = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4372), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 4, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 5, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4374), + DtMod = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4375), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 10.0, + StockStatusId = 5, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 6, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4378), + DtMod = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4379), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 6, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 7, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4381), + DtMod = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4383), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 50.0, + StockStatusId = 7, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 8, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4385), + DtMod = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4386), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 8, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 9, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4389), + DtMod = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4390), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 9, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 10, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4392), + DtMod = new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4394), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 10, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.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("stock_status"); + + 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 = 8, + Location = "V001-001-003", + QtyAvail = 50.0 + }, + new + { + StockStatusId = 8, + IsDeleted = false, + IsRemn = false, + ItemID = 11, + 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("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", b => + { + b.Property("JobID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("JobID"); + + b.ToTable("task_job"); + + b.HasData( + new + { + JobID = 1, + Description = "Rivendita / servizi" + }, + new + { + JobID = 2, + Description = "Serramento Completo Legno su linea Saomad e installatore interno" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepItemModel", b => + { + b.Property("JobStepItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobStepItemID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("ItemID") + .HasColumnType("int"); + + b.Property("JobStepID") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("double"); + + b.HasKey("JobStepItemID"); + + b.HasIndex("ItemID"); + + b.HasIndex("JobStepID"); + + b.ToTable("task_job_step_item"); + + b.HasData( + new + { + JobStepItemID = 1, + Description = "Grezzo legno abete", + Index = 1, + ItemID = 1, + JobStepID = 1, + Qty = 1.0 + }, + new + { + JobStepItemID = 2, + Description = "Vernice trasparente standard 1L", + Index = 2, + ItemID = 8, + JobStepID = 3, + Qty = 0.10000000000000001 + }, + new + { + JobStepItemID = 3, + Description = "Ferramenta AGB - rif. AGFD.00000.00000", + Index = 3, + ItemID = 9, + JobStepID = 4, + Qty = 1.0 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepModel", b => + { + b.Property("JobStepID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobStepID")); + + b.Property("CostDriverID") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("JobID") + .HasColumnType("int"); + + b.Property("PhaseID") + .HasColumnType("int"); + + b.Property("ProductivityRate") + .HasColumnType("decimal(65,30)"); + + b.Property("ResourceID") + .HasColumnType("int"); + + b.HasKey("JobStepID"); + + b.HasIndex("CostDriverID"); + + b.HasIndex("JobID"); + + b.HasIndex("PhaseID"); + + b.HasIndex("ResourceID"); + + b.ToTable("task_job_step"); + + b.HasData( + new + { + JobStepID = 1, + CostDriverID = 3, + Description = "", + Index = 1, + JobID = 2, + PhaseID = 1, + ProductivityRate = 1m, + ResourceID = 1 + }, + new + { + JobStepID = 2, + CostDriverID = 2, + Description = "", + Index = 2, + JobID = 2, + PhaseID = 2, + ProductivityRate = 1m, + ResourceID = 2 + }, + new + { + JobStepID = 3, + CostDriverID = 3, + Description = "", + Index = 3, + JobID = 2, + PhaseID = 3, + ProductivityRate = 1m, + ResourceID = 4 + }, + new + { + JobStepID = 4, + CostDriverID = 3, + Description = "", + Index = 4, + JobID = 2, + PhaseID = 4, + ProductivityRate = 1m, + ResourceID = 6 + }, + new + { + JobStepID = 5, + CostDriverID = 3, + Description = "", + Index = 5, + JobID = 2, + PhaseID = 6, + ProductivityRate = 1m, + ResourceID = 7 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.PhaseModel", b => + { + b.Property("PhaseID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PhaseID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("PhaseID"); + + b.ToTable("task_phase"); + + 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("EgwCoreLib.Lux.Data.DbModel.Utils.CounterModel", b => + { + b.Property("RefYear") + .HasColumnType("int"); + + b.Property("CountName") + .HasColumnType("varchar(255)"); + + b.Property("Counter") + .HasColumnType("int"); + + b.HasKey("RefYear", "CountName"); + + b.ToTable("utils_counter"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenClassModel", b => + { + b.Property("ClassCod") + .HasColumnType("varchar(255)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("ClassCod"); + + b.ToTable("utils_gen_class"); + + b.HasData( + new + { + ClassCod = "WoodMat", + Description = "Elenco Materiali Legno" + }, + new + { + ClassCod = "WoodCol", + Description = "Elenco Colori Legno" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenValueModel", b => + { + b.Property("GenValID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GenValID")); + + b.Property("ClassCod") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Ordinal") + .HasColumnType("int"); + + b.Property("ValString") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("GenValID"); + + b.HasIndex("ClassCod"); + + b.ToTable("utils_gen_value"); + + b.HasData( + new + { + GenValID = 1, + ClassCod = "WoodMat", + Ordinal = 1, + ValString = "Pine" + }, + new + { + GenValID = 2, + ClassCod = "WoodMat", + Ordinal = 2, + ValString = "Maple" + }, + new + { + GenValID = 3, + ClassCod = "WoodCol", + Ordinal = 1, + ValString = "Legno" + }, + new + { + GenValID = 4, + ClassCod = "WoodCol", + Ordinal = 2, + ValString = "Bianco" + }, + new + { + GenValID = 5, + ClassCod = "WoodCol", + Ordinal = 3, + ValString = "Rosso" + }, + new + { + GenValID = 6, + ClassCod = "WoodCol", + Ordinal = 4, + ValString = "Nero" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.MovTypeModel", b => + { + b.Property("MovCod") + .HasColumnType("varchar(255)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("MovCod"); + + b.ToTable("utils_mov_type"); + + b.HasData( + new + { + MovCod = "CAR", + Description = "Carico a magazzino" + }, + new + { + MovCod = "MOV", + Description = "Movimento interno (spostamento)" + }, + new + { + MovCod = "ND", + Description = "Non Definito" + }, + new + { + MovCod = "OFOR", + Description = "Ordine Fornitore" + }, + new + { + MovCod = "RETT", + Description = "Rettifica magazzino" + }, + new + { + MovCod = "SCAR", + Description = "Scarico da magazzino" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.TagsModel", b => + { + b.Property("TagID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TagID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("TagID"); + + b.ToTable("utils_tags"); + + 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("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.CostDriverModel", "DriverNav") + .WithMany() + .HasForeignKey("CostDriverID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("DriverNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.ItemGroupModel", "ItemGroupNav") + .WithMany() + .HasForeignKey("CodGroup") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ItemGroupNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", "JobNav") + .WithMany() + .HasForeignKey("JobID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("JobNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OrderRowModel", "OrderRowNav") + .WithMany() + .HasForeignKey("OrderRowID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Production.ProductionBatchModel", "ProductionBatchNav") + .WithMany() + .HasForeignKey("ProductionBatchID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OrderRowNav"); + + b.Navigation("ProductionBatchNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemStepModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.PhaseModel", "PhaseNav") + .WithMany() + .HasForeignKey("PhaseID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemModel", "ProdItemNav") + .WithMany() + .HasForeignKey("ProdItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", "ResourceNav") + .WithMany() + .HasForeignKey("ResourceID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("PhaseNav"); + + b.Navigation("ProdItemNav"); + + b.Navigation("ResourceNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.CustomerModel", "CustomerNav") + .WithMany() + .HasForeignKey("CustomerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.DealerModel", "DealerNav") + .WithMany() + .HasForeignKey("DealerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CustomerNav"); + + b.Navigation("DealerNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferRowModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", "OfferNav") + .WithMany("OfferRowNav") + .HasForeignKey("OfferID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", "SellingItemNav") + .WithMany() + .HasForeignKey("SellingItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OfferNav"); + + b.Navigation("SellingItemNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OrderModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.CustomerModel", "CustomerNav") + .WithMany() + .HasForeignKey("CustomerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.DealerModel", "DealerNav") + .WithMany() + .HasForeignKey("DealerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", "OfferNav") + .WithMany() + .HasForeignKey("OfferID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CustomerNav"); + + b.Navigation("DealerNav"); + + b.Navigation("OfferNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OrderRowModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OrderModel", "OrderNav") + .WithMany() + .HasForeignKey("OrderID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", "SellingItemNav") + .WithMany() + .HasForeignKey("SellingItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OrderNav"); + + b.Navigation("SellingItemNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.StockMovModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Utils.MovTypeModel", "MovTypeNav") + .WithMany() + .HasForeignKey("MovCod") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Stock.StockStatusModel", "StockStatusNav") + .WithMany() + .HasForeignKey("StockStatusId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MovTypeNav"); + + b.Navigation("StockStatusNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.StockStatusModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", "ItemNav") + .WithMany() + .HasForeignKey("ItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ItemNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepItemModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", "ItemNav") + .WithMany() + .HasForeignKey("ItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.JobStepModel", "JobStepNav") + .WithMany() + .HasForeignKey("JobStepID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ItemNav"); + + b.Navigation("JobStepNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.CostDriverModel", "DriverNav") + .WithMany() + .HasForeignKey("CostDriverID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", "JobNav") + .WithMany("JobStepNav") + .HasForeignKey("JobID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.PhaseModel", "PhaseNav") + .WithMany() + .HasForeignKey("PhaseID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", "ResourceNav") + .WithMany() + .HasForeignKey("ResourceID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("DriverNav"); + + b.Navigation("JobNav"); + + b.Navigation("PhaseNav"); + + b.Navigation("ResourceNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenValueModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Utils.GenClassModel", "GenClassNav") + .WithMany("GenValNav") + .HasForeignKey("ClassCod") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("GenClassNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", b => + { + b.Navigation("OfferRowNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", b => + { + b.Navigation("JobStepNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenClassModel", b => + { + b.Navigation("GenValNav"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/EgwCoreLib.Lux.Data/Migrations/20251002110150_AddConfTables_01.cs b/EgwCoreLib.Lux.Data/Migrations/20251002110150_AddConfTables_01.cs new file mode 100644 index 00000000..b42e0a3d --- /dev/null +++ b/EgwCoreLib.Lux.Data/Migrations/20251002110150_AddConfTables_01.cs @@ -0,0 +1,279 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EgwCoreLib.Lux.Data.Migrations +{ + /// + public partial class AddConfTables_01 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "conf_glass", + columns: table => new + { + GlassID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Thickness = table.Column(type: "double", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_conf_glass", x => x.GlassID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "conf_profile", + columns: table => new + { + ProfileID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Code = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Thickness = table.Column(type: "double", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_conf_profile", x => x.ProfileID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "conf_wood", + columns: table => new + { + WoodID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ExtId = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Type = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_conf_wood", x => x.WoodID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.UpdateData( + table: "sales_offer", + keyColumn: "OfferID", + keyValue: 1, + columns: new[] { "Inserted", "Modified", "ValidUntil" }, + values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4627), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4629), new DateTime(2025, 11, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4624) }); + + migrationBuilder.UpdateData( + table: "sales_offer_row", + keyColumn: "OfferRowID", + keyValue: 1, + columns: new[] { "Inserted", "Modified" }, + values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4753), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4755) }); + + migrationBuilder.UpdateData( + table: "sales_offer_row", + keyColumn: "OfferRowID", + keyValue: 2, + columns: new[] { "Inserted", "Modified" }, + values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4768), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4770) }); + + migrationBuilder.UpdateData( + table: "sales_offer_row", + keyColumn: "OfferRowID", + keyValue: 3, + columns: new[] { "Inserted", "Modified" }, + values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4780), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4782) }); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 1, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4289)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 2, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4363)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 3, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4367)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 4, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4370)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 5, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4374)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 6, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4378)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 7, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4381)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 8, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4385)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 9, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4389)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 10, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4392)); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "conf_glass"); + + migrationBuilder.DropTable( + name: "conf_profile"); + + migrationBuilder.DropTable( + name: "conf_wood"); + + migrationBuilder.UpdateData( + table: "sales_offer", + keyColumn: "OfferID", + keyValue: 1, + columns: new[] { "Inserted", "Modified", "ValidUntil" }, + values: new object[] { new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4738), new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4739), new DateTime(2025, 10, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4735) }); + + migrationBuilder.UpdateData( + table: "sales_offer_row", + keyColumn: "OfferRowID", + keyValue: 1, + columns: new[] { "Inserted", "Modified" }, + values: new object[] { new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4848), new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4850) }); + + migrationBuilder.UpdateData( + table: "sales_offer_row", + keyColumn: "OfferRowID", + keyValue: 2, + columns: new[] { "Inserted", "Modified" }, + values: new object[] { new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4862), new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4864) }); + + migrationBuilder.UpdateData( + table: "sales_offer_row", + keyColumn: "OfferRowID", + keyValue: 3, + columns: new[] { "Inserted", "Modified" }, + values: new object[] { new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4874), new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4875) }); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 1, + column: "DtCreate", + value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4416)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 2, + column: "DtCreate", + value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4475)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 3, + column: "DtCreate", + value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4479)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 4, + column: "DtCreate", + value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4482)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 5, + column: "DtCreate", + value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4486)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 6, + column: "DtCreate", + value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4490)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 7, + column: "DtCreate", + value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4493)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 8, + column: "DtCreate", + value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4497)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 9, + column: "DtCreate", + value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4501)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 10, + column: "DtCreate", + value: new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4504)); + } + } +} diff --git a/EgwCoreLib.Lux.Data/Migrations/20251002134750_AddInitConfVal.Designer.cs b/EgwCoreLib.Lux.Data/Migrations/20251002134750_AddInitConfVal.Designer.cs new file mode 100644 index 00000000..98cfa909 --- /dev/null +++ b/EgwCoreLib.Lux.Data/Migrations/20251002134750_AddInitConfVal.Designer.cs @@ -0,0 +1,2400 @@ +// +using System; +using EgwCoreLib.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 EgwCoreLib.Lux.Data.Migrations +{ + [DbContext(typeof(DataLayerContext))] + [Migration("20251002134750_AddInitConfVal")] + partial class AddInitConfVal + { + /// + 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("EgwCoreLib.Lux.Data.DbModel.Config.GlassModel", b => + { + b.Property("GlassID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GlassID")); + + b.Property("Code") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Thickness") + .HasColumnType("double"); + + b.HasKey("GlassID"); + + b.ToTable("conf_glass"); + + b.HasData( + new + { + GlassID = 1, + Code = "", + Description = "Vetro BE 2S 4/12/4", + Thickness = 20.0 + }, + new + { + GlassID = 2, + Code = "", + Description = "Vetro BE 3S 4/12/4/12/4", + Thickness = 36.0 + }, + new + { + GlassID = 3, + Code = "", + Description = "Vetro BE 3S 4/16/4/16/4", + Thickness = 44.0 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.ProfileModel", b => + { + b.Property("ProfileID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProfileID")); + + b.Property("Code") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Thickness") + .HasColumnType("double"); + + b.HasKey("ProfileID"); + + b.ToTable("conf_profile"); + + b.HasData( + new + { + ProfileID = 1, + Code = "", + Description = "Profilo 32", + Thickness = 32.0 + }, + new + { + ProfileID = 2, + Code = "", + Description = "Profilo 48", + Thickness = 48.0 + }, + new + { + ProfileID = 3, + Code = "", + Description = "Profilo 58", + Thickness = 58.0 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.WoodModel", b => + { + b.Property("WoodID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("WoodID")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("ExtId") + .HasColumnType("longtext"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("WoodID"); + + b.ToTable("conf_wood"); + + b.HasData( + new + { + WoodID = 1, + Description = "Abete", + ExtId = "", + Type = 1 + }, + new + { + WoodID = 2, + Description = "Acero", + ExtId = "", + Type = 1 + }, + new + { + WoodID = 3, + Description = "Pino", + ExtId = "", + Type = 2 + }, + new + { + WoodID = 4, + Description = "Tek", + ExtId = "", + Type = 3 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Cost.CostDriverModel", b => + { + b.Property("CostDriverID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CostDriverID")); + + b.Property("Descript") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Unit") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("CostDriverID"); + + b.ToTable("cost_driver"); + + b.HasData( + new + { + CostDriverID = 1, + Descript = "Ore lavorate per step/fase", + Name = "WorkHour", + Unit = "h" + }, + new + { + CostDriverID = 2, + Descript = "Metri prodotti per step/fase", + Name = "Meter", + Unit = "m" + }, + new + { + CostDriverID = 3, + Descript = "Numero unità prodotte (lavorate) per step/fase", + Name = "Unit", + Unit = "#" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", b => + { + b.Property("ResourceID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ResourceID")); + + b.Property("CostDriverBudget") + .HasColumnType("decimal(65,30)"); + + b.Property("CostDriverID") + .HasColumnType("int"); + + b.Property("EBTPerc") + .HasColumnType("decimal(65,30)"); + + b.Property("FixedCost") + .HasColumnType("decimal(65,30)"); + + b.Property("LaborCost") + .HasColumnType("decimal(65,30)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OverHeadCost") + .HasColumnType("decimal(65,30)"); + + b.Property("OverHeadPerc") + .HasColumnType("decimal(65,30)"); + + b.Property("PriceMargin") + .HasColumnType("decimal(65,30)"); + + b.Property("VariableCost") + .HasColumnType("decimal(65,30)"); + + b.HasKey("ResourceID"); + + b.HasIndex("CostDriverID"); + + b.ToTable("cost_resource"); + + b.HasData( + new + { + ResourceID = 1, + CostDriverBudget = 880m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 12000m, + LaborCost = 30m, + Name = "Sezionatrice", + OverHeadCost = 5000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 6000m + }, + new + { + ResourceID = 2, + CostDriverBudget = 1760m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 100000m, + LaborCost = 40m, + Name = "Linea SAOMAD WoodPecker Just 3500", + OverHeadCost = 15000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 30000m + }, + new + { + ResourceID = 3, + CostDriverBudget = 1760m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 24000m, + LaborCost = 35m, + Name = "Linea Pantografo", + OverHeadCost = 5000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 6000m + }, + new + { + ResourceID = 4, + CostDriverBudget = 880m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 24000m, + LaborCost = 30m, + Name = "Stazione Verniciatura", + OverHeadCost = 3000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 6000m + }, + new + { + ResourceID = 5, + CostDriverBudget = 220m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 6000m, + LaborCost = 30m, + Name = "Verniciatura Manuale", + OverHeadCost = 3000m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 2000m + }, + new + { + ResourceID = 6, + CostDriverBudget = 3520m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 500m, + LaborCost = 30m, + Name = "Montaggio Manuale", + OverHeadCost = 500m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 500m + }, + new + { + ResourceID = 7, + CostDriverBudget = 3520m, + CostDriverID = 1, + EBTPerc = 0.15m, + FixedCost = 0m, + LaborCost = 40m, + Name = "Installatore", + OverHeadCost = 0m, + OverHeadPerc = 0.15m, + PriceMargin = 0.2m, + VariableCost = 3000m + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.ItemGroupModel", b => + { + b.Property("CodGroup") + .HasColumnType("varchar(255)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("CodGroup"); + + b.ToTable("item_group"); + + b.HasData( + new + { + CodGroup = "WindowTrunk", + Description = "Barre legno per lavorazione" + }, + new + { + CodGroup = "WindowGlass", + Description = "Vetri serramento" + }, + new + { + CodGroup = "WindowVarnish", + Description = "Vernici per legno" + }, + new + { + CodGroup = "WindowHardware", + Description = "Ferramenta serramento" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", b => + { + b.Property("ItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemID")); + + b.Property("CodGroup") + .IsRequired() + .HasColumnType("varchar(255)"); + + 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("ItemIDParent") + .HasColumnType("int"); + + b.Property("ItemType") + .HasColumnType("int"); + + b.Property("Margin") + .HasColumnType("double"); + + b.Property("QtyMax") + .HasColumnType("double"); + + b.Property("QtyMin") + .HasColumnType("double"); + + b.Property("SupplCode") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UM") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("ItemID"); + + b.HasIndex("CodGroup"); + + b.ToTable("item_item"); + + b.HasData( + new + { + ItemID = 1, + CodGroup = "WindowTrunk", + Cost = 20.0, + Description = "BARRA-60x80 generica", + ExtItemCode = "", + IsService = false, + ItemCode = 1001, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.29999999999999999, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "BARR.001", + UM = "#" + }, + new + { + ItemID = 2, + CodGroup = "WindowTrunk", + Cost = 16.5, + Description = "Barra 60x80, lunghezza 12m", + ExtItemCode = "BARRA-60x80x12000", + IsService = false, + ItemCode = 1002, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20999999999999999, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "ABC.00123.12000", + UM = "#" + }, + new + { + ItemID = 3, + CodGroup = "WindowTrunk", + Cost = 17.5, + Description = "Barra 60x80, lunghezza 8m", + ExtItemCode = "BARRA-60x80x8000", + IsService = false, + ItemCode = 1003, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.22, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "ABC.00123.8000", + UM = "#" + }, + new + { + ItemID = 4, + CodGroup = "WindowTrunk", + Cost = 15.5, + Description = "Barra 60x80, lunghezza 16m", + ExtItemCode = "BARRA-60x80x16000", + IsService = false, + ItemCode = 1004, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20000000000000001, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "ABC.00123.16000", + UM = "#" + }, + new + { + ItemID = 5, + CodGroup = "WindowGlass", + Cost = 300.0, + Description = "Vetro triplo, basso indice termico, 800x1000", + ExtItemCode = "VETRO-3L-THERMO-800x1000", + IsService = false, + ItemCode = 2001, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20000000000000001, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "V3T.800.1000", + UM = "m2" + }, + new + { + ItemID = 6, + CodGroup = "WindowGlass", + Cost = 200.0, + Description = "Vetro doppio, 800x1000", + ExtItemCode = "VETRO-2L-800x1000", + IsService = false, + ItemCode = 2002, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.14999999999999999, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "V2.800.1000", + UM = "m2" + }, + new + { + ItemID = 7, + CodGroup = "WindowGlass", + Cost = 250.0, + Description = "Vetro triplo, 800x1000", + ExtItemCode = "VETRO-3L-800x1000", + IsService = false, + ItemCode = 2003, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.17999999999999999, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "V3.800.1000", + UM = "m2" + }, + new + { + ItemID = 8, + CodGroup = "WindowVarnish", + Cost = 20.0, + Description = "Vernice trasparente", + ExtItemCode = "VERN-TRASP", + IsService = false, + ItemCode = 3001, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20000000000000001, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "VT.STD", + UM = "l" + }, + new + { + ItemID = 9, + CodGroup = "WindowHardware", + Cost = 65.0, + Description = "Kit standard completo AGB tipo 001", + ExtItemCode = "KIT-001", + IsService = false, + ItemCode = 5001, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20000000000000001, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "AGB-KIT-001", + UM = "#" + }, + new + { + ItemID = 10, + CodGroup = "WindowHardware", + Cost = 10.0, + Description = "Cerniera AGB tipo 001", + ExtItemCode = "CERN-001", + IsService = false, + ItemCode = 5002, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20000000000000001, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "AGB-CERN-001", + UM = "#" + }, + new + { + ItemID = 11, + CodGroup = "WindowHardware", + Cost = 15.0, + Description = "Serratura AGB tipo 001", + ExtItemCode = "SERR-001", + IsService = false, + ItemCode = 5003, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20000000000000001, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "AGB-SERR-001", + UM = "#" + }, + new + { + ItemID = 12, + CodGroup = "WindowHardware", + Cost = 25.0, + Description = "Maniglia AGB tipo 001", + ExtItemCode = "MAN-001", + IsService = false, + ItemCode = 5004, + ItemIDParent = 0, + ItemType = 1, + Margin = 0.20000000000000001, + QtyMax = 0.0, + QtyMin = 0.0, + SupplCode = "AGB-MAN-001", + UM = "#" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.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("ItemSteps") + .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("item_selling_item"); + + b.HasData( + new + { + SellingItemID = 1, + Cost = 820.0, + Description = "Finestra anta Singola", + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 2, + Margin = 0.20000000000000001, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 2, + Cost = 150.0, + Description = "Persiana anta singola", + ExtItemCode = "", + IsService = false, + ItemCode = 0, + ItemSteps = "", + JobID = 1, + Margin = 0.10000000000000001, + SerStruct = "", + SupplCode = "", + UM = "#" + }, + new + { + SellingItemID = 3, + Cost = 200.0, + Description = "Installazione", + ExtItemCode = "", + IsService = true, + ItemCode = 0, + ItemSteps = "", + JobID = 1, + Margin = 0.29999999999999999, + SerStruct = "", + SupplCode = "", + UM = "#" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.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("item_supplier"); + + 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("EgwCoreLib.Lux.Data.DbModel.Production.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("production_batch"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.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("production_item"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemStepModel", b => + { + b.Property("ProdItemStepID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProdItemStepID")); + + 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("ProdItemStepID"); + + b.HasIndex("PhaseID"); + + b.HasIndex("ProdItemID"); + + b.HasIndex("ResourceID"); + + b.ToTable("production_item_step"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.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("sales_customer"); + + 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("EgwCoreLib.Lux.Data.DbModel.Sales.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("sales_dealer"); + + 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("EgwCoreLib.Lux.Data.DbModel.Sales.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("Discount") + .HasColumnType("double"); + + b.Property("Envir") + .HasColumnType("int"); + + 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("sales_offer"); + + b.HasData( + new + { + OfferID = 1, + CustomerID = 2, + DealerID = 2, + Description = "Offerta per tre serramenti", + Discount = 0.0, + Envir = 1, + Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9241), + Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9242), + OffertState = 0, + RefNum = 1, + RefRev = 1, + RefYear = 2024, + ValidUntil = new DateTime(2025, 11, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9238) + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferRowModel", b => + { + b.Property("OfferRowID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OfferRowID")); + + b.Property("AwaitBom") + .HasColumnType("tinyint(1)"); + + b.Property("AwaitPrice") + .HasColumnType("tinyint(1)"); + + b.Property("BomCost") + .HasColumnType("double"); + + b.Property("BomOk") + .HasColumnType("tinyint(1)"); + + b.Property("BomPrice") + .HasColumnType("double"); + + b.Property("Envir") + .HasColumnType("int"); + + b.Property("Inserted") + .HasColumnType("datetime(6)"); + + b.Property("ItemBOM") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ItemOk") + .HasColumnType("tinyint(1)"); + + b.Property("ItemSteps") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Modified") + .HasColumnType("datetime(6)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OfferID") + .HasColumnType("int"); + + b.Property("OfferRowUID") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Qty") + .HasColumnType("double"); + + b.Property("RowNum") + .HasColumnType("int"); + + b.Property("SellingItemID") + .HasColumnType("int"); + + b.Property("SerStruct") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StepCost") + .HasColumnType("double"); + + b.Property("StepPrice") + .HasColumnType("double"); + + b.HasKey("OfferRowID"); + + b.HasIndex("OfferID"); + + b.HasIndex("SellingItemID"); + + b.ToTable("sales_offer_row"); + + b.HasData( + new + { + OfferRowID = 1, + AwaitBom = false, + AwaitPrice = false, + BomCost = 900.0, + BomOk = true, + BomPrice = 950.0, + Envir = 1, + Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9337), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9339), + Note = "Finestra anta singola 2025", + OfferID = 1, + OfferRowUID = "OFF250000000001", + Qty = 3.0, + RowNum = 1, + SellingItemID = 1, + SerStruct = "{}", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 2, + AwaitBom = false, + AwaitPrice = false, + BomCost = 160.0, + BomOk = true, + BomPrice = 200.0, + Envir = 1, + Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9350), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9352), + Note = "Persiana per Finestra anta singola 2025", + OfferID = 1, + OfferRowUID = "OFF250000000002", + Qty = 3.0, + RowNum = 2, + SellingItemID = 2, + SerStruct = "{}", + StepCost = 0.0, + StepPrice = 0.0 + }, + new + { + OfferRowID = 3, + AwaitBom = false, + AwaitPrice = false, + BomCost = 200.0, + BomOk = true, + BomPrice = 250.0, + Envir = 1, + Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9362), + ItemBOM = "", + ItemOk = true, + ItemSteps = "{}", + Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9364), + Note = "Installazione serramento", + OfferID = 1, + OfferRowUID = "OFF250000000003", + Qty = 3.0, + RowNum = 3, + SellingItemID = 3, + SerStruct = "{}", + StepCost = 0.0, + StepPrice = 0.0 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.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("sales_order"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OrderRowModel", b => + { + b.Property("OrderRowID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("OrderRowID")); + + b.Property("BomCost") + .HasColumnType("double"); + + b.Property("BomPrice") + .HasColumnType("double"); + + b.Property("Inserted") + .HasColumnType("datetime(6)"); + + b.Property("ItemSteps") + .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.Property("StepCost") + .HasColumnType("double"); + + b.Property("StepPrice") + .HasColumnType("double"); + + b.HasKey("OrderRowID"); + + b.HasIndex("OrderID"); + + b.HasIndex("SellingItemID"); + + b.ToTable("sales_order_row"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.StockMovModel", b => + { + b.Property("StockMovID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("StockMovID")); + + b.Property("CodDoc") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DtCreate") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("DtMod") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("timestamp") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("DtMod")); + + b.Property("MovCod") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("QtyRec") + .HasColumnType("double"); + + b.Property("StockStatusId") + .HasColumnType("int"); + + b.Property("UnitVal") + .HasColumnType("double"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("StockMovID"); + + b.HasIndex("MovCod"); + + b.HasIndex("StockStatusId"); + + b.ToTable("stock_mov"); + + b.HasData( + new + { + StockMovID = 1, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8944), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8989), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 5.0, + StockStatusId = 1, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 2, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8992), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8993), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 8.0, + StockStatusId = 2, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 3, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8995), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8997), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 5.0, + StockStatusId = 3, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 4, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8999), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9000), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 4, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 5, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9003), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9004), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 10.0, + StockStatusId = 5, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 6, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9006), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9008), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 6, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 7, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9010), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9011), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 50.0, + StockStatusId = 7, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 8, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9013), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9015), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 8, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 9, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9017), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9018), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 9, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }, + new + { + StockMovID = 10, + CodDoc = "", + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9021), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9023), + MovCod = "CAR", + Note = "DEMO", + QtyRec = 1.0, + StockStatusId = 10, + UnitVal = 0.0, + UserId = "samuele.locatelli@egalware.com" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.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("stock_status"); + + 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 = 8, + Location = "V001-001-003", + QtyAvail = 50.0 + }, + new + { + StockStatusId = 8, + IsDeleted = false, + IsRemn = false, + ItemID = 11, + 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("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", b => + { + b.Property("JobID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("JobID"); + + b.ToTable("task_job"); + + b.HasData( + new + { + JobID = 1, + Description = "Rivendita / servizi" + }, + new + { + JobID = 2, + Description = "Serramento Completo Legno su linea Saomad e installatore interno" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepItemModel", b => + { + b.Property("JobStepItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobStepItemID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("ItemID") + .HasColumnType("int"); + + b.Property("JobStepID") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("double"); + + b.HasKey("JobStepItemID"); + + b.HasIndex("ItemID"); + + b.HasIndex("JobStepID"); + + b.ToTable("task_job_step_item"); + + b.HasData( + new + { + JobStepItemID = 1, + Description = "Grezzo legno abete", + Index = 1, + ItemID = 1, + JobStepID = 1, + Qty = 1.0 + }, + new + { + JobStepItemID = 2, + Description = "Vernice trasparente standard 1L", + Index = 2, + ItemID = 8, + JobStepID = 3, + Qty = 0.10000000000000001 + }, + new + { + JobStepItemID = 3, + Description = "Ferramenta AGB - rif. AGFD.00000.00000", + Index = 3, + ItemID = 9, + JobStepID = 4, + Qty = 1.0 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepModel", b => + { + b.Property("JobStepID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("JobStepID")); + + b.Property("CostDriverID") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("JobID") + .HasColumnType("int"); + + b.Property("PhaseID") + .HasColumnType("int"); + + b.Property("ProductivityRate") + .HasColumnType("decimal(65,30)"); + + b.Property("ResourceID") + .HasColumnType("int"); + + b.HasKey("JobStepID"); + + b.HasIndex("CostDriverID"); + + b.HasIndex("JobID"); + + b.HasIndex("PhaseID"); + + b.HasIndex("ResourceID"); + + b.ToTable("task_job_step"); + + b.HasData( + new + { + JobStepID = 1, + CostDriverID = 3, + Description = "", + Index = 1, + JobID = 2, + PhaseID = 1, + ProductivityRate = 1m, + ResourceID = 1 + }, + new + { + JobStepID = 2, + CostDriverID = 2, + Description = "", + Index = 2, + JobID = 2, + PhaseID = 2, + ProductivityRate = 1m, + ResourceID = 2 + }, + new + { + JobStepID = 3, + CostDriverID = 3, + Description = "", + Index = 3, + JobID = 2, + PhaseID = 3, + ProductivityRate = 1m, + ResourceID = 4 + }, + new + { + JobStepID = 4, + CostDriverID = 3, + Description = "", + Index = 4, + JobID = 2, + PhaseID = 4, + ProductivityRate = 1m, + ResourceID = 6 + }, + new + { + JobStepID = 5, + CostDriverID = 3, + Description = "", + Index = 5, + JobID = 2, + PhaseID = 6, + ProductivityRate = 1m, + ResourceID = 7 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.PhaseModel", b => + { + b.Property("PhaseID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("PhaseID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("PhaseID"); + + b.ToTable("task_phase"); + + 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("EgwCoreLib.Lux.Data.DbModel.Utils.CounterModel", b => + { + b.Property("RefYear") + .HasColumnType("int"); + + b.Property("CountName") + .HasColumnType("varchar(255)"); + + b.Property("Counter") + .HasColumnType("int"); + + b.HasKey("RefYear", "CountName"); + + b.ToTable("utils_counter"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenClassModel", b => + { + b.Property("ClassCod") + .HasColumnType("varchar(255)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("ClassCod"); + + b.ToTable("utils_gen_class"); + + b.HasData( + new + { + ClassCod = "WoodMat", + Description = "Elenco Materiali Legno" + }, + new + { + ClassCod = "WoodCol", + Description = "Elenco Colori Legno" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenValueModel", b => + { + b.Property("GenValID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GenValID")); + + b.Property("ClassCod") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("Ordinal") + .HasColumnType("int"); + + b.Property("ValString") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("GenValID"); + + b.HasIndex("ClassCod"); + + b.ToTable("utils_gen_value"); + + b.HasData( + new + { + GenValID = 1, + ClassCod = "WoodMat", + Ordinal = 1, + ValString = "Pine" + }, + new + { + GenValID = 2, + ClassCod = "WoodMat", + Ordinal = 2, + ValString = "Maple" + }, + new + { + GenValID = 3, + ClassCod = "WoodCol", + Ordinal = 1, + ValString = "Legno" + }, + new + { + GenValID = 4, + ClassCod = "WoodCol", + Ordinal = 2, + ValString = "Bianco" + }, + new + { + GenValID = 5, + ClassCod = "WoodCol", + Ordinal = 3, + ValString = "Rosso" + }, + new + { + GenValID = 6, + ClassCod = "WoodCol", + Ordinal = 4, + ValString = "Nero" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.MovTypeModel", b => + { + b.Property("MovCod") + .HasColumnType("varchar(255)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("MovCod"); + + b.ToTable("utils_mov_type"); + + b.HasData( + new + { + MovCod = "CAR", + Description = "Carico a magazzino" + }, + new + { + MovCod = "MOV", + Description = "Movimento interno (spostamento)" + }, + new + { + MovCod = "ND", + Description = "Non Definito" + }, + new + { + MovCod = "OFOR", + Description = "Ordine Fornitore" + }, + new + { + MovCod = "RETT", + Description = "Rettifica magazzino" + }, + new + { + MovCod = "SCAR", + Description = "Scarico da magazzino" + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.TagsModel", b => + { + b.Property("TagID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("TagID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("TagID"); + + b.ToTable("utils_tags"); + + 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("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.CostDriverModel", "DriverNav") + .WithMany() + .HasForeignKey("CostDriverID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("DriverNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.ItemGroupModel", "ItemGroupNav") + .WithMany() + .HasForeignKey("CodGroup") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ItemGroupNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", "JobNav") + .WithMany() + .HasForeignKey("JobID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("JobNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OrderRowModel", "OrderRowNav") + .WithMany() + .HasForeignKey("OrderRowID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Production.ProductionBatchModel", "ProductionBatchNav") + .WithMany() + .HasForeignKey("ProductionBatchID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OrderRowNav"); + + b.Navigation("ProductionBatchNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemStepModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.PhaseModel", "PhaseNav") + .WithMany() + .HasForeignKey("PhaseID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Production.ProductionItemModel", "ProdItemNav") + .WithMany() + .HasForeignKey("ProdItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", "ResourceNav") + .WithMany() + .HasForeignKey("ResourceID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("PhaseNav"); + + b.Navigation("ProdItemNav"); + + b.Navigation("ResourceNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.CustomerModel", "CustomerNav") + .WithMany() + .HasForeignKey("CustomerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.DealerModel", "DealerNav") + .WithMany() + .HasForeignKey("DealerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CustomerNav"); + + b.Navigation("DealerNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferRowModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", "OfferNav") + .WithMany("OfferRowNav") + .HasForeignKey("OfferID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", "SellingItemNav") + .WithMany() + .HasForeignKey("SellingItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OfferNav"); + + b.Navigation("SellingItemNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OrderModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.CustomerModel", "CustomerNav") + .WithMany() + .HasForeignKey("CustomerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.DealerModel", "DealerNav") + .WithMany() + .HasForeignKey("DealerID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", "OfferNav") + .WithMany() + .HasForeignKey("OfferID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CustomerNav"); + + b.Navigation("DealerNav"); + + b.Navigation("OfferNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OrderRowModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Sales.OrderModel", "OrderNav") + .WithMany() + .HasForeignKey("OrderID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.SellingItemModel", "SellingItemNav") + .WithMany() + .HasForeignKey("SellingItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("OrderNav"); + + b.Navigation("SellingItemNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.StockMovModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Utils.MovTypeModel", "MovTypeNav") + .WithMany() + .HasForeignKey("MovCod") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Stock.StockStatusModel", "StockStatusNav") + .WithMany() + .HasForeignKey("StockStatusId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MovTypeNav"); + + b.Navigation("StockStatusNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Stock.StockStatusModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", "ItemNav") + .WithMany() + .HasForeignKey("ItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ItemNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepItemModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", "ItemNav") + .WithMany() + .HasForeignKey("ItemID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.JobStepModel", "JobStepNav") + .WithMany() + .HasForeignKey("JobStepID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("ItemNav"); + + b.Navigation("JobStepNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobStepModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.CostDriverModel", "DriverNav") + .WithMany() + .HasForeignKey("CostDriverID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", "JobNav") + .WithMany("JobStepNav") + .HasForeignKey("JobID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Task.PhaseModel", "PhaseNav") + .WithMany() + .HasForeignKey("PhaseID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Cost.ResourceModel", "ResourceNav") + .WithMany() + .HasForeignKey("ResourceID") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("DriverNav"); + + b.Navigation("JobNav"); + + b.Navigation("PhaseNav"); + + b.Navigation("ResourceNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenValueModel", b => + { + b.HasOne("EgwCoreLib.Lux.Data.DbModel.Utils.GenClassModel", "GenClassNav") + .WithMany("GenValNav") + .HasForeignKey("ClassCod") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("GenClassNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Sales.OfferModel", b => + { + b.Navigation("OfferRowNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Task.JobModel", b => + { + b.Navigation("JobStepNav"); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenClassModel", b => + { + b.Navigation("GenValNav"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/EgwCoreLib.Lux.Data/Migrations/20251002134750_AddInitConfVal.cs b/EgwCoreLib.Lux.Data/Migrations/20251002134750_AddInitConfVal.cs new file mode 100644 index 00000000..a851e27a --- /dev/null +++ b/EgwCoreLib.Lux.Data/Migrations/20251002134750_AddInitConfVal.cs @@ -0,0 +1,298 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace EgwCoreLib.Lux.Data.Migrations +{ + /// + public partial class AddInitConfVal : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "conf_glass", + columns: new[] { "GlassID", "Code", "Description", "Thickness" }, + values: new object[,] + { + { 1, "", "Vetro BE 2S 4/12/4", 20.0 }, + { 2, "", "Vetro BE 3S 4/12/4/12/4", 36.0 }, + { 3, "", "Vetro BE 3S 4/16/4/16/4", 44.0 } + }); + + migrationBuilder.InsertData( + table: "conf_profile", + columns: new[] { "ProfileID", "Code", "Description", "Thickness" }, + values: new object[,] + { + { 1, "", "Profilo 32", 32.0 }, + { 2, "", "Profilo 48", 48.0 }, + { 3, "", "Profilo 58", 58.0 } + }); + + migrationBuilder.InsertData( + table: "conf_wood", + columns: new[] { "WoodID", "Description", "ExtId", "Type" }, + values: new object[,] + { + { 1, "Abete", "", 1 }, + { 2, "Acero", "", 1 }, + { 3, "Pino", "", 2 }, + { 4, "Tek", "", 3 } + }); + + migrationBuilder.UpdateData( + table: "sales_offer", + keyColumn: "OfferID", + keyValue: 1, + columns: new[] { "Inserted", "Modified", "ValidUntil" }, + values: new object[] { new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9241), new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9242), new DateTime(2025, 11, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9238) }); + + migrationBuilder.UpdateData( + table: "sales_offer_row", + keyColumn: "OfferRowID", + keyValue: 1, + columns: new[] { "Inserted", "Modified" }, + values: new object[] { new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9337), new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9339) }); + + migrationBuilder.UpdateData( + table: "sales_offer_row", + keyColumn: "OfferRowID", + keyValue: 2, + columns: new[] { "Inserted", "Modified" }, + values: new object[] { new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9350), new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9352) }); + + migrationBuilder.UpdateData( + table: "sales_offer_row", + keyColumn: "OfferRowID", + keyValue: 3, + columns: new[] { "Inserted", "Modified" }, + values: new object[] { new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9362), new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9364) }); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 1, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8944)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 2, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8992)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 3, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8995)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 4, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8999)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 5, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9003)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 6, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9006)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 7, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9010)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 8, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9013)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 9, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9017)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 10, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9021)); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "conf_glass", + keyColumn: "GlassID", + keyValue: 1); + + migrationBuilder.DeleteData( + table: "conf_glass", + keyColumn: "GlassID", + keyValue: 2); + + migrationBuilder.DeleteData( + table: "conf_glass", + keyColumn: "GlassID", + keyValue: 3); + + migrationBuilder.DeleteData( + table: "conf_profile", + keyColumn: "ProfileID", + keyValue: 1); + + migrationBuilder.DeleteData( + table: "conf_profile", + keyColumn: "ProfileID", + keyValue: 2); + + migrationBuilder.DeleteData( + table: "conf_profile", + keyColumn: "ProfileID", + keyValue: 3); + + migrationBuilder.DeleteData( + table: "conf_wood", + keyColumn: "WoodID", + keyValue: 1); + + migrationBuilder.DeleteData( + table: "conf_wood", + keyColumn: "WoodID", + keyValue: 2); + + migrationBuilder.DeleteData( + table: "conf_wood", + keyColumn: "WoodID", + keyValue: 3); + + migrationBuilder.DeleteData( + table: "conf_wood", + keyColumn: "WoodID", + keyValue: 4); + + migrationBuilder.UpdateData( + table: "sales_offer", + keyColumn: "OfferID", + keyValue: 1, + columns: new[] { "Inserted", "Modified", "ValidUntil" }, + values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4627), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4629), new DateTime(2025, 11, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4624) }); + + migrationBuilder.UpdateData( + table: "sales_offer_row", + keyColumn: "OfferRowID", + keyValue: 1, + columns: new[] { "Inserted", "Modified" }, + values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4753), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4755) }); + + migrationBuilder.UpdateData( + table: "sales_offer_row", + keyColumn: "OfferRowID", + keyValue: 2, + columns: new[] { "Inserted", "Modified" }, + values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4768), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4770) }); + + migrationBuilder.UpdateData( + table: "sales_offer_row", + keyColumn: "OfferRowID", + keyValue: 3, + columns: new[] { "Inserted", "Modified" }, + values: new object[] { new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4780), new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4782) }); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 1, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4289)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 2, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4363)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 3, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4367)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 4, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4370)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 5, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4374)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 6, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4378)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 7, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4381)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 8, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4385)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 9, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4389)); + + migrationBuilder.UpdateData( + table: "stock_mov", + keyColumn: "StockMovID", + keyValue: 10, + column: "DtCreate", + value: new DateTime(2025, 10, 2, 13, 1, 49, 436, DateTimeKind.Local).AddTicks(4392)); + } + } +} diff --git a/EgwCoreLib.Lux.Data/Migrations/DataLayerContextModelSnapshot.cs b/EgwCoreLib.Lux.Data/Migrations/DataLayerContextModelSnapshot.cs index 1fbe80cd..693e5a6a 100644 --- a/EgwCoreLib.Lux.Data/Migrations/DataLayerContextModelSnapshot.cs +++ b/EgwCoreLib.Lux.Data/Migrations/DataLayerContextModelSnapshot.cs @@ -22,6 +22,148 @@ namespace EgwCoreLib.Lux.Data.Migrations MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.GlassModel", b => + { + b.Property("GlassID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("GlassID")); + + b.Property("Code") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Thickness") + .HasColumnType("double"); + + b.HasKey("GlassID"); + + b.ToTable("conf_glass"); + + b.HasData( + new + { + GlassID = 1, + Code = "", + Description = "Vetro BE 2S 4/12/4", + Thickness = 20.0 + }, + new + { + GlassID = 2, + Code = "", + Description = "Vetro BE 3S 4/12/4/12/4", + Thickness = 36.0 + }, + new + { + GlassID = 3, + Code = "", + Description = "Vetro BE 3S 4/16/4/16/4", + Thickness = 44.0 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.ProfileModel", b => + { + b.Property("ProfileID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProfileID")); + + b.Property("Code") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Thickness") + .HasColumnType("double"); + + b.HasKey("ProfileID"); + + b.ToTable("conf_profile"); + + b.HasData( + new + { + ProfileID = 1, + Code = "", + Description = "Profilo 32", + Thickness = 32.0 + }, + new + { + ProfileID = 2, + Code = "", + Description = "Profilo 48", + Thickness = 48.0 + }, + new + { + ProfileID = 3, + Code = "", + Description = "Profilo 58", + Thickness = 58.0 + }); + }); + + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Config.WoodModel", b => + { + b.Property("WoodID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("WoodID")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("ExtId") + .HasColumnType("longtext"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("WoodID"); + + b.ToTable("conf_wood"); + + b.HasData( + new + { + WoodID = 1, + Description = "Abete", + ExtId = "", + Type = 1 + }, + new + { + WoodID = 2, + Description = "Acero", + ExtId = "", + Type = 1 + }, + new + { + WoodID = 3, + Description = "Pino", + ExtId = "", + Type = 2 + }, + new + { + WoodID = 4, + Description = "Tek", + ExtId = "", + Type = 3 + }); + }); + modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Cost.CostDriverModel", b => { b.Property("CostDriverID") @@ -948,13 +1090,13 @@ namespace EgwCoreLib.Lux.Data.Migrations Description = "Offerta per tre serramenti", Discount = 0.0, Envir = 1, - Inserted = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4738), - Modified = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4739), + Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9241), + Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9242), OffertState = 0, RefNum = 1, RefRev = 1, RefYear = 2024, - ValidUntil = new DateTime(2025, 10, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4735) + ValidUntil = new DateTime(2025, 11, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9238) }); }); @@ -1049,11 +1191,11 @@ namespace EgwCoreLib.Lux.Data.Migrations BomOk = true, BomPrice = 950.0, Envir = 1, - Inserted = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4848), + Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9337), ItemBOM = "", ItemOk = true, ItemSteps = "{}", - Modified = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4850), + Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9339), Note = "Finestra anta singola 2025", OfferID = 1, OfferRowUID = "OFF250000000001", @@ -1073,11 +1215,11 @@ namespace EgwCoreLib.Lux.Data.Migrations BomOk = true, BomPrice = 200.0, Envir = 1, - Inserted = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4862), + Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9350), ItemBOM = "", ItemOk = true, ItemSteps = "{}", - Modified = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4864), + Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9352), Note = "Persiana per Finestra anta singola 2025", OfferID = 1, OfferRowUID = "OFF250000000002", @@ -1097,11 +1239,11 @@ namespace EgwCoreLib.Lux.Data.Migrations BomOk = true, BomPrice = 250.0, Envir = 1, - Inserted = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4874), + Inserted = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9362), ItemBOM = "", ItemOk = true, ItemSteps = "{}", - Modified = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4875), + Modified = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9364), Note = "Installazione serramento", OfferID = 1, OfferRowUID = "OFF250000000003", @@ -1284,8 +1426,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 1, CodDoc = "", - DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4416), - DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4472), + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8944), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8989), MovCod = "CAR", Note = "DEMO", QtyRec = 5.0, @@ -1297,8 +1439,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 2, CodDoc = "", - DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4475), - DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4476), + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8992), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8993), MovCod = "CAR", Note = "DEMO", QtyRec = 8.0, @@ -1310,8 +1452,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 3, CodDoc = "", - DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4479), - DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4480), + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8995), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8997), MovCod = "CAR", Note = "DEMO", QtyRec = 5.0, @@ -1323,8 +1465,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 4, CodDoc = "", - DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4482), - DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4484), + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(8999), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9000), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, @@ -1336,8 +1478,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 5, CodDoc = "", - DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4486), - DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4487), + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9003), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9004), MovCod = "CAR", Note = "DEMO", QtyRec = 10.0, @@ -1349,8 +1491,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 6, CodDoc = "", - DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4490), - DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4491), + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9006), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9008), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, @@ -1362,8 +1504,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 7, CodDoc = "", - DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4493), - DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4495), + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9010), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9011), MovCod = "CAR", Note = "DEMO", QtyRec = 50.0, @@ -1375,8 +1517,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 8, CodDoc = "", - DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4497), - DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4498), + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9013), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9015), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, @@ -1388,8 +1530,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 9, CodDoc = "", - DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4501), - DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4502), + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9017), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9018), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, @@ -1401,8 +1543,8 @@ namespace EgwCoreLib.Lux.Data.Migrations { StockMovID = 10, CodDoc = "", - DtCreate = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4504), - DtMod = new DateTime(2025, 9, 29, 16, 24, 15, 212, DateTimeKind.Local).AddTicks(4506), + DtCreate = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9021), + DtMod = new DateTime(2025, 10, 2, 15, 47, 49, 911, DateTimeKind.Local).AddTicks(9023), MovCod = "CAR", Note = "DEMO", QtyRec = 1.0, diff --git a/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs b/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs index c546538e..2c621f48 100644 --- a/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs +++ b/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs @@ -1,4 +1,5 @@ -using EgwCoreLib.Lux.Data.DbModel.Cost; +using EgwCoreLib.Lux.Data.DbModel.Config; +using EgwCoreLib.Lux.Data.DbModel.Cost; using EgwCoreLib.Lux.Data.DbModel.Items; using EgwCoreLib.Lux.Data.DbModel.Sales; using EgwCoreLib.Lux.Data.DbModel.Stock; @@ -43,6 +44,23 @@ namespace EgwCoreLib.Lux.Data new GenValueModel { GenValID = 6, Ordinal = 4, ClassCod = "WoodCol", ValString = "Nero" } ); + modelBuilder.Entity().HasData( + new GlassModel { GlassID = 1, Description = "Vetro BE 2S 4/12/4", Thickness = 20 }, + new GlassModel { GlassID = 2, Description = "Vetro BE 3S 4/12/4/12/4", Thickness = 36 }, + new GlassModel { GlassID = 3, Description = "Vetro BE 3S 4/16/4/16/4", Thickness = 44 } + ); + modelBuilder.Entity().HasData( + new ProfileModel { ProfileID = 1, Description = "Profilo 32", Thickness = 32 }, + new ProfileModel { ProfileID = 2, Description = "Profilo 48", Thickness = 48 }, + new ProfileModel { ProfileID = 3, Description = "Profilo 58", Thickness = 58 } + ); + modelBuilder.Entity().HasData( + new WoodModel { WoodID = 1, Description = "Abete", Type = 1 }, + new WoodModel { WoodID = 2, Description = "Acero", Type = 1 }, + new WoodModel { WoodID = 3, Description = "Pino", Type = 2 }, + new WoodModel { WoodID = 4, Description = "Tek", Type = 3 } + ); + // valori base classi generiche diff --git a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs index efe7a9c3..c53cfd6a 100644 --- a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs +++ b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs @@ -17,6 +17,7 @@ using System.Threading.Tasks; using static EgwCoreLib.Lux.Core.Enums; using static System.Runtime.InteropServices.JavaScript.JSType; using EgwCoreLib.Lux.Data.DbModel.Items; +using EgwCoreLib.Lux.Data.DbModel.Config; namespace EgwCoreLib.Lux.Data.Services { @@ -46,6 +47,108 @@ namespace EgwCoreLib.Lux.Data.Services #region Public Methods + /// + /// Elenco completo Config Glass + /// + /// + public async Task> ConfGlassGetAllAsync() + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:ConfGlass"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = await dbController.ConfGlassGetAllAsync(); + // serializzo e salvo con config x evitare loop... + rawData = JsonConvert.SerializeObject(result, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, LongCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"ConfGlassGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + /// + /// Elenco completo Config Profile + /// + /// + public async Task> ConfProfileGetAllAsync() + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:ConfProfile"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = await dbController.ConfProfileGetAllAsync(); + // serializzo e salvo con config x evitare loop... + rawData = JsonConvert.SerializeObject(result, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, LongCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"ConfProfileGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + /// + /// Elenco completo Config Wood + /// + /// + public async Task> ConfWoodGetAllAsync() + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:ConfWood"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = await dbController.ConfWoodGetAllAsync(); + // serializzo e salvo con config x evitare loop... + rawData = JsonConvert.SerializeObject(result, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, LongCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"ConfWoodGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + /// /// Elenco completo Customers /// @@ -158,6 +261,7 @@ namespace EgwCoreLib.Lux.Data.Services Log.Debug($"FlushCacheOffersAsync in {sw.Elapsed.TotalMilliseconds} ms"); return answ; } + /// /// Reset cache sistema x Ordini modalità async /// @@ -246,20 +350,6 @@ namespace EgwCoreLib.Lux.Data.Services return result; } - /// - /// Esegue spostamento nell'ordinamento relativo alla classe + refresh cache - /// - /// - /// - /// - public async Task GenValMoveAsync(GenValueModel selRec, bool moveUp) - { - bool result = await dbController.GenValMoveAsync(selRec, moveUp); - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenClass"); - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenVal:*"); - return result; - } - /// /// Elenco valori x classe richiesta /// @@ -295,6 +385,20 @@ namespace EgwCoreLib.Lux.Data.Services return result; } + /// + /// Esegue spostamento nell'ordinamento relativo alla classe + refresh cache + /// + /// + /// + /// + public async Task GenValMoveAsync(GenValueModel selRec, bool moveUp) + { + bool result = await dbController.GenValMoveAsync(selRec, moveUp); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenClass"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:GenVal:*"); + return result; + } + /// /// Esegue Upsert del record ricevuto ///