using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static MagMan.Core.Enums;
namespace MagMan.Data.Tenant.DbModels
{
//
// This is here so CodeMaid doesn't reorganize this document
//
///
/// Tabella dei PROJ caricati da EgtBeamWall
///
[Table("ProjList")]
[Index(nameof(MachineID))]
[Index(nameof(KeyNum))]
[Index(nameof(ProjExtDbId))]
[Index(nameof(IsActive))]
[Index(nameof(IsArchived))]
public class ProjModel
{
#region Public Properties
///
/// Chiave univoca su DB
///
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ProjDbId { get; set; }
///
/// Id macchina (MagMan)
///
public int MachineID { get; set; } = 0;
///
/// Key di riferimento per il progetto
///
public int KeyNum { get; set; } = 0;
///
/// ID del DB EgtBW, univoco con KeyNum
///
public int ProjExtDbId { get; set; } = 0;
///
/// ID esterno (da EgtBW)
///
public int ProjExtId { get; set; } = 0;
///
/// Nome file BTL originale
///
public string BTLFileName { get; set; } = "";
///
/// Tipologia del progetto (Travi, Pareti, ...)
///
public BWType PType { get; set; } = BWType.NULL;
///
/// Macchina (Costruttore/Modello)
///
public string Machine { get; set; } = "";
///
/// Descrizione progetto (copiata da BTLFileName inizialmente)
///
public string ProjDescription { get; set; } = "";
///
/// Data Creazione progetto
///
public DateTime DtCreated { get; set; } = DateTime.Now;
///
/// Data di schedulazione (prevista)
///
public DateTime DtSchedule { get; set; } = DateTime.Today.AddMonths(3);
///
/// Data Inizio Produzione
///
public DateTime DtStartProd { get; set; } = DateTime.MinValue;
///
/// Data ora ultima operazione registrata
///
public DateTime DtLastAction { get; set; } = DateTime.MinValue;
///
/// ListName del BTL
///
public string ListName { get; set; } = "";
///
/// Tempo lavorazione previsto (stima) in minuti
///
public double ProcTimeEst { get; set; } = 0;
///
/// Tempo lavorazione reale in minuti (parziale o totale se chiuso/completato/archiviato)
///
public double ProcTimeReal { get; set; } = 0;
///
/// Avanzamento in percentuale (tipicamente barre fatte / da fare)
///
public double ProgPerc
{
get
{
double answ = 0;
if (ValMax > 0)
{
answ = ValAct / ValMax;
}
return answ;
}
}
///
/// Avanzamento (tipicamente barre fatte)
///
public double ValAct { get; set; } = 0;
///
/// Valore finale atteso (tipicamente barre da fare)
///
public double ValMax { get; set; } = 1;
///
/// Record attivo (se false == cancellazione logica)
///
public bool IsActive { get; set; } = true;
///
/// Stato Archiviato = NON visualizzabile normalmente, già prodotto/chiuso
///
public bool IsArchived { get; set; } = false;
#endregion Public Properties
}
}