using LinqToDB.Mapping;
using MasaBlazorApp3.Pojo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;

namespace MasaBlazorApp3.Pojo
{
    [Table("account_book")]
    public class AccountBook
    {
        /// <summary>
        /// 主键 
        ///</summary>
        [Column("id", IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }
        /// <summary>
        /// 设备id 
        ///</summary>
        [Column("machine_id")]
        public string MachineId { get; set; }
        /// <summary>
        /// 药品id 
        ///</summary>
        [Column("drug_id")]
        public string DrugId { get; set; }


        [Association(ThisKey = nameof(DrugId), OtherKey = nameof(DrugInfo.DrugId))]
        public DrugInfo Drug { get; set; }
        /// <summary>
        /// 数量 
        ///</summary>
        [Column("add_quantity")]
        public int AddQuantity { get; set; }
        [Column("out_quantity")]
        public int OutQuantity { get; set; }

        /// <summary>
        /// 批号 
        ///</summary>
        [Column("manu_no")]
        public string ManuNo { get; set; }
        /// <summary>
        /// 操作人id 
        ///</summary>
        [Column("operator")]
        public int? Operator { get; set; }


        [Association(ThisKey = nameof(Operator), OtherKey = nameof(User.Id))]
        public User OperatorUser { get; set; }
        /// <summary>
        /// 审核人id 
        ///</summary>
        [Column("reviewer")]
        public int? Reviewer { get; set; }


        [Association(ThisKey = nameof(Reviewer), OtherKey = nameof(User.Id))]
        public User ReviewerUser { get; set; }
        /// <summary>
        /// 操作时间 
        /// 默认值: CURRENT_TIMESTAMP
        ///</summary>
        [Column("create_time")]
        public DateTime OperationTime { get; set; }
        /// <summary>
        /// 效期 
        ///</summary>
        [Column("eff_date")]
        public DateTime? EffDate { get; set; }
        /// <summary>
        /// 出库入库类型(1领入2发出3盘点4日结5日总结6转结) 
        ///</summary>
        [Column("type")]
        public int Type { get; set; }
        /// <summary>
        /// 出入库调拨单id 
        ///</summary>
        [Column("invoice_id")]
        public string InvoiceId { get; set; }
        /// <summary>
        /// 列号 
        ///</summary>
        [Column("yesterday_quantity")]
        public int YesterdayQuantity { get; set; }
        /// <summary>
        /// 抽屉号 
        ///</summary>
        [Column("manu_stock")]
        public int ManuStock { get; set; }
        [Column("total_stock")]
        public int TotalStock { get; set; }
        
        /// <summary>
        /// 取药科室 
        ///</summary>
        [Column("department")]
        public string department { get; set; }
        /// <summary>
        /// 退药量 
        /// 默认值: 0
        ///</summary>
        [Column("create_date")]
        public string CreateDate { get; set; }


    }
}
