using RB_MES_API.Context;
using System.ComponentModel.DataAnnotations;
namespace RB_MES_API.Models.Cloud
{
    /// <summary>
    /// 直接调拨单
    /// </summary>
    public class STK_TransferDirect
    {
        /// <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","ZJDB01_SYS"}
        };
        ///// <summary>
        ///// 调拨方向    (必填项)  
        ///// </summary>
        //[StringLength(36)]
        //public string FTransferDirect { get; set; } = "GENERAL";
        /// <summary>
        /// 调拨类型     (必填项)   
        /// </summary>
        [StringLength(36)]
        public string FTransferBizType { get; set; } //= "InnerOrgTransfer";
        /// <summary>
        /// 调拨类型     (必填项)   
        /// </summary>
        [StringLength(36)]
        public string FBizType { get; set; } //= "InnerOrgTransfer";
        /// <summary>
        /// 调出库存组织  (必填项)
        /// </summary>
        public Dictionary<string, string> FStockOutOrgId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",LocalStaticRequest.DefaultOrg}
        };
        /// <summary>
        /// 调出货主类型     (必填项)   
        /// </summary>
        [StringLength(36)]
        public string FOwnerTypeOutIdHead { get; set; } 
        /// <summary>
        /// 调出货主
        /// </summary>
        public Dictionary<string, string> FOwnerOutIdHead { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",LocalStaticRequest.DefaultOrg}
        };
        /// <summary>
        /// 调入库存组织  (必填项)
        /// </summary>
        public Dictionary<string, string> FStockOrgId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",LocalStaticRequest.DefaultOrg}
        };
        /// <summary>
        /// 是否含税
        /// </summary>
        public bool FIsIncludedTax { get; set; } = false;
        /// <summary>
        /// 价外税
        /// </summary>
        public bool FIsPriceExcludeTax { get; set; } = false;
        /// <summary>
        /// 汇率类型
        /// </summary>
        public Dictionary<string, string> FExchangeTypeId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER","HLTX01_SYS"}
        };
        /// <summary>
        /// 调入货主类型     (必填项)   
        /// </summary>
        [StringLength(36)]
        public string FOwnerTypeIdHead { get; set; } = "BD_OwnerOrg";
        /// <summary>
        /// 汇率
        /// </summary>
        public decimal FExchangeRate { get; set; } 
        /// <summary>
        /// 调入货主
        /// </summary>
        public Dictionary<string, string> FOwnerIdHead { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",LocalStaticRequest.DefaultOrg}
        };
        /// <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>
        [DataType(DataType.DateTime)]
        public string FDate { get; set; } = DateTime.Now.ToShortDateString();
        /// <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 Dictionary<string, string> FSaleDeptId { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
        /// <summary>
        /// 销售组 
        /// </summary>
        [StringLength(36)]
        public Dictionary<string, string> FSaleGroupId { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
        /// <summary>
        /// 销售员 
        /// </summary>
        [StringLength(36)]
        public Dictionary<string, string> FSalerId { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };
        /// <summary>
        /// 序列号上传 
        /// </summary>
        //[StringLength(36)]
        //public string FScanBox { get; set; } = "";
        /// <summary>
        /// 冲减普通寄售调拔单结算数量
        /// </summary>
        public bool FWriteOffConsign { get; set; } = false;
        /// <summary>
        /// 客户 必录项
        /// </summary>

        public Dictionary<string,string> F_PKGR_CustomerID { get; set; } = new Dictionary<string, string>() { { "FNUMBER", "" } };


        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> 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 Dictionary<string, string> FSaleUnitId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 基本单位
            /// </summary>
            public Dictionary<string,string> FBaseUnitId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 调拨数量
            /// </summary>
            public decimal FQty { get; set; }
            /// <summary>
            /// 销售基本数量
            /// </summary>
            public decimal FSalBaseQty { get; set; }
            /// <summary>
            /// 调出批号   
            /// </summary>
            public Dictionary<string, string> FLot { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 调出仓库   
            /// </summary>
            public Dictionary<string, string> FSrcStockId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 调出仓位  
            /// </summary>
            public StockLocId FStockLocId { get; set; } = new StockLocId();
            public class StockLocId
            {
                public Dictionary<string, string> FSRCSTOCKLOCID__FF100001 { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
                public Dictionary<string, string> FSRCSTOCKLOCID__FF100002 { get; set; } = new Dictionary<string, string>() {
            { "FNumber",""}
        };
            }
            /// <summary>
            /// 调入仓库   
            /// </summary>
            public Dictionary<string, string> FDestStockId { 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> FSrcStockStatusId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER","KCZT01_SYS"}
        };
            /// <summary>
            /// 调入库存状态      
            /// </summary>
            public Dictionary<string, string> FDestStockStatusId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER","KCZT01_SYS"}
        };
            /// <summary>
            /// 计划跟踪号 
            /// </summary>
            [StringLength(36)]
            public string FMtoNo { get; set; } = "";
            /// <summary>
            /// 入库日期  
            /// </summary>
            //public DateTime FBusinessDate { get; set; }
            /// <summary>
            /// 有效期至  
            /// </summary>
            //[DataType(DataType.Date)]
            //public string FExpiryDate { get; set; }
            /// <summary>
            /// 调出货主类型   (必填项) 
            /// </summary>
            [StringLength(36)]
            public string FOwnerTypeOutId { get; set; }
            /// <summary>
            /// 调出货主      (必填项)  
            /// </summary>
            public Dictionary<string, string> FOwnerOutId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 调入货主类型   (必填项) 
            /// </summary>
            [StringLength(36)]
            public string FOwnerTypeId { get; set; } = "BD_OwnerOrg";
            /// <summary>
            /// 调入货主      (必填项)  
            /// </summary>
            public Dictionary<string, string> FOwnerId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",LocalStaticRequest.DefaultOrg}
        };
            /// <summary>
            ///  结算组织      (VMI必填项)  
            /// </summary>
            public Dictionary<string, string> FSettleOrgId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 备注
            /// </summary>
            [StringLength(36)]
            public string FNoteEntry { get; set; }
            /// <summary>
            /// 项目编号
            /// </summary>
            [StringLength(36)]
            public string FProjectNo { get; set; }
            /// <summary>
            /// 调入保管者类型    (必填项)
            /// </summary>
            [StringLength(36)]
            public string FKeeperTypeId { get; set; } = "BD_KeeperOrg";
            /// <summary>
            /// 实收数量
            /// </summary>
            public decimal FActQty { get; set; } 
            /// <summary>
            /// 调入保管者    (必填项)
            /// </summary>
            public Dictionary<string, string> FKeeperId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",LocalStaticRequest.DefaultOrg}
        };
            /// <summary>
            /// 调出保管者类型    (必填项)
            /// </summary>
            [StringLength(36)]
            public string FKeeperTypeOutId { get; set; } = "BD_KeeperOrg";
            /// <summary>
            /// 调出保管者    (必填项)
            /// </summary>
            public Dictionary<string, string> FKeeperOutId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",LocalStaticRequest.DefaultOrg}
        };
            /// <summary>
            /// 折扣率%
            /// </summary>
            public decimal FDiscountRate { get; set; } 
            /// <summary>
            /// 补货数量
            /// </summary>
            public decimal FRepairQty { get; set; } 
            /// <summary>
            /// 退货备注
            /// </summary>
            [StringLength(36)]
            public string FRETURNNOTE { get; set; } 
            /// <summary>
            /// 调入批号
            /// </summary>
            public Dictionary<string, string> FDestLot { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 调入BOM
            /// </summary>
            public Dictionary<string, string> FDestBomId { get; set; } = new Dictionary<string, string>() {
            { "FNUMBER",""}
        };
            /// <summary>
            /// 销售数量
            /// </summary>
            public decimal FSaleQty { get; set; } 
            /// <summary>
            /// 基本单位数量
            /// </summary>
            public decimal FBaseQty { get; set; } 
            /// <summary>
            /// 转移预留关系  
            /// </summary>
            public bool FTransReserveLink { get; set; } = false;
            /// <summary>
            /// 发货检验  
            /// </summary>
            public bool FCheckDelivery { get; set; } = false;
            /// <summary>
            /// BOM分录内码
            /// </summary>          
            public int FBomEntryId { get; set; }
            ///// <summary>
            ///// 更新库存标志
            ///// </summary>
            //public string FStockOutFlag { get; set; } = "1";
            ///// <summary>
            ///// 更新库存标志
            ///// </summary>
            //public string FStockInFlag { get; set; } = "1";

            /// <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 List<BillEntry_Link> FBillEntry_Link { get; set; } = new List<BillEntry_Link>();
            public class BillEntry_Link
            {
                /// <summary>
                /// 实体主键，新建时为空，由系统自动填充
                /// </summary>
                public string FLinkId { get; set; }
                public string FBillEntry_Link_FFlowId { get; set; }
                public string FBillEntry_Link_FFlowLineId { get; set; }
                public string FBillEntry_Link_FRuleId { get; set; }// = "DeliveryNotice-StkTransferDirect";         /这是发货通知转调拨单的...
                public int FBillEntry_Link_FSTableId { get; set; } = 0;
                public string FBillEntry_Link_FSTableName { get; set; } //= "T_SAL_DELIVERYNOTICE";
                /// <summary>
                /// 系统源单内码
                /// </summary>
                public int FBillEntry_Link_FSBillId { get; set; }  //要二次查询，或者由MES提供。一般二次查询...
                /// <summary>
                /// 系统源单分录内码
                /// </summary>
                public int FBillEntry_Link_FSId { get; set; }  //要二次查询，或者由MES提供。一般二次查询...
                public decimal FBillEntry_Link_FBaseQtyOld { get; set; }     //原始携带量
                public decimal FBillEntry_Link_FBaseQty { get; set; }    //修改携带量
                public decimal FBillEntry_Link_FSalBaseQtyOld { get; set; }     //原始携带量
                public decimal FBillEntry_Link_FSalBaseQty { get; set; }    //修改携带量
            }
        }




        /// <summary>
        ///  序列号子单据体  
        /// </summary>
        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; } 
        }
    }
}
