Merge branch 'develop' of https://gitlab.steamware.net/etis/lux into develop

This commit is contained in:
Annamaria Sassi
2026-04-14 15:50:12 +02:00
22 changed files with 10098 additions and 104 deletions
+36
View File
@@ -162,6 +162,9 @@
Lost
}
/// <summary>
/// Status ordini cliente
/// </summary>
public enum OrderStates
{
/// <summary>
@@ -210,6 +213,39 @@
Closed
}
public enum BuyOrderStates
{
/// <summary>
/// Ordine acquisto creato da BOM di 1/+ ordini
/// </summary>
Created,
/// <summary>
/// Richiesta quotazione fornitori
/// </summary>
Requested,
/// <summary>
/// Assegnato a supplier (e inviato)
/// </summary>
Assigned,
/// <summary>
/// Parzialmente ricevuto
/// </summary>
Partial,
/// <summary>
/// Completato poiché ho ricevuto Merce (e DDT)
/// </summary>
Completed,
/// <summary>
/// Ordine chiuso (con fatturazione)
/// </summary>
Closed
}
/// <summary>
/// Enum risultati verifica lavorabilità part (e tempo)
/// </summary>
+7
View File
@@ -44,6 +44,10 @@
public virtual DbSet<CustomerModel> DbSetCustomer { get; set; }
public virtual DbSet<DealerModel> DbSetDealer { get; set; }
public virtual DbSet<SupplierModel> DbSetSupplier { get; set; }
public virtual DbSet<SupplierQualifyModel> DbSetSupplierQualify { get; set; }
public virtual DbSet<BuyOrderModel> DbSetBuyOrder { get; set; }
public virtual DbSet<BuyOrderRowModel> DbSetBuyOrderRow { get; set; }
public virtual DbSet<OfferModel> DbSetOffer { get; set; }
public virtual DbSet<OfferRowModel> DbSetOfferRow { get; set; }
public virtual DbSet<OrderModel> DbSetOrder { get; set; }
@@ -123,6 +127,9 @@
modelBuilder.Entity<JobStepTagModel>()
.HasKey(jst => new { jst.JobStepID, jst.CodTag });
modelBuilder.Entity<SupplierQualifyModel>()
.HasKey(sq => new { sq.SupplierID, sq.CodGroup });
modelBuilder.Entity<ProductionItem2ODLModel>()
.HasKey(x => new { x.ProdItemID, x.ProdODLID });
@@ -54,7 +54,7 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
public int? SellingItemID { get; set; }
/// <summary>
/// Riferimento (opzionale9 al template da cui è derivato
/// Riferimento (opzionale) al template da cui è derivato
/// </summary>
public int? TemplateRowID { get; set; } = null;
@@ -0,0 +1,92 @@
namespace EgwCoreLib.Lux.Data.DbModel.Supplier
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("buy_order")]
public class BuyOrderModel
{
/// <summary>
/// ID del record
/// </summary>
[Key]
public int BuyOrderID { get; set; }
/// <summary>
/// Anno rif Ordine Fornitore
/// </summary>
public int RefYear { get; set; } = DateTime.Today.Year;
/// <summary>
/// Numero prog Ordine nell'anno (da calcolare)
/// </summary>
public int RefNum { get; set; } = 0;
/// <summary>
/// Indice revisione
/// </summary>
public int RefRev { get; set; } = 1;
/// <summary>
/// Codice calcolato Ordine ANNO.NUMERO.REV
/// </summary>
[NotMapped]
public string BuyOrderCode
{
get => $"BO.{RefYear:00}.{RefNum:00000}.{RefRev:00}";
}
/// <summary>
/// Descrizione generale
/// </summary>
public string Description { get; set; } = "";
/// <summary>
/// Fornitore (quandoa ssegnato, altrimenti è quotazione)
/// </summary>
public int? SupplierID { get; set; } = null;
/// <summary>
/// Ordine assegnato se ho un supplier definito
/// </summary>
[NotMapped]
public bool Assigned => SupplierID != null;
/// <summary>
/// DataOra inserimento
/// </summary>
public DateTime Inserted { get; set; } = DateTime.Now;
/// <summary>
/// DataOra ultima modifica
/// </summary>
public DateTime Modified { get; set; } = DateTime.Now;
/// <summary>
/// DataOra richiesta per il completamento dell'ordine di fornitura
/// </summary>
public DateTime DueDateReq { get; set; } = DateTime.Today.AddDays(30);
/// <summary>
/// note di consegna (opzionali)
/// </summary>
public string ConsNote { get; set; } = "";
/// <summary>
/// Enum stato Ordine Acquisto
/// </summary>
public BuyOrderStates OrderState { get; set; } = BuyOrderStates.Created;
/// <summary>
/// Navigazione Supplier
/// </summary>
[ForeignKey("SupplierID")]
public virtual SupplierModel? SupplierNav { get; set; } = null;
/// <summary>
/// Navigazione alle righe Ordine Acquisto
/// </summary>
public virtual ICollection<BuyOrderRowModel> BuyOrderRowNav { get; set; } = new List<BuyOrderRowModel>();
}
}
@@ -0,0 +1,92 @@
namespace EgwCoreLib.Lux.Data.DbModel.Supplier
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("buy_order_row")]
public class BuyOrderRowModel
{
/// <summary>
/// ID del record
/// </summary>
[Key]
public int BuyOrderRowID { get; set; }
/// <summary>
/// ID Ordine di acquisto di riferimento
/// </summary>
public int BuyOrderID { get; set; }
/// <summary>
/// Riga Ordine (per ordinamento)
/// </summary>
public int RowNum { get; set; } = 0;
/// <summary>
/// ID dell'item richiesto
/// </summary>
public int ItemID { get; set; } = 0;
/// <summary>
/// Classificazione Item
/// </summary>
public string ClassCode { get; set; } = "";
/// <summary>
/// Descrizione Item
/// </summary>
public string DescriptionCode { get; set; } = "";
/// <summary>
/// Codice Item
/// </summary>
public string ItemCode { get; set; } = "";
/// <summary>
/// Quantità articolo TOTALE
/// </summary>
public double TotQty
{
get => DictOrderRowDetail.Sum(x => x.Value);
}
/// <summary>
/// Dizionario serializzato di RigheOrdine + Qty
/// </summary>
public string OrderRowData { get; set; } = "";
/// <summary>
/// Dizionario escplicito degli OrderRow esplosi rispetto a ItemId delle BOM
/// </summary>
[NotMapped]
public Dictionary<int, double> DictOrderRowDetail
{
get
{
Dictionary<int, double> answ = new();
if (!string.IsNullOrEmpty(OrderRowData) && OrderRowData.Count() > 2)
{
answ = JsonConvert.DeserializeObject<Dictionary<int, double>>(OrderRowData) ?? new();
}
return answ;
}
set
{
OrderRowData = JsonConvert.SerializeObject(value);
}
}
/// <summary>
/// Navigazione Ordine Acquisto
/// </summary>
[ForeignKey("BuyOrderID")]
public virtual BuyOrderModel? BuyOrderNav { get; set; } = null;
/// <summary>
/// Navigazione Item
/// </summary>
[ForeignKey("ItemID")]
public virtual ItemModel? ItemNav { get; set; } = null;
}
}
@@ -1,10 +1,10 @@
namespace EgwCoreLib.Lux.Data.DbModel.Items
namespace EgwCoreLib.Lux.Data.DbModel.Supplier
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("item_supplier")]
[Table("buy_supplier")]
public class SupplierModel
{
/// <summary>
@@ -13,13 +13,6 @@
[Key]
public int SupplierID { get; set; }
#if false
/// <summary>
/// Ruolo assocaito da anagrafica esterna
/// </summary>
public int RoleID { get; set; }
#endif
/// <summary>
/// Denominazione se persona giuridica
/// </summary>
@@ -40,12 +33,9 @@
/// </summary>
public string VAT { get; set; } = "";
#if false
/// <summary>
/// Navigazione al ruolo
/// Many-to-many with Qualifica Fornitori
/// </summary>
[ForeignKey("RoleID")]
public virtual RoleModel RoleNav { get; set; } = null!;
#endif
public virtual ICollection<SupplierQualifyModel> QualifNav { get; set; } = new List<SupplierQualifyModel>();
}
}
@@ -0,0 +1,15 @@
namespace EgwCoreLib.Lux.Data.DbModel.Supplier
{
[Table("buy_supplier_qualify")]
public class SupplierQualifyModel
{
public int SupplierID { get; set; }
public string CodGroup { get; set; } = "";
[ForeignKey("SupplierID")]
public virtual SupplierModel SupplierNav { get; set; } = null!;
[ForeignKey("CodGroup")]
public virtual ItemGroupModel GroupNav { get; set; } = null!;
}
}
@@ -54,6 +54,7 @@
<ItemGroup>
<Folder Include="DbModel\Engine\" />
<Folder Include="Migrations\" />
<Folder Include="Services\Supplier\" />
</ItemGroup>
<ItemGroup>
+1
View File
@@ -9,6 +9,7 @@ global using EgwCoreLib.Lux.Data.DbModel.Production;
global using EgwCoreLib.Lux.Data.DbModel.Sales;
global using EgwCoreLib.Lux.Data.DbModel.Stats;
global using EgwCoreLib.Lux.Data.DbModel.Stock;
global using EgwCoreLib.Lux.Data.DbModel.Supplier;
global using EgwCoreLib.Lux.Data.DbModel.Utils;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.Extensions.Configuration;
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,385 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace EgwCoreLib.Lux.Data.Migrations
{
/// <inheritdoc />
public partial class AddBuyOrder : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "item_supplier");
migrationBuilder.CreateTable(
name: "buy_supplier",
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_buy_supplier", x => x.SupplierID);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "buy_order",
columns: table => new
{
BuyOrderID = 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"),
SupplierID = table.Column<int>(type: "int", nullable: true),
Inserted = table.Column<DateTime>(type: "datetime(6)", nullable: false),
Modified = table.Column<DateTime>(type: "datetime(6)", nullable: false),
DueDateReq = table.Column<DateTime>(type: "datetime(6)", nullable: false),
ConsNote = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
OrderState = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_buy_order", x => x.BuyOrderID);
table.ForeignKey(
name: "FK_buy_order_buy_supplier_SupplierID",
column: x => x.SupplierID,
principalTable: "buy_supplier",
principalColumn: "SupplierID",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "buy_order_row",
columns: table => new
{
BuyOrderRowID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
BuyOrderID = table.Column<int>(type: "int", nullable: false),
OrderID = table.Column<int>(type: "int", nullable: false),
ItemID = table.Column<int>(type: "int", nullable: false),
ClassCode = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
DescriptionCode = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ItemCode = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
OrderRowData = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_buy_order_row", x => x.BuyOrderRowID);
table.ForeignKey(
name: "FK_buy_order_row_buy_order_BuyOrderID",
column: x => x.BuyOrderID,
principalTable: "buy_order",
principalColumn: "BuyOrderID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_buy_order_row_item_item_ItemID",
column: x => x.ItemID,
principalTable: "item_item",
principalColumn: "ItemID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_buy_order_row_sales_order_OrderID",
column: x => x.OrderID,
principalTable: "sales_order",
principalColumn: "OrderID",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "buy_supplier",
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.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 1,
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
values: new object[] { new DateTime(2026, 6, 13, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 5, 14, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 5, 14, 11, 22, 33, 792, DateTimeKind.Local).AddTicks(5680) });
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 2,
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
values: new object[] { new DateTime(2026, 6, 13, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 5, 14, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 5, 14, 11, 22, 33, 792, DateTimeKind.Local).AddTicks(5692) });
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 3,
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
values: new object[] { new DateTime(2026, 6, 13, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 5, 14, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 5, 14, 11, 22, 33, 792, DateTimeKind.Local).AddTicks(5699) });
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 4,
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
values: new object[] { new DateTime(2026, 6, 13, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 5, 14, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 5, 14, 11, 22, 33, 792, DateTimeKind.Local).AddTicks(5705) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 1,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 2,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 3,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 4,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 5,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 6,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 7,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 8,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 9,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 10,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.CreateIndex(
name: "IX_buy_order_SupplierID",
table: "buy_order",
column: "SupplierID");
migrationBuilder.CreateIndex(
name: "IX_buy_order_row_BuyOrderID",
table: "buy_order_row",
column: "BuyOrderID");
migrationBuilder.CreateIndex(
name: "IX_buy_order_row_ItemID",
table: "buy_order_row",
column: "ItemID");
migrationBuilder.CreateIndex(
name: "IX_buy_order_row_OrderID",
table: "buy_order_row",
column: "OrderID");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "buy_order_row");
migrationBuilder.DropTable(
name: "buy_order");
migrationBuilder.DropTable(
name: "buy_supplier");
migrationBuilder.CreateTable(
name: "item_supplier",
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_item_supplier", x => x.SupplierID);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "item_supplier",
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.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 1,
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
values: new object[] { new DateTime(2026, 5, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 27, 17, 9, 50, 585, DateTimeKind.Local).AddTicks(4789) });
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 2,
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
values: new object[] { new DateTime(2026, 5, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 27, 17, 9, 50, 585, DateTimeKind.Local).AddTicks(4807) });
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 3,
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
values: new object[] { new DateTime(2026, 5, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 27, 17, 9, 50, 585, DateTimeKind.Local).AddTicks(4813) });
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 4,
columns: new[] { "DueDateProm", "DueDateReq", "ValidUntil" },
values: new object[] { new DateTime(2026, 5, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 26, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 4, 27, 17, 9, 50, 585, DateTimeKind.Local).AddTicks(4820) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 1,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 2,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 3,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 4,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 5,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 6,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 7,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 8,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 9,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local) });
migrationBuilder.UpdateData(
table: "sales_offer_row",
keyColumn: "OfferRowID",
keyValue: 10,
columns: new[] { "Inserted", "Modified" },
values: new object[] { new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local), new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local) });
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,140 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EgwCoreLib.Lux.Data.Migrations
{
/// <inheritdoc />
public partial class UpdateBuyOrderData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_buy_order_row_sales_order_OrderID",
table: "buy_order_row");
migrationBuilder.DropIndex(
name: "IX_buy_order_row_OrderID",
table: "buy_order_row");
migrationBuilder.RenameColumn(
name: "OrderID",
table: "buy_order_row",
newName: "RowNum");
migrationBuilder.CreateTable(
name: "buy_supplier_qualify",
columns: table => new
{
SupplierID = table.Column<int>(type: "int", nullable: false),
CodGroup = table.Column<string>(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_buy_supplier_qualify", x => new { x.SupplierID, x.CodGroup });
table.ForeignKey(
name: "FK_buy_supplier_qualify_buy_supplier_SupplierID",
column: x => x.SupplierID,
principalTable: "buy_supplier",
principalColumn: "SupplierID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_buy_supplier_qualify_item_group_CodGroup",
column: x => x.CodGroup,
principalTable: "item_group",
principalColumn: "CodGroup",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 1,
column: "ValidUntil",
value: new DateTime(2026, 5, 14, 12, 24, 22, 268, DateTimeKind.Local).AddTicks(7042));
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 2,
column: "ValidUntil",
value: new DateTime(2026, 5, 14, 12, 24, 22, 268, DateTimeKind.Local).AddTicks(7058));
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 3,
column: "ValidUntil",
value: new DateTime(2026, 5, 14, 12, 24, 22, 268, DateTimeKind.Local).AddTicks(7064));
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 4,
column: "ValidUntil",
value: new DateTime(2026, 5, 14, 12, 24, 22, 268, DateTimeKind.Local).AddTicks(7071));
migrationBuilder.CreateIndex(
name: "IX_buy_supplier_qualify_CodGroup",
table: "buy_supplier_qualify",
column: "CodGroup");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "buy_supplier_qualify");
migrationBuilder.RenameColumn(
name: "RowNum",
table: "buy_order_row",
newName: "OrderID");
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 1,
column: "ValidUntil",
value: new DateTime(2026, 5, 14, 11, 22, 33, 792, DateTimeKind.Local).AddTicks(5680));
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 2,
column: "ValidUntil",
value: new DateTime(2026, 5, 14, 11, 22, 33, 792, DateTimeKind.Local).AddTicks(5692));
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 3,
column: "ValidUntil",
value: new DateTime(2026, 5, 14, 11, 22, 33, 792, DateTimeKind.Local).AddTicks(5699));
migrationBuilder.UpdateData(
table: "sales_offer",
keyColumn: "OfferID",
keyValue: 4,
column: "ValidUntil",
value: new DateTime(2026, 5, 14, 11, 22, 33, 792, DateTimeKind.Local).AddTicks(5705));
migrationBuilder.CreateIndex(
name: "IX_buy_order_row_OrderID",
table: "buy_order_row",
column: "OrderID");
migrationBuilder.AddForeignKey(
name: "FK_buy_order_row_sales_order_OrderID",
table: "buy_order_row",
column: "OrderID",
principalTable: "sales_order",
principalColumn: "OrderID",
onDelete: ReferentialAction.Restrict);
}
}
}
@@ -1171,61 +1171,6 @@ namespace EgwCoreLib.Lux.Data.Migrations
});
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Items.SupplierModel", b =>
{
b.Property<int>("SupplierID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierID"));
b.Property<string>("CompanyName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("VAT")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("SupplierID");
b.ToTable("item_supplier");
b.HasData(
new
{
SupplierID = 1,
CompanyName = "Company One",
FirstName = "Supplier A",
LastName = "Egalware",
VAT = "7294857103879254"
},
new
{
SupplierID = 2,
CompanyName = "Company Two",
FirstName = "Supplier B",
LastName = "User",
VAT = "7294857103879254"
},
new
{
SupplierID = 3,
CompanyName = "Company Two",
FirstName = "Supplier C",
LastName = "User Test",
VAT = "7294857103879254"
});
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Job.JobDriverConfigModel", b =>
{
b.Property<int>("JobDriverConfID")
@@ -2265,8 +2210,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
Description = "Offerta per tre serramenti",
DictPresel = "",
Discount = 0.0,
DueDateProm = new DateTime(2026, 5, 26, 0, 0, 0, 0, DateTimeKind.Local),
DueDateReq = new DateTime(2026, 4, 26, 0, 0, 0, 0, DateTimeKind.Local),
DueDateProm = new DateTime(2026, 6, 13, 0, 0, 0, 0, DateTimeKind.Local),
DueDateReq = new DateTime(2026, 5, 14, 0, 0, 0, 0, DateTimeKind.Local),
Envir = 1,
Inserted = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Modified = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
@@ -2274,7 +2219,7 @@ namespace EgwCoreLib.Lux.Data.Migrations
RefNum = 1,
RefRev = 1,
RefYear = 2025,
ValidUntil = new DateTime(2026, 4, 27, 17, 9, 50, 585, DateTimeKind.Local).AddTicks(4789)
ValidUntil = new DateTime(2026, 5, 14, 12, 24, 22, 268, DateTimeKind.Local).AddTicks(7042)
},
new
{
@@ -2285,8 +2230,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
Description = "Offerta BEAM",
DictPresel = "",
Discount = 0.0,
DueDateProm = new DateTime(2026, 5, 26, 0, 0, 0, 0, DateTimeKind.Local),
DueDateReq = new DateTime(2026, 4, 26, 0, 0, 0, 0, DateTimeKind.Local),
DueDateProm = new DateTime(2026, 6, 13, 0, 0, 0, 0, DateTimeKind.Local),
DueDateReq = new DateTime(2026, 5, 14, 0, 0, 0, 0, DateTimeKind.Local),
Envir = 2,
Inserted = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Modified = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
@@ -2294,7 +2239,7 @@ namespace EgwCoreLib.Lux.Data.Migrations
RefNum = 2,
RefRev = 1,
RefYear = 2025,
ValidUntil = new DateTime(2026, 4, 27, 17, 9, 50, 585, DateTimeKind.Local).AddTicks(4807)
ValidUntil = new DateTime(2026, 5, 14, 12, 24, 22, 268, DateTimeKind.Local).AddTicks(7058)
},
new
{
@@ -2305,8 +2250,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
Description = "Offerta Cabinet",
DictPresel = "",
Discount = 0.0,
DueDateProm = new DateTime(2026, 5, 26, 0, 0, 0, 0, DateTimeKind.Local),
DueDateReq = new DateTime(2026, 4, 26, 0, 0, 0, 0, DateTimeKind.Local),
DueDateProm = new DateTime(2026, 6, 13, 0, 0, 0, 0, DateTimeKind.Local),
DueDateReq = new DateTime(2026, 5, 14, 0, 0, 0, 0, DateTimeKind.Local),
Envir = 4,
Inserted = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Modified = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
@@ -2314,7 +2259,7 @@ namespace EgwCoreLib.Lux.Data.Migrations
RefNum = 3,
RefRev = 1,
RefYear = 2025,
ValidUntil = new DateTime(2026, 4, 27, 17, 9, 50, 585, DateTimeKind.Local).AddTicks(4813)
ValidUntil = new DateTime(2026, 5, 14, 12, 24, 22, 268, DateTimeKind.Local).AddTicks(7064)
},
new
{
@@ -2325,8 +2270,8 @@ namespace EgwCoreLib.Lux.Data.Migrations
Description = "Offerta Wall",
DictPresel = "",
Discount = 0.0,
DueDateProm = new DateTime(2026, 5, 26, 0, 0, 0, 0, DateTimeKind.Local),
DueDateReq = new DateTime(2026, 4, 26, 0, 0, 0, 0, DateTimeKind.Local),
DueDateProm = new DateTime(2026, 6, 13, 0, 0, 0, 0, DateTimeKind.Local),
DueDateReq = new DateTime(2026, 5, 14, 0, 0, 0, 0, DateTimeKind.Local),
Envir = 3,
Inserted = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Modified = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
@@ -2334,7 +2279,7 @@ namespace EgwCoreLib.Lux.Data.Migrations
RefNum = 4,
RefRev = 1,
RefYear = 2025,
ValidUntil = new DateTime(2026, 4, 27, 17, 9, 50, 585, DateTimeKind.Local).AddTicks(4820)
ValidUntil = new DateTime(2026, 5, 14, 12, 24, 22, 268, DateTimeKind.Local).AddTicks(7071)
});
});
@@ -2477,14 +2422,14 @@ namespace EgwCoreLib.Lux.Data.Migrations
FileResource = "",
FileSize = 0L,
ImgType = 0,
Inserted = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Inserted = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
ItemBOM = "",
ItemJCD = "",
ItemOk = true,
ItemSteps = "{}",
ItemTags = "",
JobID = 0,
Modified = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Modified = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
Note = "Finestra Anta Singola 2025",
OfferID = 1,
OfferRowUID = "SOR.26.00000002",
@@ -2512,14 +2457,14 @@ namespace EgwCoreLib.Lux.Data.Migrations
FileResource = "",
FileSize = 0L,
ImgType = 0,
Inserted = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Inserted = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
ItemBOM = "",
ItemJCD = "",
ItemOk = true,
ItemSteps = "{}",
ItemTags = "",
JobID = 0,
Modified = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Modified = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
Note = "Finestra Vetro Fisso 2025",
OfferID = 1,
OfferRowUID = "SOR.26.00000001",
@@ -2547,14 +2492,14 @@ namespace EgwCoreLib.Lux.Data.Migrations
FileResource = "",
FileSize = 0L,
ImgType = 0,
Inserted = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Inserted = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
ItemBOM = "",
ItemJCD = "",
ItemOk = true,
ItemSteps = "{}",
ItemTags = "",
JobID = 0,
Modified = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Modified = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
Note = "Persiana per Finestra anta singola 2025",
OfferID = 1,
OfferRowUID = "SOR.26.00000003",
@@ -2582,14 +2527,14 @@ namespace EgwCoreLib.Lux.Data.Migrations
FileResource = "",
FileSize = 0L,
ImgType = 0,
Inserted = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Inserted = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
ItemBOM = "",
ItemJCD = "",
ItemOk = true,
ItemSteps = "{}",
ItemTags = "",
JobID = 0,
Modified = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Modified = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
Note = "Installazione serramento",
OfferID = 1,
OfferRowUID = "SOR.26.00000004",
@@ -2617,14 +2562,14 @@ namespace EgwCoreLib.Lux.Data.Migrations
FileResource = "",
FileSize = 0L,
ImgType = 0,
Inserted = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Inserted = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
ItemBOM = "",
ItemJCD = "",
ItemOk = true,
ItemSteps = "{}",
ItemTags = "",
JobID = 0,
Modified = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Modified = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
Note = "Demo file 01",
OfferID = 2,
OfferRowUID = "SOR.26.00000005",
@@ -2652,14 +2597,14 @@ namespace EgwCoreLib.Lux.Data.Migrations
FileResource = "",
FileSize = 0L,
ImgType = 0,
Inserted = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Inserted = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
ItemBOM = "",
ItemJCD = "",
ItemOk = true,
ItemSteps = "{}",
ItemTags = "",
JobID = 0,
Modified = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Modified = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
Note = "Demo file 02",
OfferID = 2,
OfferRowUID = "SOR.26.00000006",
@@ -2687,14 +2632,14 @@ namespace EgwCoreLib.Lux.Data.Migrations
FileResource = "",
FileSize = 0L,
ImgType = 0,
Inserted = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Inserted = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
ItemBOM = "",
ItemJCD = "",
ItemOk = true,
ItemSteps = "{}",
ItemTags = "",
JobID = 0,
Modified = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Modified = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
Note = "Demo file 01",
OfferID = 3,
OfferRowUID = "SOR.26.00000007",
@@ -2722,14 +2667,14 @@ namespace EgwCoreLib.Lux.Data.Migrations
FileResource = "",
FileSize = 0L,
ImgType = 0,
Inserted = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Inserted = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
ItemBOM = "",
ItemJCD = "",
ItemOk = true,
ItemSteps = "{}",
ItemTags = "",
JobID = 0,
Modified = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Modified = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
Note = "Demo file 02",
OfferID = 3,
OfferRowUID = "SOR.26.00000008",
@@ -2757,14 +2702,14 @@ namespace EgwCoreLib.Lux.Data.Migrations
FileResource = "",
FileSize = 0L,
ImgType = 0,
Inserted = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Inserted = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
ItemBOM = "",
ItemJCD = "",
ItemOk = true,
ItemSteps = "{}",
ItemTags = "",
JobID = 0,
Modified = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Modified = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
Note = "Demo file 01",
OfferID = 4,
OfferRowUID = "SOR.26.00000009",
@@ -2792,14 +2737,14 @@ namespace EgwCoreLib.Lux.Data.Migrations
FileResource = "",
FileSize = 0L,
ImgType = 0,
Inserted = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Inserted = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
ItemBOM = "",
ItemJCD = "",
ItemOk = true,
ItemSteps = "{}",
ItemTags = "",
JobID = 0,
Modified = new DateTime(2026, 3, 27, 0, 0, 0, 0, DateTimeKind.Local),
Modified = new DateTime(2026, 4, 14, 0, 0, 0, 0, DateTimeKind.Local),
Note = "Demo file 02",
OfferID = 4,
OfferRowUID = "SOR.26.0000000A",
@@ -3408,6 +3353,165 @@ namespace EgwCoreLib.Lux.Data.Migrations
});
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Supplier.BuyOrderModel", b =>
{
b.Property<int>("BuyOrderID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("BuyOrderID"));
b.Property<string>("ConsNote")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("DueDateReq")
.HasColumnType("datetime(6)");
b.Property<DateTime>("Inserted")
.HasColumnType("datetime(6)");
b.Property<DateTime>("Modified")
.HasColumnType("datetime(6)");
b.Property<int>("OrderState")
.HasColumnType("int");
b.Property<int>("RefNum")
.HasColumnType("int");
b.Property<int>("RefRev")
.HasColumnType("int");
b.Property<int>("RefYear")
.HasColumnType("int");
b.Property<int?>("SupplierID")
.HasColumnType("int");
b.HasKey("BuyOrderID");
b.HasIndex("SupplierID");
b.ToTable("buy_order");
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Supplier.BuyOrderRowModel", b =>
{
b.Property<int>("BuyOrderRowID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("BuyOrderRowID"));
b.Property<int>("BuyOrderID")
.HasColumnType("int");
b.Property<string>("ClassCode")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("DescriptionCode")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ItemCode")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("ItemID")
.HasColumnType("int");
b.Property<string>("OrderRowData")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("RowNum")
.HasColumnType("int");
b.HasKey("BuyOrderRowID");
b.HasIndex("BuyOrderID");
b.HasIndex("ItemID");
b.ToTable("buy_order_row");
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Supplier.SupplierModel", b =>
{
b.Property<int>("SupplierID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierID"));
b.Property<string>("CompanyName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("VAT")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("SupplierID");
b.ToTable("buy_supplier");
b.HasData(
new
{
SupplierID = 1,
CompanyName = "Company One",
FirstName = "Supplier A",
LastName = "Egalware",
VAT = "7294857103879254"
},
new
{
SupplierID = 2,
CompanyName = "Company Two",
FirstName = "Supplier B",
LastName = "User",
VAT = "7294857103879254"
},
new
{
SupplierID = 3,
CompanyName = "Company Two",
FirstName = "Supplier C",
LastName = "User Test",
VAT = "7294857103879254"
});
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Supplier.SupplierQualifyModel", b =>
{
b.Property<int>("SupplierID")
.HasColumnType("int");
b.Property<string>("CodGroup")
.HasColumnType("varchar(255)");
b.HasKey("SupplierID", "CodGroup");
b.HasIndex("CodGroup");
b.ToTable("buy_supplier_qualify");
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.CounterModel", b =>
{
b.Property<int>("RefYear")
@@ -4046,6 +4150,54 @@ namespace EgwCoreLib.Lux.Data.Migrations
b.Navigation("ItemNav");
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Supplier.BuyOrderModel", b =>
{
b.HasOne("EgwCoreLib.Lux.Data.DbModel.Supplier.SupplierModel", "SupplierNav")
.WithMany()
.HasForeignKey("SupplierID")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("SupplierNav");
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Supplier.BuyOrderRowModel", b =>
{
b.HasOne("EgwCoreLib.Lux.Data.DbModel.Supplier.BuyOrderModel", "BuyOrderNav")
.WithMany("BuyOrderRowNav")
.HasForeignKey("BuyOrderID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.ItemModel", "ItemNav")
.WithMany()
.HasForeignKey("ItemID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("BuyOrderNav");
b.Navigation("ItemNav");
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Supplier.SupplierQualifyModel", b =>
{
b.HasOne("EgwCoreLib.Lux.Data.DbModel.Items.ItemGroupModel", "GroupNav")
.WithMany()
.HasForeignKey("CodGroup")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("EgwCoreLib.Lux.Data.DbModel.Supplier.SupplierModel", "SupplierNav")
.WithMany("QualifNav")
.HasForeignKey("SupplierID")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("GroupNav");
b.Navigation("SupplierNav");
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenValueModel", b =>
{
b.HasOne("EgwCoreLib.Lux.Data.DbModel.Utils.GenClassModel", "GenClassNav")
@@ -4109,6 +4261,16 @@ namespace EgwCoreLib.Lux.Data.Migrations
b.Navigation("ProdItemNav");
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Supplier.BuyOrderModel", b =>
{
b.Navigation("BuyOrderRowNav");
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Supplier.SupplierModel", b =>
{
b.Navigation("QualifNav");
});
modelBuilder.Entity("EgwCoreLib.Lux.Data.DbModel.Utils.GenClassModel", b =>
{
b.Navigation("GenValNav");
@@ -0,0 +1,127 @@
namespace EgwCoreLib.Lux.Data.Repository.Supplier
{
public class BuyOrderRepository : BaseRepository, IBuyOrderRepository
{
#region Public Constructors
public BuyOrderRepository(IDbContextFactory<DataLayerContext> ctxFactory) : base(ctxFactory)
{
}
#endregion Public Constructors
#region Public Methods
/// <inheritdoc />
public async Task<bool> AddAsync(BuyOrderModel entity)
{
await using var dbCtx = await CreateContextAsync();
await dbCtx.DbSetBuyOrder.AddAsync(entity);
return await dbCtx.SaveChangesAsync() > 0;
}
/// <inheritdoc />
public async Task<bool> DeleteAsync(BuyOrderModel entity)
{
await using var dbCtx = await CreateContextAsync();
dbCtx.DbSetBuyOrder.Remove(entity);
return await dbCtx.SaveChangesAsync() > 0;
}
/// <inheritdoc />
public async Task<List<BuyOrderModel>> GetAllAsync()
{
await using var dbCtx = await CreateContextAsync();
return await dbCtx.DbSetBuyOrder
.Include(c => c.SupplierNav)
.Include(o => o.BuyOrderRowNav)
.ThenInclude(s => s.ItemNav)
.AsNoTracking()
.ToListAsync();
}
/// <inheritdoc />
public async Task<BuyOrderModel?> GetByIdAsync(int recId)
{
await using var dbCtx = await CreateContextAsync();
return await dbCtx.DbSetBuyOrder
.Where(x => x.BuyOrderID == recId)
.Include(c => c.SupplierNav)
.Include(o => o.BuyOrderRowNav)
.ThenInclude(s => s.ItemNav)
.FirstOrDefaultAsync();
}
/// <inheritdoc />
public async Task<List<BuyOrderModel>> GetFiltAsync(DateTime inizio, DateTime fine)
{
await using var dbCtx = await CreateContextAsync();
return await dbCtx.DbSetBuyOrder
.Where(x => x.Inserted >= inizio && x.Inserted <= fine)
.Include(c => c.SupplierNav)
.Include(o => o.BuyOrderRowNav)
.ThenInclude(s => s.ItemNav)
.AsNoTracking()
.ToListAsync();
}
/// <inheritdoc />
public async Task<List<BuyOrderRowModel>> GetRowsAsync(int recId)
{
await using var dbCtx = await CreateContextAsync();
return await dbCtx.DbSetBuyOrderRow
.Where(x => x.BuyOrderID == recId)
.ToListAsync();
}
/// <inheritdoc />
public async Task<bool> SaveRowsAsync(List<BuyOrderRowModel> rows)
{
// Add validation for null or empty list
if (rows == null || rows.Count == 0) return false;
await using var dbCtx = await CreateContextAsync();
// Wrap in transaction for atomicity (batch update multiple rows)
await using var tx = await dbCtx.Database.BeginTransactionAsync();
try
{
foreach (var row in rows)
dbCtx.Entry(row).State = EntityState.Modified;
bool done = await dbCtx.SaveChangesAsync() > 0;
if (done)
await tx.CommitAsync();
return done;
}
catch
{
await tx.RollbackAsync();
throw;
}
}
/// <inheritdoc />
public async Task<bool> UpdateAsync(BuyOrderModel entity)
{
await using var dbCtx = await CreateContextAsync();
// Recuperiamo l'entità tracciata dal context
var trackedEntity = await dbCtx.DbSetBuyOrder.FirstOrDefaultAsync(x => x.BuyOrderID == entity.BuyOrderID);
if (trackedEntity != null)
{
// Aggiorna i valori dell'entità tracciata con quelli della nuova
dbCtx.Entry(trackedEntity).CurrentValues.SetValues(entity);
}
else
{
dbCtx.DbSetBuyOrder.Update(entity);
}
return await dbCtx.SaveChangesAsync() > 0;
}
#endregion Public Methods
}
}
@@ -0,0 +1,135 @@
namespace EgwCoreLib.Lux.Data.Repository.Supplier
{
public class BuyOrderRowrepository : BaseRepository, IBuyOrderRowrepository
{
#region Public Constructors
public BuyOrderRowrepository(IDbContextFactory<DataLayerContext> ctxFactory) : base(ctxFactory)
{
}
#endregion Public Constructors
#region Public Methods
/// <inheritdoc />
public async Task<bool> AddAsync(BuyOrderRowModel entity)
{
await using var dbCtx = await CreateContextAsync();
await dbCtx.DbSetBuyOrderRow.AddAsync(entity);
return await dbCtx.SaveChangesAsync() > 0;
}
/// <inheritdoc />
public async Task<bool> DeleteAsync(BuyOrderRowModel entity)
{
await using var dbCtx = await CreateContextAsync();
// Wrap in transaction for atomicity (multi-row update + delete)
await using var tx = await dbCtx.Database.BeginTransactionAsync();
try
{
// 1. Recupero il record da eliminare
var dbResult = await dbCtx.DbSetBuyOrderRow
.FirstOrDefaultAsync(x => x.BuyOrderRowID == entity.BuyOrderRowID);
if (dbResult == null)
return false;
// 2. Recupero i record successivi da shiftare
var list2Move = await dbCtx.DbSetBuyOrderRow
.Where(x => x.BuyOrderID == entity.BuyOrderID && x.RowNum > dbResult.RowNum)
.ToListAsync();
foreach (var item in list2Move)
{
item.RowNum--;
dbCtx.Entry(item).State = EntityState.Modified;
}
// 3. Rimuovo il record
dbCtx.DbSetBuyOrderRow.Remove(dbResult);
// 4. Salvo tutto
bool done = await dbCtx.SaveChangesAsync() > 0;
if (done)
await tx.CommitAsync();
return done;
}
catch
{
await tx.RollbackAsync();
throw;
}
}
/// <inheritdoc />
public async Task<BuyOrderRowModel?> GetByIdAsync(int buyOrderRowId)
{
await using var dbCtx = await CreateContextAsync();
return await dbCtx.DbSetBuyOrderRow
.Include(r => r.ItemNav)
.FirstOrDefaultAsync(x => x.BuyOrderRowID == buyOrderRowId);
}
/// <inheritdoc />
public async Task<List<BuyOrderRowModel>> GetByParentAsync(int buyOrderId)
{
await using var dbCtx = await CreateContextAsync();
return await dbCtx.DbSetBuyOrderRow
.Where(x => x.BuyOrderID == buyOrderId)
.Include(r => r.ItemNav)
.AsNoTracking()
.ToListAsync();
}
/// <inheritdoc />
public async Task<bool> SaveRowsAsync(List<BuyOrderRowModel> rows)
{
await using var dbCtx = await CreateContextAsync();
// Wrap in transaction for atomicity (batch update multiple rows)
await using var tx = await dbCtx.Database.BeginTransactionAsync();
try
{
foreach (var row in rows)
dbCtx.Entry(row).State = EntityState.Modified;
bool done = await dbCtx.SaveChangesAsync() > 0;
if (done)
await tx.CommitAsync();
return done;
}
catch
{
await tx.RollbackAsync();
throw;
}
}
/// <inheritdoc />
public async Task<bool> UpdateAsync(BuyOrderRowModel entity)
{
await using var dbCtx = await CreateContextAsync();
// Recuperiamo l'entità tracciata dal context
var trackedEntity = await dbCtx.DbSetBuyOrderRow.FirstOrDefaultAsync(x => x.BuyOrderRowID == entity.BuyOrderRowID);
if (trackedEntity != null)
{
// Aggiorna i valori dell'entità tracciata con quelli della nuova
dbCtx.Entry(trackedEntity).CurrentValues.SetValues(entity);
}
else
{
dbCtx.DbSetBuyOrderRow.Update(entity);
}
return await dbCtx.SaveChangesAsync() > 0;
}
#endregion Public Methods
}
}
@@ -0,0 +1,64 @@
namespace EgwCoreLib.Lux.Data.Repository.Supplier
{
/// <summary>
/// Interfaccia per la gestione degli ordini.
/// </summary>
public interface IBuyOrderRepository : IBaseRepository
{
/// <summary>
/// Inserisce un nuovo ordine nel database.
/// </summary>
/// <param name="entity">L'ordine da inserire.</param>
/// <returns>True se l'inserimento ha successo, false altrimenti.</returns>
Task<bool> AddAsync(BuyOrderModel entity);
/// <summary>
/// Elimina un ordine dal database.
/// </summary>
/// <param name="entity">L'ordine da eliminare.</param>
/// <returns>True se l'eliminazione ha successo, false altrimenti.</returns>
Task<bool> DeleteAsync(BuyOrderModel entity);
/// <summary>
/// Recupera l'elenco di tutti gli ordini.
/// </summary>
/// <returns>L'elenco di tutti gli ordini con clienti, rivenditori e righe associate.</returns>
Task<List<BuyOrderModel>> GetAllAsync();
/// <summary>
/// Recupera un ordine per il suo identificatore.
/// </summary>
/// <param name="recId">L'identificatore dell'ordine.</param>
/// <returns>L'ordine corrispondente, o null se non esiste.</returns>
Task<BuyOrderModel?> GetByIdAsync(int recId);
/// <summary>
/// Recupera gli ordini inseriti in un intervallo di date specifico.
/// </summary>
/// <param name="inizio">La data di inizio del periodo.</param>
/// <param name="fine">La data di fine del periodo.</param>
/// <returns>L'elenco degli ordini nell'intervallo specificato.</returns>
Task<List<BuyOrderModel>> GetFiltAsync(DateTime inizio, DateTime fine);
/// <summary>
/// Recupera le righe dell'ordine per un ordine specifico.
/// </summary>
/// <param name="recId">L'identificatore dell'ordine.</param>
/// <returns>L'elenco delle righe dell'ordine.</returns>
Task<List<BuyOrderRowModel>> GetRowsAsync(int recId);
/// <summary>
/// Aggiorna in batch le righe di un ordine.
/// </summary>
/// <param name="rows">L'elenco delle righe da aggiornare.</param>
/// <returns>True se l'aggiornamento ha successo, false altrimenti.</returns>
Task<bool> SaveRowsAsync(List<BuyOrderRowModel> rows);
/// <summary>
/// Aggiorna un ordine esistente nel database.
/// </summary>
/// <param name="entity">L'ordine aggiornato.</param>
/// <returns>True se l'aggiornamento ha successo, false altrimenti.</returns>
Task<bool> UpdateAsync(BuyOrderModel entity);
}
}
@@ -0,0 +1,51 @@
namespace EgwCoreLib.Lux.Data.Repository.Supplier
{
/// <summary>
/// Interfaccia per la gestione delle righe degli ordini.
/// </summary>
public interface IBuyOrderRowrepository : IBaseRepository
{
/// <summary>
/// Inserisce una nuova riga d'ordine nel database.
/// </summary>
/// <param name="entity">La riga d'ordine da inserire.</param>
/// <returns>True se l'inserimento ha successo, false altrimenti.</returns>
Task<bool> AddAsync(BuyOrderRowModel entity);
/// <summary>
/// Elimina una riga d'ordine e adegua i numeri di riga successivi.
/// </summary>
/// <param name="entity">La riga d'ordine da eliminare.</param>
/// <returns>True se l'eliminazione ha successo, false altrimenti.</returns>
Task<bool> DeleteAsync(BuyOrderRowModel entity);
/// <summary>
/// Recupera una riga d'ordine per il suo identificatore.
/// </summary>
/// <param name="buyOrderRowId">L'identificatore della riga d'ordine.</param>
/// <returns>La riga d'ordine corrispondente, o null se non esiste.</returns>
Task<BuyOrderRowModel?> GetByIdAsync(int buyOrderRowId);
/// <summary>
/// Recupera tutte le righe d'ordine per un ordine specifico.
/// </summary>
/// <param name="buyOrderId">L'identificatore dell'ordine.</param>
/// <returns>L'elenco delle righe d'ordine associate all'ordine.</returns>
Task<List<BuyOrderRowModel>> GetByParentAsync(int buyOrderId);
/// <summary>
/// Aggiorna in batch le righe d'ordine.
/// </summary>
/// <param name="rows">L'elenco delle righe da aggiornare.</param>
/// <returns>True se l'aggiornamento ha successo, false altrimenti.</returns>
Task<bool> SaveRowsAsync(List<BuyOrderRowModel> rows);
/// <summary>
/// Aggiorna una riga d'ordine esistente.
/// </summary>
/// <param name="entity">La riga d'ordine aggiornata.</param>
/// <returns>True se l'aggiornamento ha successo, false altrimenti.</returns>
Task<bool> UpdateAsync(BuyOrderRowModel entity);
}
}
@@ -0,0 +1,51 @@
namespace EgwCoreLib.Lux.Data.Repository.Supplier
{
public interface ISupplierRepository : IBaseRepository
{
#region Public Methods
/// <summary>
/// Inserisce un nuovo record Supplier nel database.
/// </summary>
/// <param name="entity">Record da inserire</param>
Task<bool> AddAsync(SupplierModel entity);
/// <summary>
/// Elimina un record Supplier dal database.
/// </summary>
/// <param name="entity">Record da eliminare</param>
Task<bool> DeleteAsync(SupplierModel entity);
/// <summary>
/// Elenco completo supplier
/// </summary>
/// <returns></returns>
Task<List<SupplierModel>> GetAllAsync();
/// <summary>
/// Recupera un record Supplier specifico per ID.
/// </summary>
/// <param name="recId">ID dell'Supplier da recuperare</param>
Task<SupplierModel?> GetByIdAsync(int recId);
/// <summary>
/// Recupera gli Supplier filtrati per gruppo e tipo classe.
/// </summary>
/// <param name="codGroup">Codice del gruppo filtro (vuoto = tutti)</param>
Task<List<SupplierModel>> GetFiltAsync(string codGroup);
/// <summary>
/// Recupera gli Supplier filtrati per più gruppi e tipo classe.
/// </summary>
/// <param name="codGroups">Elenco Codici dei gruppi</param>
Task<List<SupplierModel>> GetFiltAsync(List<string> codGroups);
/// <summary>
/// Aggiorna un record Supplier esistente nel database.
/// </summary>
/// <param name="entity">Record aggiornato</param>
Task<bool> UpdateAsync(SupplierModel entity);
#endregion Public Methods
}
}
@@ -0,0 +1,92 @@
namespace EgwCoreLib.Lux.Data.Repository.Supplier
{
public class SupplierRepository : BaseRepository, ISupplierRepository
{
#region Public Constructors
public SupplierRepository(IDbContextFactory<DataLayerContext> ctxFactory) : base(ctxFactory)
{
}
#endregion Public Constructors
#region Public Methods
/// <inheritdoc />
public async Task<bool> AddAsync(SupplierModel entity)
{
await using var dbCtx = await CreateContextAsync();
await dbCtx.DbSetSupplier.AddAsync(entity);
return await dbCtx.SaveChangesAsync() > 0;
}
/// <inheritdoc />
public async Task<bool> DeleteAsync(SupplierModel entity)
{
await using var dbCtx = await CreateContextAsync();
dbCtx.DbSetSupplier.Remove(entity);
return await dbCtx.SaveChangesAsync() > 0;
}
/// <inheritdoc />
public async Task<List<SupplierModel>> GetAllAsync()
{
await using var dbCtx = await CreateContextAsync();
return await dbCtx.DbSetSupplier
.AsNoTracking()
.Include(s => s.QualifNav)
.ToListAsync();
}
/// <inheritdoc />
public async Task<SupplierModel?> GetByIdAsync(int recId)
{
await using var dbCtx = await CreateContextAsync();
return await dbCtx.DbSetSupplier
.Where(x => x.SupplierID == recId)
.Include(s => s.QualifNav)
.FirstOrDefaultAsync();
}
/// <inheritdoc />
public async Task<List<SupplierModel>> GetFiltAsync(string codGroup)
{
await using var dbCtx = await CreateContextAsync();
return await dbCtx.DbSetSupplier
.AsNoTracking()
.Include(s => s.QualifNav)
.Where(s => s.QualifNav.Any(q => q.CodGroup == codGroup))
.ToListAsync();
}
public async Task<List<SupplierModel>> GetFiltAsync(List<string> codGroups)
{
await using var dbCtx = await CreateContextAsync();
return await dbCtx.DbSetSupplier
.AsNoTracking()
.Where(s => s.QualifNav.Any(q => codGroups.Contains(q.CodGroup)))
.ToListAsync();
}
/// <inheritdoc />
public async Task<bool> UpdateAsync(SupplierModel entity)
{
await using var dbCtx = await CreateContextAsync();
// Recuperiamo l'entità tracciata dal context
var trackedEntity = await dbCtx.DbSetSupplier.FirstOrDefaultAsync(x => x.SupplierID == entity.SupplierID);
if (trackedEntity != null)
{
// Aggiorna i valori dell'entità tracciata con quelli della nuova
dbCtx.Entry(trackedEntity).CurrentValues.SetValues(entity);
}
else
{
dbCtx.DbSetSupplier.Update(entity);
}
return await dbCtx.SaveChangesAsync() > 0;
}
#endregion Public Methods
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>1.1.2604.1313</Version>
<Version>1.1.2604.1412</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50</UserSecretsId>
<Version>1.1.2604.1313</Version>
<Version>1.1.2604.1412</Version>
</PropertyGroup>
<ItemGroup>