using RB_MES_API.Context;
using System.ComponentModel.DataAnnotations;
namespace RB_MES_API.Models.Cloud
{
    /// <summary>
    /// 生产入库单
    /// </summary>
    public class PRD_INSTOCK
    {
        /// <summary>
        /// 实体主键（无需填写，保存时自动添加）
        /// </summary>
        public int FID { get; set; }
        /// <summary>
        /// 单据类型  (必填项)
        /// </summary>
        public Dictionary<string, string> FBillType { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER","SCRKD02_SYS"}
        };
        /// <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> FPrdOrgId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
        /// <summary>
        /// 车间  
        /// </summary>
        public Dictionary<string, string> FWorkShopId { 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",""}
        };
        /// <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 bool FIsEntrust { get; set; } = false;
        /// <summary>
        /// 本位币  
        /// </summary>
        public Dictionary<string, string> FCurrId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
        /// <summary>
        /// 委托组织入库单Id
        /// </summary>
        public int FEntrustInStockId { get; set; }
        /// <summary>
        /// 序列号上传   
        /// </summary>
        [StringLength(36)]
        public string FScanBox { get; set; }
        /// <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 FSrcEntryId { get; set; }
            /// <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 FIsNew { get; set; } = false;
            /// <summary>
            /// 物料编码  (必填项)  
            /// </summary>
            public Dictionary<string, string> FMaterialId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            /// 产品检验(弃用)
            /// </summary>
            public bool FCheckProduct { get; set; } = false;
            /// <summary>
            /// 产品类型   
            /// </summary>
            [StringLength(36)]
            public string FProductType { get; set; }
            /// <summary>
            ///  入库类型     (必填项)  
            /// </summary>
            [StringLength(36)]
            public string FInStockType { get; set; }
            /// <summary>
            /// 单位  (必填项)  
            /// </summary>
            public Dictionary<string, string> FUnitID { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            ///  应收数量
            /// </summary>
            public decimal FMustQty { get; set; }
            /// <summary>
            ///  实收数量
            /// </summary>
            public decimal FRealQty { get; set; }
            /// <summary>
            ///  成本权重
            /// </summary>
            public int FCostRate { get; set; }
            /// <summary>
            /// 基本单位  (必填项)  
            /// </summary>
            public Dictionary<string, string> FBaseUnitId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            ///   基本单位应收数量
            /// </summary>
            public decimal FBaseMustQty { get; set; }
            /// <summary>
            ///   基本单位库存实收数量
            /// </summary>
            public decimal FBaseRealQty { get; set; }
            /// <summary>
            ///  货主类型     (必填项)  
            /// </summary>
            [StringLength(36)]
            public string FOwnerTypeId0 { get; set; }
            /// <summary>
            /// 货主  (必填项)  
            /// </summary>
            public Dictionary<string, string> FOwnerId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",LocalStaticRequest.DefaultOrg}
        };
            /// <summary>
            /// 仓库  (必填项)  
            /// </summary>
            public Dictionary<string, string> FStockId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            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>
            ///  BOM版本 
            /// </summary>
            public Dictionary<string, string> FBomId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            ///  批号 
            /// </summary>
            public Dictionary<string, string> FLot { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            /// 倒冲领料
            /// </summary>
            public bool FISBACKFLUSH { get; set; } = false;
            /// <summary>
            ///  计划跟踪号
            /// </summary>
            [StringLength(36)]
            public string FMtoNo { get; set; }
            /// <summary>
            ///  项目编号
            /// </summary>
            [StringLength(36)]
            public string FProjectNo { get; set; }
            /// <summary>
            ///  生产车间 
            /// </summary>
            public Dictionary<string, string> FWorkShopId1 { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            ///  产线 
            /// </summary>
            public Dictionary<string, string> FLINEID { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            ///  班组 
            /// </summary>
            public Dictionary<string, string> FShiftGroupId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            ///  生产订单编号   (必填项)
            /// </summary>
            [StringLength(36)]
            public string FMoBillNo { get; set; }
            /// <summary>
            /// 生产订单内码
            /// </summary>
            public int FMoId { get; set; }
            /// <summary>
            /// 生产订单分录内码
            /// </summary>
            public int FMoEntryId { get; set; }
            /// <summary>
            /// 生产订单行号
            /// </summary>
            public int FMoEntrySeq { get; set; }
            /// <summary>
            ///  备注
            /// </summary>
            [StringLength(36)]
            public string FMemo { get; set; }
            /// <summary>
            ///  辅助属性
            /// </summary>
            //    public class FAuxpropId 
            //    {
            //        public Dictionary<string, string> FAUXPROPID__FF100002 { 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 FStockRealQty { get; set; }
            /// <summary>
            /// 辅助单位 
            /// </summary>
            public Dictionary<string, string> FSecUnitId { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            /// <summary>
            /// 辅助单位实收数量
            /// </summary>
            public int FSecRealQty { get; set; }
            /// <summary>
            ///  源单类型
            /// </summary>
            [StringLength(36)]
            public string FSrcBillType { get; set; }
            /// <summary>
            /// 源单内码
            /// </summary>
            public int FSrcInterId { get; set; }
            /// <summary>
            ///  源单编号
            /// </summary>
            [StringLength(36)]
            public string FSrcBillNo { get; set; }
            /// <summary>
            /// 基本单位生产实收数量
            /// </summary>
            public decimal FBasePrdRealQty { get; set; }
            /// <summary>
            /// 完工
            /// </summary>
            public bool FIsFinished { get; set; } = false;
            /// <summary>
            /// 库存状态    (必填项) 
            /// </summary>
            public Dictionary<string, string> FStockStatusId { get; set; } = new Dictionary<string, string>() {
            { "FNumber","KCZT01_SYS"}
        };
            /// <summary>
            /// 源单行号
            /// </summary>
            public int FSrcEntrySeq { get; set; }
            /// <summary>
            /// 生产订单主产品分录
            /// </summary>
            public int FMOMAINENTRYID { get; set; } = 0;
            /// <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>
            [DataType(DataType.Date)]
            public string FProduceDate { get; set; } //= DateTime.Now.ToShortDateString();
            /// <summary>
            /// 有效期至
            /// </summary>
            [DataType(DataType.Date)]
            public string FExpiryDate { get; set; }
            /// <summary>
            /// 退库选单数   
            /// </summary>
            public int FSelReStkQty { get; set; }
            /// <summary>
            /// 基本单位退库选单数量   
            /// </summary>
            public int FBaseSelReStkQty { get; set; }
            /// <summary>
            ///  业务来源类型  
            /// </summary>
            [StringLength(36)]
            public string FSrcBusinessType { get; set; }
            /// <summary>
            /// 组织间结算跨法人
            /// </summary>
            public bool FIsOverLegalOrg { get; set; } = false;
            /// <summary>
            ///  直送标识     
            /// </summary>
            [StringLength(36)]
            public string FSendRowId { get; set; }
            /// <summary>
            /// 更新库存标志
            /// </summary>
            //public string FStockFlag { get; set; } = "1";

            public Dictionary<string, string> F_PNDR_BASE_QTR { get; set; } = new Dictionary<string, string>() { { "FNumber", "" } };
            /// <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; } /*= "466b5e95-19b7-4195-b9e2-1c36006331a3";*/

                public string FEntity_Link_FFlowLineId { get; set; }
                public string FEntity_Link_FRuleId { get; set; } = "PRD_MO2INSTOCK";
                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 List<SerialSubEntity> FSerialSubEntity { get; set; } = new List<SerialSubEntity>();
            public class SerialSubEntity
            {
                /// <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>
                public int FQty { get; set; }
                /// <summary>
                /// 基本单位数量
                /// </summary>
                public int FBaseSNQty { get; set; }
                /// <summary>
                ///  备注     
                /// </summary>
                [StringLength(36)]
                public string FSerialNote { get; set; }
            }
        }
    }
}
