using RB_MES_API.Context;
using System.ComponentModel.DataAnnotations;
namespace RB_MES_API.Models.Cloud
{
    /// <summary>
    /// 工单物料需求
    /// </summary>
    public class PRD_PPBOM
    {
        /// <summary>
        /// 实体主键（无需填写，保存时自动添加）
        /// </summary>
        public int FID { get; set; }
        /// <summary>
        /// 单据编号    
        /// </summary>
        [StringLength(36)]
        public string FBillNo { get; set; }
        /// <summary>
        /// 产品编码  (必填项)
        /// </summary>
        public Dictionary<string, string> FMaterialID { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
        /// <summary>
        /// 辅助属性 
        /// </summary>
        public AuxPropIDHead FAuxPropIDHead = new AuxPropIDHead();

        public class AuxPropIDHead
        {
            public Dictionary<string, string> FAUXPROPIDHEAD__FF100001 { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
        }
        /// <summary>
        /// 生产组织  (必填项)
        /// </summary>
        public Dictionary<string, object> FPrdOrgId { get; set; } = new Dictionary<string, object>() { { "FNumber", LocalStaticRequest.DefaultOrg } };
        /// <summary>
        /// 生产车间  (必填项)
        /// </summary>
        public Dictionary<string, string> FWorkshopID { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
        /// <summary>
        /// 数量  (必填项)
        /// </summary>
        public decimal FQty { get; set; }
        /// <summary>
        /// 生产订单分录内码  (必填项)
        /// </summary>
        public long FMOEntryID { get; set; }
        /// <summary>
        /// 单位  (必填项)
        /// </summary>
        public Dictionary<string, string> FUnitID { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
        /// <summary>
        /// 生产订单类型
        /// </summary>
        public Dictionary<string, string> FMOType { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
        /// <summary>
        /// 生产订单编号  (必填项)    
        /// </summary>
        [StringLength(36)]
        public string FMOBillNO { get; set; }
        /// <summary>
        /// 生产订单行号
        /// </summary>
        public long FMOEntrySeq { get; set; }
        /// <summary>
        /// 备注   
        /// </summary>
        [StringLength(36)]
        public string FDescription { get; set; }
        /// <summary>
        /// 基本单位数量
        /// </summary>
        public decimal FBaseQty { get; set; }
        /// <summary>
        /// 生产订单内码  
        /// </summary>
        public long FMoId { get; set; }
        /// <summary>
        /// 基本单位
        /// </summary>
        public Dictionary<string, string> FBaseUnitID { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
        /// <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>
        public Dictionary<string, string> FEntrustOrgId { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
        /// <summary>
        /// 生产订单行镜像
        /// </summary>
        public Dictionary<string, string> FMoEntryMirror { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };


        public Dictionary<string, string> FBOMID { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
        /// <summary>
        /// 销售订单ID
        /// </summary>
        public long FSaleOrderId { get; set; }
        /// <summary>
        /// 销售订单行号
        /// </summary>
        public long FSaleOrderEntrySeq { get; set; }
        /// <summary>
        /// 销售订单分录内码
        /// </summary>
        public long FSaleOrderEntryId { get; set; }
        /// <summary>
        /// 销售订单   
        /// </summary>
        [StringLength(36)]
        public string FSALEORDERNO { get; set; }
        /// <summary>
        /// 需求来源   
        /// </summary>
        [StringLength(36)]
        public string FReqSrc { get; set; }
        /// <summary>
        /// BOM日期
        /// </summary>
        [DataType(DataType.Date)]
        public string FGeneRateDate { get; set; }
        /// <summary>
        /// 库存日期
        /// </summary>
        [DataType(DataType.Date)]
        public string FInventoryDate { get; set; }
        /// <summary>
        /// 期初生产订单
        /// </summary>
        public bool FIsQCMo { get; set; } = true;

        public List<Entity> FEntity { get; set; } = new List<Entity>();

        /// <summary>
        /// 子项明细
        /// </summary>
        public class Entity
        {
            public int FSeq { get; set; }
            /// <summary>
            /// 实体主键（无需填写，保存时自动添加）
            /// </summary>
            public long FEntryID { get; set; } = 0;
            /// <summary>
            /// 子项物料编码   (必填项)
            /// </summary>
            public Dictionary<string, string> FMaterialID2 { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            /// <summary>
            /// 子项类型  (必填项)   
            /// </summary>
            [StringLength(36)]
            public string FMaterialType { get; set; } = "1";
            /// <summary>
            /// 供应类型  
            /// </summary>
            [StringLength(36)]
            public string FSupplyType { get; set; }
            /// <summary>
            /// 用量类型    (必填项) 
            /// </summary>
            [StringLength(36)]
            public string FDosageType { get; set; } = "2";
            /// <summary>
            /// 分子
            /// </summary>
            public long FNumerator { get; set; }
            /// <summary>
            /// 分母
            /// </summary>
            public long FDenominator { get; set; }
            /// <summary>
            /// 子项单位   (必填项)
            /// </summary>
            public Dictionary<string, string> FUnitID2 { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            /// <summary>
            /// 固定损耗
            /// </summary>
            public long FFixScrapQty { get; set; }
            /// <summary>
            /// 变动损耗率%
            /// </summary>
            public long FScrapRate { get; set; }
            /// <summary>
            /// 需求日期
            /// </summary>
            public string FNeedDate2 { get; set; }
            /// <summary>
            ///  发料组织   (必填项)
            /// </summary>
            public Dictionary<string, string> FSupplyOrg { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            /// <summary>
            /// 是否关键件
            /// </summary>
            public bool FIsKeyComponent { get; set; } = false;
            /// <summary>
            ///  BOM版本
            /// </summary>
            public Dictionary<string, string> FBomId2 { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            /// <summary>
            /// 是否超发
            /// </summary>
            public bool FAllowOver { get; set; } = false;
            /// <summary>
            ///  子项工作日历
            /// </summary>
            public Dictionary<string, string> FWorkCalId2 { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            /// <summary>
            /// 基本单位分子
            /// </summary>
            public long FBaseNumerator { get; set; }
            /// <summary>
            /// 预留类型    (必填项) 
            /// </summary>
            [StringLength(36)]
            public string FReserveType { get; set; } = "1";
            /// <summary>
            /// 基本单位固定损耗数量
            /// </summary>
            public long FBaseFixScrapQTY { get; set; }
            /// <summary>
            /// 辅助属性
            /// </summary>
            public AuxPropID FAuxPropID = new AuxPropID();
            public class AuxPropID
            {
                public Dictionary<string, string> FAUXPROPID__FF100001 { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            }

            /// <summary>
            /// 基本单位分母
            /// </summary>
            public long FBASEDENOMINATOR { get; set; }
            /// <summary>
            /// 超发控制方式    (必填项) 
            /// </summary>
            [StringLength(36)]
            public string FOverControlMode { get; set; } = "1";
            /// <summary>
            ///  货源 
            /// </summary>
            public Dictionary<string, string> FSMId { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            /// <summary>
            /// 货源分录
            /// </summary>
            public long FSMEntryId { get; set; }
            /// <summary>
            ///  供应组织 
            /// </summary>
            public Dictionary<string, string> FChildSupplyOrgId { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            /// <summary>
            /// 工序序列    
            /// </summary>
            [StringLength(36)]
            public string FOptQueue { get; set; }
            /// <summary>
            ///  库存状态    
            /// </summary>
            public Dictionary<string, string> FStockStatusId { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            /// <summary>
            ///  产品货主       
            /// </summary>
            public Dictionary<string, string> FEntrustPickOrgId { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            /// <summary>
            /// 工序
            /// </summary>
            public long FOperID { get; set; }
            /// <summary>
            ///  批号       
            /// </summary>
            public Dictionary<string, string> FLot { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            /// <summary>
            /// 偏置提前期
            /// </summary>
            public long FOffsetTime { get; set; }
            /// <summary>
            /// 偏置提前期单位  (必填项)    
            /// </summary>
            [StringLength(36)]
            public string FTimeUnit2 { get; set; } = "1";
            /// <summary>
            ///  作业       
            /// </summary>
            public Dictionary<string, string> FProcessID { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            /// <summary>
            /// 发料方式  (必填项)    
            /// </summary>
            [StringLength(36)]
            public string FIssueType { get; set; } = "1";
            /// <summary>
            ///  仓库       
            /// </summary>
            public Dictionary<string, string> FStockID { 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 Dictionary<string, string> FSrcTransOrgId { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            /// <summary>
            ///  拨出仓库       
            /// </summary>
            public Dictionary<string, string> FSrcTransStockId { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            /// <summary>
            ///  拨出仓位       
            /// </summary>
            public class FSrcTransStockLocId
            {
                public Dictionary<string, string> FSRCTRANSSTOCKLOCID__FF100001 { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
                public Dictionary<string, string> FSRCTRANSSTOCKLOCID__FF100002 { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
            }
            /// <summary>
            /// 位置号
            /// </summary>
            public string FPositionNO { get; set; }
            /// <summary>
            /// 未领数量
            /// </summary>
            public decimal FNoPickedQty { get; set; }
            /// <summary>
            /// 可用库存
            /// </summary>
            public decimal FInventoryQty { get; set; }
            /// <summary>
            /// 跳层
            /// </summary>
            public bool FIsSkip { get; set; } = false;
            /// <summary>
            /// 领料考虑最小发料批量
            /// </summary>
            public bool FISMinIssueQty { get; set; } = false;
            /// <summary>
            /// 是否发损耗
            /// </summary>
            public bool FIsGetScrap { get; set; } = false;
            /// <summary>
            /// 用料清单类型     
            /// </summary>
            [StringLength(36)]
            public string FPPBomEntryType { get; set; }
            /// <summary>
            ///  最后更新人       
            /// </summary>
            public Dictionary<string, string> FUPDATERID { get; set; } = new Dictionary<string, string>() { { "FUserID", "" } };
            /// <summary>
            /// 最后更新时间
            /// </summary>
            [DataType(DataType.Date)]
            public string FUPDateDate { get; set; }
            /// <summary>
            /// 货主类型     
            /// </summary>
            [StringLength(36)]
            public string FOwnerTypeId { get; set; } //= "BD_OwnerOrg";
            /// <summary>
            /// 供料方式     
            /// </summary>
            [StringLength(36)]
            public string FSupplyMode { get; set; }
            /// <summary>
            /// 基本单位未领数量
            /// </summary>
            public decimal FBaseNoPickedQty { get; set; }
            /// <summary>
            ///  MRP运算
            /// </summary>
            public bool FIsMrpRun { get; set; } = true;
            /// <summary>
            /// 原用料清单内码
            /// </summary>
            public long FSrcPPBOMID { get; set; }
            /// <summary>
            /// 原用料清单分录内码
            /// </summary>
            public long FSrcPPBOMEntryId { get; set; }
            /// <summary>
            /// 备料数量
            /// </summary>
            public decimal FStockReadyQty { get; set; }
            /// <summary>
            /// 基本单位备料数量
            /// </summary>
            public decimal FBaseStockReadyQty { get; set; }
            /// <summary>
            ///  子项基本单位       
            /// </summary>
            public Dictionary<string, string> FBaseUnitID1 { get; set; } = new Dictionary<string, string>() { { "FNumber", "" } };
            /// <summary>
            /// 开单未退数量
            /// </summary>
            public decimal FReturnNoOkQty { get; set; }
            /// <summary>
            ///  生产订单类型       
            /// </summary>
            public Dictionary<string, string> FMoType1 { get; set; } = new Dictionary<string, string>() { { "FNumber", "" } };
            /// <summary>
            ///  货主       
            /// </summary>
            public Dictionary<string, string> FOwnerID { get; set; } = new Dictionary<string, string>() { { "FNumber", "" } };
            /// <summary>
            ///  分组货主       
            /// </summary>
            public Dictionary<string, string> FGroupByOwnerId { get; set; } = new Dictionary<string, string>() { { "FNumber", "" } };
            /// <summary>
            ///  是否展开
            /// </summary>
            public bool FIsExpand { get; set; } = false;
            /// <summary>
            ///  生产退料检验
            /// </summary>
            public bool FCheckReturnMtrl { get; set; } = false;
            /// <summary>
            /// 基本单位生产退料请检选单数量
            /// </summary>
            public decimal FBaseReturnAppSelQty { get; set; }
            /// <summary>
            /// 生产退料请检选单数量
            /// </summary>
            public decimal FReturnAppSelQty { get; set; }
            /// <summary>
            /// 累计成品率
            /// </summary>
            public decimal FBillAccuYieldRate { get; set; }
            /// <summary>
            /// 应发数量
            /// </summary>
            public decimal FMustQty { get; set; }
            /// <summary>
            /// 需求数量
            /// </summary>
            public decimal FNeedQty2 { get; set; }
            /// <summary>
            /// 应发数量(最小发料批量)
            /// </summary>
            public decimal FMinIssueQty { get; set; }
            /// <summary>
            /// 基本单位应发数量(最小发料批量)
            /// </summary>
            public decimal FBaseMinIssueQty { get; set; }
            /// <summary>
            /// 初始化数量
            /// </summary>
            public decimal FALLOCATEQTY { get; set; }
            /// <summary>
            /// 基本单位初始化数量
            /// </summary>
            public decimal FBASEALLOCATEQTY { get; set; }
            /// <summary>
            /// 替代策略
            /// </summary>
            public string FReplacePolicy { get; set; } = string.Empty;
            /// <summary>
            /// 替代方式
            /// </summary>
            public string FReplaceType { get; set; }
            /// <summary>
            /// 替代优先级
            /// </summary>
            public int FReplacePriority { get; set; }
            /// <summary>
            /// 替代主料
            /// </summary>
            public int FIsKeyItem { get; set; }
            /// <summary>
            /// 项次，替代主料的行号
            /// </summary>
            public int FReplaceGroup { get; set; }
            /// <summary>
            /// 使用比例
            /// </summary>
            public decimal FUseRate { get; set; } = 100;
            public int FRowExpandType { get; set; } = 16;
        }























    }
}
