using EgwCoreLib.Lux.Core.Generic;
using EgwCoreLib.Lux.Core.RestPayload;
//
// This is here so CodeMaid doesn't reorganize this document
//
namespace EgwCoreLib.Lux.Data.DbModel.Production
{
///
/// Tabella delle fasi di lavorazione x ogni item da produrre
///
[Table("production_odl")]
public class ProductionODLModel
{
///
/// ID del record
///
[Key]
public int ProdODLID { get; set; }
///
/// Codice calcolato (16 char)
/// - tipo (ODL.)
/// - anno (yyyy)
/// - id annuale (00000000x8)
/// es: "ODL.20250012AF
///
public string OdlTag { get; set; } = "";
///
/// BatchID di appartenenza
///
public int ProdBatchID { get; set; }
///
/// Indice della fase all'interno del Job x produrre item
///
public int Index { get; set; } = 0;
///
/// ID della fase realizzata
///
public int? PhaseID { get; set; }
///
/// ID della risorsa impiegata
///
public int? ResourceID { get; set; }
///
/// Codice Plant
///
public string ProdPlantCod { get; set; } = "";
///
/// Descrizione della fase del Job
///
public string Description { get; set; } = "";
///
/// Margine percentuale standard
///
public double Qty { get; set; } = 1;
///
/// DataOra assegnazione (in planner)
///
public DateTime? DateAssign { get; set; } = null;
///
/// DataOra massima per completamento (in planner)
///
public DateTime? DateMaxCompl { get; set; } = null;
///
/// DataOra inizio effettivo
///
public DateTime? DateStart { get; set; } = null;
///
/// DataOra fine
///
public DateTime? DateEnd { get; set; } = null;
///
/// Tempo di lavorazione Stimato
///
public decimal EstimTime { get; set; } = 0;
///
/// Tempo di lavorazione netto (non solo inizio fine ma al netto di pause/spento)
///
public decimal WorkTime { get; set; } = 0;
///
/// BOM serializzata per la produzione dell'intero ODL
///
public string RawBoM { get; set; } = "";
///
/// Valore serializzato del materiale DISPONIBILE inviato al prod per la produzione dell'intero ODL
///
public string RawItemRawList { get; set; } = "";
///
/// Valore serializzato del materiale NECESSARIO (calcolato) per la produzione dell'intero ODL (es barre e consumo) tornato dal PROD
///
public string RawMaterials { get; set; } = "";
///
/// BOM in versione deserializzata
///
[NotMapped]
public List ListBoM
{
get
{
List bomList = new List();
if (!string.IsNullOrEmpty(RawBoM) && RawBoM.Length > 2)
{
bomList = JsonConvert.DeserializeObject>(RawBoM) ?? new List();
}
return bomList;
}
}
///
/// Dizionario ItemList per calcolo lavorazioni inviato al prod, deserializzato
///
[NotMapped]
public Dictionary> DictItemRaw
{
get
{
Dictionary> itemList = new Dictionary>();
if (!string.IsNullOrEmpty(RawItemRawList) && RawItemRawList.Length > 2)
{
itemList = JsonConvert.DeserializeObject>>(RawItemRawList) ?? new Dictionary>();
}
return itemList;
}
}
///
/// Navigazione sui Batch
///
[ForeignKey("ProdBatchID")]
public virtual ProductionBatchModel ProdBatchNav { get; set; } = null!;
#if false
///
/// Navigazione Job/Cicli
///
[ForeignKey("PhaseID")]
public virtual PhaseModel? PhaseNav { get; set; }
///
/// Navigazione Job/Cicli
///
[ForeignKey("ResourceID")]
public virtual ResourceModel? ResourceNav { get; set; }
#endif
///
/// Navigazione verso tabella Item2Odl
///
public ICollection Item2OdlNav { get; set; } = new List();
}
}