70 lines
1.8 KiB
C#
70 lines
1.8 KiB
C#
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")]
|
|
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;
|
|
}
|
|
|
|
|
|
[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}";
|
|
}
|
|
|
|
|
|
}
|
|
}
|