HKC_Blazor/MasaBlazorApp3/Pojo/DrugInfo.cs

70 lines
1.8 KiB
C#
Raw Normal View History

2025-04-18 11:01:56 +08:00
using LinqToDB.Mapping;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace MasaBlazorApp3.Pojo
{
[Table("drug_info")]
public class DrugInfo
{
[PrimaryKey]
[Column("drug_id")]
public string DrugId { get; set; }
[Column("drug_name")]
public string DrugName { get; set;}
[Column("drug_type")]
public string DrugType { get; set;}
[Column("drug_spec")]
public string DrugSpec { get; set;}
[Column("manufactory")]
public string Manufactory { get; set; }
[Column("pack_unit")]
2025-07-05 10:07:33 +08:00
public string PackUnit { get; set; }
[Column("py_code")]
public string PyCode { get; set; }
[Column(IsColumn =false)]
public string DrugNameSpecManufactory
{
get => DrugName + " / " + DrugSpec+ " / " + Manufactory+" / " + PyCode+" / " + DrugId;
}
2025-04-18 11:01:56 +08:00
[Association(ThisKey = nameof(DrugId), OtherKey = nameof(ChannelStock.DrugId))]
public List<ChannelStock> Stocks { get; set;} = new List<ChannelStock>();
[Association(ThisKey = nameof(DrugId), OtherKey = nameof(DrugManuNo.DrugId))]
public List<DrugManuNo> Manus { get; set; } = new List<DrugManuNo>();
[Column(IsColumn = false)]
public int StockQuantity
{
get { return Stocks.Aggregate(0, (current, next) => current + next.Quantity); ; }
}
public override bool Equals(object o)
{
var other = o as DrugInfo;
return other?.DrugId == DrugId;
}
public override string ToString()
{
return $"名称: {DrugName},规格:{DrugSpec}";
}
}
}