using RB_MES_API.Context;
using System.ComponentModel.DataAnnotations;

namespace RB_MES_API.Models.Cloud
{
    public class PUR_PurchaseOrder
    {
        /// <summary>
        /// 实体主键（无需填写，保存时自动添加）
        /// </summary>
        public int FID { get; set; } 
        /// <summary>
        /// 单据类型  (必填项)
        /// </summary>
        [StringLength(36)]
        public Dictionary<string, string> FBillTypeID { get; set; } = new Dictionary<string, string>() {
            { "FNumber","CGDD01_SYS"}
        };
        /// <summary>
        /// 单据编号
        /// </summary>
        [StringLength(36)]
        public string FBillNo { get; set; } = string.Empty;
        /// <summary>
        /// 日期  (必填项)
        /// </summary>
        [DataType(DataType.Date)]
        public string FDate { get; set; } = "1900-01-01";
        /// <summary>
        /// 供应商  (必填项)
        /// </summary>
        public Dictionary<string, string> FSupplierId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
        /// <summary>
        /// 采购组织  (必填项)
        /// </summary>
        public Dictionary<string, string> FPurchaseOrgId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",LocalStaticRequest.DefaultOrg}
        };
        /// <summary>
        /// 采购部门
        /// </summary>
        public Dictionary<string, string> FPurchaseDeptId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",LocalStaticRequest.DefaultOrg}
        };
        public POOrderEntry FPOOrderFinance { get; set; }
        public class POOrderFinance
        {
            public int FEntryId { get; set; }
            /// <summary>
            /// 结算币别   (必填项)
            /// </summary>
            public Dictionary<string, string> FSettleCurrId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
        }
        public POOrderClause FPOOrderClause { get; set; }
        public class POOrderClause
        {
            public int FEntryID { get;set; }
        }
        public List<POOrderEntry> FPOOrderEntry { get; set; }
        public class POOrderEntry
        {
            public int FEntryID { get; set; }
            /// <summary>
            ///  物料编码   (必填项)  
            /// </summary>
            public Dictionary<string, string> FMaterialId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            ///  采购单位   (必填项)  
            /// </summary>
            public Dictionary<string, string> FUnitID { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            ///  计价单位    (必填项) 
            /// </summary>
            public Dictionary<string, string> FPriceUnitID { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            ///  库存单位    (必填项) 
            /// </summary>
            public Dictionary<string, string> FStockUnitID { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            /// 累计入库数量
            /// </summary>
            public decimal FStockInQty { get; set; }
            /// <summary>
            /// 剩余入库数量
            /// </summary>
            public decimal FRemainStockINQty { get; set; }
            public List<EntryDeliveryPlan> FEntryDeliveryPlan { get; set; }
            /// <summary>
            /// 交货明细
            /// </summary>
            public class EntryDeliveryPlan
            {
                public int FDetailId { get; set; }
                /// <summary>
                /// 已交货数量
                /// </summary>
                public decimal FDeliCommitQty { get; set; }
                /// <summary>
                /// 剩余数量
                /// </summary>
                public decimal FDeliRemainQty { get; set; }
                /// <summary>
                /// 已交货数量（基本单位）
                /// </summary>
                public decimal FBaseDeliCommitQty { get;set; }
                /// <summary>
                /// 剩余数量（基本单位）
                /// </summary>
                public decimal FBaseDeliRemainQty { get; set; }
            }
        }
    }
}
