Beispiel #1
0
    /// <summary>
    /// 促销信息
    /// </summary>
    /// <param name="ProID">促销ID</param>
    /// <param name="GoodInfoID">GoodsInfoID</param>
    /// <returns></returns>
    public BD_GoodsCategory.PromotionInfo GetProInfo(int ProID, int GoodInfoID)
    {
        Hi.Model.BD_Promotion pro = new Hi.BLL.BD_Promotion().GetModel(ProID);
        if (pro != null)
        {
            string proInfos = string.Empty;

            List <Hi.Model.BD_PromotionDetail> dList = new Hi.BLL.BD_PromotionDetail()
                                                       .GetList("", " ProID=" + pro.ID + " and GoodInfoID ='" + GoodInfoID + "' and dr=0",
                                                                "");
            if (dList != null && dList.Count > 0)
            {
                if (pro.Type == 0 && pro.ProType == 1)
                {
                    proInfos = "赠品";
                }
                else if (pro.Type == 0 && pro.ProType == 2)
                {
                    proInfos = "商品优惠价" + dList[0].GoodsPrice.ToString("0.00");
                }
                else if (pro.Type == 1 && pro.ProType == 3)
                {
                    proInfos = "商品数量满" + pro.Discount.ToString("0.00") + "赠" +
                               dList[0].GoodsPrice.ToString("0.00") + dList[0].GoodsUnit;
                }
                else if (pro.Type == 1 && pro.ProType == 4)
                {
                    proInfos = "商品打折" + pro.Discount.ToString("0.00") + "%";
                }
            }

            return(new BD_GoodsCategory.PromotionInfo()
            {
                ProID = ProID.ToString(),
                ProTitle = pro.ProTitle,
                ProInfos = proInfos,

                Tpye = pro.Type.ToString(),
                ProTpye = pro.ProType.ToString(),
                Discount = pro.Discount.ToString("0.00"),

                ProStartTime = pro.ProStartTime.ToString("yy-MM-dd"),
                ProEndTime = pro.ProEndTime.ToString("yy-MM-dd")
            });
        }
        else
        {
            return(null);
        }
    }
Beispiel #2
0
    /// <summary>
    /// 促销
    /// </summary>
    /// <returns></returns>
    public string Cuxiao(string goodsInfoId)
    {
        string str = string.Empty;
        List <Hi.Model.BD_PromotionDetail> pd = new Hi.BLL.BD_PromotionDetail().GetList("", "isnull(dr,0)=0 and Goodinfoid=" + goodsInfoId, " id  desc");

        if (pd.Count > 0)
        {
            for (int i = 0; i < pd.Count; i++)
            {
                List <Hi.Model.BD_Promotion> pt = new Hi.BLL.BD_Promotion().GetList("", "isnull(IsEnabled,0)=1 and isnull(dr,0)=0 and ('" + DateTime.Now.Date + "' between  ProStartTime and ProEndTime ) and id=" + pd[i].ProID, "");
                if (pt.Count > 0)
                {
                    //if (pt[0].ProType.ToString() != "3")
                    //{
                    return(pt[0].ID.ToString());
                    // }
                }
            }
        }
        return(str);
    }
