Files
magman/MagMan.Data.Tenant/DbModels/RawItemModel.cs
T
2024-01-18 17:14:45 +01:00

116 lines
2.9 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagMan.Data.Tenant.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
//[Index(nameof(Installazione), nameof(Active), nameof(DiskStatus))]
[Table("RawItemList")]
public partial class RawItemModel
{
/// <summary>
/// Primary Key AUTO
/// </summary>
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int RawItemId { get; set; }
/// <summary>
/// Ext ref for Material
/// </summary>
public int MatId { get; set; } = 0;
/// <summary>
/// Qty available on wharehouse
/// </summary>
public int QtyAvail { get; set; } = 0;
/// <summary>
/// Check if is a Remnant
/// </summary>
public bool IsActive { get; set; } = false;
/// <summary>
/// Check if is a Remnant
/// </summary>
public bool IsRemn { get; set; } = false;
/// <summary>
/// Location
/// </summary>
public string Location { get; set; } = "";
/// <summary>
/// Item's Lenght
/// </summary>
public decimal LMm { get; set; } = 0;
/// <summary>
/// Item's Width
/// </summary>
public decimal WMm { get; set; } = 0;
/// <summary>
/// Item's Height (Thikness/Spessore) in mm
/// </summary>
public decimal HMm { get; set; } = 0;
/// <summary>
/// Note (optional)
/// </summary>
public string Note { get; set; } = "";
#if false
[NotMapped]
public decimal LIn
{
get => Math.Round(LMm / (decimal)25.4, 3);
}
[NotMapped]
public decimal WIn
{
get => Math.Round(WMm / (decimal)25.4, 3);
}
[NotMapped]
public decimal HIn
{
get => Math.Round(HMm / (decimal)25.4, 3);
}
[NotMapped]
public decimal Area
{
get => LMm * WMm;
}
#endif
[NotMapped]
public string ItemDtmx
{
get
{
string answ = $"MT99999999W{WMm * 10:000000}H{HMm * 10:000000}L{LMm * 10:000000}";
if (MaterialNav != null)
{
answ = $"MT{MaterialNav.MatId:00000000}W{WMm * 10:000000}H{HMm * 10:000000}L{LMm * 10:000000}";
}
return answ;
}
}
/// <summary>
/// Navigation property to Material
/// </summary>
[ForeignKey("MatId")]
public virtual MaterialModel MaterialNav { get; set; } = null!;
}
}