Files
lux/EgwCoreLib.Lux.Data/DbModel/Items/SellingItemModel.cs
T
2026-04-02 15:48:02 +02:00

181 lines
5.1 KiB
C#

namespace EgwCoreLib.Lux.Data.DbModel.Items
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("item_selling_item")]
public class SellingItemModel
{
/// <summary>
/// ID dell'articolo di vendita/finito
/// </summary>
[Key]
public int SellingItemID { get; set; }
/// <summary>
/// Environment del selling item
/// </summary>
public EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS Envir { get; set; } = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW;
/// <summary>
/// Definisce l'articolo come servizio vs concreto=materiale
/// </summary>
public bool IsService { get; set; } = false;
/// <summary>
/// SourceType dell'Item
/// </summary>
public ItemSourceType SourceType { get; set; } = ItemSourceType.ND;
/// <summary>
/// Se 1 = rivendita, >1 è il ciclo di produzione associato
/// </summary>
public int JobID { get; set; } = 1;
/// <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
/// </summary>
public double Margin { get; set; } = 0.1;
/// <summary>
/// Unità di Misura
/// </summary>
public string UM { get; set; } = "#";
/// <summary>
/// Valore serializzato della composizione articolo (in formato JWD x finestra)
/// </summary>
public string SerStruct { get; set; } = "";
/// <summary>
/// Elenco StepDTO (Fasi) per la stima tempi / costi
/// potrebbe contenere anche altre info accessorie x definire dati logistico/gestionali
/// </summary>
public string ItemSteps { get; set; } = "";
/// <summary>
/// Tipo immagine da visualizzare
/// </summary>
public ImageType ImgType { get; set; } = ImageType.ND;
/// <summary>
/// URL Immagine calcolato
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static string CodeUid(int id)
{
return $"SP.{id:X12}";
}
/// <summary>
/// Restituisce Url da impiegare x immagine
/// </summary>
[NotMapped]
public string ImgUID
{
get => ImgType == ImageType.Fixed ? FileName : CodeUid(SellingItemID);
}
/// <summary>
/// Definisce se sia calcolabile, dato il tipo SellingItem
/// </summary>
[NotMapped]
public bool CalcEnabled
{
get => ImgType == ImageType.Calculated;
}
/// <summary>
/// Restituisce Url immagine già calcolato (da sistemare!!!)
/// </summary>
[NotMapped]
public string ImgUrl
{
get
{
string answ = "empty.svg";
string fType = Envir == Constants.EXECENVIRONMENTS.WINDOW ? "svg" : "png";
if (CalcEnabled)
{
string rndImg = $"{DateTime.Now:HHmmssfff}";
answ = $"cache/{ImgUID}-{rndImg}.{fType}?env={Envir}";
}
else
{
answ = $"static/{ImgUID}";
}
return answ;
}
}
#if false
/// <summary>
/// Nomi risorsa file associato alla riga offerta (es per BTL)
/// URI come risorsa dentro folder offerta/riga-offerta/guid
/// </summary>
public string FileResource { get; set; } = "";
/// <summary>
/// Dimensione del file (per visualizzazione rapida)
/// </summary>
public long FileSize { get; set; } = 0;
#endif
/// <summary>
/// Nomi file (fixed) da mostrare e salvare
/// </summary>
public string FileName { get; set; } = "";
/// <summary>
/// Indica protetto = NON consentito edit completo (da definire...)
/// </summary>
/// <returns></returns>
[NotMapped]
public bool IsProtected
{
get => false;
}
[NotMapped]
public bool HasBOM
{
get => SourceType == ItemSourceType.Jwd || SourceType == ItemSourceType.FileBTL;
}
/// <summary>
/// Navigazione Job/Cicli
/// </summary>
[ForeignKey("JobID")]
public virtual JobTaskModel JobNav { get; set; } = null!;
}
}