using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.Attributes;
using WIDESEA_Core.DB.Models;
namespace WIDESEA_Model.Models
{
    /// 
    /// 
    /// 
    [SugarTable(nameof(Dt_PurchaseOrder), "采购单"), ModelValidate]
    public class Dt_PurchaseOrder : BaseEntity
    {
        /// 
        /// 主键
        /// 
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主键")]
        public int Id { get; set; }
        /// 
        /// 采购单号
        /// 
        [PropertyValidate("采购单号", NotNullAndEmpty = true)]
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "采购单号")]
        public string PurchaseOrderNo { get; set; }
        /// 
        /// 单据类型(S:标准入库、V:寄售补给入库)
        /// 
        [PropertyValidate("单据类型", NotNullAndEmpty = true, Check = new[] { "S", "V" })]
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "单据类型")]
        public string PurchaseOrderType { get; set; }
        /// 
        /// 供应商编号
        /// 
        [PropertyValidate("供应商编号", NotNullAndEmpty = true)]
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "供应商编号")]
        public string SupplierCode { get; set; }
        /// 
        /// 采购数量
        /// 
        [PropertyValidate("采购数量", MinValue = 0, IsContainMinValue = false)]
        [SugarColumn(IsNullable = false, ColumnDescription = "采购数量")]
        public float OrderQuantity { get; set; }
        /// 
        /// 采购单状态
        /// 
        [SugarColumn(IsNullable = false, ColumnDescription = "采购单状态")]
        public int PurchaseOrderStatus { get; set; }
        /// 
        /// 下单日期
        /// 
        [PropertyValidate("下单日期", NotNullAndEmpty = true)]
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "下单日期")]
        public string OrderDate { get; set; }
        /// 
        /// 备注
        /// 
        [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "备注")]
        public string Remark { get; set; }
        /// 
        /// 物料列表
        /// 
        [PropertyValidate("物料列表", NotNullAndEmpty = true), Navigate(NavigateType.OneToMany, nameof(Dt_PurchaseOrderDetail.PurchaseOrderId), nameof(Id))]
        public List Details { get; set; }
    }
}