Files
lux/EgwCoreLib.Lux.Data/DbModel/Items/ItemModel.cs
T
2025-09-19 18:54:17 +02:00

130 lines
3.4 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static EgwCoreLib.Lux.Core.Enums;
namespace EgwCoreLib.Lux.Data.DbModel.Items
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("item_item")]
public class ItemModel
{
/// <summary>
/// ID dell'articolo
/// </summary>
[Key]
public int ItemID { get; set; }
/// <summary>
/// Cod gruppo articolo (per selezione omogenea alternative)
/// </summary>
public string CodGroup { get; set; } = "";
/// <summary>
/// Tipologia articolo
/// </summary>
public ItemClassType ItemType { get; set; } = ItemClassType.ND;
/// <summary>
/// Definisce l'articolo come servizio vs concreto=materiale
/// </summary>
public bool IsService { get; set; } = false;
/// <summary>
/// CodArticolo (opzionale) numerico
/// </summary>
public int ItemCode { get; set; } = 0;
/// <summary>
/// CodArticolo (opzionale) string
/// </summary>
public string ExtItemCode { get; set; } = "";
/// <summary>
/// Cod Fornitore (opzionale)
/// </summary>
public string SupplCode { get; set; } = "";
/// <summary>
/// Descrizione
/// </summary>
public string Description { get; set; } = "";
/// <summary>
/// Costo (standard / senza listini)
/// </summary>
public double Cost { get; set; } = 0;
/// <summary>
/// Margine percentuale standard (che comprende info su resa)
/// </summary>
public double Margin { get; set; } = 0.2;
/// <summary>
/// Valore minimo per assegnazione in calcolo BOM
/// </summary>
public double QtyMin { get; set; } = 0;
/// <summary>
/// Valore massimo per assegnazione in calcolo BOM
/// </summary>
public double QtyMax { get; set; } = 0;
/// <summary>
/// Unità di Misura
/// </summary>
public string UM { get; set; } = "#";
/// <summary>
/// Indica se il range quantity sia ok
/// </summary>
[NotMapped]
public bool IsOkQty
{
get => QtyMax > 0 && QtyMax - QtyMin > 0;
}
/// <summary>
/// Indica se il range quantity sia ok
/// </summary>
[NotMapped]
public bool IsOkCost
{
get => Cost > 0;
}
#if false
/// <summary>
/// Opzionale, valore JWD di default come template di partenza in formato JWD
/// </summary>
public string TemplateJWD { get; set; } = "";
#endif
/// <summary>
/// ID dell'oggeto Parent da cui deriva (se zero è "originale")
/// </summary>
public int ItemIDParent { get; set; } = 0;
/// <summary>
/// Indica protetto = NON consentito edit completo (per oggetti BOM)
/// </summary>
/// <returns></returns>
[NotMapped]
public bool IsProtected
{
get => ItemType == ItemClassType.Bom;
}
/// <summary>
/// Navigation per ItemGroup
/// </summary>
[ForeignKey("CodGroup")]
public virtual ItemGroupModel ItemGroupNav { get; set; } = null!;
}
}