//
// This is here so CodeMaid doesn't reorganize this document
//
namespace EgwCoreLib.Lux.Data.DbModel.Job
{
///
/// Routing dei cicli di lavoro, con riferimento a risorse e fasi
///
[Table("task_job_step")]
public class JobStepModel
{
///
/// ID del record
///
[Key]
public int JobStepID { get; set; }
///
/// Ciclo di appartenenza
///
public int JobID { get; set; }
///
/// Indice della fase all'interno del Job
///
public int Index { get; set; } = 0;
///
/// ID della fase realizzata
///
public int PhaseID { get; set; }
///
/// ID della risorsa impiegata
///
public int ResourceID { get; set; }
///
/// Descrizione della fase del Job
///
public string Description { get; set; } = "";
///
/// Rapporto produttività Risorsa
/// es: se in più fasi sono previste perdite (sovrametalli, scarti) di processo sarà < 100%
///
public decimal ProductivityRate { get; set; } = 1;
///
/// Costo RockBottom Fase (step) di produzione
/// sulla base del costo della risorsa, della produttività e della quantità impiegata
///
/// Quantità risorsa impiegata
///
public decimal RockBottomCost(decimal quantity)
{
decimal stepCost = 0;
var unitRequired = quantity / ProductivityRate;
if (ResourceNav != null)
{
stepCost = ResourceNav.BaseRockBottomCost * quantity;
}
return stepCost;
}
///
/// Prezzo calcolato per Fase (step) di produzione
/// sulla base del costo RockBottom + marginalità standard
///
/// Quantità risorsa impiegata
///
public decimal RockBottomPrice(decimal quantity)
{
decimal stepCost = 0;
var unitRequired = quantity / ProductivityRate;
if (ResourceNav != null)
{
stepCost = ResourceNav.BasePrice * quantity;
}
return stepCost;
}
///
/// Navigazione Job/Cicli
///
[ForeignKey("JobID")]
public virtual JobTaskModel JobNav { get; set; } = null!;
///
/// Navigazione Fasi
///
[ForeignKey("PhaseID")]
public virtual PhaseModel PhaseNav { get; set; } = null!;
///
/// Navigazione Risorse
///
[ForeignKey("ResourceID")]
public virtual ResourceModel ResourceNav { get; set; } = null!;
///
/// Many-to-many with Tags
///
public virtual ICollection TagNav { get; set; } = new List();
///
/// Numero Tags compresi
///
[NotMapped]
public int NumTags
{
get => TagNav?.Count ?? 0;
}
///
/// Elenco Tags come stringa comma delimited
///
[NotMapped]
public List TagList
{
get => TagNav.Select(x => x.CodTag).ToList() ?? new List();
}
}
}