Beispiel #3
0
    /// <summary>
    /// 获取某一分类产品信息,兼容了无属性的值,分类传-1
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public BD_GoodsCategory.ResultProductList GetProductsList(string JSon)
    {
        try
        {
            #region JSon取值

            string userID            = string.Empty;
            string disID             = string.Empty;
            string categoryID        = string.Empty; //分类ID
            string criticalProductID = string.Empty; //当前列表最临界点产品ID:初始-1
            string getType           = string.Empty; //方向
            string rows     = string.Empty;
            string sortType = string.Empty;
            string sort     = string.Empty;

            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["ResellerID"].ToString() != "" &&
                JInfo["CriticalProductID"].ToString() != "" &&
                JInfo["GetType"].ToString() != "" && JInfo["Rows"].ToString() != "" &&
                JInfo["SortType"].ToString() != "" && JInfo["Sort"].ToString() != "")
            {
                userID            = JInfo["UserID"].ToString();
                disID             = JInfo["ResellerID"].ToString();
                categoryID        = JInfo["ClassifyID"].ToString();
                criticalProductID = JInfo["CriticalProductID"].ToString();
                getType           = JInfo["GetType"].ToString();
                rows     = JInfo["Rows"].ToString();
                sortType = JInfo["SortType"].ToString();
                sort     = JInfo["Sort"].ToString();
            }
            else
            {
                return(new BD_GoodsCategory.ResultProductList()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(userID), out user, 0, int.Parse(disID == "" ? "0" : disID)))
            {
                return new BD_GoodsCategory.ResultProductList()
                       {
                           Result = "F", Description = "参数异常"
                       }
            }
            ;

            #endregion

            #region 模拟分页

            string strsql = string.Empty; //搜索sql
            Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(int.Parse(disID));
            if (dis == null || dis.dr == 1 || dis.IsEnabled == 0)
            {
                return new BD_GoodsCategory.ResultProductList()
                       {
                           Result = "F", Description = "未找到经销商"
                       }
            }
            ;
            const string tabName = " [dbo].[BD_Goods]";      //表名
            sortType = sortType == "2" ? "SalePrice" : "ID"; //价格排序
            string strWhere = string.Empty;

            switch (categoryID)
            {
            case "-2":     //促销列表
            {
                List <Hi.Model.BD_Promotion> promotionList = new Hi.BLL.BD_Promotion().GetList("",
                                                                                               " compID='" + dis.CompID + "' and ProStartTime<='" + DateTime.Now + "' and ProEndTime >='" +
                                                                                               DateTime.Now + "' and IsEnabled=1", "");
                List <Hi.Model.BD_PromotionDetail> detailList = new List <BD_PromotionDetail>();
                if (promotionList != null && promotionList.Count > 0)
                {
                    detailList = new Hi.BLL.BD_PromotionDetail().GetList("",
                                                                         " ProID in(" + string.Join(",", promotionList.Select(p => p.ID)) + ")", "");
                }
                if (promotionList == null)
                {
                    return new BD_GoodsCategory.ResultProductList()
                           {
                               Result = "F", Description = "今天无促销"
                           }
                }
                ;
                if (detailList == null)
                {
                    return new BD_GoodsCategory.ResultProductList()
                           {
                               Result = "F", Description = "今天无促销"
                           }
                }
                ;
                var ienum = detailList.Select(p => p.GoodsID);
                if (ienum.Count() > 0)
                {
                    strWhere += " and ID in ( " + string.Join(",", ienum) + ")";
                }
            }
            break;

            case "-3":     //收藏列表
            {
                List <Hi.Model.BD_DisCollect> collects = new Hi.BLL.BD_DisCollect().GetList("",
                                                                                            "disID='" + disID + "' and dr=0", "");
                if (collects != null)
                {
                    strWhere += " and ID not in ( -1 ";
                    strWhere  = collects.Aggregate(strWhere, (current, goods) => current + ("," + goods.GoodsID)) +
                                ")";
                }
            }
            break;

            default:
                if (categoryID != "-1")     //全部
                {
                    strWhere += " and CategoryID in (" + Common.AllCategory(int.Parse(categoryID)) + ")";
                }
                break;
            }

            //商品可售区域判断
            List <Common.GoodsID> list = Common.DisEnAreaGoodsID(disID, dis.CompID.ToString());
            if (list != null)
            {
                strWhere += " and ID not in ( -1 ";
                strWhere  = list.Aggregate(strWhere, (current, goods) => current + ("," + goods.goodsID)) + ")";
            }
            strWhere += " and ISNULL(dr,0)=0 and isoffline=1 and IsEnabled = 1 and compid=" + dis.CompID;

            strsql = new Common().PageSqlString(criticalProductID, "ID", tabName, sortType,
                                                sort, strWhere, getType, rows);

            #endregion

            List <Hi.Model.BD_DisCollect> Colist = Common.GetDataSource <BD_DisCollect>("",
                                                                                        " and disID='" + disID + "' and compID='" + dis.CompID + "' and IsEnabled =1");
            List <Hi.Model.BD_GoodsInfo> infoAllList = new Hi.BLL.BD_GoodsInfo().GetList("",
                                                                                         " CompID='" + dis.CompID + "' and ISNULL(dr,0)=0 and IsEnabled=1 and isoffline=1", "");

            #region 赋值

            int CategoryID = 0;

            List <BD_GoodsCategory.Product> ProductList = new List <BD_GoodsCategory.Product>();
            DataTable dsList = SqlHelper.Query(SqlHelper.LocalSqlServer, strsql).Tables[0];
            if (dsList != null)
            {
                if (dsList.Rows.Count == 0)
                {
                    return new BD_GoodsCategory.ResultProductList()
                           {
                               Result = "F", Description = "未找到数据"
                           }
                }
                ;
                foreach (DataRow row in dsList.Rows)
                {
                    string SKUName = string.Empty;

                    BD_GoodsCategory.Product product = new BD_GoodsCategory.Product();
                    product.ProductID   = row["ID"].ToString(); //商品ID
                    product.ProductName = row["GoodsName"].ToString();
                    SKUName            += product.ProductName;
                    product.SalePrice   = decimal.Parse(row["SalePrice"].ToString()).ToString("0.00");
                    product.IsSale      = row["IsSale"].ToString();

                    List <Hi.Model.BD_DisCollect> alist = Colist != null && Colist.Count > 0
                        ? Colist.Where(p => p.GoodsID.ToString() == product.ProductID).ToList()
                        : null;
                    product.IsCollect = alist != null && alist.Count > 0 ? "1" : "0";
                    product.Title     = row["Title"].ToString();
                    //product.Details = row["Details"].ToString();
                    product.Title      = row["Title"].ToString();
                    product.Unit       = row["Unit"].ToString();
                    product.ClassifyID = row["CategoryID"].ToString();
                    CategoryID         = int.Parse(row["CategoryID"].ToString()); //类别ID

                    List <BD_GoodsCategory.Pic> Pic = new List <BD_GoodsCategory.Pic>();

                    #region List<Pic> Pic

                    if (row["Pic"].ToString() != "" && row["Pic"].ToString() != "X")
                    {
                        BD_GoodsCategory.Pic pic = new BD_GoodsCategory.Pic();
                        pic.ProductID = row["ID"].ToString();
                        pic.IsDeafult = "1";
                        pic.PicUrl    = ConfigurationManager.AppSettings["ImgViewPath"].ToString().Trim() + "GoodsImg/" +
                                        row["Pic"].ToString();
                        Pic.Add(pic);
                    }

                    Pic.AddRange(GetPicList(row["ID"].ToString()));

                    #endregion

                    product.ProductPicUrlList = Pic;

                    List <BD_GoodsCategory.SKU> SKUList = new List <BD_GoodsCategory.SKU>();
                    string strID = "0";

                    #region 通过 商品ID和属性值ID关联表,找到属性值

                    List <Hi.Model.BD_GoodsInfo> goodsInfoList = infoAllList != null && infoAllList.Count > 0
                        ? infoAllList.Where(p => p.GoodsID.ToString() == row["ID"].ToString()).ToList()
                        : null;
                    foreach (Hi.Model.BD_GoodsInfo goodsInfo in goodsInfoList)
                    {
                        if (!Common.IsOffline(goodsInfo.ID))
                        {
                            continue;
                        }

                        BD_GoodsCategory.SKU SKU = new BD_GoodsCategory.SKU();
                        //SKUID是GoodsInfoID,SKUName是GoodsName+各种属性值
                        SKU.SKUID     = goodsInfo.ID.ToString();
                        SKU.ProductID = goodsInfo.GoodsID.ToString();
                        SKU.BarCode   = goodsInfo.BarCode;
                        //SKUName = GoodsName + ValueInfo
                        SKU.SKUName = SKUName + " " + goodsInfo.ValueInfo;

                        SKU.ValueInfo = goodsInfo.ValueInfo;
                        SKU.SalePrice = goodsInfo.SalePrice.ToString("0.00");

                        int ProID = 0;   //暂时未用到 促销ID
                        SKU.IsPro = "0"; //默认不是促销价
                        decimal price = Common.GetProPrice(goodsInfo.GoodsID.ToString(), goodsInfo.ID.ToString(),
                                                           goodsInfo.CompID.ToString(), out ProID);
                        if (price == 0)
                        {
                            List <Hi.Model.BD_GoodsPrice> goodsPrice = new Hi.BLL.BD_GoodsPrice().GetList("",
                                                                                                          " GoodsInfoID='" + goodsInfo.ID + "' and ISNULL(dr,0)=0 and compid='" + goodsInfo.CompID +
                                                                                                          "' and IsEnabled=1", "");
                            SKU.TinkerPrice = goodsPrice.Count != 0
                                ? goodsPrice[0].TinkerPrice.ToString("0.00")
                                : goodsInfo.TinkerPrice.ToString("0.00");
                        }
                        else
                        {
                            SKU.IsPro       = "1"; //是促销价
                            SKU.ProInfo     = GetProInfo(ProID, goodsInfo.ID);
                            SKU.TinkerPrice = price.ToString("0.00");
                        }


                        List <BD_GoodsCategory.ProductAttValueID> ProductAttValueIDList = new List <BD_GoodsCategory.ProductAttValueID>();

                        List <Hi.Model.BD_GoodsAttrsInfo> attrList = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", " GoodsID='" + goodsInfo.GoodsID + "' and ISNULL(dr,0)=0", "");
                        if (attrList == null)
                        {
                            return new BD_GoodsCategory.ResultProductList()
                                   {
                                       Result = "F", Description = "未找到商品属性名字"
                                   }
                        }
                        ;
                        List <Hi.Model.BD_GoodsAttrs> attrValList = new Hi.BLL.BD_GoodsAttrs().GetList("*", " CompID ='" + dis.CompID + "'", "");
                        foreach (Hi.Model.BD_GoodsAttrsInfo attribute in attrList)
                        {
                            strID += "," + attribute.AttrsID;

                            string[] args  = new[] { goodsInfo.ValueInfo };
                            string[] items = args[0].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                            foreach (string item in items)
                            {
                                string[] strs = item.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);

                                if (strs[1] == attribute.AttrsInfoName)
                                {
                                    BD_GoodsCategory.ProductAttValueID productAttValueID = new BD_GoodsCategory.ProductAttValueID()
                                    {
                                        ProductAttributeValueID = attribute.ID.ToString()//
                                    };
                                    ProductAttValueIDList.Add(productAttValueID);
                                }
                            }
                        }

                        SKU.ProductAttValueIDList = ProductAttValueIDList;
                        SKUList.Add(SKU);
                    }

                    #endregion

                    product.SKUList = SKUList;

                    List <BD_GoodsCategory.ProductAttribute> ProductAttributeList = new List <BD_GoodsCategory.ProductAttribute>();

                    #region 通过商品类别ID和属性ID关联表,找到属性ID

                    List <Hi.Model.BD_GoodsAttrs> val = new Hi.BLL.BD_GoodsAttrs().GetList("", " ID in (" + strID + ") and CompID='" + dis.CompID + "' and ISNULL(dr,0)=0", "");
                    if (val == null)
                    {
                        return new BD_GoodsCategory.ResultProductList()
                               {
                                   Result = "F", Description = "未找到商品属性"
                               }
                    }
                    ;

                    foreach (Hi.Model.BD_GoodsAttrs goodsAttr in val)
                    {
                        BD_GoodsCategory.ProductAttribute proAttr = new BD_GoodsCategory.ProductAttribute();

                        proAttr.ProductID            = row["ID"].ToString();
                        proAttr.ProductAttributeID   = goodsAttr.ID.ToString(); //属性ID
                        proAttr.ProductAttributeName = goodsAttr.AttrsName;     //属性名称

                        List <BD_GoodsCategory.ProductAttValue> ProductAttValueList = new List <BD_GoodsCategory.ProductAttValue>();

                        List <Hi.Model.BD_GoodsAttrsInfo> attrList = new Hi.BLL.BD_GoodsAttrsInfo().GetList("",
                                                                                                            " AttrsID='" + goodsAttr.ID + "' and CompID='" + dis.CompID + "' and ISNULL(dr,0)=0" +
                                                                                                            " and AttrsID in (" + strID + ")", "ID"); //todo:商品属性表修改咨询商品结构
                        if (attrList == null)
                        {
                            return new BD_GoodsCategory.ResultProductList()
                                   {
                                       Result = "F", Description = "未找到商品属性名字"
                                   }
                        }
                        ;
                        foreach (Hi.Model.BD_GoodsAttrsInfo attribute in attrList)
                        {
                            BD_GoodsCategory.ProductAttValue productAttValue = new BD_GoodsCategory.ProductAttValue();

                            productAttValue.ProductID           = row["ID"].ToString();
                            productAttValue.ProductAttributeID  = goodsAttr.ID.ToString();
                            productAttValue.ProductAttValueID   = attribute.ID.ToString();
                            productAttValue.ProductAttValueName = attribute.AttrsInfoName;

                            ProductAttValueList.Add(productAttValue);
                        }
                        proAttr.ProductAttValueList = ProductAttValueList;
                        ProductAttributeList.Add(proAttr);
                    }

                    #endregion

                    product.ProductAttributeList = ProductAttributeList;

                    ProductList.Add(product);
                }
            }

            #endregion

            return(new BD_GoodsCategory.ResultProductList()
            {
                Result = "T",
                Description = "获取成功",
                ClassifyID = categoryID,
                ProductList = ProductList
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetResellerProductList :" + JSon);
            return(new BD_GoodsCategory.ResultProductList()
            {
                Result = "F", Description = "异常"
            });
        }
    }
