示例#1
0
    protected void BindGrid1()
    {
        using (LCustBB bb = new LCustBB())
        {
            string strwhere = " 1=1 ";
            if (!string.IsNullOrEmpty(sCustNo.Text))
            {
                strwhere += "  and custNo like '%" + sCustNo.Text + "%'";
            }

            if (!string.IsNullOrEmpty(sCustNm.Text))
            {
                strwhere += "  and custNm like '%" + sCustNm.Text + "%'";
            }

            DataSet ds = bb.GetList(strwhere);
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
    }
    /// <summary>
    /// 显示备货单信息
    /// </summary>
    private void ShowInfo()
    {
        CStockUpBillBB stockUpBillBB = new CStockUpBillBB();
        LCustBB custBB = new LCustBB();
        CSaleDetailBB saleDetailBB = new CSaleDetailBB();

        try
        {
            string strCustNo = Request.QueryString["custNo"];
            string strSaleBillNos = Request.QueryString["saleBillNos"];//销售订单号
            string strAbsEntrys = Request.QueryString["absEntrys"];//提货单号
            string strFinanceBillNos = Request.QueryString["financeBillNos"];//采购合同号组合
            string strLineNums = Request.QueryString["lineNums"];//行号组合
            string strWhere = "1=1";
            DataSet ds = new DataSet();

            if (Request.Params["id"] != null && Request.Params["id"] != "")
            {
                this.IdValue = Convert.ToInt32(Request.Params["id"]);
                vCStockUpBillData stockUpBillModel = stockUpBillBB.GetVModel(this.IdValue);

                this.StockBillNo = stockUpBillModel.stockUpBillNo;
                this.stockUpBillNo.Text = stockUpBillModel.stockUpBillNo;
                this.shippingMarkNo.Text = stockUpBillModel.shippingMarkNo;
                this.lblCustNm.Text = stockUpBillModel.custNm;
                this.invoiceNo.Text = stockUpBillModel.invoiceNo;
                this.txtstockEmpNm.Text = stockUpBillModel.stockUpEmpNm;
                this.empId.Value = stockUpBillModel.stockUpEmpId.ToString();

                strSaleBillNos = "'" + stockUpBillModel.saleBillNos.Replace(",", "','") + "'";//销售订单编号组合
                strAbsEntrys = "'" + stockUpBillModel.absEntrys.Replace(",", "','") + "'";//提货单编号组合
                strLineNums = "'" + stockUpBillModel.lineNums.Replace(",", "','") + "'";//行号组合

                if (stockUpBillModel.financeBillNos != "")//采购合同号组合
                {
                    strFinanceBillNos = "'" + stockUpBillModel.financeBillNos.Replace(",", "','") + "'";
                }

                this.mark.Text = stockUpBillModel.mark;
                this.outStockDt.Text = Convert.ToDateTime(stockUpBillModel.outStockDt).ToString("yyyy-MM-dd");
            }
            else
            {
                if (strCustNo == null || strCustNo == "")
                {
                    return;
                }

                DataSet dsCust = custBB.GetList(" custNo ='" + strCustNo.Trim() + "'");

                if (dsCust != null && dsCust.Tables[0] != null && dsCust.Tables[0].Rows.Count > 0)
                {
                    this.stockUpBillNo.Text = stockUpBillBB.GetCurrentInBillNoByStockUpBillNo();
                    this.StockBillNo = this.stockUpBillNo.Text;
                    this.CustomNo = strCustNo;
                    this.shippingMarkNo.Text = dsCust.Tables[0].Rows[0]["shippingMark"].ToString();
                    this.lblCustNm.Text = dsCust.Tables[0].Rows[0]["custNm"].ToString();
                }
            }

            //绑定销售订单明细列表
            string[] saleBillNoArray = strSaleBillNos.Split(',');
            string[] absEntryArray = strAbsEntrys.Split(',');
            string[] lineNumArray = strLineNums.Split(',');

            strWhere += " and (";

            for (int i = 0; i < saleBillNoArray.Length; i++)
            {
                if (i == 0)
                {
                    strWhere += " (absEntry=" + absEntryArray[i] + " and saleBillNo=" + saleBillNoArray[i]
                        + " and lineNum=" + lineNumArray[i] + ")";
                }
                else
                {
                    strWhere += " or (absEntry=" + absEntryArray[i] + " and saleBillNo=" + saleBillNoArray[i]
                        + " and lineNum=" + lineNumArray[i] + ")";
                }
            }

            strWhere += ")";

            ds = saleDetailBB.GetVList(strWhere);

            //ds = saleDetailBB.GetVList(" saleBillNo in (" + strSaleBillNos
            //    + ") and absEntry in (" + strAbsEntrys + ") and lineNum in (" + strLineNums + ")");

            this.DtSaleList = ds.Tables[0];
        }
        finally
        {
            stockUpBillBB.Dispose();
            custBB.Dispose();
            saleDetailBB.Dispose();
        }
    }