焊接修改
This commit is contained in:
@@ -58,26 +58,28 @@ namespace FineUIPro.Web.HJGL.TestPackage
|
||||
protected void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
Model.PTP_TestPackage updateTestPackage = Funs.DB.PTP_TestPackage.FirstOrDefault(x => x.PTP_ID == PTP_ID);
|
||||
|
||||
var fastReportItem = BLL.TestPackagePrintService.GetFastReportItem(updateTestPackage,Grid1.SelectedRowID,PTP_ID,this.CurrUser.LoginProjectId);
|
||||
BLL.FastReportService.ResetData();
|
||||
BLL.FastReportService.AddFastreportParameter(fastReportItem.ParameterValues);
|
||||
if (fastReportItem.DataTables!=null)
|
||||
List<Model.FastReportItem> FastReportItemList = new List<Model.FastReportItem>();
|
||||
foreach (var item in Grid1.SelectedRowIDArray)
|
||||
{
|
||||
foreach (var item in fastReportItem.DataTables)
|
||||
{
|
||||
BLL.FastReportService.AddFastreportTable(item);
|
||||
}
|
||||
var fastReportItem = BLL.TestPackagePrintService.GetFastReportItem(updateTestPackage, item, PTP_ID, this.CurrUser.LoginProjectId);
|
||||
FastReportItemList.Add(fastReportItem);
|
||||
TestPackagePrintService.AddPrintCountByTypeInt(PTP_ID, int.Parse(item)); //增加打印次数
|
||||
}
|
||||
string initTemplatePath = "";
|
||||
string rootPath = Server.MapPath("~/");
|
||||
initTemplatePath = fastReportItem.ReportPath;
|
||||
|
||||
if (File.Exists(rootPath + initTemplatePath))
|
||||
{
|
||||
TestPackagePrintService.AddPrintCountByTypeInt(PTP_ID, int.Parse( Grid1.SelectedRowID));
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
||||
}
|
||||
}
|
||||
// 在文件名中加入时间戳,例如:PTP_ID_2025-09-17-14-30-00.pdf
|
||||
string timeStamp = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
|
||||
string fileName = $"{PTP_ID}_{timeStamp}.pdf";
|
||||
string filePath = System.IO.Path.Combine(Funs.RootPath, "FileUpload", fileName);
|
||||
BLL.FastReportService.ExportMergeReport(FastReportItemList, filePath, "1");
|
||||
FileInfo info = new FileInfo(filePath);
|
||||
long fileSize = info.Length;
|
||||
System.Web.HttpContext.Current.Response.Clear();
|
||||
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode("试压包资料子类.pdf", System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(filePath, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user