Aggiunta datamodel x Materiali e grezzi (barre, pareti)

This commit is contained in:
Samuele Locatelli
2024-01-18 12:45:35 +01:00
parent fc1ce2ce53
commit 07b7ad6ee3
4 changed files with 199 additions and 2 deletions
@@ -0,0 +1,93 @@
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 EgtBEAMWALL.DataLayer.DatabaseModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("Materials")]
public partial class MaterialModel
{
/// <summary>
/// Primary Key AUTO
/// </summary>
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int MatId { get; set; }
/// <summary>
/// Codice materiale (Identificativo esterno del magazzino in sync)
/// </summary>
public int MatExtId { get; set; } = 0;
/// <summary>
/// Codice Materiale
/// </summary>
public string MatCode { get; set; } = "";
/// <summary>
/// Descrizione Materiale
/// </summary>
public string MatDesc { get; set; } = "";
/// <summary>
/// Lenght/Lunghezza in mm
/// </summary>
public decimal LMm { get; set; } = 0;
/// <summary>
/// Width/Larghezza in mm
/// </summary>
public decimal WMm { get; set; } = 0;
/// <summary>
/// Height (Thikness/Spessore) in mm
/// </summary>
public decimal HMm { get; set; } = 0;
/// <summary>
/// ItemId dell'ultimo artico,o usato per il materiale
/// </summary>
public int ItemIdLast { get; set; } = 0;
#if false
/// <summary>
/// Lenght/Lunghezza in inch
/// </summary>
[NotMapped]
public decimal LIn
{
get => Math.Round(LMm / (decimal)25.4, 3);
}
/// <summary>
/// Width/Larghezza in inch
/// </summary>
[NotMapped]
public decimal WIn
{
get => Math.Round(WMm / (decimal)25.4, 3);
}
/// <summary>
/// Height/Altezza (Thikness/Spessore) in inch
/// </summary>
[NotMapped]
public decimal HIn
{
get => Math.Round(HMm / (decimal)25.4, 3);
}
/// <summary>
/// Codice materiale x QR/Datamatrix
/// </summary>
[NotMapped]
public string MatDtmx
{
get => $"MT{MatExtId:00000000}";
}
#endif
public virtual ICollection<RawItemModel> ItemList { get; set; }
}
}
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static EgtBEAMWALL.Core.ConstBeam;
@@ -0,0 +1,104 @@
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 EgtBEAMWALL.DataLayer.DatabaseModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
//[Index(nameof(Installazione), nameof(Active), nameof(DiskStatus))]
[Table("RawItemModel")]
public partial class RawItemModel
{
/// <summary>
/// Primary Key AUTO
/// </summary>
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ItemId { get; set; }
/// <summary>
/// ForeignKey Materiale
/// </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>
/// 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;
}
[NotMapped]
public string ItemDtmx
{
get
{
string answ = $"MT99999999-{LMm * 1000:00000000}";
if (MaterialNav != null)
{
answ = $"MT{MaterialNav.MatExtId:00000000}-{LMm * 1000:00000000}";
}
return answ;
}
}
#endif
/// <summary>
/// Navigation property to Material
/// </summary>
[ForeignKey("MatId")]
public virtual MaterialModel MaterialNav { get; set; }
}
}
@@ -126,6 +126,8 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AdminContext.cs" />
<Compile Include="DatabaseModels\MaterialModel.cs" />
<Compile Include="DatabaseModels\RawItemModel.cs" />
<Compile Include="DatabaseModels\UserPrivModel.cs" />
<Compile Include="DbConfig.cs" />
<Compile Include="Controllers\LogMachineController.cs" />