From 44a2af74290d21986a4fb20094652c3ab8907a02 Mon Sep 17 00:00:00 2001 From: AJ Date: Mon, 27 Oct 2025 20:08:10 -0400 Subject: [PATCH] feat(db): add MaterialHeader EF entity and DbSet mapping\n\n- Map to dbo.MaterialHeader with key and relevant columns.\n- Register DbSet in PepDB and configure string columns as non-Unicode. --- PepLib.Core/Data/MaterialHeader.cs | 73 ++++++++++++++++++++++++++++++ PepLib.Core/Data/PepDB.cs | 14 ++++++ 2 files changed, 87 insertions(+) create mode 100644 PepLib.Core/Data/MaterialHeader.cs diff --git a/PepLib.Core/Data/MaterialHeader.cs b/PepLib.Core/Data/MaterialHeader.cs new file mode 100644 index 0000000..5c78bc8 --- /dev/null +++ b/PepLib.Core/Data/MaterialHeader.cs @@ -0,0 +1,73 @@ +namespace PepLib.Data +{ + using System; + using System.ComponentModel.DataAnnotations; + using System.ComponentModel.DataAnnotations.Schema; + + [Table("MaterialHeader")] + public partial class MaterialHeader + { + [Key] + public int ID { get; set; } + + public DateTime? ModifiedDate { get; set; } + + [Required] + [StringLength(254)] + public string ModifiedBy { get; set; } + + [Required] + [StringLength(32)] + public string CompanyID { get; set; } + + [Required] + [StringLength(32)] + public string FacilityID { get; set; } + + [Required] + [StringLength(64)] + public string GroupID { get; set; } + + // Typically numeric-as-string in PEP data; used as material number in other tables + [Required] + [StringLength(254)] + public string Material { get; set; } + + [Required] + [StringLength(254)] + public string MatGrade { get; set; } + + public byte AutoAddText { get; set; } + + public double Cost { get; set; } + + [Required] + [StringLength(254)] + public string Description { get; set; } + + public double Density { get; set; } + + public byte KeepRemnant { get; set; } + + [Required] + [StringLength(16)] + public string KeepRemnantLogic { get; set; } + + public double Kfactor { get; set; } + + public double MinRemnantArea { get; set; } + + public double MinRemnantCost { get; set; } + + public double MinRemnantSize { get; set; } + + public double MinRemnantWeight { get; set; } + + [Required] + [StringLength(254)] + public string OriginalMaterialForStack { get; set; } + + public double Thickness { get; set; } + } +} + diff --git a/PepLib.Core/Data/PepDB.cs b/PepLib.Core/Data/PepDB.cs index 7b054ac..ef50dd7 100644 --- a/PepLib.Core/Data/PepDB.cs +++ b/PepLib.Core/Data/PepDB.cs @@ -18,6 +18,7 @@ public partial class PepDB : DbContext public virtual DbSet NestHeaders { get; set; } public virtual DbSet PlateDetails { get; set; } public virtual DbSet PlateHeaders { get; set; } + public virtual DbSet MaterialHeaders { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { @@ -159,5 +160,18 @@ public partial class PepDB : DbContext entity.Property(e => e.Location).IsUnicode(false); entity.Property(e => e.NestedSize).IsUnicode(false); }); + + modelBuilder.Entity(entity => + { + entity.Property(e => e.ModifiedBy).IsUnicode(false); + entity.Property(e => e.CompanyID).IsUnicode(false); + entity.Property(e => e.FacilityID).IsUnicode(false); + entity.Property(e => e.GroupID).IsUnicode(false); + entity.Property(e => e.Material).IsUnicode(false); + entity.Property(e => e.MatGrade).IsUnicode(false); + entity.Property(e => e.Description).IsUnicode(false); + entity.Property(e => e.KeepRemnantLogic).IsUnicode(false); + entity.Property(e => e.OriginalMaterialForStack).IsUnicode(false); + }); } }