////选择料架时触发
        //protected void DropDownList_frame_key_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        DropDownList_issue_sub_key.Items.Clear();

        //        string text = DropDownList_frame_key.SelectedValue.ToString();
        //        DataSet ds_issue_sub_key = invoiceDC.getSubinventoryByFrame(text);
        //        if (ds_issue_sub_key != null)
        //        {
        //            DropDownList_issue_sub_key.DataSource = ds_issue_sub_key.Tables[0].DefaultView;
        //            DropDownList_issue_sub_key.DataValueField = "subinventory_name";
        //            DropDownList_issue_sub_key.DataTextField = "subinventory_name";
        //            DropDownList_issue_sub_key.DataBind();
        //        }

        //        DropDownList_issue_sub_key.Items.Insert(0, "--选择库别--");
        //        DropDownList_issue_sub_key.SelectedIndex = 1;
        //    }
        //    catch (Exception e2)
        //    {
        //        PageUtil.showToast(this, "料架与库别二级联动失败,请检查是否有关联数据");
        //        return;
        //    }
        //}


        //生成一个领料单单据号
        protected void NewInvoice_no(object sender, EventArgs e)
        {
            string strInvoice_no = invoice_no.Value;

            if (!string.IsNullOrWhiteSpace(strInvoice_no))
            {
                PageUtil.showToast(this, "单据号已生成,请勿重复操作");

                return;
            }

            int     end;
            string  end_text;
            string  month = string.Empty;
            string  year  = string.Empty;
            DataSet ds;

            ds = invoiceDC.getTheNewestIssueHeaderByCreatetime();

            //判断数据库是否有数据,没有数据则初始化一个流水号
            if (ds == null)
            {
                end_text = "00001";

                month = DateTime.Now.Month.ToString();

                year = DateTime.Now.Year.ToString();


                //为月份补0
                for (int i = month.Length; i < 2; i++)
                {
                    month = "0" + month;
                }

                //截取年份后两位
                year = year.Substring(2, 2);
            }
            else
            {
                //截取上一个单号的后5位,即从第5位开始的5位(0开始增)
                string sInvoice_no = ds.Tables[0].Rows[0]["invoice_no"].ToString();
                string result      = sInvoice_no.Substring(5, 5);
                end = int.Parse(result);

                string last_month = sInvoice_no.Substring(3, 2);
                string last_year  = sInvoice_no.Substring(1, 2);


                //当end为99999时,重置从1开始计数。否则,递增
                if (end == 99999)
                {
                    end = 1;
                }
                else
                {
                    end = end + 1;
                }

                end_text = end.ToString();


                //为流水号补0
                for (int i = end_text.Length; i < 5; i++)
                {
                    end_text = "0" + end_text;
                }

                month = DateTime.Now.Month.ToString();

                year = DateTime.Now.Year.ToString();

                year = year.Substring(2, 2);

                //为单数月补0
                for (int i = month.Length; i < 2; i++)
                {
                    month = "0" + month;
                }

                //新月份或新的一年,从1重新计数
                if (month != last_month)
                {
                    end_text = "00001";
                }
                if (year != last_year)
                {
                    end_text = "00001";
                }
            }

            invoice_no.Value = "Q" + year + month + end_text;
        }