Aggiunta schema DB + batch e item produzione
This commit is contained in:
@@ -55,6 +55,8 @@ namespace Lux.Data
|
||||
public virtual DbSet<JobModel> DbSetJob { get; set; }
|
||||
public virtual DbSet<JobRowModel> DbSetJobRow { get; set; }
|
||||
public virtual DbSet<JobRowItemModel> DbSetJobRowItem { get; set; }
|
||||
public virtual DbSet<ProductionBatchModel> DbSetProdBatch { get; set; }
|
||||
public virtual DbSet<ProductionItemModel> DbSetProdItem { get; set; }
|
||||
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Lux.Data.DbModel
|
||||
/// DataOra inserimento
|
||||
/// </summary>
|
||||
public DateTime Inserted { get; set; } = DateTime.Now;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// DataOra ultima modifica
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
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("ProductionBatch")]
|
||||
public class ProductionBatchModel
|
||||
{
|
||||
/// <summary>
|
||||
/// ID dell'articolo
|
||||
/// </summary>
|
||||
[Key]
|
||||
public int ProductionBatchID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione
|
||||
/// </summary>
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// DataOra prevista esecuzione
|
||||
/// </summary>
|
||||
public DateTime DueDate { get; set; } = DateTime.Today.AddMonths(1);
|
||||
|
||||
/// <summary>
|
||||
/// DataOra inizio
|
||||
/// </summary>
|
||||
public DateTime? DateStart { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra fine
|
||||
/// </summary>
|
||||
public DateTime? DateEnd { get; set; } = null;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
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("ProductionItem")]
|
||||
public class ProductionItemModel
|
||||
{
|
||||
/// <summary>
|
||||
/// ID dell'articolo
|
||||
/// </summary>
|
||||
[Key]
|
||||
public int ProdItemID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Riga Ordine da cui scaturisce
|
||||
/// </summary>
|
||||
public int OrderRowID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CodArticolo (opzionale) numerico
|
||||
/// </summary>
|
||||
public int ItemCode { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// CodArticolo (opzionale) string
|
||||
/// </summary>
|
||||
public string ExtItemCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Batch di produzione cui è correlato
|
||||
/// </summary>
|
||||
public int ProductionBatchID { get; set; } = 0;
|
||||
#if false
|
||||
/// <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; } = "#";
|
||||
#endif
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione OrderRow
|
||||
/// </summary>
|
||||
[ForeignKey("OrderRowID")]
|
||||
public virtual OrderRowModel OrderRowNav { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione Batch Produzione
|
||||
/// </summary>
|
||||
[ForeignKey("ProductionBatchID")]
|
||||
public virtual ProductionBatchModel ProductionBatchNav { get; set; } = null!;
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 95 KiB |
+1231
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Lux.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddProdBatch : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProductionBatch",
|
||||
columns: table => new
|
||||
{
|
||||
ProductionBatchID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DueDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
DateStart = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
DateEnd = table.Column<DateTime>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProductionBatch", x => x.ProductionBatchID);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProductionItem",
|
||||
columns: table => new
|
||||
{
|
||||
ProdItemID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
OrderRowID = 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"),
|
||||
ProductionBatchID = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProductionItem", x => x.ProdItemID);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProductionItem_OrderRowList_OrderRowID",
|
||||
column: x => x.OrderRowID,
|
||||
principalTable: "OrderRowList",
|
||||
principalColumn: "OrderRowID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProductionItem_ProductionBatch_ProductionBatchID",
|
||||
column: x => x.ProductionBatchID,
|
||||
principalTable: "ProductionBatch",
|
||||
principalColumn: "ProductionBatchID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 1,
|
||||
columns: new[] { "Inserted", "Modified", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4269), new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4271), new DateTime(2025, 8, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4265) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "OfferRowList",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 1,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4291), new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4293) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "OfferRowList",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 2,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4300), new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4302) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "OfferRowList",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 3,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4307), new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4309) });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductionItem_OrderRowID",
|
||||
table: "ProductionItem",
|
||||
column: "OrderRowID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductionItem_ProductionBatchID",
|
||||
table: "ProductionItem",
|
||||
column: "ProductionBatchID");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProductionItem");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProductionBatch");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Offer",
|
||||
keyColumn: "OfferID",
|
||||
keyValue: 1,
|
||||
columns: new[] { "Inserted", "Modified", "ValidUntil" },
|
||||
values: new object[] { new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9450), new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9452), new DateTime(2025, 8, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9439) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "OfferRowList",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 1,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9478), new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9479) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "OfferRowList",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 2,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9486), new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9487) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "OfferRowList",
|
||||
keyColumn: "OfferRowID",
|
||||
keyValue: 3,
|
||||
columns: new[] { "Inserted", "Modified" },
|
||||
values: new object[] { new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9494), new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9496) });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -456,13 +456,13 @@ namespace Lux.Data.Migrations
|
||||
CustomerID = 2,
|
||||
DealerID = 2,
|
||||
Description = "Offerta per tre serramenti",
|
||||
Inserted = new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9450),
|
||||
Modified = new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9452),
|
||||
Inserted = new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4269),
|
||||
Modified = new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4271),
|
||||
OffertState = 0,
|
||||
RefNum = 1,
|
||||
RefRev = 1,
|
||||
RefYear = 2024,
|
||||
ValidUntil = new DateTime(2025, 8, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9439)
|
||||
ValidUntil = new DateTime(2025, 8, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4265)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -520,9 +520,9 @@ namespace Lux.Data.Migrations
|
||||
{
|
||||
OfferRowID = 1,
|
||||
Cost = 950.0,
|
||||
Inserted = new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9478),
|
||||
Inserted = new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4291),
|
||||
ItemSPP = "{}",
|
||||
Modified = new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9479),
|
||||
Modified = new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4293),
|
||||
Note = "Finestra anta singola 2025",
|
||||
OfferID = 1,
|
||||
Qty = 3.0,
|
||||
@@ -534,9 +534,9 @@ namespace Lux.Data.Migrations
|
||||
{
|
||||
OfferRowID = 2,
|
||||
Cost = 160.0,
|
||||
Inserted = new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9486),
|
||||
Inserted = new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4300),
|
||||
ItemSPP = "{}",
|
||||
Modified = new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9487),
|
||||
Modified = new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4302),
|
||||
Note = "Persiana per Finestra anta singola 2025",
|
||||
OfferID = 1,
|
||||
Qty = 3.0,
|
||||
@@ -548,9 +548,9 @@ namespace Lux.Data.Migrations
|
||||
{
|
||||
OfferRowID = 3,
|
||||
Cost = 200.0,
|
||||
Inserted = new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9494),
|
||||
Inserted = new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4307),
|
||||
ItemSPP = "{}",
|
||||
Modified = new DateTime(2025, 7, 3, 17, 38, 38, 470, DateTimeKind.Local).AddTicks(9496),
|
||||
Modified = new DateTime(2025, 7, 3, 18, 7, 7, 847, DateTimeKind.Local).AddTicks(4309),
|
||||
Note = "Installazione serramento",
|
||||
OfferID = 1,
|
||||
Qty = 3.0,
|
||||
@@ -712,6 +712,62 @@ namespace Lux.Data.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lux.Data.DbModel.ProductionBatchModel", b =>
|
||||
{
|
||||
b.Property<int>("ProductionBatchID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProductionBatchID"));
|
||||
|
||||
b.Property<DateTime?>("DateEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("DateStart")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("DueDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("ProductionBatchID");
|
||||
|
||||
b.ToTable("ProductionBatch");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lux.Data.DbModel.ProductionItemModel", b =>
|
||||
{
|
||||
b.Property<int>("ProdItemID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProdItemID"));
|
||||
|
||||
b.Property<string>("ExtItemCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ItemCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OrderRowID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ProductionBatchID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ProdItemID");
|
||||
|
||||
b.HasIndex("OrderRowID");
|
||||
|
||||
b.HasIndex("ProductionBatchID");
|
||||
|
||||
b.ToTable("ProductionItem");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lux.Data.DbModel.ResourceModel", b =>
|
||||
{
|
||||
b.Property<int>("ResourceID")
|
||||
@@ -1137,6 +1193,25 @@ namespace Lux.Data.Migrations
|
||||
b.Navigation("SellingItemNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lux.Data.DbModel.ProductionItemModel", b =>
|
||||
{
|
||||
b.HasOne("Lux.Data.DbModel.OrderRowModel", "OrderRowNav")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderRowID")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Lux.Data.DbModel.ProductionBatchModel", "ProductionBatchNav")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductionBatchID")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("OrderRowNav");
|
||||
|
||||
b.Navigation("ProductionBatchNav");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Lux.Data.DbModel.SellingItemModel", b =>
|
||||
{
|
||||
b.HasOne("Lux.Data.DbModel.JobModel", "JobNav")
|
||||
|
||||
Reference in New Issue
Block a user