From 85e2dfe8214c3c8a4d94e790993dee222e4c8a97 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 19 Nov 2025 18:58:31 +0100 Subject: [PATCH] update modello dati x prodItem child --- .../DbModel/Production/ProductionItemModel.cs | 17 ++++++++++++----- EgwCoreLib.Lux.Data/DbModel/Sales/OrderModel.cs | 6 ++++-- .../DbModel/Sales/OrderRowModel.cs | 8 ++++++++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemModel.cs b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemModel.cs index a3c30f2..6a96522 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemModel.cs @@ -20,7 +20,7 @@ namespace EgwCoreLib.Lux.Data.DbModel.Production /// /// Riga Ordine da cui scaturisce /// - public int OrderRowID { get; set; } + public int OrderRowID { get; set; } = 0; /// /// CodArticolo (opzionale) numerico @@ -33,9 +33,10 @@ namespace EgwCoreLib.Lux.Data.DbModel.Production public string ExtItemCode { get; set; } = ""; /// - /// Batch di produzione cui è correlato + /// Batch di produzione cui è correlato (può essere nullo inizialmente e poi variato) /// - public int ProductionBatchID { get; set; } = 0; + public int? ProductionBatchID { get; set; } + #if false /// /// Cod Fornitore (opzionale) @@ -62,7 +63,13 @@ namespace EgwCoreLib.Lux.Data.DbModel.Production /// public string UM { get; set; } = "#"; #endif - + /// + /// Etichetta dell'item + /// + public string ProdLabel + { + get => $"PT{ProdItemID:X8}"; + } /// /// Navigazione OrderRow @@ -74,7 +81,7 @@ namespace EgwCoreLib.Lux.Data.DbModel.Production /// Navigazione Batch Produzione /// [ForeignKey("ProductionBatchID")] - public virtual ProductionBatchModel ProductionBatchNav { get; set; } = null!; + public virtual ProductionBatchModel? ProductionBatchNav { get; set; } } } diff --git a/EgwCoreLib.Lux.Data/DbModel/Sales/OrderModel.cs b/EgwCoreLib.Lux.Data/DbModel/Sales/OrderModel.cs index 6148303..703cc1b 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Sales/OrderModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Sales/OrderModel.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +using EgwCoreLib.Lux.Data.DbModel.Production; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using static EgwCoreLib.Lux.Core.Enums; @@ -129,7 +130,7 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales [NotMapped] public double NumProdItems { - get => OrderRowNav?.Sum(x => x.ProdItemQty) ?? 0; + get => OrderRowNav?.Sum(x => x.ProdItemQtyTot) ?? 0; } /// @@ -190,5 +191,6 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales /// Navigazione alle righe ordine /// public virtual ICollection OrderRowNav { get; set; } = new List(); + } } diff --git a/EgwCoreLib.Lux.Data/DbModel/Sales/OrderRowModel.cs b/EgwCoreLib.Lux.Data/DbModel/Sales/OrderRowModel.cs index b9dfb21..14197b4 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Sales/OrderRowModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Sales/OrderRowModel.cs @@ -177,6 +177,14 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales /// public int ProdItemQty { get; set; } = 0; + /// + /// Quantità degli item da produrre per PEZZO (es parti del serramento, singole parti BTL...) + /// + public double ProdItemQtyTot + { + get => Qty * ProdItemQty; + } + /// /// Riferimento JobID Ciclo corrente (tra quelli ammissibili dato ItemJCD) ///