Split tra articoli commerciali di vendita e di produzione

This commit is contained in:
Samuele Locatelli
2025-06-20 11:10:26 +02:00
parent ea70ddba5f
commit 975ba07d7e
9 changed files with 472 additions and 235 deletions
-1
View File
@@ -77,7 +77,6 @@ namespace Lux.Data.Controllers
currRec.ItemCode = newRec.ItemCode;
currRec.Cost = newRec.Cost;
currRec.Description = newRec.Description;
currRec.IsMake = newRec.IsMake;
currRec.IsService = newRec.IsService;
currRec.Margin = newRec.Margin;
dbCtx.Entry(currRec).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
+1
View File
@@ -41,6 +41,7 @@ namespace Lux.Data
public virtual DbSet<ItemModel> DbSetItem { get; set; }
public virtual DbSet<SellItemModel> DbSetSellItem { get; set; }
public virtual DbSet<TagsModel> DbSetRole { get; set; }
public virtual DbSet<CustomerModel> DbSetCustomer { get; set; }
public virtual DbSet<DealerModel> DbSetDealer { get; set; }
-5
View File
@@ -21,11 +21,6 @@ namespace Lux.Data.DbModel
/// </summary>
public bool IsService { get; set; } = false;
/// <summary>
/// Articolo di produzione (vs da acquisto)
/// </summary>
public bool IsMake { get; set; } = true;
/// <summary>
/// CodArticolo (opzionale) numerico
/// </summary>
+4 -4
View File
@@ -42,9 +42,9 @@ namespace Lux.Data.DbModel
}
/// <summary>
/// ID dell'articolo offerto
/// ID dell'articolo di vendita offerto
/// </summary>
public int ItemID { get; set; }
public int SellItemID { get; set; }
/// <summary>
/// Costo (standard / senza listini)
@@ -105,7 +105,7 @@ namespace Lux.Data.DbModel
/// <summary>
/// Navigazione Item
/// </summary>
[ForeignKey("ItemID")]
public virtual ItemModel ItemNav { get; set; } = null!;
[ForeignKey("SellItemID")]
public virtual SellItemModel SellItemNav { get; set; } = null!;
}
}
+70
View File
@@ -0,0 +1,70 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Lux.Data.DbModel
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("SellItem")]
public class SellItemModel
{
/// <summary>
/// ID dell'articolo di vendita/finito
/// </summary>
[Key]
public int SellItemID { get; set; }
/// <summary>
/// Definisce l'articolo come servizio vs concreto=materiale
/// </summary>
public bool IsService { get; set; } = false;
/// <summary>
/// Se 1 = rivendita, >1 è il ciclo di produzione associato
/// </summary>
public int JobID { get; set; } = 1;
/// <summary>
/// CodArticolo (opzionale) numerico
/// </summary>
public int ItemCode { get; set; } = 0;
/// <summary>
/// CodArticolo (opzionale) string
/// </summary>
public string ExtItemCode { get; set; } = "";
/// <summary>
/// Cod Fornitore (opzionale)
/// </summary>
public string SupplCode { get; set; } = "";
/// <summary>
/// Descrizione
/// </summary>
public string Description { get; set; } = "";
/// <summary>
/// Costo (standard / senza listini)
/// </summary>
public double Cost { get; set; } = 0;
/// <summary>
/// Margine percentuale standard
/// </summary>
public double Margin { get; set; } = 0.1;
/// <summary>
/// Unità di Misura
/// </summary>
public string UM { get; set; } = "#";
/// <summary>
/// Navigazione Job/Cicli
/// </summary>
[ForeignKey("JobID")]
public virtual JobModel JobNav { get; set; } = null!;
}
}
@@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Lux.Data.Migrations
{
[DbContext(typeof(DataLayerContext))]
[Migration("20250620083825_InitDb")]
[Migration("20250620090604_InitDb")]
partial class InitDb
{
/// <inheritdoc />
@@ -154,9 +154,6 @@ namespace Lux.Data.Migrations
.IsRequired()
.HasColumnType("longtext");
b.Property<bool>("IsMake")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsService")
.HasColumnType("tinyint(1)");
@@ -182,75 +179,33 @@ namespace Lux.Data.Migrations
new
{
ItemID = 1,
Cost = 820.0,
Description = "Finestra anta Singola",
Cost = 50.0,
Description = "Barra di legno 80x120",
ExtItemCode = "",
IsMake = true,
IsService = false,
ItemCode = 0,
Margin = 0.20000000000000001,
Margin = 0.29999999999999999,
SupplCode = "",
UM = "#"
},
new
{
ItemID = 2,
Cost = 150.0,
Description = "Persiana anta singola",
Cost = 35.0,
Description = "Vernice trasparente",
ExtItemCode = "",
IsMake = false,
IsService = false,
ItemCode = 0,
Margin = 0.10000000000000001,
Margin = 0.29999999999999999,
SupplCode = "",
UM = "#"
},
new
{
ItemID = 3,
Cost = 200.0,
Description = "Installazione",
ExtItemCode = "",
IsMake = true,
IsService = true,
ItemCode = 0,
Margin = 0.29999999999999999,
SupplCode = "",
UM = "#"
},
new
{
ItemID = 4,
Cost = 50.0,
Description = "Barra di legno 80x120",
ExtItemCode = "",
IsMake = false,
IsService = false,
ItemCode = 0,
Margin = 0.29999999999999999,
SupplCode = "",
UM = "#"
},
new
{
ItemID = 5,
Cost = 35.0,
Description = "Vernice trasparente",
ExtItemCode = "",
IsMake = false,
IsService = false,
ItemCode = 0,
Margin = 0.29999999999999999,
SupplCode = "",
UM = "#"
},
new
{
ItemID = 6,
Cost = 1.0,
Description = "Ferramenta",
ExtItemCode = "",
IsMake = false,
IsService = false,
ItemCode = 0,
Margin = 0.29999999999999999,
@@ -279,6 +234,11 @@ namespace Lux.Data.Migrations
new
{
JobID = 1,
Description = "Rivendita / servizi"
},
new
{
JobID = 2,
Description = "Serramento Completo Legno su linea Saomad e installatore interno"
});
});
@@ -321,7 +281,7 @@ namespace Lux.Data.Migrations
JobRowItemID = 1,
Description = "Grezzo legno abete",
Index = 1,
ItemID = 4,
ItemID = 1,
JobRowID = 1,
Qty = 4.5
},
@@ -330,7 +290,7 @@ namespace Lux.Data.Migrations
JobRowItemID = 2,
Description = "Vernice trasparente standard 1L",
Index = 2,
ItemID = 5,
ItemID = 2,
JobRowID = 4,
Qty = 1.0
},
@@ -339,7 +299,7 @@ namespace Lux.Data.Migrations
JobRowItemID = 3,
Description = "Ferramenta AGB - rif. AGFD.00000.00000",
Index = 3,
ItemID = 6,
ItemID = 3,
JobRowID = 5,
Qty = 1.0
});
@@ -388,7 +348,7 @@ namespace Lux.Data.Migrations
JobRowID = 1,
Description = "",
Index = 1,
JobID = 1,
JobID = 2,
PhaseID = 1,
Qty = 1.0,
ResourceID = 1
@@ -398,7 +358,7 @@ namespace Lux.Data.Migrations
JobRowID = 2,
Description = "",
Index = 2,
JobID = 1,
JobID = 2,
PhaseID = 2,
Qty = 1.0,
ResourceID = 2
@@ -408,7 +368,7 @@ namespace Lux.Data.Migrations
JobRowID = 3,
Description = "",
Index = 3,
JobID = 1,
JobID = 2,
PhaseID = 4,
Qty = 1.0,
ResourceID = 6
@@ -418,7 +378,7 @@ namespace Lux.Data.Migrations
JobRowID = 4,
Description = "",
Index = 4,
JobID = 1,
JobID = 2,
PhaseID = 3,
Qty = 1.0,
ResourceID = 4
@@ -428,7 +388,7 @@ namespace Lux.Data.Migrations
JobRowID = 5,
Description = "",
Index = 5,
JobID = 1,
JobID = 2,
PhaseID = 5,
Qty = 1.0,
ResourceID = 6
@@ -438,7 +398,7 @@ namespace Lux.Data.Migrations
JobRowID = 6,
Description = "",
Index = 6,
JobID = 1,
JobID = 2,
PhaseID = 6,
Qty = 1.0,
ResourceID = 7
@@ -496,12 +456,12 @@ namespace Lux.Data.Migrations
CustomerID = 2,
DealerID = 2,
Description = "Offerta per tre serramenti",
Inserted = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8791),
Modified = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8792),
Inserted = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3672),
Modified = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3673),
RefNum = 1,
RefRev = 1,
RefYear = 2024,
ValidUntil = new DateTime(2025, 7, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8788)
ValidUntil = new DateTime(2025, 7, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3668)
});
});
@@ -519,9 +479,6 @@ namespace Lux.Data.Migrations
b.Property<DateTime>("Inserted")
.HasColumnType("datetime(6)");
b.Property<int>("ItemID")
.HasColumnType("int");
b.Property<string>("ItemSPP")
.IsRequired()
.HasColumnType("longtext");
@@ -542,16 +499,19 @@ namespace Lux.Data.Migrations
b.Property<int>("RowNum")
.HasColumnType("int");
b.Property<int>("SellItemID")
.HasColumnType("int");
b.Property<string>("SerStruct")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("OfferRowID");
b.HasIndex("ItemID");
b.HasIndex("OfferID");
b.HasIndex("SellItemID");
b.ToTable("OfferRowList");
b.HasData(
@@ -559,42 +519,42 @@ namespace Lux.Data.Migrations
{
OfferRowID = 1,
Cost = 950.0,
Inserted = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8814),
ItemID = 1,
Inserted = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3701),
ItemSPP = "{}",
Modified = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8816),
Modified = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3703),
Note = "Finestra anta singola 2025",
OfferID = 1,
Qty = 3.0,
RowNum = 1,
SellItemID = 1,
SerStruct = "{}"
},
new
{
OfferRowID = 2,
Cost = 160.0,
Inserted = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8822),
ItemID = 2,
Inserted = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3709),
ItemSPP = "{}",
Modified = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8824),
Modified = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3711),
Note = "Persiana per Finestra anta singola 2025",
OfferID = 1,
Qty = 3.0,
RowNum = 1,
SellItemID = 2,
SerStruct = "{}"
},
new
{
OfferRowID = 3,
Cost = 200.0,
Inserted = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8829),
ItemID = 3,
Inserted = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3716),
ItemSPP = "{}",
Modified = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8831),
Modified = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3717),
Note = "Installazione serramento",
OfferID = 1,
Qty = 3.0,
RowNum = 1,
SellItemID = 3,
SerStruct = "{}"
});
});
@@ -743,6 +703,93 @@ namespace Lux.Data.Migrations
});
});
modelBuilder.Entity("Lux.Data.DbModel.SellItemModel", b =>
{
b.Property<int>("SellItemID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SellItemID"));
b.Property<double>("Cost")
.HasColumnType("double");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ExtItemCode")
.IsRequired()
.HasColumnType("longtext");
b.Property<bool>("IsService")
.HasColumnType("tinyint(1)");
b.Property<int>("ItemCode")
.HasColumnType("int");
b.Property<int>("JobID")
.HasColumnType("int");
b.Property<double>("Margin")
.HasColumnType("double");
b.Property<string>("SupplCode")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("UM")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("SellItemID");
b.HasIndex("JobID");
b.ToTable("SellItem");
b.HasData(
new
{
SellItemID = 1,
Cost = 820.0,
Description = "Finestra anta Singola",
ExtItemCode = "",
IsService = false,
ItemCode = 0,
JobID = 2,
Margin = 0.20000000000000001,
SupplCode = "",
UM = "#"
},
new
{
SellItemID = 2,
Cost = 150.0,
Description = "Persiana anta singola",
ExtItemCode = "",
IsService = false,
ItemCode = 0,
JobID = 1,
Margin = 0.10000000000000001,
SupplCode = "",
UM = "#"
},
new
{
SellItemID = 3,
Cost = 200.0,
Description = "Installazione",
ExtItemCode = "",
IsService = true,
ItemCode = 0,
JobID = 1,
Margin = 0.29999999999999999,
SupplCode = "",
UM = "#"
});
});
modelBuilder.Entity("Lux.Data.DbModel.SupplierModel", b =>
{
b.Property<int>("SupplierID")
@@ -909,21 +956,32 @@ namespace Lux.Data.Migrations
modelBuilder.Entity("Lux.Data.DbModel.OfferRowModel", b =>
{
b.HasOne("Lux.Data.DbModel.ItemModel", "ItemNav")
.WithMany()
.HasForeignKey("ItemID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Lux.Data.DbModel.OfferModel", "OfferNav")
.WithMany()
.HasForeignKey("OfferID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("ItemNav");
b.HasOne("Lux.Data.DbModel.SellItemModel", "SellItemNav")
.WithMany()
.HasForeignKey("SellItemID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("OfferNav");
b.Navigation("SellItemNav");
});
modelBuilder.Entity("Lux.Data.DbModel.SellItemModel", b =>
{
b.HasOne("Lux.Data.DbModel.JobModel", "JobNav")
.WithMany()
.HasForeignKey("JobID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("JobNav");
});
#pragma warning restore 612, 618
}
@@ -81,7 +81,6 @@ namespace Lux.Data.Migrations
ItemID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
IsService = table.Column<bool>(type: "tinyint(1)", nullable: false),
IsMake = table.Column<bool>(type: "tinyint(1)", nullable: false),
ItemCode = table.Column<int>(type: "int", nullable: false),
ExtItemCode = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
@@ -171,6 +170,38 @@ namespace Lux.Data.Migrations
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "SellItem",
columns: table => new
{
SellItemID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
IsService = table.Column<bool>(type: "tinyint(1)", nullable: false),
JobID = table.Column<int>(type: "int", nullable: false),
ItemCode = table.Column<int>(type: "int", nullable: false),
ExtItemCode = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SupplCode = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Cost = table.Column<double>(type: "double", nullable: false),
Margin = table.Column<double>(type: "double", nullable: false),
UM = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_SellItem", x => x.SellItemID);
table.ForeignKey(
name: "FK_SellItem_JobList_JobID",
column: x => x.JobID,
principalTable: "JobList",
principalColumn: "JobID",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Offer",
columns: table => new
@@ -252,7 +283,7 @@ namespace Lux.Data.Migrations
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
OfferID = table.Column<int>(type: "int", nullable: false),
RowNum = table.Column<int>(type: "int", nullable: false),
ItemID = table.Column<int>(type: "int", nullable: false),
SellItemID = table.Column<int>(type: "int", nullable: false),
Cost = table.Column<double>(type: "double", nullable: false),
Qty = table.Column<double>(type: "double", nullable: false),
ItemSPP = table.Column<string>(type: "longtext", nullable: false)
@@ -274,10 +305,10 @@ namespace Lux.Data.Migrations
principalColumn: "OfferID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_OfferRowList_RegItem_ItemID",
column: x => x.ItemID,
principalTable: "RegItem",
principalColumn: "ItemID",
name: "FK_OfferRowList_SellItem_SellItemID",
column: x => x.SellItemID,
principalTable: "SellItem",
principalColumn: "SellItemID",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
@@ -316,7 +347,11 @@ namespace Lux.Data.Migrations
migrationBuilder.InsertData(
table: "JobList",
columns: new[] { "JobID", "Description" },
values: new object[] { 1, "Serramento Completo Legno su linea Saomad e installatore interno" });
values: new object[,]
{
{ 1, "Rivendita / servizi" },
{ 2, "Serramento Completo Legno su linea Saomad e installatore interno" }
});
migrationBuilder.InsertData(
table: "RegCustomer",
@@ -340,15 +375,12 @@ namespace Lux.Data.Migrations
migrationBuilder.InsertData(
table: "RegItem",
columns: new[] { "ItemID", "Cost", "Description", "ExtItemCode", "IsMake", "IsService", "ItemCode", "Margin", "SupplCode", "UM" },
columns: new[] { "ItemID", "Cost", "Description", "ExtItemCode", "IsService", "ItemCode", "Margin", "SupplCode", "UM" },
values: new object[,]
{
{ 1, 820.0, "Finestra anta Singola", "", true, false, 0, 0.20000000000000001, "", "#" },
{ 2, 150.0, "Persiana anta singola", "", false, false, 0, 0.10000000000000001, "", "#" },
{ 3, 200.0, "Installazione", "", true, true, 0, 0.29999999999999999, "", "#" },
{ 4, 50.0, "Barra di legno 80x120", "", false, false, 0, 0.29999999999999999, "", "#" },
{ 5, 35.0, "Vernice trasparente", "", false, false, 0, 0.29999999999999999, "", "#" },
{ 6, 1.0, "Ferramenta", "", false, false, 0, 0.29999999999999999, "", "#" }
{ 1, 50.0, "Barra di legno 80x120", "", false, 0, 0.29999999999999999, "", "#" },
{ 2, 35.0, "Vernice trasparente", "", false, 0, 0.29999999999999999, "", "#" },
{ 3, 1.0, "Ferramenta", "", false, 0, 0.29999999999999999, "", "#" }
});
migrationBuilder.InsertData(
@@ -405,37 +437,47 @@ namespace Lux.Data.Migrations
columns: new[] { "JobRowID", "Description", "Index", "JobID", "PhaseID", "Qty", "ResourceID" },
values: new object[,]
{
{ 1, "", 1, 1, 1, 1.0, 1 },
{ 2, "", 2, 1, 2, 1.0, 2 },
{ 3, "", 3, 1, 4, 1.0, 6 },
{ 4, "", 4, 1, 3, 1.0, 4 },
{ 5, "", 5, 1, 5, 1.0, 6 },
{ 6, "", 6, 1, 6, 1.0, 7 }
{ 1, "", 1, 2, 1, 1.0, 1 },
{ 2, "", 2, 2, 2, 1.0, 2 },
{ 3, "", 3, 2, 4, 1.0, 6 },
{ 4, "", 4, 2, 3, 1.0, 4 },
{ 5, "", 5, 2, 5, 1.0, 6 },
{ 6, "", 6, 2, 6, 1.0, 7 }
});
migrationBuilder.InsertData(
table: "Offer",
columns: new[] { "OfferID", "CustomerID", "DealerID", "Description", "Inserted", "Modified", "RefNum", "RefRev", "RefYear", "ValidUntil" },
values: new object[] { 1, 2, 2, "Offerta per tre serramenti", new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8791), new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8792), 1, 1, 2024, new DateTime(2025, 7, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8788) });
values: new object[] { 1, 2, 2, "Offerta per tre serramenti", new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3672), new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3673), 1, 1, 2024, new DateTime(2025, 7, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3668) });
migrationBuilder.InsertData(
table: "SellItem",
columns: new[] { "SellItemID", "Cost", "Description", "ExtItemCode", "IsService", "ItemCode", "JobID", "Margin", "SupplCode", "UM" },
values: new object[,]
{
{ 1, 820.0, "Finestra anta Singola", "", false, 0, 2, 0.20000000000000001, "", "#" },
{ 2, 150.0, "Persiana anta singola", "", false, 0, 1, 0.10000000000000001, "", "#" },
{ 3, 200.0, "Installazione", "", true, 0, 1, 0.29999999999999999, "", "#" }
});
migrationBuilder.InsertData(
table: "JobRowItemList",
columns: new[] { "JobRowItemID", "Description", "Index", "ItemID", "JobRowID", "Qty" },
values: new object[,]
{
{ 1, "Grezzo legno abete", 1, 4, 1, 4.5 },
{ 2, "Vernice trasparente standard 1L", 2, 5, 4, 1.0 },
{ 3, "Ferramenta AGB - rif. AGFD.00000.00000", 3, 6, 5, 1.0 }
{ 1, "Grezzo legno abete", 1, 1, 1, 4.5 },
{ 2, "Vernice trasparente standard 1L", 2, 2, 4, 1.0 },
{ 3, "Ferramenta AGB - rif. AGFD.00000.00000", 3, 3, 5, 1.0 }
});
migrationBuilder.InsertData(
table: "OfferRowList",
columns: new[] { "OfferRowID", "Cost", "Inserted", "ItemID", "ItemSPP", "Modified", "Note", "OfferID", "Qty", "RowNum", "SerStruct" },
columns: new[] { "OfferRowID", "Cost", "Inserted", "ItemSPP", "Modified", "Note", "OfferID", "Qty", "RowNum", "SellItemID", "SerStruct" },
values: new object[,]
{
{ 1, 950.0, new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8814), 1, "{}", new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8816), "Finestra anta singola 2025", 1, 3.0, 1, "{}" },
{ 2, 160.0, new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8822), 2, "{}", new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8824), "Persiana per Finestra anta singola 2025", 1, 3.0, 1, "{}" },
{ 3, 200.0, new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8829), 3, "{}", new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8831), "Installazione serramento", 1, 3.0, 1, "{}" }
{ 1, 950.0, new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3701), "{}", new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3703), "Finestra anta singola 2025", 1, 3.0, 1, 1, "{}" },
{ 2, 160.0, new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3709), "{}", new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3711), "Persiana per Finestra anta singola 2025", 1, 3.0, 1, 2, "{}" },
{ 3, 200.0, new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3716), "{}", new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3717), "Installazione serramento", 1, 3.0, 1, 3, "{}" }
});
migrationBuilder.CreateIndex(
@@ -473,15 +515,20 @@ namespace Lux.Data.Migrations
table: "Offer",
column: "DealerID");
migrationBuilder.CreateIndex(
name: "IX_OfferRowList_ItemID",
table: "OfferRowList",
column: "ItemID");
migrationBuilder.CreateIndex(
name: "IX_OfferRowList_OfferID",
table: "OfferRowList",
column: "OfferID");
migrationBuilder.CreateIndex(
name: "IX_OfferRowList_SellItemID",
table: "OfferRowList",
column: "SellItemID");
migrationBuilder.CreateIndex(
name: "IX_SellItem_JobID",
table: "SellItem",
column: "JobID");
}
/// <inheritdoc />
@@ -502,14 +549,14 @@ namespace Lux.Data.Migrations
migrationBuilder.DropTable(
name: "JobRowList");
migrationBuilder.DropTable(
name: "Offer");
migrationBuilder.DropTable(
name: "RegItem");
migrationBuilder.DropTable(
name: "JobList");
name: "Offer");
migrationBuilder.DropTable(
name: "SellItem");
migrationBuilder.DropTable(
name: "RegPhase");
@@ -522,6 +569,9 @@ namespace Lux.Data.Migrations
migrationBuilder.DropTable(
name: "RegDealer");
migrationBuilder.DropTable(
name: "JobList");
}
}
}
@@ -151,9 +151,6 @@ namespace Lux.Data.Migrations
.IsRequired()
.HasColumnType("longtext");
b.Property<bool>("IsMake")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsService")
.HasColumnType("tinyint(1)");
@@ -179,75 +176,33 @@ namespace Lux.Data.Migrations
new
{
ItemID = 1,
Cost = 820.0,
Description = "Finestra anta Singola",
Cost = 50.0,
Description = "Barra di legno 80x120",
ExtItemCode = "",
IsMake = true,
IsService = false,
ItemCode = 0,
Margin = 0.20000000000000001,
Margin = 0.29999999999999999,
SupplCode = "",
UM = "#"
},
new
{
ItemID = 2,
Cost = 150.0,
Description = "Persiana anta singola",
Cost = 35.0,
Description = "Vernice trasparente",
ExtItemCode = "",
IsMake = false,
IsService = false,
ItemCode = 0,
Margin = 0.10000000000000001,
Margin = 0.29999999999999999,
SupplCode = "",
UM = "#"
},
new
{
ItemID = 3,
Cost = 200.0,
Description = "Installazione",
ExtItemCode = "",
IsMake = true,
IsService = true,
ItemCode = 0,
Margin = 0.29999999999999999,
SupplCode = "",
UM = "#"
},
new
{
ItemID = 4,
Cost = 50.0,
Description = "Barra di legno 80x120",
ExtItemCode = "",
IsMake = false,
IsService = false,
ItemCode = 0,
Margin = 0.29999999999999999,
SupplCode = "",
UM = "#"
},
new
{
ItemID = 5,
Cost = 35.0,
Description = "Vernice trasparente",
ExtItemCode = "",
IsMake = false,
IsService = false,
ItemCode = 0,
Margin = 0.29999999999999999,
SupplCode = "",
UM = "#"
},
new
{
ItemID = 6,
Cost = 1.0,
Description = "Ferramenta",
ExtItemCode = "",
IsMake = false,
IsService = false,
ItemCode = 0,
Margin = 0.29999999999999999,
@@ -276,6 +231,11 @@ namespace Lux.Data.Migrations
new
{
JobID = 1,
Description = "Rivendita / servizi"
},
new
{
JobID = 2,
Description = "Serramento Completo Legno su linea Saomad e installatore interno"
});
});
@@ -318,7 +278,7 @@ namespace Lux.Data.Migrations
JobRowItemID = 1,
Description = "Grezzo legno abete",
Index = 1,
ItemID = 4,
ItemID = 1,
JobRowID = 1,
Qty = 4.5
},
@@ -327,7 +287,7 @@ namespace Lux.Data.Migrations
JobRowItemID = 2,
Description = "Vernice trasparente standard 1L",
Index = 2,
ItemID = 5,
ItemID = 2,
JobRowID = 4,
Qty = 1.0
},
@@ -336,7 +296,7 @@ namespace Lux.Data.Migrations
JobRowItemID = 3,
Description = "Ferramenta AGB - rif. AGFD.00000.00000",
Index = 3,
ItemID = 6,
ItemID = 3,
JobRowID = 5,
Qty = 1.0
});
@@ -385,7 +345,7 @@ namespace Lux.Data.Migrations
JobRowID = 1,
Description = "",
Index = 1,
JobID = 1,
JobID = 2,
PhaseID = 1,
Qty = 1.0,
ResourceID = 1
@@ -395,7 +355,7 @@ namespace Lux.Data.Migrations
JobRowID = 2,
Description = "",
Index = 2,
JobID = 1,
JobID = 2,
PhaseID = 2,
Qty = 1.0,
ResourceID = 2
@@ -405,7 +365,7 @@ namespace Lux.Data.Migrations
JobRowID = 3,
Description = "",
Index = 3,
JobID = 1,
JobID = 2,
PhaseID = 4,
Qty = 1.0,
ResourceID = 6
@@ -415,7 +375,7 @@ namespace Lux.Data.Migrations
JobRowID = 4,
Description = "",
Index = 4,
JobID = 1,
JobID = 2,
PhaseID = 3,
Qty = 1.0,
ResourceID = 4
@@ -425,7 +385,7 @@ namespace Lux.Data.Migrations
JobRowID = 5,
Description = "",
Index = 5,
JobID = 1,
JobID = 2,
PhaseID = 5,
Qty = 1.0,
ResourceID = 6
@@ -435,7 +395,7 @@ namespace Lux.Data.Migrations
JobRowID = 6,
Description = "",
Index = 6,
JobID = 1,
JobID = 2,
PhaseID = 6,
Qty = 1.0,
ResourceID = 7
@@ -493,12 +453,12 @@ namespace Lux.Data.Migrations
CustomerID = 2,
DealerID = 2,
Description = "Offerta per tre serramenti",
Inserted = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8791),
Modified = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8792),
Inserted = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3672),
Modified = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3673),
RefNum = 1,
RefRev = 1,
RefYear = 2024,
ValidUntil = new DateTime(2025, 7, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8788)
ValidUntil = new DateTime(2025, 7, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3668)
});
});
@@ -516,9 +476,6 @@ namespace Lux.Data.Migrations
b.Property<DateTime>("Inserted")
.HasColumnType("datetime(6)");
b.Property<int>("ItemID")
.HasColumnType("int");
b.Property<string>("ItemSPP")
.IsRequired()
.HasColumnType("longtext");
@@ -539,16 +496,19 @@ namespace Lux.Data.Migrations
b.Property<int>("RowNum")
.HasColumnType("int");
b.Property<int>("SellItemID")
.HasColumnType("int");
b.Property<string>("SerStruct")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("OfferRowID");
b.HasIndex("ItemID");
b.HasIndex("OfferID");
b.HasIndex("SellItemID");
b.ToTable("OfferRowList");
b.HasData(
@@ -556,42 +516,42 @@ namespace Lux.Data.Migrations
{
OfferRowID = 1,
Cost = 950.0,
Inserted = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8814),
ItemID = 1,
Inserted = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3701),
ItemSPP = "{}",
Modified = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8816),
Modified = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3703),
Note = "Finestra anta singola 2025",
OfferID = 1,
Qty = 3.0,
RowNum = 1,
SellItemID = 1,
SerStruct = "{}"
},
new
{
OfferRowID = 2,
Cost = 160.0,
Inserted = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8822),
ItemID = 2,
Inserted = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3709),
ItemSPP = "{}",
Modified = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8824),
Modified = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3711),
Note = "Persiana per Finestra anta singola 2025",
OfferID = 1,
Qty = 3.0,
RowNum = 1,
SellItemID = 2,
SerStruct = "{}"
},
new
{
OfferRowID = 3,
Cost = 200.0,
Inserted = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8829),
ItemID = 3,
Inserted = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3716),
ItemSPP = "{}",
Modified = new DateTime(2025, 6, 20, 10, 38, 24, 772, DateTimeKind.Local).AddTicks(8831),
Modified = new DateTime(2025, 6, 20, 11, 6, 4, 160, DateTimeKind.Local).AddTicks(3717),
Note = "Installazione serramento",
OfferID = 1,
Qty = 3.0,
RowNum = 1,
SellItemID = 3,
SerStruct = "{}"
});
});
@@ -740,6 +700,93 @@ namespace Lux.Data.Migrations
});
});
modelBuilder.Entity("Lux.Data.DbModel.SellItemModel", b =>
{
b.Property<int>("SellItemID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SellItemID"));
b.Property<double>("Cost")
.HasColumnType("double");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ExtItemCode")
.IsRequired()
.HasColumnType("longtext");
b.Property<bool>("IsService")
.HasColumnType("tinyint(1)");
b.Property<int>("ItemCode")
.HasColumnType("int");
b.Property<int>("JobID")
.HasColumnType("int");
b.Property<double>("Margin")
.HasColumnType("double");
b.Property<string>("SupplCode")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("UM")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("SellItemID");
b.HasIndex("JobID");
b.ToTable("SellItem");
b.HasData(
new
{
SellItemID = 1,
Cost = 820.0,
Description = "Finestra anta Singola",
ExtItemCode = "",
IsService = false,
ItemCode = 0,
JobID = 2,
Margin = 0.20000000000000001,
SupplCode = "",
UM = "#"
},
new
{
SellItemID = 2,
Cost = 150.0,
Description = "Persiana anta singola",
ExtItemCode = "",
IsService = false,
ItemCode = 0,
JobID = 1,
Margin = 0.10000000000000001,
SupplCode = "",
UM = "#"
},
new
{
SellItemID = 3,
Cost = 200.0,
Description = "Installazione",
ExtItemCode = "",
IsService = true,
ItemCode = 0,
JobID = 1,
Margin = 0.29999999999999999,
SupplCode = "",
UM = "#"
});
});
modelBuilder.Entity("Lux.Data.DbModel.SupplierModel", b =>
{
b.Property<int>("SupplierID")
@@ -906,21 +953,32 @@ namespace Lux.Data.Migrations
modelBuilder.Entity("Lux.Data.DbModel.OfferRowModel", b =>
{
b.HasOne("Lux.Data.DbModel.ItemModel", "ItemNav")
.WithMany()
.HasForeignKey("ItemID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Lux.Data.DbModel.OfferModel", "OfferNav")
.WithMany()
.HasForeignKey("OfferID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("ItemNav");
b.HasOne("Lux.Data.DbModel.SellItemModel", "SellItemNav")
.WithMany()
.HasForeignKey("SellItemID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("OfferNav");
b.Navigation("SellItemNav");
});
modelBuilder.Entity("Lux.Data.DbModel.SellItemModel", b =>
{
b.HasOne("Lux.Data.DbModel.JobModel", "JobNav")
.WithMany()
.HasForeignKey("JobID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("JobNav");
});
#pragma warning restore 612, 618
}
+25 -19
View File
@@ -48,14 +48,12 @@ namespace Lux.Data
// inizializzazione dei valori di default x Item
modelBuilder.Entity<ItemModel>().HasData(
new ItemModel { ItemID = 1, IsService = false, IsMake = true, Description = "Finestra anta Singola", Cost = 820, Margin = 0.2 },
new ItemModel { ItemID = 2, IsService = false, IsMake = false, Description = "Persiana anta singola", Cost = 150, Margin = 0.1 },
new ItemModel { ItemID = 3, IsService = true, IsMake = true, Description = "Installazione", Cost = 200, Margin = 0.3 },
new ItemModel { ItemID = 4, IsService = false, IsMake = false, Description = "Barra di legno 80x120", Cost = 50, Margin = 0.3 },
new ItemModel { ItemID = 5, IsService = false, IsMake = false, Description = "Vernice trasparente", Cost = 35, Margin = 0.3 },
new ItemModel { ItemID = 6, IsService = false, IsMake = false, Description = "Ferramenta", Cost = 1, Margin = 0.3 }
new ItemModel { ItemID = 1, IsService = false, Description = "Barra di legno 80x120", Cost = 50, Margin = 0.3 },
new ItemModel { ItemID = 2, IsService = false, Description = "Vernice trasparente", Cost = 35, Margin = 0.3 },
new ItemModel { ItemID = 3, IsService = false, Description = "Ferramenta", Cost = 1, Margin = 0.3 }
);
// inizializzazione risorse
modelBuilder.Entity<ResourceModel>().HasData(
new ResourceModel { ResourceID = 1, Description = "Sezionatrice", IsAsset = true, IsHuman = false, UnitCost = 15, UM = "€/h" },
@@ -80,7 +78,8 @@ namespace Lux.Data
// inizializzazione cicli
modelBuilder.Entity<JobModel>().HasData(
new JobModel { JobID = 1, Description = "Serramento Completo Legno su linea Saomad e installatore interno" }//,
new JobModel { JobID = 1, Description = "Rivendita / servizi" },
new JobModel { JobID = 2, Description = "Serramento Completo Legno su linea Saomad e installatore interno" }//,
//new JobModel { JobID = 2, Description = "Serramento Completo Legno/Alluminio" },
//new JobModel { JobID = 3, Description = "Persiana Legno" },
//new JobModel { JobID = 4, Description = "restauro Persiana Esistente" }
@@ -88,22 +87,29 @@ namespace Lux.Data
// init righe ciclo (fasi di ciclo)
modelBuilder.Entity<JobRowModel>().HasData(
new JobRowModel { JobRowID = 1, JobID = 1, Index = 1, PhaseID = 1, Qty = 1, ResourceID = 1 },
new JobRowModel { JobRowID = 2, JobID = 1, Index = 2, PhaseID = 2, Qty = 1, ResourceID = 2 },
new JobRowModel { JobRowID = 3, JobID = 1, Index = 3, PhaseID = 4, Qty = 1, ResourceID = 6 },
new JobRowModel { JobRowID = 4, JobID = 1, Index = 4, PhaseID = 3, Qty = 1, ResourceID = 4 },
new JobRowModel { JobRowID = 5, JobID = 1, Index = 5, PhaseID = 5, Qty = 1, ResourceID = 6 },
new JobRowModel { JobRowID = 6, JobID = 1, Index = 6, PhaseID = 6, Qty = 1, ResourceID = 7 }
new JobRowModel { JobRowID = 1, JobID = 2, Index = 1, PhaseID = 1, Qty = 1, ResourceID = 1 },
new JobRowModel { JobRowID = 2, JobID = 2, Index = 2, PhaseID = 2, Qty = 1, ResourceID = 2 },
new JobRowModel { JobRowID = 3, JobID = 2, Index = 3, PhaseID = 4, Qty = 1, ResourceID = 6 },
new JobRowModel { JobRowID = 4, JobID = 2, Index = 4, PhaseID = 3, Qty = 1, ResourceID = 4 },
new JobRowModel { JobRowID = 5, JobID = 2, Index = 5, PhaseID = 5, Qty = 1, ResourceID = 6 },
new JobRowModel { JobRowID = 6, JobID = 2, Index = 6, PhaseID = 6, Qty = 1, ResourceID = 7 }
);
// init item righe ciclo (articoli delle fasi del ciclo)
modelBuilder.Entity<JobRowItemModel>().HasData(
new JobRowItemModel { JobRowItemID = 1, JobRowID = 1, Index = 1, ItemID = 4, Qty = 4.5, Description = "Grezzo legno abete" },
new JobRowItemModel { JobRowItemID = 2, JobRowID = 4, Index = 2, ItemID = 5, Qty = 1, Description = "Vernice trasparente standard 1L" },
new JobRowItemModel { JobRowItemID = 3, JobRowID = 5, Index = 3, ItemID = 6, Qty = 1, Description = "Ferramenta AGB - rif. AGFD.00000.00000" }
new JobRowItemModel { JobRowItemID = 1, JobRowID = 1, Index = 1, ItemID = 1, Qty = 4.5, Description = "Grezzo legno abete" },
new JobRowItemModel { JobRowItemID = 2, JobRowID = 4, Index = 2, ItemID = 2, Qty = 1, Description = "Vernice trasparente standard 1L" },
new JobRowItemModel { JobRowItemID = 3, JobRowID = 5, Index = 3, ItemID = 3, Qty = 1, Description = "Ferramenta AGB - rif. AGFD.00000.00000" }
);
// inizializzazione dei valori di default x Item
modelBuilder.Entity<SellItemModel>().HasData(
new SellItemModel { SellItemID = 1, IsService = false, Description = "Finestra anta Singola", Cost = 820, Margin = 0.2, JobID = 2 },
new SellItemModel { SellItemID = 2, IsService = false, Description = "Persiana anta singola", Cost = 150, Margin = 0.1, JobID = 1 },
new SellItemModel { SellItemID = 3, IsService = true, Description = "Installazione", Cost = 200, Margin = 0.3, JobID = 1 }
);
// inizializzazione dei valori di default x Offer
modelBuilder.Entity<OfferModel>().HasData(
new OfferModel { OfferID = 1, RefYear = 2024, RefNum = 1, RefRev = 1, Description = "Offerta per tre serramenti", CustomerID = 2, DealerID = 2 }
@@ -114,9 +120,9 @@ namespace Lux.Data
// inizializzazione dei valori di default x OfferRow
modelBuilder.Entity<OfferRowModel>().HasData(
new OfferRowModel { OfferRowID = 1, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 950, ItemID = 1, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Finestra anta singola 2025", ItemSPP = "{}" },
new OfferRowModel { OfferRowID = 2, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 160, ItemID = 2, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Persiana per Finestra anta singola 2025", ItemSPP = "{}" },
new OfferRowModel { OfferRowID = 3, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 200, ItemID = 3, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Installazione serramento", ItemSPP = "{}" }
new OfferRowModel { OfferRowID = 1, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 950, SellItemID = 1, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Finestra anta singola 2025", ItemSPP = "{}" },
new OfferRowModel { OfferRowID = 2, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 160, SellItemID = 2, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Persiana per Finestra anta singola 2025", ItemSPP = "{}" },
new OfferRowModel { OfferRowID = 3, OfferID = 1, Inserted = DateTime.Now, Modified = DateTime.Now, Cost = 200, SellItemID = 3, Qty = 3, RowNum = 1, SerStruct = "{}", Note = "Installazione serramento", ItemSPP = "{}" }
);