Beispiel #4
0
    public ResultOrderList GetBriefingList(string JSon)
    {
        try
        {
            string UserID          = string.Empty;
            string CompID          = string.Empty;
            string criticalOrderID = string.Empty; //当前列表最临界点产品ID:初始-1
            string getType         = string.Empty; //方向
            string rows            = string.Empty;
            string sortType        = string.Empty;
            string sort            = string.Empty;
            string datetype        = string.Empty;
            string ordertype       = string.Empty;
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["CompID"].ToString() != "" &&
                JInfo["CriticalOrderID"].ToString() != "" && JInfo["GetType"].ToString() != "" &&
                JInfo["Rows"].ToString() != "" && JInfo["SortType"].ToString() != "" &&
                JInfo["Sort"].ToString() != "" && JInfo["DateType"].ToString() != "" && JInfo["OrderType"].ToString() != "")
            {
                UserID          = JInfo["UserID"].ToString();
                CompID          = JInfo["CompID"].ToString();
                criticalOrderID = JInfo["CriticalOrderID"].ToString();
                getType         = JInfo["GetType"].ToString();
                rows            = JInfo["Rows"].ToString();
                sortType        = JInfo["SortType"].ToString();
                sort            = JInfo["Sort"].ToString();
                datetype        = JInfo["DateType"].ToString();
                ordertype       = JInfo["OrderType"].ToString();
            }
            else
            {
                return(new ResultOrderList()
                {
                    Result = "F", Description = "参数异常"
                });
            }
            #endregion
            //判断登录信息是否异常
            Hi.Model.SYS_Users one = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out one, int.Parse(CompID == "" ? "0" : CompID)))
            {
                return new ResultOrderList()
                       {
                           Result = "F", Description = "登录信息异常"
                       }
            }
            ;
            //判断经销商信息是否异常
            Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(Convert.ToInt32(CompID));
            if (comp == null || comp.dr == 1 || comp.AuditState == 0 || comp.IsEnabled == 0)
            {
                return new ResultOrderList()
                       {
                           Result = "F", Description = "核心企业异常"
                       }
            }
            ;

            DateTime date       = DateTime.Now;
            DateTime date_start = new DateTime();
            DateTime date_end   = date.AddDays(1);
            //string strdate_start = string.Empty;
            // string strdate_end = date_end.ToString("yyyy-MM-dd");

            string strwhere = "";
            switch (datetype)
            {
            case "0":
                date_start = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);

                //strdate_start = date_start.ToString("yyyy-MM-dd");
                break;

            case "1":
                DateTime startWeek = date.AddDays(1 - Convert.ToInt32(date.DayOfWeek.ToString("d")));
                date_start = new DateTime(startWeek.Year, startWeek.Month, startWeek.Day, 0, 0, 0);
                //strdate_start = date_start.ToString("yyyy-MM-dd");
                break;

            case "2":
                date_start = new DateTime(date.Year, date.Month, 1);
                //strdate_start = date_start.ToString("yyyy-MM-dd");
                break;

            default:
                return(new ResultOrderList()
                {
                    Result = "F", Description = "时间段类型异常"
                });

                break;
            }
            switch (ordertype)
            {
            case "0":
                strwhere = " and  isnull(dr,0)=0 and Otype!=9 and CompID=" + comp.ID + " and OState in (2,3,4,5,7) and CreateDate>='" + date_start + "' and CreateDate<='" + date_end + "'";
                break;

            case "1":
                strwhere = " and  isnull(dr,0)=0 and CompID=" + comp.ID + " and  CreateDate>='" + date_start + "' and CreateDate<='" + date_end + "' and ReturnState =3";
                break;

            case "2":
                string sql = "SELECT distinct orderID FROM [dbo].[CompCollection_view] where OrderID not in(select ID from Dis_Order where ISNULL(dr,0)=0 and (Otype=9 or OState not in(2,3,4,5,7)) and CompID=" + comp.ID + ")  and status!=3 and CompID=" + comp.ID +
                             " and Date>='" + date_start + "' and Date<'" + date_end + "'  AND vedf9=1 ";
                DataTable dt_pay = SqlHelper.Query(SqlHelper.LocalSqlServer, sql).Tables[0];
                string where = "";
                for (int i = 0; i < dt_pay.Rows.Count; i++)
                {
                    if (ClsSystem.gnvl(dt_pay.Rows[i]["orderID"], "") != "")
                    {
                        where += ",";
                        where += ClsSystem.gnvl(dt_pay.Rows[i]["orderID"], "");
                    }
                }
                where    = where.Substring(1, where.Length - 1);
                strwhere = " and id in (" + where + ")";
                break;

            default:
                return(new ResultOrderList()
                {
                    Result = "F", Description = "订单类型异常"
                });

                break;
            }

            if (sortType == "1") //价格排序
            {
                sortType = "CreateDate";
            }
            else if (sortType == "2") //价格排序
            {
                sortType = "TotalAmount";
            }
            else
            {
                sortType = "ID";
            }

            string strsql = new Common().PageSqlString(criticalOrderID, "ID", "DIS_Order", sortType,
                                                       sort, strwhere, getType, rows);


            if (strsql == "")
            {
                return new ResultOrderList()
                       {
                           Result = "F", Description = "基础数据异常"
                       }
            }
            ;


            #region 赋值


            List <Order> OrderList = new List <Order>();
            DataSet      ds        = SqlHelper.Query(SqlHelper.LocalSqlServer, strsql);
            if (ds.Tables.Count == 0)
            {
                return new ResultOrderList()
                       {
                           Result = "T", Description = "没有更多数据"
                       }
            }
            ;
            DataTable orderList = ds.Tables[0];
            if (orderList != null)
            {
                if (orderList.Rows.Count == 0)
                {
                    return new ResultOrderList()
                           {
                               Result = "T", Description = "没有更多数据"
                           }
                }
                ;

                foreach (DataRow row in orderList.Rows)
                {
                    Order order = new Order();

                    Hi.Model.DIS_Order orderModel = new Hi.BLL.DIS_Order().GetModel(int.Parse(row["ID"].ToString()));
                    if (orderModel == null || orderModel.dr == 1)
                    {
                        return new ResultOrderList()
                               {
                                   Result = "F", Description = "订单异常"
                               }
                    }
                    ;
                    order.OrderID  = orderModel.ID.ToString();
                    order.CompID   = orderModel.CompID.ToString();
                    order.CompName = comp.CompName;

                    order.State = Common.GetCompOrderType(orderModel.OState, orderModel.PayState, orderModel.Otype,
                                                          orderModel.ReturnState);
                    string IsEnSend, IsEnPay, IsEnReceive, IsEnReturn, IsEnAudit;
                    Common.GetEspecialType(orderModel.OState.ToString(), orderModel.PayState.ToString(), orderModel.Otype.ToString(),
                                           orderModel.ReturnState.ToString(), out IsEnSend, out IsEnPay, out IsEnAudit, out IsEnReceive, out IsEnReturn);
                    order.IsEnSend    = IsEnSend;
                    order.IsEnPay     = IsEnPay;
                    order.IsEnAudit   = IsEnAudit;
                    order.IsEnReceive = IsEnReceive;
                    order.IsEnReturn  = IsEnReturn;

                    order.Otype       = orderModel.Otype.ToString();
                    order.AddType     = orderModel.AddType.ToString();
                    order.OState      = orderModel.OState.ToString();
                    order.PayState    = orderModel.PayState.ToString();
                    order.ReturnState = orderModel.ReturnState.ToString();
                    order.DisID       = orderModel.DisID.ToString();
                    Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(orderModel.DisID);
                    if (dis == null || dis.AuditState == 0 || dis.dr == 1)
                    {
                        return new ResultOrderList()
                               {
                                   Result = "F", Description = "经销信息商异常"
                               }
                    }
                    ;
                    order.DisName   = dis.DisName;
                    order.DisUserID = orderModel.DisUserID.ToString();
                    Hi.Model.SYS_Users user = new Hi.BLL.SYS_Users().GetModel(int.Parse(order.DisUserID));
                    //if (user == null || user.IsEnabled == 0 || user.dr == 1)
                    //    return new ResultOrderList() { Result = "F", Description = "经销商用户信息异常" };
                    //order.DisUserName = orderModel.DisUserName;
                    if (user != null && user.IsEnabled == 1 && user.dr == 0)
                    {
                        order.DisUserName = user.TrueName;
                    }
                    else
                    {
                        order.DisUserName = "";
                    }
                    order.AddrID    = orderModel.AddrID.ToString();
                    order.ReceiptNo = orderModel.ReceiptNo;
                    if (ClsSystem.gnvl(orderModel.ArriveDate, "") != "0001/1/1 0:00:00" && ClsSystem.gnvl(orderModel.ArriveDate, "") != "")
                    {
                        order.ArriveDate = orderModel.ArriveDate.ToString("yyyy-MM-dd");
                    }
                    if (!string.IsNullOrEmpty(orderModel.AddrID.ToString()))
                    {
                        Hi.Model.BD_DisAddr addr = new Hi.BLL.BD_DisAddr().GetModel(orderModel.AddrID);
                        if (addr != null)
                        {
                            order.Zip = addr.Zip;
                        }
                    }
                    order.Address           = orderModel.Address;
                    order.Contact           = orderModel.Principal;
                    order.Phone             = orderModel.Phone;
                    order.TotalAmount       = orderModel.AuditAmount.ToString("0.00");
                    order.AuditTotalAmount  = orderModel.AuditAmount.ToString("0.00");
                    order.PayedAmount       = orderModel.PayedAmount.ToString("0.00");
                    order.CreateUserID      = orderModel.CreateUserID.ToString();
                    order.CreateDate        = orderModel.CreateDate.ToString("yyyy-MM-dd HH:mm");
                    order.ReturnMoneyDate   = orderModel.ReturnMoneyDate.ToString();
                    order.ReturnMoneyUser   = orderModel.ReturnMoneyUser;
                    order.ReturnMoneyUserId = orderModel.ReturnMoneyUserId.ToString();

                    List <Hi.Model.DIS_OrderOut> outList = new Hi.BLL.DIS_OrderOut().GetList("",
                                                                                             " OrderID='" + orderModel.ID + "' and CompID='" + orderModel.CompID + "' and DisID='" +
                                                                                             orderModel.DisID + "' and ISNULL(dr,0)=0", "");
                    if (outList.Count != 0)
                    {
                        Hi.Model.DIS_OrderOut orderOut = new Hi.Model.DIS_OrderOut();
                        foreach (Hi.Model.DIS_OrderOut Out in outList)
                        {
                            orderOut = Out;
                        }
                        order.SendID   = orderOut.ID.ToString();
                        order.SendDate = orderOut.SendDate.ToString();
                        ////order.Express = orderOut.Express;
                        ////order.ExpressNo = orderOut.ExpressNo;
                        ////order.ExpressPerson = orderOut.ExpressPerson;
                        ////order.ExpressTel = orderOut.ExpressTel;
                        ////order.ExpressBao = orderOut.ExpressBao;
                        ////order.PostFee = orderOut.PostFee.ToString("0.00");
                        order.ActionUser = orderOut.ActionUser;
                        List <Hi.Model.DIS_Logistics> exlist = Common.GetExpress(orderOut.ID.ToString());
                        if (exlist != null)
                        {
                            order.SendRemark = exlist[0].Context;
                        }
                        order.IsAudit     = orderOut.IsAudit.ToString();
                        order.AuditUserID = orderOut.AuditUserID.ToString();
                        order.AuditDate   = orderOut.AuditDate.ToString();
                        order.AuditRemark = orderOut.AuditRemark == null ? "" : orderOut.AuditRemark.ToString();
                        order.SignDate    = orderOut.SignDate.ToString();
                        order.IsSign      = orderOut.IsSign.ToString();
                        order.SignUserId  = orderOut.SignUserId.ToString();
                        order.SignUser    = orderOut.SignUser;
                        order.SignRemark  = orderOut.SignRemark;
                    }
                    //todo:不知道的排序
                    //order.SortIndex = orderModel.SortIndex.ToString();
                    order.IsDel = orderModel.dr.ToString();

                    //明细
                    List <OrderDetail> orderDetail             = new List <OrderDetail>();
                    List <Hi.Model.DIS_OrderDetail> detailList = new Hi.BLL.DIS_OrderDetail().GetList("",
                                                                                                      " OrderID='" + orderModel.ID + "' and DisID='" + orderModel.DisID + "' and ISNULL(dr,0)=0", "");
                    if (detailList == null) //|| detailList.Count==0
                    {
                        return new ResultOrderList()
                               {
                                   Result = "F", Description = "订单明细异常"
                               }
                    }
                    ;
                    List <Hi.Model.BD_GoodsAttrs> list_attrs = null;
                    foreach (Hi.Model.DIS_OrderDetail detail in detailList)
                    {
                        string SKUName = string.Empty;

                        OrderDetail ordetail = new OrderDetail();
                        ordetail.SKUID = detail.GoodsinfoID.ToString();
                        //通过GoodsInfoID找到GoodsID
                        Hi.Model.BD_GoodsInfo goodsInfo = new Hi.BLL.BD_GoodsInfo().GetModel(detail.GoodsinfoID);
                        if (goodsInfo == null)
                        {
                            //if (goodsInfo == null || goodsInfo.IsEnabled == false || goodsInfo.dr == 1)
                            return new ResultOrderList()
                                   {
                                       Result = "F", Description = "SKU信息异常"
                                   }
                        }
                        ;
                        ordetail.ProductID = goodsInfo.GoodsID.ToString();

                        //通过GoodsID找到GoodsName
                        Hi.Model.BD_Goods goods = new Hi.BLL.BD_Goods().GetModel(goodsInfo.GoodsID);
                        if (goods == null)
                        {
                            //if (goods == null || goods.IsEnabled == 0 | goods.dr == 1)
                            return new ResultOrderList()
                                   {
                                       Result = "F", Description = "商品异常"
                                   }
                        }
                        ;
                        ordetail.ProductName = goods.GoodsName;
                        SKUName += goods.GoodsName;

                        list_attrs = new Hi.BLL.BD_GoodsAttrs().GetList("AttrsName", "GoodsID = " + goodsInfo.GoodsID + " and CompID = " + comp.ID + " and ISNULL(dr,0) = 0", "");
                        if (list_attrs != null && list_attrs.Count != 0)
                        {
                            foreach (Hi.Model.BD_GoodsAttrs attr in list_attrs)
                            {
                                SKUName += attr.AttrsName;
                            }
                        }
                        ordetail.SKUName = SKUName;
                        //todo:描述是什么
                        ordetail.ValueInfo   = goodsInfo.ValueInfo;
                        ordetail.SalePrice   = detail.Price.ToString("0.00");
                        ordetail.TinkerPrice = detail.AuditAmount.ToString("0.00");
                        ordetail.Num         = detail.GoodsNum.ToString("0.00");
                        ordetail.Remark      = detail.Remark;
                        //ordetail.IsPro =  .Trim() == "0" || detail.vdef1.Trim() == "" ? "0" : "1"; //是否是促销商品
                        //是否是促销商品
                        ordetail.IsPro = ClsSystem.gnvl(detail.vdef1, "").Trim() == "0" || ClsSystem.gnvl(detail.vdef1, "").Trim() == "" ? "0" : "1";

                        if (ordetail.IsPro != "0")
                        {
                            ordetail.ProNum = detail.vdef5;

                            if (detail.vdef1 != "" && detail.vdef1.Length > 0)
                            {
                                Hi.Model.BD_Promotion pro =
                                    new Hi.BLL.BD_Promotion().GetModel(Convert.ToInt32(detail.vdef1));
                                if (pro != null)
                                {
                                    List <Hi.Model.BD_PromotionDetail> dList = new Hi.BLL.BD_PromotionDetail().GetList(
                                        "", " ProID=" + pro.ID + " and GoodInfoID ='" + ordetail.SKUID + "' and dr=0",
                                        "");
                                    string info = string.Empty;
                                    if (dList != null && dList.Count > 0)
                                    {
                                        if (pro.Type == 0 && pro.ProType == 1)
                                        {
                                            info = "赠品";
                                        }
                                        else if (pro.Type == 0 && pro.ProType == 2)
                                        {
                                            info = "商品优惠价" + dList[0].GoodsPrice.ToString("0.00");
                                        }
                                        else if (pro.Type == 1 && pro.ProType == 3)
                                        {
                                            info = "商品数量满" + pro.Discount.ToString("0.00") + "赠" + dList[0].GoodsPrice.ToString("0.00") + dList[0].GoodsUnit;
                                        }
                                        else if (pro.Type == 1 && pro.ProType == 4)
                                        {
                                            info = "商品打折" + pro.Discount.ToString("0.00") + "%";
                                        }
                                    }
                                    ordetail.proInfo = new PromotionInfo()
                                    {
                                        ProID        = detail.vdef1,
                                        ProTitle     = pro.ProTitle,
                                        ProInfos     = info,
                                        Type         = pro.Type.ToString(),
                                        ProTpye      = pro.ProType.ToString(),
                                        Discount     = pro.Discount.ToString("0.00"),
                                        ProStartTime = pro.ProStartTime.ToString("yy-MM-dd"),
                                        ProEndTime   = pro.ProEndTime.ToString("yy-MM-dd")
                                    };
                                }
                            }
                        }

                        List <Pic> Pic = new List <Pic>();
                        if (goods.Pic != "" && goods.Pic != "X")
                        {
                            Pic pic = new Pic();
                            pic.ProductID = goodsInfo.GoodsID.ToString();
                            pic.IsDeafult = "1";
                            pic.PicUrl    = ConfigurationManager.AppSettings["ImgViewPath"].ToString().Trim() + "GoodsImg/" +
                                            goods.Pic;
                            Pic.Add(pic);
                        }
                        ordetail.ProductPicUrlList = Pic;

                        orderDetail.Add(ordetail);
                    }
                    order.OrderDetailList = orderDetail;
                    OrderList.Add(order);
                }
            }
            else
            {
                return(new ResultOrderList()
                {
                    Result = "F", Description = "没有更多数据"
                });
            }

            #endregion

            return(new ResultOrderList()
            {
                Result = "T",
                Description = "获取成功",
                OrderList = OrderList
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetBriefingList:" + JSon);
            return(new ResultOrderList()
            {
                Result = "F", Description = "参数异常"
            });
        }
    }