private void toolStripButton1_Click(object sender, EventArgs e)
        {
            var worksheet = this.reoGridControlUser.Worksheets[0];
            StandardFormPreviewExcel formPreview = new StandardFormPreviewExcel("上架单预览");
            WMSEntities wmsEntities = new WMSEntities();

            int[] ids = Utilities.GetSelectedIDs(this.reoGridControlUser);
            if (ids.Length == 0)
            {
                MessageBox.Show("请选择一项预览", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            foreach (int id in ids)
            {
                try
                {
                    PutawayTicketView       putawayTicketView     = (from ptv in wmsEntities.PutawayTicketView where ptv.ID == id select ptv).FirstOrDefault();
                    PutawayTicketItemView[] putawayTicketItemView = (from ptiv in wmsEntities.PutawayTicketItemView where ptiv.PutawayTicketID == putawayTicketView.ID select ptiv).ToArray <PutawayTicketItemView>();
                    string worksheetName = id.ToString();
                    if (putawayTicketView == null)
                    {
                        MessageBox.Show("上架单不存在,请重新查询!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    //ReceiptTicketView receiptTicketView = (from rtv in wmsEntities.ReceiptTicketView where rtv.ID == submissionTicketView.ReceiptTicketID select rtv).FirstOrDefault();
                    if (formPreview.AddPatternTable(@"Excel\PutawayTicket.xlsx", worksheetName) == false)
                    {
                        this.Close();
                        return;
                    }
                    if (putawayTicketView != null)
                    {
                        formPreview.AddData("PutawayTicket", putawayTicketView, worksheetName);
                    }
                    formPreview.AddData("PutawayTicketItem", putawayTicketItemView, worksheetName);
                    formPreview.SetPrintScale(1.0F, worksheetName);
                }
                catch
                {
                    MessageBox.Show("搜索失败,请检查网络连接!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            formPreview.SetPrintedCallback(new Action(() =>
            {
                WMSEntities wmsEntities2 = new WMSEntities();
                foreach (int id in ids)
                {
                    PutawayTicket putawayTicket = (from pt in wmsEntities2.PutawayTicket where pt.ID == id select pt).FirstOrDefault();
                    if (putawayTicket != null)
                    {
                        if (putawayTicket.PrintTimes == null)
                        {
                            putawayTicket.PrintTimes = 0;
                        }
                        putawayTicket.PrintTimes++;
                    }
                }
                new Thread(() =>
                {
                    wmsEntities2.SaveChanges();
                    Search();
                }).Start();
            }));

            //formPreview.AddData("SubmissionTicketItem", submissionTicketItemView);
            formPreview.Show();
        }