//protected override void gridWebGrid_ItemCommand(GridRecord row, string commandName) //{ // if (commandName == "Edit") // { // object obj = this.GetEditObject(row); // if (obj != null) // { // this.SetEditObject(obj); // this.buttonHelper.PageActionStatusHandle(PageActionType.Update); // } // } // else if (commandName == "LinkDetail") // { // string pickNo = row.Items.FindItemByKey("PickNo").Text.Trim(); // //string storageOut = row.Items.FindItemByKey("StorageOut").Text.Trim(); // Response.Redirect(this.MakeRedirectUrl("FCreatePickLineMP.aspx", new string[] { "ACT", "PickNo" }, new string[] { "LinkDetail", pickNo })); // } //} protected override void cmdExport_Click(object sender, EventArgs e) { BenQGuru.eMES.Material.WarehouseFacade _WarehouseFacade = new BenQGuru.eMES.Material.WarehouseFacade(base.DataProvider); List <string> ca = new List <string>(); XlsPackage xls = new XlsPackage(); IFont font = xls.Black; font.FontHeightInPoints = 10; ICellStyle style = xls.Normal; style.SetFont(font); xls.CreateSheet("到货拒收统计-BUYER"); xls.NewRow(0); xls.Cell(0, "鼎桥物料编码", style); xls.Cell(1, "鼎桥物料描述", style); xls.Cell(2, "供应商代码", style); xls.Cell(3, "供应商名称", style); xls.Cell(4, "来料数量", style); xls.Cell(5, "拒收数量", style); xls.Cell(6, "拒收率", style); int rowNum = 1; ReceiveRejectSummaryBuyer[] rs = _WarehouseFacade.GetReceiveRejectSummarysBuyer( FormatHelper.TODateInt(dateInDateFromQuery.Text), FormatHelper.TODateInt(dateInDateToQuery.Text), txtDQMCodeQuery.Text, txtDQMDESCQuery.Text, txtVendorCodeQuery.Text, txtVendorNameQuery.Text); for (int i = 0; i < rs.Length; i++) { xls.NewRow(rowNum); string DQMCODE = rs[i].DQMCODE; xls.Cell(0, DQMCODE, style); string MDESC = rs[i].MDESC; xls.Cell(1, MDESC, style); string VENDORCODE = rs[i].VENDORCODE; xls.Cell(2, VENDORCODE, style); string VENDORNAME = rs[i].VENDORNAME; xls.Cell(3, VENDORNAME, style); string QTY = rs[i].QTY.ToString(); xls.Cell(4, QTY, style); string N = rs[i].N.ToString(); xls.Cell(5, N, style); string L = rs[i].L; xls.Cell(6, L, style); rowNum++; } string filename = string.Format("Export_{0}_{1}.{2}", FormatHelper.TODateInt(System.DateTime.Now).ToString(), FormatHelper.TOTimeInt(System.DateTime.Now).ToString(), "xls"); string filepath = string.Format(@"{0}{1}", this.DownloadPhysicalPath, filename); FileStream file = new FileStream(filepath, FileMode.Create, FileAccess.ReadWrite); xls.Save(file); file.Close(); DownLoadFile1(filename); }