/// <summary>
    /// 确定退货 
    /// 董利特 2015-02-05
    /// 生成叉车任务 确定退货
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnConfirmReturn_Click(object sender, EventArgs e)
    {
        //生成从N01.01出库
        //增加YCCK01库位
        //01是未提交 02是已提交 03是已经扫描出库

        bool retChecked = false;
        BBackBillBB backBillBB = new BBackBillBB();

        try
        {
            foreach (GridViewRow gvrow in this.grid.Rows)
            {
                CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
                if (chkId.Checked == true)
                {
                    int id = int.Parse(chkId.ValidationGroup);
                    BBackBillData backBillModel = backBillBB.GetModel(Convert.ToInt32(id));

                    if (backBillModel.instantState != "03")
                    {
                        this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条未提交退货单记录!\");", true);
                        return;
                    }
                    else
                    {
                        retChecked = true;
                        //仓库确认的退货时间 以及仓库修改信息 存放到王工新建立的两张表当中
                        //backBillModel.commitDt = System.DateTime.Now.ToString();
                        //backBillModel.commitEmpId = this.currentUser.empId;
                        backBillModel.instantState = "04";
                        if (backBillBB.ModifyRecord(backBillModel))
                        {
                            if (backBillBB.UpdateNotice(backBillModel.backBillNo, currentUser.empId, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")))
                            {
                                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"确认退货单成功!\");", true);
                                return;
                            }
                            else
                            {
                                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"确认退货单失败!\");", true);
                                return;
                            }
                        }
                        else
                        {
                            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"仓库确认退货单失败!\");", true);
                            return;
                        }

                    }

                    //DataTable dtDetail = new DataTable();
                    //BBackDetailBB backDetailBB = new BBackDetailBB();
                    ////获取退货明细数据源
                    //dtDetail = backDetailBB.GetList("backBillNo='" + backBillModel.backBillNo + "'").Tables[0];
                    //string commadPallet = "";
                    //for (int i = 0; i < dtDetail.Rows.Count; i++)
                    //{
                    //    if (i == dtDetail.Rows.Count - 1)
                    //    {
                    //        commadPallet += "BoxNO = '" + dtDetail.Rows[i]["BoxNo"].ToString().ToUpper().Trim() + "'";
                    //    }
                    //    else
                    //    {
                    //        commadPallet += "BoxNO = '" + dtDetail.Rows[i]["BoxNo"].ToString().ToUpper().Trim() + "' or ";
                    //    }
                    //}
                    //string command = "select distinct palletNo  from BArrangeBillBox where " + commadPallet;//获取订单下的托盘号码
                    //SCommBB bb = new SCommBB();
                    //DataTable dt = bb.Query(command).Tables[0];
                    //bb.Dispose();
                    //BForkliftTaskBC bforkTaskBC = new BForkliftTaskBC();
                    //for (int j = 0; j < dt.Rows.Count; j++)
                    //{
                    //    bforkTaskBC.SaveForkliftTaskWithTHD(dt.Rows[j][0].ToString(), "YCQ", "N01.01", "30", this.currentUser.empId, backBillModel.backBillNo);
                    //}
                }

            }

        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            backBillBB.Dispose();
        }

        if (retChecked)
        {
            this.BindGrid();
        }
    }