예제 #1
0
    /// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        CSaleBillBB saleBillBB = new CSaleBillBB();
        DataSet ds = new DataSet();

        try
        {
            string strwhere = this.StrWhere;

            //销售订单编号
            if (!string.IsNullOrEmpty(this.txtSaleBillNo.Text))
            {
                strwhere += " and saleBillNo like '%" + this.txtSaleBillNo.Text.Trim().Replace("'", "''").Trim() + "%'";
            }

            //客户
            if (!string.IsNullOrEmpty(this.txtCustNo.Text))
            {
                strwhere += " and (custNo like '%" + this.txtCustNo.Text.Replace("'", "''").Trim()
                    + "%' or custNm like '" + this.txtCustNo.Text.Trim().Replace("'", "''") + "')";
            }

            //订单状态
            if (!string.IsNullOrEmpty(this.ddlState.SelectedValue))
            {
                strwhere += " and instantState = '" + this.ddlState.SelectedValue.Replace("'", "''").Trim() + "'";
            }

            ds = saleBillBB.GetVList(strwhere);
            this.grid.DataSource = ds.Tables[0];
            this.grid.DataBind();

            //赋值记录条数、页面总数
            this.Label3.Text = ds.Tables[0].Rows.Count.ToString();
            this.Label2.Text = this.grid.PageCount.ToString();
            this.currPage.Text = (this.grid.PageIndex + 1).ToString();
        }
        finally
        {
            saleBillBB.Dispose();
        }
    }
예제 #2
0
    /// <summary>
    /// 显示销售订单信息
    /// </summary>
    private void ShowInfo()
    {
        CSaleBillBB saleBillBB = new CSaleBillBB();
        CSaleDetailBB saleDetailBB = new CSaleDetailBB();

        try
        {
            string id = Request.Params["id"];
            vCSaleBillData saleBillModel = saleBillBB.GetVModel(Convert.ToInt32(id));
            DataSet ds = new DataSet();

            this.saleBillNo.Text = saleBillModel.saleBillNo;
            this.saleBillDt.Text = Convert.ToDateTime(saleBillModel.saleBillDt).ToString("yyyy-MM-dd");
            this.custNo.Text = saleBillModel.custNo;
            this.custNm.Text = saleBillModel.custNm;
            this.saleEmpNo.Text = saleBillModel.saleEmpNo;
            this.saleBillType.Text = saleBillModel.saleBillType;
            this.mark.Text = saleBillModel.mark;

            //根据提货单号、销售订单号、采购合同号,查找销售订单明细
            ds = saleDetailBB.GetVList(" absEntry='" + saleBillModel.AbsEntry
                    + "' and saleBillNo = '" + saleBillModel.saleBillNo
                    + "' and lineNum='" + saleBillModel.lineNum.ToString() + "'");

            if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
            {
                this.grid.DataSource = ds;
                this.grid.DataBind();
            }
        }
        finally
        {
            saleBillBB.Dispose();
            saleDetailBB.Dispose();
        }
    }
    /// <summary>
    /// 删除提货单
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDel_Click(object sender, EventArgs e)
    {
        bool retChecked = false;
        CStockUpBillBC stockUpBillBC = new CStockUpBillBC();
        CSaleBillBB saleBillBB = new CSaleBillBB();

        try
        {
            //获取选中的数据Id
            foreach (GridViewRow gvrow in this.grid.Rows)
            {
                CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
                if (chkId.Checked == true)
                {
                    retChecked = true;
                    int absEntry = 0;
                    CSaleBillData saleBillModel = new CSaleBillData();

                    saleBillModel = saleBillBB.GetModel(Convert.ToInt32(chkId.ValidationGroup));

                    if (saleBillModel != null && saleBillModel.instantState != "01")
                    {
                        this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"销售订单已生成备货单,不允许删除!\");", true);
                        return;
                    }

                    //删除提货单信息
                    absEntry = Convert.ToInt32(this.grid.DataKeys[gvrow.RowIndex]["absEntry"]);
                    stockUpBillBC.DeleteSaleBill(absEntry);
                }
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            stockUpBillBC.Dispose();
            saleBillBB.Dispose();
        }

        if (retChecked)
        {
            this.BindGrid();
        }
        else
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条记录!\");", true);
        }
    }
예제 #4
0
    /// <summary>
    /// 生成备货单
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnNewBill_Click(object sender, EventArgs e)
    {
        string strPreCustNo = "", strSaleBillNos = "", strAbsEntrys = "", strFinanceBillNos = "", strLineNums = "";

        //获取选中的数据Id
        foreach (GridViewRow gvrow in this.grid.Rows)
        {
            CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
            if (chkId.Checked == true)
            {
                string id = this.grid.DataKeys[gvrow.RowIndex].Values["id"].ToString();
                string custNo = this.grid.DataKeys[gvrow.RowIndex].Values["custNo"].ToString();
                string strSaleBillNo = this.grid.DataKeys[gvrow.RowIndex].Values["saleBillNo"].ToString();
                string strAbsEntry = this.grid.DataKeys[gvrow.RowIndex].Values["absEntry"].ToString();
                string strFinanceBillNo = this.grid.DataKeys[gvrow.RowIndex].Values["financeBillNo"].ToString();
                string strLineNum = this.grid.DataKeys[gvrow.RowIndex].Values["lineNum"].ToString();

                //判断选择的是否是同一客户
                if (strPreCustNo == "")
                {
                    strPreCustNo = custNo;
                }

                if (custNo != strPreCustNo)
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"只能选择同一客户的销售订单!\");", true);
                    return;
                }

                //实时获取订单状态
                using (CSaleBillBB billBB = new CSaleBillBB())
                {
                    CSaleBillData data = billBB.GetModel(Convert.ToInt32(id));

                    if (data.instantState == "01")
                    {
                        strSaleBillNos += ",'" + strSaleBillNo + "'";
                        strAbsEntrys += "," + strAbsEntry;
                        strLineNums += "," + strLineNum;

                        //采购合同号组合
                        if (strFinanceBillNo != "")
                        {
                            strFinanceBillNos += "," + strFinanceBillNo;
                        }
                    }
                    else
                    {
                        this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"销售订单【"
                            + strSaleBillNo + "】已生成备货单,不允许再生成备货单!\");", true);
                        return;
                    }
                }
            }
        }

        if (strSaleBillNos.Trim(',') != "")
        {
            string strCurrUrl = "", strBackUrl = "";

            strCurrUrl = HttpContext.Current.Request.Url.OriginalString;
            strBackUrl = Server.UrlEncode(strCurrUrl);

            Response.Redirect("~/Page/Operation/CStockUpBill/CStockUpBill.aspx?id=&custNo=" + strPreCustNo
                + "&saleBillNos=" + Server.UrlEncode(strSaleBillNos.Trim(',')) + "&absEntrys=" + strAbsEntrys.Trim(',')
                + "&financeBillNos=" + Server.UrlEncode(strFinanceBillNos.Trim(','))
                + "&lineNums=" + Server.UrlEncode(strLineNums.Trim(',')) + "&itemNo=" + this.itemNo
                + "&pTypeNo=main&backUrl=" + strBackUrl);
        }

        this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条记录!\");", true);
        return;
    }