Fix dataseed + migrationz

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