Ejemplo n.º 1
0
    /// <summary>
    /// 选择商品
    /// </summary>
    /// <returns></returns>
    public string disBing(string goodsinfoid = "")
    {
        List <Hi.Model.DIS_GoodsStock> gstocklist = null;
        StringBuilder strwhere = new StringBuilder();

        //启用库存
        strwhere.AppendFormat("and Inventory>=0 and a.compid=" + this.CompID + " and b.compid=" + this.CompID);
        if (!Util.IsEmpty(goodsinfoid))
        {
            strwhere.AppendFormat(" and a.id in(" + goodsinfoid + ")");
            gstocklist = new Hi.BLL.DIS_GoodsStock().GetList("", " GoodsInfo in( " + goodsinfoid + " )", "");
        }
        DataTable dt = new Hi.BLL.BD_GoodsInfo().GetGoodsModel(strwhere.ToString()).Tables[0];

        if (dt != null && dt.Rows.Count > 0)
        {
            if (gstocklist != null && gstocklist.Count > 0)
            {
                foreach (DataRow item in dt.Rows)
                {
                    List <Hi.Model.DIS_GoodsStock> stock = gstocklist.FindAll(p => p.GoodsInfo == item["ID"].ToString());
                    if (stock != null && stock.Count > 0)
                    {
                        item["Inventory"] = stock[0].StockTotalNum;
                    }
                }
            }
        }
        return(ConvertJson.ToJson(dt));
    }
Ejemplo n.º 2
0
    public string GetBv(string CompID, string goodsinfoid)
    {
        //string msg = SelectGoodsInfo.GetBv(CompID.ToString(), Eval("GoodsInfoID").ToString(), col);
        //string r = string.Empty;
        //string classname = string.Empty;
        //if (col == "BatchNO")
        //{
        //    classname = "box BatchNO";
        //}
        //else
        //{
        //    classname = "Wdate validDate";
        //    r = "readonly=\"readonly\"";
        //}
        //return "<input type=\"text\" class=\"" + classname + "\" value=\"" + msg + "\" " + r + " />";

        List <Hi.Model.DIS_GoodsStock> stocklist = new Hi.BLL.DIS_GoodsStock().GetList("", " CompID=" + CompID + "and StockNum>0 and GoodsInfo=" + goodsinfoid, "CreateDate asc");

        string td      = string.Empty;
        string BatchNO = "";

        if (stocklist != null && stocklist.Count > 0)
        {
            if (stocklist[0].BatchNO != null)
            {
                BatchNO = stocklist[0].BatchNO.ToString();
            }
            td += "<td><div class=\"tc\"><input type=\"hidden\" class=\"box BatchNO\" value=\"" + BatchNO + "\" /><select class=\"box ddrBatchNO\" style=\"width:120px;\">";

            foreach (var item in stocklist)
            {
                td += "<option tip=" + item.validDate.ToString("yyyy-MM-dd") + " value='" + item.BatchNO + "'>" + item.BatchNO + "</option>";
            }

            td += "</select></div></td>";
        }

        td += "<td><div class=\"tc\">";
        if (stocklist.Count > 0 && stocklist[0].validDate != null)
        {
            td += "<input type=\"text\" style=\"width:80px;\" class=\"Wdate validDate\" value=\"" + stocklist[0].validDate.ToString("yyyy-MM-dd") + "\" readonly=\"readonly\" />";
        }
        td += "</div></td>";

        return(td);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 返回前台分页数据
    /// </summary>
    /// <param name="pageIndex">页码</param>
    /// <param name="pageSize">页数据</param>
    /// <param name="sql">查询sql</param>
    /// <returns></returns>
    public string GetJson3(int pageIndex, int pageSize, string sql, string sql2, int CompId, int DisID)
    {
        Pagger    pagger = new Pagger(sql);
        int       count  = pagger.GetDataCount(sql2);
        DataTable dt     = pagger.getData(pageSize, (pageIndex - 1) * pageSize);

        List <int> infoidl = new List <int>();

        if (dt != null && dt.Rows.Count > 0)
        {
            foreach (DataRow item in dt.Rows)
            {
                int id = item["ID"].ToString().ToInt(0);//BD_goodsInfo表的ID
                infoidl.Add(id);
            }
        }

        //获取商品价格
        List <BLL.gDprice> l = BLL.Common.GetPrice(CompId, DisID, infoidl);

        if (l != null && l.Count > 0)
        {
            foreach (var item in l)
            {
                DataRow[] dr = dt.Select(" ID=" + item.goodsInfoId);
                if (dr.Length > 0)
                {
                    //获取的价格大于促销价时、取促销价
                    dr[0]["pr"] = item.FinalPrice;
                    dr[0]["typeTinkerPrice"] = item.typePrice;
                    dr[0]["disTinkerPrice"]  = item.disPrice;
                    dr[0]["disProPr"]        = item.bpPrice;
                }
            }
        }

        if (!dt.Columns.Contains("StockNum"))
        {
            DataColumn col = new DataColumn("StockNum", typeof(int));
            dt.Columns.Add(col);
            col.DefaultValue = 0;
            //dt.Columns["StockNum"].DataType = Type.GetType("System.Int");
        }
        //获取
        if (infoidl != null && infoidl.Count > 0)
        {
            var infoID = string.Join(",", infoidl);
            List <Hi.Model.DIS_GoodsStock> stocklist = new Hi.BLL.DIS_GoodsStock().GetList("", "Goodsinfo in (" + infoID + ")", "");
            if (stocklist != null && stocklist.Count > 0)
            {
                foreach (var item in stocklist)
                {
                    DataRow[] dr = dt.Select(" ID=" + item.GoodsInfo);
                    if (dr.Length > 0)
                    {
                        dr[0]["StockNum"] = item.StockTotalNum == 0 ? 0 : item.StockTotalNum;
                    }
                }
            }
        }

        return(CreateJson(count, pageSize, dt));
    }