using RB_MES_API.Context;
using System.ComponentModel.DataAnnotations;
namespace RB_MES_API.Models.Cloud
{
    /// <summary>
    /// 受托加工材料入库单
    /// </summary>
    public class STK_OEMInStock
    {
        /// <summary>
        /// 实体主键（无需填写，保存时自动添加）
        /// </summary>
        public int FID { get; set; } 
        /// <summary>
        /// 单据编号   
        /// </summary>
        [StringLength(36)]
        public string FBillNo { get; set; }
        /// <summary>
        /// 单据类型   (必填项)
        /// </summary>
        public Dictionary<string, string> FBillTypeID { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER","STCLRK01_SYS"}
        };
        /// <summary>
        /// 库存组织   (必填项)
        /// </summary>
        public Dictionary<string, string> FStockOrgId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",LocalStaticRequest.DefaultOrg}
        };
        /// <summary>
        /// 日期  (必填项)
        /// </summary>
        [DataType(DataType.DateTime)]
        public string FDate { get; set; } = DateTime.Now.ToShortDateString();
        /// <summary>
        /// 客户   (必填项)
        /// </summary>
        public Dictionary<string, string> FCustId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
        /// <summary>
        /// 验收   
        /// </summary>
        public Dictionary<string, string> FCheckerId { get; set; } = new Dictionary<string, string>() {
            { "",""}
        };
        /// <summary>
        /// 仓管员   
        /// </summary>
        public Dictionary<string, string> FStockerId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
        /// <summary>
        /// 库存组 
        /// </summary>
        public Dictionary<string, string> FStockerGroupId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
        /// <summary>
        /// 备注    
        /// </summary>
        [StringLength(36)]
        public string FNote { get; set; }
        /// <summary>
        /// MES唯一标识
        /// </summary>
        [StringLength(36)]
        public string F_SBMI_QUEUE_ID { get; set; }
        ///// <summary>
        ///// 序列号上传    
        ///// </summary>
        ////[StringLength(36)]
        ////public string FScanBox { get; set; } = "";


