using System.ComponentModel.DataAnnotations;
namespace RB_MES_API.Models.Cloud
{
    /// <summary>
    /// 生产汇报单
    /// </summary>
    public class PRD_MORPT
    {
        /// <summary>
        /// 实体主键（无需填写，保存时自动添加）
        /// </summary>
        public int FID { get; set; } 
        /// <summary>
        /// 单据类型  (必填项)
        /// </summary>
        [StringLength(36)]
        public Dictionary<string, string> FBillType { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER","SCHBD02_SYS"}
        };
        /// <summary>
        /// 单据状态  (必填项)
        /// </summary>
        public string FDocumentStatus { get; set; }
        /// <summary>
        /// 单据日期  (必填项)
        /// </summary>
        [DataType(DataType.Date)]
        public string FDate { get; set; }
        /// <summary>
        /// 生产组织  (必填项)
        /// </summary>
        [StringLength(36)]
        public Dictionary<string, string> FPrdOrgId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
        /// <summary>
        ///生产车间
        /// </summary>
        [StringLength(36)]
        public Dictionary<string, string> FWorkshipIdH { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
        /// <summary>
        /// 备注
        /// </summary>
        public string FDescription { get; set; } 
        /// <summary>
        /// 序列号上传
        /// </summary>
        public string FScanBox { 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 string FSrcEntryId { get; set; }
            /// <summary>
            ///  是否新增行
            /// </summary>
            public bool FIsNew { get; set; } = false;
            /// <summary>
            ///物料编码
            /// </summary>
            [StringLength(36)]
            public Dictionary<string, string> FMaterialId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 产品类型
            /// </summary>
            public string FProductType { get; set; }
            /// <summary>
            ///生产汇报类型    (必填项)
            /// </summary>
            [StringLength(36)]
            public Dictionary<string, string> FReportType { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            ///单位
            /// </summary>
            [StringLength(36)]
            public Dictionary<string, string> FUnitID { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            ///生产车间    (必填项)
            /// </summary>
            [StringLength(36)]
            public Dictionary<string, string> FWorkshipId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            ///产线
            /// </summary>
            [StringLength(36)]
            public Dictionary<string, string> FLINEID { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            ///班组
            /// </summary>
            [StringLength(36)]
            public Dictionary<string, string> FShiftGroupId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            ///批号
            /// </summary>
            [StringLength(36)]
            public Dictionary<string, string> FLot { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            ///责任部门
            /// </summary>
            [StringLength(36)]
            public Dictionary<string, string> FDeptId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 仓位   
            /// </summary>
            public class FStockLocId
            {
                [StringLength(36)]
                public Dictionary<string, string> FSTOCKLOCID__FF100001 { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
                [StringLength(36)]
                public Dictionary<string, string> FSTOCKLOCID__FF100002 { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            }
            /// <summary>
            /// 计划跟踪号
            /// </summary>
            public string FMtoNo { get; set; } 
            /// <summary>
            ///  产品检验
            /// </summary>
            public bool FCheckProduct { get; set; } = false;
            /// <summary>
            ///  组织委托加工
            /// </summary>
            public bool FIsEntrust { get; set; } = false;
            /// <summary>
            /// 源单类型
            /// </summary>
            public string FSrcBillType { get; set; } 
            /// <summary>
            /// 辅助属性   
            /// </summary>
            public class FAuxPropId
            {
                [StringLength(36)]
                public Dictionary<string, string> FAUXPROPID__FF100002 { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            }
            /// <summary>
            /// 生产订单
            /// </summary>
            public string FMoBillNo { get; set; } 
            /// <summary>
            /// 人数
            /// </summary>
            public int FHumanQty { get; set; }
            /// <summary>
            /// 源单编号
            /// </summary>
            public string FSrcBillNo { get; set; } 
            /// <summary>
            /// 机台数
            /// </summary>
            public int FMachineQty { get; set; } 
            /// <summary>
            ///物料生产单位
            /// </summary>
            [StringLength(36)]
            public Dictionary<string, string> FMaterialUnitID { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 开始时间
            /// </summary>
            [DataType(DataType.Date)]
            public string FStartTime { get; set; }
            /// <summary>
            /// 结束时间
            /// </summary>
            [DataType(DataType.Date)]
            public string FEndTime { get; set; }
            /// <summary>
            /// 时间单位   (必填项)
            /// </summary>
            public string FTimeUnitId { get; set; } = "H";
            /// <summary>
            /// 生产订单行号
            /// </summary>
            public int FMoEntrySeq { get; set; } 
            /// <summary>
            /// 单位标准工时单位   (必填项)
            /// </summary>
            public string FStandHourUnitId { get; set; } 
            /// <summary>
            /// 项目编号
            /// </summary>
            public string FProjectNo { get; set; }
            /// <summary>
            /// 单位标准工时
            /// </summary>
            public int FStdManHour { get; set; } 
            /// <summary>
            /// 人员准备工时
            /// </summary>
            public int FHrPrepareTime { get; set; } 
            /// <summary>
            /// 人员实作工时
            /// </summary>
            public int FHrWorkTime { get; set; } 
            /// <summary>
            ///  机器准备工时
            /// </summary>
            public int FMacPrepareTime { get; set; } 
            /// <summary>
            /// 机器实作工时
            /// </summary>
            public int FMacWorkTime { get; set; } 
            /// <summary>
            /// 备注
            /// </summary>
            public string FDescriptionE { get; set; }
            /// <summary>
            /// 源单内码
            /// </summary>
            public int FSrcInterId { get; set; } 
            /// <summary>
            /// 源单行号
            /// </summary>
            public int FSrcEntrySeq { get; set; }
            /// <summary>
            /// 生产订单内码
            /// </summary>
            public int FMoId { get; set; } 
            /// <summary>
            /// 生产订单分录号
            /// </summary>
            public int FMoEntryId { get; set; } 
            /// <summary>
            ///基本单位
            /// </summary>
            [StringLength(36)]
            public Dictionary<string, string> FBaseUnitId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            ///入库组织
            /// </summary>
            [StringLength(36)]
            public Dictionary<string, string> FStockInOrgId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            ///BOM版本
            /// </summary>
            [StringLength(36)]
            public Dictionary<string, string> FBomId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 货主类型
            /// </summary>
            public string FOwnerTypeId { get; set; } 
            /// <summary>
            ///货主
            /// </summary>
            [StringLength(36)]
            public Dictionary<string, string> FOwnerId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 成本权重
            /// </summary>
            public int FCostRate { get; set; } 
            /// <summary>
            ///序列号单位
            /// </summary>
            [StringLength(36)]
            public Dictionary<string, string> FSNUnitID { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 序列号单位数量
            /// </summary>
            public int FSNQty { get; set; } 
            /// <summary>
            /// 生产日期
            /// </summary>
            public DateTime FProduceDate { get; set; }
            /// <summary>
            /// 倒冲领料
            /// </summary>
            public bool FISBACKFLUSH { get; set; } = false;
            /// <summary>
            /// 有效期至
            /// </summary>
            [DataType(DataType.Date)]
            public string FExpiryDate { get; set; }
            /// <summary>
            /// 生产订单主产品分录
            /// </summary>
            public int FMOMAINENTRYID { get; set; } 
            /// <summary>
            /// 合格品入库数量
            /// </summary>
            public int FStockInSelQty { get; set; } 
            /// <summary>
            /// 基本单位合格品入库数量
            /// </summary>
            public int FBaseStockInSelQty { get; set; } 
            /// <summary>
            /// 领料选单数量
            /// </summary>
            public int FPickMtrlSelQty { get; set; }
            /// <summary>
            /// 完成数量
            /// </summary>
            public decimal FFinishQty { get; set; }
            /// <summary>
            /// 基本单位领料选单数量
            /// </summary>
            public int FBasePickMtrlSelQty { get; set; } 
            /// <summary>
            ///  首检
            /// </summary>
            public bool FIsFirstinspect { get; set; } = false;

            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; } //= "3c1a4345-38c0-4530-bbd9-5c3ccc53be88";
                public string FEntity_Link_FFlowLineId { get; set; }
                public string FEntity_Link_FRuleId { get; set; } = "PRD_MO2MORPT";
                public int FEntity_Link_FSTableId { get; set; } = 0;
                public string FEntity_Link_FSTableName { get; set; } = "T_PRD_MOENTRY";
                /// <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>
            public Dictionary<string, string> FQCMaterialId { get; set; } = new Dictionary<string, string>() {
            { "FNAME",""}
        };
            /// <summary>
            /// 检验结果
            /// </summary>
            [StringLength(36)]
            public string FInspectResult { get; set; } 
            /// <summary>
            /// 辅助属性   
            /// </summary>
            public class FQcAuxPropId
            {
                [StringLength(36)]
                public Dictionary<string, string> FQCAUXPROPID__FF100002 { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            }
            /// <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>
            public int FQCStockInSelQty { get; set; } 
            /// <summary>
            /// 备注
            /// </summary>
            [StringLength(36)]
            public string FSerialNote { get; set; } 
            /// <summary>
            /// 基本单位数量
            /// </summary>
            public int FBaseQCQty { get; set; } 
            /// <summary>
            /// 基本单位入库选单数量
            /// </summary>
            public int FBaseQCStockInSelQty { get; set; } 
        }
    }
}
