/// <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);
        }
    }
    /// <summary>
    /// 保存或提交备货单公共方法
    /// </summary>
    /// <param name="isSubmit"></param>
    protected void SubmitArrangeBill(bool isSubmit)
    {
        CStockUpBillBC stockUpBillBC = new CStockUpBillBC();
        CStockUpBillBB stockUpBillBB = new CStockUpBillBB();

        try
        {
            this.SaveStencilDetailViewState();//保存备货信息
            this.BindGridStockUpDetail();//绑定备货单明细列表
            this.BindGridSaleBill();//显示销售订单明细列表

            if (this.ValidateArrangeDetail())
            {
                CStockUpBillData data = stockUpBillBB.GetModel(this.StockBillNo);

                if (data == null)
                {
                    #region 未生成备货单

                    data = new CStockUpBillData();

                    data.id = 0;
                    data.stockUpBillNo = this.StockBillNo;
                    data.invoiceNo = this.invoiceNo.Text;
                    data.stockUpEmpId = Convert.ToInt32(this.empId.Value == "" ? "0" : this.empId.Value);
                    data.mark = this.mark.Text;
                    data.custNo = this.CustomNo;
                    data.outStockDt = this.outStockDt.Text;
                    data.saleBillNos = this.lbSaleBillNos.Text;
                    data.lineNums = Request.QueryString["lineNums"];
                    data.absEntrys = Request.QueryString["absEntrys"];
                    data.financeBillNos = Request.QueryString["financeBillNos"];
                    data.shippingMarkNo = this.shippingMarkNo.Text;
                    data.isrtDt = DateTime.Now.ToString();
                    data.isrtEmpId = this.currentUser.empId;

                    if (isSubmit)
                    {
                        data.instantState = "02";
                        data.updtDt = DateTime.Now.ToString();
                        data.updtEmpId = this.currentUser.empId;
                        data.commitDt = DateTime.Now.ToString();
                        data.commitEmpId = this.currentUser.empId;
                    }
                    else
                    {
                        data.instantState = "01";
                        data.updtDt = DateTime.Now.ToString();
                        data.updtEmpId = this.currentUser.empId;
                    }

                    #endregion 未生成备货单
                }
                else
                {
                    #region 已生成备货单

                    if (data.instantState != "01")
                    {
                        this.ClientScript.RegisterStartupScript(this.GetType(), "alert9", "alert(\"当前备货单已经提交,不允许继续修改备货单信息!\");", true);
                        return;
                    }

                    data.invoiceNo = this.invoiceNo.Text;
                    data.stockUpEmpId = Convert.ToInt32(this.empId.Value == "" ? "0" : this.empId.Value);
                    data.mark = this.mark.Text;
                    data.custNo = this.CustomNo;
                    data.outStockDt = this.outStockDt.Text;
                    data.shippingMarkNo = this.shippingMarkNo.Text;
                    data.updtDt = DateTime.Now.ToString();
                    data.updtEmpId = this.currentUser.empId;

                    if (isSubmit)
                    {
                        data.instantState = "02";
                        data.updtDt = DateTime.Now.ToString();
                        data.updtEmpId = this.currentUser.empId;
                        data.commitDt = DateTime.Now.ToString();
                        data.commitEmpId = this.currentUser.empId;
                    }
                    else
                    {
                        data.instantState = "01";
                        data.updtDt = DateTime.Now.ToString();
                        data.updtEmpId = this.currentUser.empId;
                    }

                    #endregion 已生成备货单
                }

                if (stockUpBillBC.SaveBArrangeBill(data, this.DtResult, isSubmit))
                {
                    this.DtResult = null;
                    this.InitDtResult();//初始化备货单明细数据源
                    this.BindGridStockUpDetail();//绑定备货单明细列表
                    this.BindGridSaleBill();//绑定销售订单明细列表

                    if (isSubmit)//提交
                    {
                        this.ClientScript.RegisterStartupScript(this.GetType(), "alert12", "alert(\"备货单维护成功!\");window.location='"
                            + Request.Params["backurl"] + "';", true);
                    }
                    else//保存
                    {
                        this.BindGridStockUpDetail();//绑定备货单明细列表
                        this.BindGridSaleBill();//绑定销售订单明细列表
                        this.ClientScript.RegisterStartupScript(this.GetType(), "alert12", "alert(\"备货单维护成功!\");", true);
                    }
                }
                else
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "alert12", "alert(\"备货单维护失败!\");", true);
                }
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            stockUpBillBB.Dispose();
            stockUpBillBC.Dispose();
        }
    }