//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("到货拒收统计表"); xls.NewRow(0); xls.Cell(0, "入库指令号", style); xls.Cell(1, "SAP单据号", style); xls.Cell(2, "入库类型", style); xls.Cell(3, "供应商代码", style); xls.Cell(4, "供应商名称", style); xls.Cell(5, "库位", style); xls.Cell(6, "初检完成日期", style); xls.Cell(7, "拒收原因", style); int rowNum = 1; ReceiveRejectSummary[] rs = _WarehouseFacade.GetReceiveRejectSummarys(FormatHelper.TODateInt(dateInDateFromQuery.Text), FormatHelper.TODateInt(dateInDateToQuery.Text), this.drpStorageQuery.SelectedValue, this.drpStorageInTypeQuery.SelectedValue); for (int i = 0; i < rs.Length; i++) { xls.NewRow(rowNum); string stno = rs[i].STNO; xls.Cell(0, stno, style); string invNo = rs[i].INVNO; xls.Cell(1, invNo, style); string stType = rs[i].sttype; xls.Cell(2, stType, style); string vendorCode = rs[i].VENDORCODE; xls.Cell(3, vendorCode, style); string VendorName = rs[i].VENDORNAME; xls.Cell(4, VendorName, style); string storageCode = rs[i].STORAGECODE; xls.Cell(5, storageCode, style); string MDATE = FormatHelper.ToDateString(rs[i].MDATE); xls.Cell(6, MDATE, style); string PARAMDESC = rs[i].PARAMDESC; xls.Cell(7, PARAMDESC, 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); }