Files
lux/EgwCoreLib.Lux.Data/DbModel/Production/ProductionAssignModel.cs
T
2025-12-19 16:28:41 +01:00

98 lines
2.8 KiB
C#

using EgwCoreLib.Lux.Data.DbModel.Sales;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace EgwCoreLib.Lux.Data.DbModel.Production
{
/// <summary>
/// Classe che definisce un assegnazione di produzione connettendo info relative a
/// - riga ordine
/// - macchine
/// - tags (item) assegnati)
/// </summary>
[Table("production_assign")]
public class ProductionAssignModel
{
[Key]
public int ProdAssignID { get; set; }
/// <summary>
/// Ordine cui fa riferimento
/// </summary>
public int OrderRowID { get; set; } = 0;
/// <summary>
/// Codice UID della riga ordine riferita
/// </summary>
public string OrderRowUID { get; set; } = "POR.00.00000000";
/// <summary>
/// Codice plant di assegnazione
/// </summary>
public string ProdPlantCod { get; set; } = "";
/// <summary>
/// Elenco assegnazioni con gestione serializzazione/deserializzazione inclusa
/// </summary>
public List<string> TagsList { get; set; } = new();
/// <summary>
/// Num parts complessivamente incluse
/// </summary>
public int NumParts { get; set; } = 0;
/// <summary>
/// Tempo stimato complessivo
/// </summary>
public int EstimTime { get; set; } = 0;
/// <summary>
/// Navigazione OrderRow
/// </summary>
[ForeignKey("OrderRowID")]
public virtual OrderRowModel OrderRowNav { get; set; } = null!;
#if false
/// <summary>
/// Assegnazione dei Tags di produzione come List<string> da gestire serializzando/deserializzando
/// </summary>
public string RawAssign { get; set; } = "";
/// <summary>
/// Elenco assegnazioni con gestione serializzazione/deserializzazione inclusa
/// </summary>
[NotMapped]
public List<string> TagsList
{
get
{
List<string> result = new List<string>();
if (!string.IsNullOrEmpty(RawAssign) && RawAssign.Length > 2)
{
try
{
result = JsonConvert.DeserializeObject<List<string>>(RawAssign) ?? new List<string>();
}
catch
{ }
}
return result;
}
set
{
RawAssign = JsonConvert.SerializeObject(value);
}
}
#endif
}
}