using RB_MES_API.Context;
using System.ComponentModel.DataAnnotations;
namespace RB_MES_API.Models.Cloud
{
    public class SUB_FeedMtrl
    {
        /// <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",LocalStaticRequest.DefaultOrg}
        };
        /// <summary>
        /// 仓库
        /// </summary>
        public Dictionary<string, string> FStockId0 { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
        /// <summary>
        /// 委外组织  (必填项)
        /// </summary>
        public Dictionary<string, string> FSubOrgId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",LocalStaticRequest.DefaultOrg}
        };
        /// <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> FOwnerId0 { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",LocalStaticRequest.DefaultOrg}
        };
        /// <summary>
        /// 领料人
        /// </summary>
        public Dictionary<string, string> FPickerId { 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> 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>
        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 int FEntrySrcEntrySeq { get; set; }
            /// <summary>
            /// 业务源单编号
            /// </summary>
            [StringLength(36)]
            public string FSrcBizBillNo { get; set; }
            /// <summary>
            /// 业务源单类型
            /// </summary>
            public Dictionary<string, string> FSrcBizBillType { get; set; } = new Dictionary<string, string>() {
            { "FNAME",""}
        };
            /// <summary>
            ///  业务源单分录内码        
            /// </summary>
            public int FSrcBizEntryId { get; set; }
            /// <summary>
            ///  业务源单内码        
            /// </summary>
            public int FSrcBizInterId { get; set; }
            /// <summary>
            ///  业务源单行号        
            /// </summary>
            public int FSrcBizEntrySeq { get; set; }
            /// <summary>
            /// 产品编码
            /// </summary>
            public Dictionary<string, string> FParentMaterialId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            /// 消耗汇总   
            /// </summary>
            [StringLength(36)]
            public string FConsome { get; set; }
            /// <summary>
            /// 预留类型   
            /// </summary>
            [StringLength(36)]
            public string FReserveType { get; set; } = "1";
            /// <summary>
            /// 结算组织     
            /// </summary>
            public Dictionary<string, string> FSettleOrgId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""} };
            /// <summary>
            /// 主库存基本单位数量
            /// </summary>
            public decimal FBaseStockActualQty { 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 FActualQty { 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>
            /// 报废数量        
            /// </summary>
            public int FScrapQty { get; set; }
            /// <summary>
            /// 工序序列   
            /// </summary>
            [StringLength(36)]
            public string FOptQueue { get; set; }
            /// <summary>
            /// 工序计划单编号   
            /// </summary>
            [StringLength(36)]
            public string FOptPlanBillNo { get; set; }
            /// <summary>
            /// 工序计划单内码        
            /// </summary>
            public int FOptPlanBillId { get; set; }
            /// <summary>
            /// 仓库
            /// </summary>
            public Dictionary<string, string> FStockId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            /// 工作中心
            /// </summary>
            public Dictionary<string, string> FWorkCenterId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 仓位
            /// </summary>
            public class FStockLocId
            {
                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>
            public int FOptDetailId { get; set; }
            /// <summary>
            /// 批号
            /// </summary>
            public Dictionary<string, string> FLot { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 作业
            /// </summary>
            public Dictionary<string, string> FProcessId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// BOM版本
            /// </summary>
            public Dictionary<string, string> FBomId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 转出退料单标识    
            /// </summary>
            [StringLength(36)]
            public string FTransRetFormId { get; set; }
            /// <summary>
            /// 转出退料单号    
            /// </summary>
            [StringLength(36)]
            public string FTransRetBillNo { get; set; }
            /// <summary>
            /// 转出退料单内码        
            /// </summary>
            public int FTransRetId { get; set; }
            /// <summary>
            /// 转出退料单分录内码        
            /// </summary>
            public int FTransRetEntryId { get; set; }
            /// <summary>
            ///  转出退料单行号        
            /// </summary>
            public int FTransRetEntrySeq { get; set; }
            /// <summary>
            /// 补料原因
            /// </summary>
            public Dictionary<string, string> FFeedReasonId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 备注    
            /// </summary>
            [StringLength(36)]
            public string FEntrtyDescription { get; set; }
            /// <summary>
            /// 库存状态
            /// </summary>
            public Dictionary<string, string> FStockStatusId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER","KCZT01_SYS"}
        };
            /// <summary>
            /// 生产日期 
            /// </summary>
            [DataType(DataType.Date)]
            public string FProduceDate { get; set; }
            /// <summary>
            /// 计划跟踪号    
            /// </summary>
            [StringLength(36)]
            public string FMtoNo { get; set; }
            /// <summary>
            /// 项目编号    
            /// </summary>
            [StringLength(36)]
            public string FProjectNo { get; set; }
            /// <summary>
            /// 委外订单编号   (必填项)    
            /// </summary>
            [StringLength(36)]
            public string FSUBReqBillNo { get; set; }
            /// <summary>
            ///  委外订单分录内码        
            /// </summary>
            public int FSubReqEntryId { get; set; }
            /// <summary>
            ///  委外用料清单分录内码        
            /// </summary>
            public int FPPBomEntryId { get; set; }
            /// <summary>
            ///  工序号        
            /// </summary>
            public int FOperId { get; set; }
            /// <summary>
            /// 货主类型   (必填项)    
            /// </summary>
            [StringLength(36)]
            public string FOwnerTypeId { get; set; } = "BD_OwnerOrg";
            /// <summary>
            ///  主库存单位申请数量        
            /// </summary>
            public decimal FStockAppQty { get; set; }
            /// <summary>
            ///  主库存单位数量        
            /// </summary>
            public decimal FStockActualQty { get; set; }
            /// <summary>
            ///  辅库存单位数量        
            /// </summary>
            public decimal FSecActualQty { get; set; }
            /// <summary>
            ///  委外订单内码        
            /// </summary>
            public int FSUBReqId { get; set; }
            /// <summary>
            ///  委外订单行号        
            /// </summary>
            public int FSUBReqEntrySeq { get; set; }
            /// <summary>
            ///  基本单位申请数量        
            /// </summary>
            public decimal FBaseAppQty { get; set; }
            /// <summary>
            ///  主库存单位报废数量        
            /// </summary>
            public int FStockScrapQty { get; set; }
            /// <summary>
            ///  辅库存单位报废数量        
            /// </summary>
            public int FSecScrapQty { get; set; }
            /// <summary>
            ///  基本单位报废数量        
            /// </summary>
            public int FBaseScrapQty { get; set; }
            /// <summary>
            /// 委外用料清单编号 
            /// </summary>
            [StringLength(36)]
            public string FPPBomBillNo { get; set; }
            /// <summary>
            /// 基本单位   (必填项)
            /// </summary>
            public Dictionary<string, string> FBaseUnitId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 主库存单位   (必填项)
            /// </summary>
            public Dictionary<string, string> FStockUnitId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 辅库存单位
            /// </summary>
            public Dictionary<string, string> FSecUnitId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 车间
            /// </summary>
            public Dictionary<string, string> FEntryWorkShopId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            ///  基本单位实发数量        
            /// </summary>
            public decimal FBaseActualQty { get; set; }
            /// <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",LocalStaticRequest.DefaultOrg}
        };
            /// <summary>
            /// 货主   (必填项)
            /// </summary>
            public Dictionary<string, string> FOwnerId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",LocalStaticRequest.DefaultOrg}
        };
            /// <summary>
            /// 有效期至
            /// </summary>
            [DataType(DataType.Date)]
            public string FExpiryDate { get; set; }
            /// <summary>
            /// 系统源单类型   
            /// </summary>
            [StringLength(36)]
            public string FSrcBillType { get; set; } = "SUB_PPBOM";
            /// <summary>
            /// 系统源单编号   
            /// </summary>
            [StringLength(36)]
            public string FSrcBillNo { get; set; }
            /// <summary>
            /// 系统源单内码
            /// </summary>
            public int FSrcBillId { get; set; }
            /// <summary>
            /// 系统源单行号
            /// </summary>
            public int FSrcEntrySeq { get; set; }
            /// <summary>
            /// 系统源单分录内码
            /// </summary>
            public int FSrcEntryId { get; set; }

            /// <summary>
            ///  成本价        
            /// </summary>
            public int FPrice { get; set; }
            /// <summary>
            ///  总成本        
            /// </summary>
            public int FAmount { get; set; }
            /// <summary>
            /// 产品货主类型   (必填项) 
            /// </summary>
            [StringLength(36)]
            public string FParentOwnerTypeId { get; set; } = "BD_OwnerOrg";
            /// <summary>
            /// 产品货主   (必填项)
            /// </summary>
            public Dictionary<string, string> FParentOwnerId { get; set; } = new Dictionary<string, string>() { { "FNUMBER", LocalStaticRequest.DefaultOrg } };
            /// <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 string FStockFlag { get; set; } = "1";
            public List<Entity_Link> FEntity_Link { get; set; }
            public class Entity_Link
            {
                /// <summary>
                /// 实体主键，新建时为空，由系统自动填充
                /// </summary>
                public string FLinkId { get; set; }
                public string FEntity_Link_FFlowId { get; set; }// = "41c42878-ddec-40a0-85eb-8eb093ce051c";
                public string FEntity_Link_FFlowLineId { get; set; }
                public string FEntity_Link_FRuleId { get; set; } = "SUB_PPBOM_FEED";
                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; }    //实发数量
            }
        }

        public FSerialSubEntity SerialSubEntity { get; set; } = new FSerialSubEntity();
        /// <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>() {
            { "FNAME",""}
        };
            /// <summary>
            /// 备注
            /// </summary>
            [StringLength(36)]
            public string FSerialNote { get; set; }

        }
    }
}
