/// <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 GetOrderJsjList(string loginID, BzjOrderEntity bzjEntity, int pageindex,
            int pagesize, ref int page, ref ObservableCollection<BzjOrderEntity> retrnList, int roleType)
        {
            try
            {
                retrnList.Clear();
                OrderEntity entity = new OrderEntity();
                entity.Account = bzjEntity.Account;//客户账号
                entity.OrderNo = bzjEntity.OrderNO;//单号
                entity.Name = bzjEntity.Name;//姓名
                entity.OrderCode = bzjEntity.OrderCode;//验证码
                entity.CreateDate = bzjEntity.CreateDate;//提货开始时间
                entity.EndDate = bzjEntity.EndDate;//提货结束时间

                List<OrderEntity> list = new List<OrderEntity>();
                EntityBase result = _IManagerBzj.GetOrderJsjList(loginID, entity, pageindex, pagesize, ref page, ref list, roleType);
                if (result.Result)
                {
                    list = list.OrderByDescending(p=>p.CreateDate).ToList();
                    foreach (OrderEntity item in list)
                    {
                        BzjOrderEntity newBzjOrderEntity = new BzjOrderEntity();
                        newBzjOrderEntity.Name = item.Name;
                        newBzjOrderEntity.Account = item.Account;
                        newBzjOrderEntity.OrderNO = item.OrderNo;
                        //newBzjOrderEntity.OrderCode = item.OrderCode;
                        ////newBzjOrderEntity.CarryWay = item.CarryWay;
                        newBzjOrderEntity.Au = item.Au;
                        newBzjOrderEntity.Ag = item.Ag;
                        newBzjOrderEntity.Pt = item.Pt;
                        newBzjOrderEntity.Pd = item.Pd;
                        ////newBzjOrderEntity.AgQuantity = item.AgQuantity;
                        ////newBzjOrderEntity.AuQuantity = item.AuQuantity;
                        ////newBzjOrderEntity.PtQuantity = item.PtQuantity;
                        ////newBzjOrderEntity.PdQuantity = item.PdQuantity;
                        newBzjOrderEntity.AuP = item.AuP;
                        newBzjOrderEntity.AgP = item.AgP;
                        newBzjOrderEntity.PtP = item.PtP;
                        newBzjOrderEntity.PdP = item.PdP;
                        newBzjOrderEntity.CreateDate = item.CreateDate;
                        //newBzjOrderEntity.OperationDate = item.OperationDate;
                        newBzjOrderEntity.State = item.State;
                        //newBzjOrderEntity.OrderType = item.OrderType;

                        retrnList.Add(newBzjOrderEntity);
                    }
                }
                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 GetOrderBackList(string loginID, BzjOrderEntity bzjEntity,
            int pageindex, int pagesize, ref int page, ref ObservableCollection<BzjOrderEntity> retrnList, int roleType)
        {
            try
            {
                retrnList.Clear();
                OrderEntity entity = new OrderEntity();
                entity.Account = bzjEntity.Account;//客户账号
                entity.OrderNo = bzjEntity.OrderNO;//单号
                entity.Name = bzjEntity.Name;//姓名
                entity.OrderCode = bzjEntity.OrderCode;//验证码
                entity.CreateDate = bzjEntity.CreateDate;//提货开始时间
                entity.EndDate = bzjEntity.EndDate;//提货结束时间

                List<OrderEntity> list = new List<OrderEntity>();
                EntityBase result = _IManagerBzj.GetOrderBackList(loginID, entity, pageindex, pagesize, ref page, ref list, roleType);
                if (result.Result)
                {
                    list = list.OrderByDescending(p => p.CreateDate).ToList();
                    foreach (OrderEntity item in list)
                    {
                    //          <!--客户账号	姓名	单号	黄金买跌重量	黄金买跌单价	黄金成本单价	白银买跌重量	
                    //白银买跌单价	白银成本单价	铂金买跌重量	铂金买跌单价	铂金成本单价	钯金买跌重量
                    //钯金买跌单价	钯金成本单价	总买跌款	买跌时间	付款时间	操作员	状态-->
                        BzjOrderEntity newBzjOrderEntity = new BzjOrderEntity();
                        newBzjOrderEntity.Name = item.Name;
                        newBzjOrderEntity.Account = item.Account;
                        newBzjOrderEntity.OrderNO = item.OrderNo;
                        //newBzjOrderEntity.OrderCode = item.OrderCode;
                        //newBzjOrderEntity.CarryWay = item.CarryWay;
                        newBzjOrderEntity.Au = item.Au;//重量 
                        newBzjOrderEntity.Ag = item.Ag;
                        newBzjOrderEntity.Pt = item.Pt;
                        newBzjOrderEntity.Pd = item.Pd;
                        //newBzjOrderEntity.AgQuantity = item.AgQuantity;
                        //newBzjOrderEntity.AuQuantity = item.AuQuantity;
                        //newBzjOrderEntity.PtQuantity = item.PtQuantity;
                        //newBzjOrderEntity.PdQuantity = item.PdQuantity;
                        newBzjOrderEntity.AuP = item.AuP;//平均价/买跌价
                        newBzjOrderEntity.AgP = item.AgP;
                        newBzjOrderEntity.PtP = item.PtP;
                        newBzjOrderEntity.PdP = item.PdP;

                        newBzjOrderEntity.TotalBackPrice = item.Au*item.AuP + item.Ag*item.AgP + item.Pt*item.PtP +
                                                           item.Pd * item.PdP;

                        newBzjOrderEntity.AuCost = item.AuCost;//成本价
                        newBzjOrderEntity.AgCost = item.AgCost;
                        newBzjOrderEntity.PtCost = item.PtCost;
                        newBzjOrderEntity.PdCost = item.PtCost;

                        newBzjOrderEntity.CreateDate = item.CreateDate;//买跌时间
                        newBzjOrderEntity.OperationDate = item.OperationDate;//付款时间
                        newBzjOrderEntity.ClerkId = item.ClerkID;         //操作员
                        //newBzjOrderEntity.OrderType = item.OrderType;
                        newBzjOrderEntity.State = item.State;
                        retrnList.Add(newBzjOrderEntity);
                    }
                }
                return result.Result ? GeneralErr.Success : new ErrType(ERR.SERVICE, result.Desc);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + ex.StackTrace);
                return null;
            }
        }
        public void GetJgjGoodsExecute()
        {
            if (JgjGoodsList != null && JgjGoodsList.Count > 0)
                JgjGoodsList.Clear();
            BzjOrderEntity entity = new BzjOrderEntity();

            entity.Account = JgjGoodsCondition.Account;//客户账号
            entity.OrderNO = JgjGoodsCondition.OrderNO;//单号
            entity.Name = JgjGoodsCondition.UserName;//姓名
            entity.OrderCode = JgjGoodsCondition.OrderCode;//验证码
            entity.CreateDate = JgjGoodsCondition.StartTime.ToString();//提货开始时间
            entity.EndDate = JgjGoodsCondition.EndTime.AddDays(1).ToString();//提货结束时间
            int pageCount = 0;
            ErrType err = _bzjService.GetOrderJsjList(_loginID, entity, JgjGoodsCondition.PageIndex,
                JgjGoodsCondition.PageSize, ref pageCount, ref _JgjGoodsList, (int)_accType);
            if (err.Err != ERR.SUCCESS)
            {
                MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                JgjGoodsCondition.PageCount = pageCount;
                JgjGoodsList = _JgjGoodsList;
            }
        }
        /// <summary>
        /// 定单明细
        /// </summary>
        /// <param name="loginID"></param>
        /// <param name="orderCode"></param>
        /// <param name="bzjInfo"></param>
        /// <returns></returns>
        public ErrType GetOrderNOInfo(string loginID, string orderCode, ref BzjOrderEntity bzjInfo, int roleType)
        {
            try
            {
                OrderEntity info = _IManagerBzj.GetOrderNOInfo(loginID, orderCode, roleType);
                bzjInfo = MyConverter.ToBzjOrderEntity(info);
                return info.Result ? GeneralErr.Success : new ErrType(ERR.SERVICE, info.Desc);

            }
            catch (Exception ex)
            {
                Console.WriteLine("用户库存信息查询:" + ex.Message + ex.StackTrace);
                return null;
            }
        }
        /// <summary>
        /// 更新买跌单
        /// </summary>
        /// <param name="selectData"></param>
        public void UpdateBuyBackOrder(BzjOrderEntity selectData)
        {
            ErrType err = _bzjService.UpdateBuyBackOrder(_loginID, selectData.OrderNO, _accName, (int)_accType);
            if (err.Err != ERR.SUCCESS)
            {
                MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Error);

            }
            else
            {
                MessageBox.Show("更新成功", "提示信息", MessageBoxButton.OK, MessageBoxImage.Information);
                selectData.OperationDate = DateTime.Now.ToShortDateString();//付款时间
                selectData.ClerkId = _accName;
                selectData.State = 2;//状态更新为完成
            }
        }