        public List<BillEntry> FBillEntry { get; set; } = new List<BillEntry>();
        /// <summary>
        /// 明细信息
        /// </summary>
        public class BillEntry
        {
            /// <summary>
            /// 实体主键（无需填写，保存时自动添加）
            /// </summary>
            public int FEntryID { get; set; }
            /// <summary>
            /// 客户物料编码 
            /// </summary>
            public Dictionary<string, string> FCustMatId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 物料编码   (必填项) 
            /// </summary>
            public Dictionary<string, string> FMaterialId { 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>   
            /// BOM版本   
            /// </summary>
            public Dictionary<string, string> FBomId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 生产日期
            /// </summary>
            [DataType(DataType.DateTime)]
            public string FProduceDate { get; set; }
            /// <summary>
            /// 有效期至
            /// </summary>
            [DataType(DataType.Date)]
            public string FExpiryDate { get; set; }
            /// <summary>
            /// 计划跟踪号    
            /// </summary>
            [StringLength(36)]
            public string FMtoNo { get; set; }
            /// <summary>
            /// 单位   (必填项)   
            /// </summary>
            public Dictionary<string, string> FUnitID { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 基本单位    (必填项)
            /// </summary>
            public Dictionary<string, string> FBaseUnitId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 入库类型    
            /// </summary>
            [StringLength(36)]
            public string FInStockType { get; set; }
            /// <summary>
            /// 项目编号    
            /// </summary>
            [StringLength(36)]
            public string FProjectNo { get; set; } 
            /// <summary>
            /// 实收数量
            /// </summary>
            public decimal FQty { get; set; } 
            /// <summary>
            /// 收货仓库   (必填项)   
            /// </summary>
            public Dictionary<string, string> FStockId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            public StockLocId FStockLocId { get; set; } = new StockLocId();
            /// <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>
            public decimal FSecQty { get; set; }
            /// <summary>
            /// 批号
            /// </summary>
            public Dictionary<string, string> FLot { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 库存状态    (必填项)
            /// </summary>
            public Dictionary<string, string> FStockStatusId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER","KCZT01_SYS"}
        };
            /// <summary>
            /// 货主类型    (必填项)
            /// </summary>
            [StringLength(36)]
            public string FOwnerTypeId { get; set; } = "BD_Customer";
            /// <summary>
            /// 备注
            /// </summary>
            [StringLength(36)]
            public string FNoteEntry { get; set; } 
            /// <summary>
            /// 货主    (必填项)。注意，这里填写客户
            /// </summary>
            public Dictionary<string, string> FOwnerId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 保管者类型   (必填项)
            /// </summary>
            [StringLength(36)]
            public string FKeeperTypeId { get; set; } = "BD_KeeperOrg";
            /// <summary>
            /// 辅单位
            /// </summary>
            public Dictionary<string, string> FExtAuxUnitId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""} 
        };
            /// <summary>
            /// 保管者  (必填项)
            /// </summary>
            public Dictionary<string, string> FKeeperId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",LocalStaticRequest.DefaultOrg}
        };
            /// <summary>
            /// 实收数量（辅单位）
            /// </summary>
            public decimal FExtAuxUnitQty { get; set; }
            /// <summary>
            /// BOM展开需求序号
            /// </summary>
            public int FSrcSeqNo { get; set; } 
            /// <summary>
            /// 收料单分录内码
            /// </summary>
            public int FRESRCENTRYID { get; set; } 
            /// <summary>
            /// 源单分录行号
            /// </summary>
            public string FSeq { get; set; }
        }


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



        public class FSubHeadEntity
        {
            /// <summary>
            /// 实体主键（无需填写，保存时自动添加）
            /// </summary>
            public int FEntryID { get; set; } 
            /// <summary>
            /// 展开项
            /// </summary>
            public bool FSelect { get; set; } = false;
            /// <summary>
            /// 单位
            /// </summary>
            public Dictionary<string, string> FSubUnitID { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// BOM版本
            /// </summary>
            public Dictionary<string, string> FSubBomId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 更新库存标志
            /// </summary>
            //public string FStockFlag { get; set; } = "1";
            /// <summary>
            /// 基本单位
            /// </summary>
            public Dictionary<string, string> FSubBaseUnitId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 基本单位数量
            /// </summary>
            public decimal FSubBaseQty { get; set; } 
            /// <summary>
            /// 源单编号
            /// </summary>
            [StringLength(36)]
            public string FSubSRCBILLNO { get; set; }
            /// <summary>
            /// 源单行号
            /// </summary>
            [StringLength(36)]
            public string FSubSrcSeq { get; set; } 
            /// <summary>
            /// 库存辅单位
            /// </summary>
            public Dictionary<string, string> FSubAuxUnitID { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 库存辅单位数量
            /// </summary>
            public decimal FSubAuxQty { get; set; } 
            /// <summary>
            /// 需要检验
            /// </summary>
            public bool FNeedCheck { get; set; } = false;
            /// <summary>
            /// 收料合格辅单位数量
            /// </summary>
            public decimal FReceiveAuxQty { get; set; } 
            /// <summary>
            /// 让步接收辅单位数量
            /// </summary>
            public decimal FCsnReceiveAuxQty { get; set; } 
            /// <summary>
            /// 判退辅单位数量
            /// </summary>
            public decimal FRefuseAuxQty { get; set; } 
            /// <summary>
            /// 收料合格数量
            /// </summary>
            public decimal FReceiveBaseQty { get; set; } 
            /// <summary>
            /// 让步接收数量
            /// </summary>
            public decimal FCsnReceiveBaseQty { get; set; }
            /// <summary>
            /// 判退数量
            /// </summary>
            public decimal FRefuseBaseQty { get; set; } 
        }

    }
}
