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;
//
// This is here so CodeMaid doesn't reorganize this document
//
namespace EgwCoreLib.Lux.Data.DbModel.Production
{
///
/// Classe che definisce un assegnazione di produzione connettendo info relative a
/// - riga ordine
/// - macchine
/// - tags (item) assegnati
///
[Table("production_assign")]
[Obsolete("Classe da rimuovere in favore di ProductionGroup")]
public class ProductionAssignModel
{
[Key]
public int ProdAssignID { get; set; }
///
/// Ordine cui fa riferimento
///
public int OrderRowID { get; set; } = 0;
///
/// Codice plant di assegnazione
///
public string ProdPlantCod { get; set; } = "";
///
/// Num parts complessivamente incluse
///
[NotMapped]
public int NumParts => ItemsNav?.Count ?? 0;
///
/// Tempo stimato complessivo
///
[NotMapped]
public double TotalEstimTime => ItemsNav?.Sum(i => i.Time) ?? 0;
///
/// Navigazione OrderRow
///
[ForeignKey("OrderRowID")]
public virtual OrderRowModel OrderRowNav { get; set; } = null!;
///
/// Navigazione sugli items collegati
///
public virtual ICollection ItemsNav { get; set; } = new HashSet();
}
}