using System.ComponentModel.DataAnnotations;
namespace RB_MES_API.Models.Cloud
{

    /// <summary>
    /// 委外退料单
    /// </summary>
    public class SUB_RETURNMTRL
    {
        /// <summary>
        /// 实体主键（无需填写，保存时自动添加）
        /// </summary>
        public int FID { get; set; } 
        /// <summary>
        /// 单据类型   (必填项)
        /// </summary>
        public Dictionary<string, string> FBillType { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
        /// <summary>
        /// 日期  (必填项)
        /// </summary>
        [DataType(DataType.DateTime)]
        public string FDate { get; set; } = DateTime.Now.ToShortDateString();
        /// <summary>
        /// 收料组织   (必填项)
        /// </summary>
        public Dictionary<string, string> FStockOrgId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
        /// <summary>
        /// 仓库
        /// </summary>
        public Dictionary<string, string> FStockId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
        /// <summary>
        /// 委外组织   (必填项)
        /// </summary>
        public Dictionary<string, string> FSubOrgId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
        /// <summary>
        /// 供应商   (必填项)
        /// </summary>
        public Dictionary<string, string> FSubSupplierId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
        /// <summary>
        /// 货主类型   
        /// </summary>
        [StringLength(36)]
        public string FOwnerTypeId0 { get; set; } = "BD_OwnerOrg";
        /// <summary>
        /// 退料人   
        /// </summary>
        public Dictionary<string, string> FReturnerId { get; set; } = new Dictionary<string, string>() {
            { "",""}
        };
        /// <summary>
        /// 仓管员
        /// </summary>
        public Dictionary<string, string> FSTOCKERID { get; set; } = new Dictionary<string, string>() {
            { "FNAME",""}
        };
        /// <summary>
        /// 备注   
        /// </summary>
        [StringLength(36)]
        public string FDescription { get; set; } 
        /// <summary>
        /// 货主
        /// </summary>
        public Dictionary<string, string> FOwnerId0 { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
        /// <summary>
        /// 本位币
        /// </summary>
        public Dictionary<string, string> FCurrId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
        /// <summary>
        /// 跨法人交易
        /// </summary>
        public bool FIsCrossTrade { get; set; } = false;
        /// <summary>
        /// VMI业务
        /// </summary>
        public bool FVmiBusiness { get; set; } = false;
        /// <summary>
        /// 序列号上传   
        /// </summary>
        [StringLength(36)]
        public string FScanBox { get; set; } 
        /// <summary>
        /// 倒冲来源   
        /// </summary>
        [StringLength(36)]
        public string FSourceType { get; set; } 
        /// <summary>
        /// 货主含组织
        /// </summary>
        public bool FIsOwnerTInclOrg { get; set; } = false;
        /// <summary>
        /// MES唯一标识
        /// </summary>
        [StringLength(36)]
        public string F_SBMI_QUEUE_ID { get; set; }



        public List<Entity> FEntity { get; set; } = new List<Entity>();
        /// <summary>
        /// 明细  
        /// </summary>
        public class Entity
        {
            /// <summary>
            /// 实体主键（无需填写，保存时自动添加）
            /// </summary>
            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 decimal FAPPQty { get; set; } 
            /// <summary>
            /// 实退数量
            /// </summary>
            public decimal FQty { get; set; } 
            /// <summary>
            /// 退料类型    (必填项)   
            /// </summary>
            [StringLength(36)]
            public string FReturnType { get; set; }
            /// <summary>
            /// 退料原因
            /// </summary>
            public Dictionary<string, string> FReturnReason  { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 业务源单行号
            /// </summary>
            public int FSRCBIZENTRYSEQ { get; set; } 
            /// <summary>
            /// 仓库    (必填项)
            /// </summary>
            public Dictionary<string, string> FStockId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 业务源单类型
            /// </summary>
            public Dictionary<string, string> FSRCBIZBILLTYPE { get; set; } = new Dictionary<string, string>() {
            { "FID",""}
        };
            public StockLocId FStockLocId { get; set; }
            /// <summary>
            /// 仓位  
            /// </summary>
            public class StockLocId
            {
                public Dictionary<string, string> FSTOCKLOCID__FF100001 { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}

        };
                public Dictionary<string, string> FSTOCKLOCID__FF100002 { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}

        };
            }
            /// <summary>
            /// 业务源单编号 
            /// </summary>
            [StringLength(36)]
            public string FSRCBIZBILLNO { get; set; } 
            /// <summary>
            /// 批号
            /// </summary>
            public Dictionary<string, string> FLot { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 委外订单   (必填项) 
            /// </summary>
            [StringLength(36)]
            public string FSUBReqBillNo { get; set; } 
            /// <summary>
            /// 系统源单行号
            /// </summary>
            public int FSrcEntrySeq { get; set; } 
            /// <summary>
            /// 产品编码
            /// </summary>
            public Dictionary<string, string> FParentMaterialId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 委外订单ID
            /// </summary>
            public int FSUBReqId { get; set; } 
            /// <summary>
            /// 委外订单行号
            /// </summary>
            public int FSUBReqEntrySeq { get; set; } 
            /// <summary>
            /// 委外用料清单分录ID
            /// </summary>
            public int FPPBOMEntryId { get; set; } 
            /// <summary>
            /// 委外订单分录ID
            /// </summary>
            public int FSubReqEntryId { get; set; } 
            /// <summary>
            /// 货主类型   (必填项) 
            /// </summary>
            [StringLength(36)]
            public string FOwnerTypeId { get; set; } = "BD_OwnerOrg";
            /// <summary>
            /// 货主      (必填项) 
            /// </summary>
            public Dictionary<string, string> FOwnerId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 系统源单编号   
            /// </summary>
            [StringLength(36)]
            public string FSrcBillNo { get; set; }
            /// <summary>
            /// 系统源单类型   
            /// </summary>
            [StringLength(36)]
            public string FSrcBillType { get; set; } = "SUB_PPBOM";
            /// <summary>
            /// 业务源单内码
            /// </summary>
            public int FSRCBIZINTERID { get; set; }
            /// <summary>
            /// 系统源单内码
            /// </summary>
            public int FSrcBillId { get; set; } 
            /// <summary>
            /// 消耗汇总   
            /// </summary>
            [StringLength(36)]
            public string FConsome { get; set; } 
            /// <summary>
            /// 系统源单分录内码
            /// </summary>
            public int FSrcEntryId { get; set; } 
            /// <summary>
            /// 基本单位
            /// </summary>
            public Dictionary<string, string> FBaseUnitId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 预留类型   
            /// </summary>
            [StringLength(36)]
            public string FReserveType { get; set; } 
            /// <summary>
            /// 结算组织
            /// </summary>
            public Dictionary<string, string> FSettleOrgId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 业务源单分录内码
            /// </summary>
            public int FSRCBIZENTRYID { get; set; } 
            /// <summary>
            /// 基本单位补料选单数
            /// </summary>
            public decimal FBaseSelRePickedQty { get; set; } 
            /// <summary>
            /// 主库存基本单位实退数量
            /// </summary>
            public decimal FBaseStockQty { get; set; } 
            /// <summary>
            /// 基本单位申请数量
            /// </summary>
            public decimal FBaseAppQty { get; set; }
            /// <summary>
            /// 基本单位实退数量
            /// </summary>
            public decimal FBaseQty { get; set; } 
            /// <summary>
            /// 成本价
            /// </summary>
            public decimal FPrice { get; set; } 
            /// <summary>
            /// 总成本
            /// </summary>
            public decimal FAmount { get; set; } 
            /// <summary>
            /// 主库存单位     (必填项)
            /// </summary>
            public Dictionary<string, string> FStockUnitId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 主库存申请数量
            /// </summary>
            public decimal FStockAppQty { get; set; }
            /// <summary>
            /// 主库存实退数量
            /// </summary>
            public decimal FStockQty { get; set; }
            /// <summary>
            /// 辅库存单位     
            /// </summary>
            public Dictionary<string, string> FSecUnitId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 辅库存实退数量
            /// </summary>
            public decimal FSecStockQty { get; set; } 
            /// <summary>
            /// 计划跟踪号   
            /// </summary>
            [StringLength(36)]
            public string FMtoNo { get; set; } 
            /// <summary>
            /// 项目编号   
            /// </summary>
            [StringLength(36)]
            public string FProjectNo { get; set; } 
            /// <summary>
            /// 库存状态    (必填项)     
            /// </summary>
            public Dictionary<string, string> FStockStatusId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 生产日期
            /// </summary>
            [DataType(DataType.Date)]
            public string FProduceDate { get; set; }=String.Empty;
            /// <summary>
            ///有效期至
            /// </summary>
            [DataType(DataType.Date)]
            public string FExpiryDate { get; set; } = String.Empty;
            /// <summary>
            /// 保管者类型    (必填项)        
            /// </summary>
            [StringLength(36)]
            public string FKeeperTypeId { get; set; } = "BD_KeeperOrg";
            /// <summary>
            /// 保管者    (必填项)     
            /// </summary>
            public Dictionary<string, string> FKeeperId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 作业        
            /// </summary>
            public Dictionary<string, string> FProcessId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 工序号
            /// </summary>
            public int FOperId { get; set; } 
            /// <summary>
            ///  备注   
            /// </summary>
            [StringLength(36)]
            public string FMemo { get; set; } 
            /// <summary>
            /// VMI业务
            /// </summary>
            public bool FEntryVmiBusiness { get; set; } = false;
            /// <summary>
            ///  采购订单   
            /// </summary>
            [StringLength(36)]
            public string FPOOrderBillNo { get; set; } 
            /// <summary>
            /// 采购订单行号
            /// </summary>
            public int FPOOrderSeq { get; set; } 
            /// <summary>
            /// 供应商        
            /// </summary>
            public Dictionary<string, string> FSupplierId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""} };
            /// <summary>
            /// BOM版本        
            /// </summary>
            public Dictionary<string, string> FBomId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            ///  辅助属性
            /// </summary>
            public AuxpropId FAuxPropId { get; set; }
            public class AuxpropId
            {
                public Dictionary<string, string> FAUXPROPID__FF100001 { get; set; } = new Dictionary<string, string>() {
                { "FNumber",""} };
            }
            /// <summary>
            /// 不更新未领
            /// </summary>
            public bool FIsUpdateQty { get; set; } = false;
            /// <summary>
            /// 补料选单数
            /// </summary>
            public decimal FSelRePickedQty { get; set; } 
            /// <summary>
            ///  产品货主类型    (必填项)   
            /// </summary>
            [StringLength(36)]
            public string FParentOwnerTypeId { get; set; } 
            /// <summary>
            /// 产品货主      (必填项)      
            /// </summary>
            public Dictionary<string, string> FParentOwnerId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            ///  委外用料清单编号  
            /// </summary>
            [StringLength(36)]
            public string FPPBomBillNo { get; set; } 
            /// <summary>
            /// 关联关系表
            /// </summary>
            public List<Entity_Link> FEntity_Link { get; set; } = new List<Entity_Link>();
            public class Entity_Link
            {
                /// <summary>
                /// 实体主键，新建时为空，由系统自动填充
                /// </summary>
                public string FLinkId { get; set; }
                public string FEntity_Link_FFlowId { get; set; } = "0b064121-4926-4808-8632-a195b6a202e8";
                public string FEntity_Link_FFlowLineId { get; set; } 
                public string FEntity_Link_FRuleId { get; set; } = "SUB_PPBOM2RETURNMTRL";
                public int FEntity_Link_FSTableId { get; set; } = 0;
                public string FEntity_Link_FSTableName { get; set; } = "T_SUB_PPBOMENTRY";
                /// <summary>
                /// 系统源单内码
                /// </summary>
                public int FEntity_Link_FSBillId { get; set; }  //要二次查询，或者由MES提供。一般二次查询...
                /// <summary>
                /// 系统源单分录内码
                /// </summary>
                public int FEntity_Link_FSId { get; set; }  //要二次查询，或者由MES提供。一般二次查询...
                public decimal FEntity_Link_FBaseActualQtyOld { get; set; }     //应发数量
                public decimal FEntity_Link_FBaseActualQty { get; set; }    //实发数量

            }
        }


        /// <summary>
        ///  序列号子单据体  
        /// </summary>
        public class FSerialSubEntity
        {
            /// <summary>
            /// 实体主键（无需填写，保存时自动添加）
            /// </summary>
            public int FDetailID { get; set; } 
            /// <summary>
            /// 序列号
            /// </summary>
            [StringLength(36)]
            public string FSerialNo { get; set; } 
            /// <summary>
            /// 序列号        
            /// </summary>
            public Dictionary<string, string> FSerialId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 备注
            /// </summary>
            [StringLength(36)]
            public string FSerialNote { get; set; } 
        }
    }
}
