/// <summary>
        /// 金商交割单查询
        /// </summary>
        /// <param name="loginID">登录ID</param>
        /// <param name="bzjEntity">查询实体</param>
        /// <param name="userName">用户姓名</param>
        /// <param name="pageindex">当前页</param>
        /// <param name="pagesize">页大小</param>
        /// <param name="page">总页面</param>
        /// <param name="bzjDeliverList">返回数据集</param>
        /// <returns></returns>
        public ErrType GetDeliverOrderList(string loginID, BzjDeliverEntity bzjEntity, string userName,
                                           int pageindex, int pagesize, ref int page, ref ObservableCollection <BzjDeliverEntity> bzjDeliverList, int roleType)
        {
            try
            {
                bzjDeliverList.Clear();
                DeliverEntity entity = new DeliverEntity();
                entity.Account    = bzjEntity.Account;    //客户账号
                entity.DeliverNo  = bzjEntity.DeliverNo;  //单号
                entity.CreateDate = bzjEntity.CreateDate; //提货开始时间
                entity.EndDate    = bzjEntity.EndDate;    //提货结束时间

                List <DeliverEntity> list   = new List <DeliverEntity>();
                EntityBase           result = _IManagerBzj.GetDeliverOrderList(loginID, entity, userName, pageindex, pagesize, ref page, ref list, roleType);

                if (result.Result)
                {
                    list = list.OrderByDescending(p => p.CreateDate).ToList();
                    foreach (DeliverEntity item in list)
                    {
                        BzjDeliverEntity newBzjDeliverEntity = new BzjDeliverEntity();
                        newBzjDeliverEntity.UserName    = item.UserName;    //		姓名
                        newBzjDeliverEntity.Account     = item.Account;     //	客户账号
                        newBzjDeliverEntity.DeliverNo   = item.DeliverNo;   //  交割单号
                        newBzjDeliverEntity.DeliverDate = item.DeliverDate; //	日期
                        //方向 提货单 = 1,买跌单 = 2,金生金 = 3,到期单 = 5,已生金单 = 6,提成单 = 7,金店库存同步 = 8,实物受理=9,金商转库=10,公司提成=11,大区提成=12,库存调整=13
                        newBzjDeliverEntity.Direction = item.Direction;

                        newBzjDeliverEntity.Total          = item.Total;          //交割单总数量
                        newBzjDeliverEntity.AvailableTotal = item.AvailableTotal; //	可用数量
                        newBzjDeliverEntity.Goods          = item.Goods;          //商品类型
                        newBzjDeliverEntity.LockPrice      = item.LockPrice;      //交割价
                        newBzjDeliverEntity.CreateDate     = item.CreateDate;     //	交割时间
                        newBzjDeliverEntity.State          = item.State;          //禁用 = 0,正常 = 1
                        bzjDeliverList.Add(newBzjDeliverEntity);
                    }
                }
                return(result.Result ? GeneralErr.Success : new ErrType(ERR.SERVICE, result.Desc));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + ex.StackTrace);
                return(null);
            }
        }
 /// <summary>
 /// 实物入库\增加库存
 /// </summary>
 /// <param name="userID">客户用户ID</param>
 /// <param name="loginAccountName">登录用户名</param>
 /// <param name="accountName">被操作用户名</param>
 /// <param name="orderType">定单类型 1入库 2 买跌</param>
 /// <param name="Product">入库商品类别XAU黄金 XAG白银 XPT铂金 XPD巴金</param>
 /// <param name="loginID">登录标识ID</param>
 /// <param name="deliverNo">定单编码</param>
 /// <param name="total">数量</param>
 /// <param name="price">价格</param>
 /// <param name="direction">交割单表方向: 9 实物入库 13 库存调整</param>
 /// <returns></returns>
 public ErrType CreateDeliverAdmin(string userID, string loginAccountName, string userName, string orderType,
                                   string Product, string loginID, string deliverNo, decimal total, double price, int direction, int roleType)
 {
     try
     {
         DeliverEntity entity = new DeliverEntity();
         entity.UserID          = userID;
         entity.DeliverNo       = deliverNo;
         entity.OperationUserID = loginAccountName;
         entity.Total           = total;
         entity.LockPrice       = (decimal)price;
         entity.Account         = userName;
         entity.Direction       = direction;
         ResultDesc result = _IManagerBzj.CreateDeliverAdmin(entity, orderType, Product, loginID, roleType);
         return(result.Result ? GeneralErr.Success : new ErrType(ERR.SERVICE, result.Desc));
     }
     catch (Exception ex)
     {
         Console.WriteLine(@"实物入库\增加库存:" + ex.Message + ex.StackTrace);
         return(null);
     }
 }
        /// <summary>
        /// 实物入库\增加库存
        /// </summary>
        /// <param name="userID">客户用户ID</param>
        /// <param name="loginAccountName">登录用户名</param>
        /// <param name="accountName">被操作用户名</param>
        /// <param name="orderType">定单类型 1入库 2 买跌</param>
        /// <param name="Product">入库商品类别XAU黄金 XAG白银 XPT铂金 XPD巴金</param>
        /// <param name="loginID">登录标识ID</param>
        /// <param name="deliverNo">定单编码</param>
        /// <param name="total">数量</param>
        /// <param name="price">价格</param>
        /// <param name="direction">交割单表方向: 9 实物入库 13 库存调整</param>
        /// <returns></returns>
        public ErrType CreateDeliverAdmin(string userID, string loginAccountName, string userName, string orderType,
            string Product, string loginID, string deliverNo, decimal total, double price, int direction, int roleType)
        {
            try
            {
                DeliverEntity entity = new DeliverEntity();
                entity.UserID = userID;
                entity.DeliverNo = deliverNo;
                entity.OperationUserID = loginAccountName;
                entity.Total = total;
                entity.LockPrice = (decimal)price;
                entity.Account = userName;
                entity.Direction = direction;
                ResultDesc result = _IManagerBzj.CreateDeliverAdmin(entity, orderType, Product, loginID, roleType);
                return result.Result ? GeneralErr.Success : new ErrType(ERR.SERVICE, result.Desc);

            }
            catch (Exception ex)
            {
                Console.WriteLine(@"实物入库\增加库存:" + ex.Message + ex.StackTrace);
                return null;
            }
        }
        /// <summary>
        /// 金商交割单查询
        /// </summary>
        /// <param name="loginID">登录ID</param>
        /// <param name="bzjEntity">查询实体</param>
        /// <param name="userName">用户姓名</param>
        /// <param name="pageindex">当前页</param>
        /// <param name="pagesize">页大小</param>
        /// <param name="page">总页面</param>
        /// <param name="bzjDeliverList">返回数据集</param>
        /// <returns></returns>
        public ErrType GetDeliverOrderList(string loginID, BzjDeliverEntity bzjEntity, string userName,
            int pageindex, int pagesize, ref int page, ref ObservableCollection<BzjDeliverEntity> bzjDeliverList, int roleType)
        {
            try
            {
                bzjDeliverList.Clear();
                DeliverEntity entity = new DeliverEntity();
                entity.Account = bzjEntity.Account;//客户账号
                entity.DeliverNo = bzjEntity.DeliverNo;//单号
                entity.CreateDate = bzjEntity.CreateDate;//提货开始时间
                entity.EndDate = bzjEntity.EndDate;//提货结束时间

                List<DeliverEntity> list = new List<DeliverEntity>();
                EntityBase result = _IManagerBzj.GetDeliverOrderList(loginID, entity, userName, pageindex, pagesize, ref page, ref list, roleType);

                if (result.Result)
                {
                    list = list.OrderByDescending(p => p.CreateDate).ToList();
                    foreach (DeliverEntity item in list)
                    {
                        BzjDeliverEntity newBzjDeliverEntity = new BzjDeliverEntity();
                        newBzjDeliverEntity.UserName = item.UserName;//		姓名
                        newBzjDeliverEntity.Account = item.Account;	//	客户账号
                        newBzjDeliverEntity.DeliverNo = item.DeliverNo;// 	交割单号
                        newBzjDeliverEntity.DeliverDate = item.DeliverDate;	//	日期
                        //方向 提货单 = 1,买跌单 = 2,金生金 = 3,到期单 = 5,已生金单 = 6,提成单 = 7,金店库存同步 = 8,实物受理=9,金商转库=10,公司提成=11,大区提成=12,库存调整=13
                        newBzjDeliverEntity.Direction = item.Direction;
                       
                        newBzjDeliverEntity.Total = item.Total;	//交割单总数量
                        newBzjDeliverEntity.AvailableTotal = item.AvailableTotal;//	可用数量
                        newBzjDeliverEntity.Goods = item.Goods;//商品类型
                        newBzjDeliverEntity.LockPrice = item.LockPrice;//交割价
                        newBzjDeliverEntity.CreateDate = item.CreateDate;//	交割时间
                        newBzjDeliverEntity.State = item.State;//禁用 = 0,正常 = 1 
                        bzjDeliverList.Add(newBzjDeliverEntity);
                    }
                }
                return result.Result ? GeneralErr.Success : new ErrType(ERR.SERVICE, result.Desc);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + ex.StackTrace);
                return null;
            }
        }