试压管理修改
This commit is contained in:
@@ -171,6 +171,7 @@ namespace FineUIPro.Web.HJGL.TestPackage
|
||||
t.UnitWorkId,
|
||||
t.TestPackageNo,
|
||||
t.TestPackageName,
|
||||
t.FinishDef,
|
||||
(case when t.PrintState>0 then '第'+convert(varchar(10),t.PrintState)+'次打印' else '未打印' end) as PrintState,
|
||||
t.TableDate
|
||||
from PTP_TestPackage t where t.ProjectId=@projectId";
|
||||
@@ -245,175 +246,175 @@ namespace FineUIPro.Web.HJGL.TestPackage
|
||||
/// <param name="e"></param>
|
||||
protected void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID))
|
||||
{
|
||||
this.PTP_ID = this.Grid1.SelectedRowID;
|
||||
exportWord("1");
|
||||
}
|
||||
else
|
||||
var selectedRows = this.Grid1.SelectedRowIDArray;
|
||||
if (selectedRows.Length==0)
|
||||
{
|
||||
Alert.ShowInTop("请选择一条试压包", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
foreach (var ptp_id in selectedRows)
|
||||
{
|
||||
exportWord(ptp_id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void exportWord(string type)
|
||||
protected void exportWord(string ptp_id)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.PTP_ID))
|
||||
{
|
||||
//修改试压包打印状态
|
||||
var updateTestPackage = Funs.DB.PTP_TestPackage.FirstOrDefault(x => x.PTP_ID == this.PTP_ID);
|
||||
if (updateTestPackage != null)
|
||||
{
|
||||
if (updateTestPackage.PrintState.HasValue && updateTestPackage.PrintState > 0)
|
||||
{
|
||||
updateTestPackage.PrintState = updateTestPackage.PrintState + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
updateTestPackage.PrintState = 1;
|
||||
}
|
||||
BLL.TestPackageEditService.UpdateTestPackagePrintState(updateTestPackage);
|
||||
|
||||
string rootPath = Server.MapPath("~/");
|
||||
BLL.FastReportService.ResetData();
|
||||
|
||||
if (this.drpPrintType.SelectedValue == "1")//pdf格式
|
||||
{
|
||||
ListItem[] list = new ListItem[10];
|
||||
list[0] = new ListItem("0", "File\\Fastreport\\JGZL\\管道试压包文件资料.frx");
|
||||
list[1] = new ListItem("1", "File\\Fastreport\\JGZL\\管道压力试验技术要求.frx");
|
||||
list[2] = new ListItem("2", "File\\Fastreport\\JGZL\\管道压力包文件资料目录.frx");
|
||||
list[3] = new ListItem("3", "File\\Fastreport\\JGZL\\管道系统压力试验条件确认记录.frx");
|
||||
list[4] = new ListItem("4", "File\\Fastreport\\JGZL\\管道试压包尾项清单.frx");
|
||||
list[5] = new ListItem("5", "File\\Fastreport\\JGZL\\管道系统压力试验记录.frx");
|
||||
list[6] = new ListItem("6", "File\\Fastreport\\JGZL\\管道材料材质标识检查记录.frx");
|
||||
list[7] = new ListItem("7", "File\\Fastreport\\JGZL\\管道焊接工作记录.frx");
|
||||
list[8] = new ListItem("8", "File\\Fastreport\\JGZL\\管道无损检测数量统计表.frx");
|
||||
list[9] = new ListItem("9", "File\\Fastreport\\JGZL\\无损检测结果汇总表.frx");
|
||||
|
||||
List<Model.FastReportItem> FastReportItemList = new List<Model.FastReportItem>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
FastReportItemList.Add(GetFastReportItem(updateTestPackage, item.Text));
|
||||
}
|
||||
|
||||
var Path = Funs.RootPath + "FileUpload/" + this.PTP_ID + ".pdf";
|
||||
|
||||
BLL.FastReportService.ExportMergeReport(FastReportItemList, Path, this.drpPrintType.SelectedValue);
|
||||
FileInfo info = new FileInfo(Path);
|
||||
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(Path, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
File.Delete(Path);
|
||||
}
|
||||
else if (this.drpPrintType.SelectedValue == "2")//word格式
|
||||
{
|
||||
ListItem[] list = new ListItem[3];
|
||||
list[0] = new ListItem("0", "File\\Fastreport\\JGZL\\管道试压包文件资料.frx");
|
||||
list[1] = new ListItem("1", "File\\Fastreport\\JGZL\\管道压力试验技术要求.frx");
|
||||
list[2] = new ListItem("2", "File\\Fastreport\\JGZL\\管道压力包文件资料目录.frx");
|
||||
|
||||
List<Model.FastReportItem> FastReportItemList = new List<Model.FastReportItem>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
FastReportItemList.Add(GetFastReportItem(updateTestPackage, item.Text));
|
||||
}
|
||||
var PathA = Funs.RootPath + "FileUpload/" + this.PTP_ID + ".docx";
|
||||
BLL.FastReportService.ExportMergeReport(FastReportItemList, PathA, this.drpPrintType.SelectedValue);
|
||||
Aspose.Words.Document doc1 = new Aspose.Words.Document(PathA);
|
||||
|
||||
ListItem[] list2 = new ListItem[1];
|
||||
list2[0] = new ListItem("3", "File\\Fastreport\\JGZL\\管道系统压力试验条件确认记录.frx");
|
||||
List<Model.FastReportItem> FastReportItemList2 = new List<Model.FastReportItem>();
|
||||
foreach (var item in list2)
|
||||
{
|
||||
FastReportItemList2.Add(GetFastReportItem(updateTestPackage, item.Text));
|
||||
}
|
||||
var PathB = Funs.RootPath + "FileUpload/" + this.PTP_ID + "2.docx";
|
||||
BLL.FastReportService.ExportMergeReport(FastReportItemList2, PathB, this.drpPrintType.SelectedValue);
|
||||
Aspose.Words.Document doc2 = new Aspose.Words.Document(PathB);
|
||||
|
||||
// 合并 Word DOcx 文档
|
||||
doc1.AppendDocument(doc2, Aspose.Words.ImportFormatMode.KeepSourceFormatting);
|
||||
|
||||
|
||||
ListItem[] list3 = new ListItem[1];
|
||||
list3[0] = new ListItem("4", "File\\Fastreport\\JGZL\\管道试压包尾项清单.frx");
|
||||
List<Model.FastReportItem> FastReportItemList3 = new List<Model.FastReportItem>();
|
||||
foreach (var item in list3)
|
||||
{
|
||||
FastReportItemList3.Add(GetFastReportItem(updateTestPackage, item.Text));
|
||||
}
|
||||
var PathC = Funs.RootPath + "FileUpload/" + this.PTP_ID + "3.docx";
|
||||
BLL.FastReportService.ExportMergeReport(FastReportItemList3, PathC, this.drpPrintType.SelectedValue);
|
||||
Aspose.Words.Document doc3 = new Aspose.Words.Document(PathC);
|
||||
// 合并 Word DOcx 文档
|
||||
doc1.AppendDocument(doc3, Aspose.Words.ImportFormatMode.KeepSourceFormatting);
|
||||
|
||||
ListItem[] list4 = new ListItem[2];
|
||||
list4[0] = new ListItem("5", "File\\Fastreport\\JGZL\\管道系统压力试验记录.frx");
|
||||
list4[1] = new ListItem("6", "File\\Fastreport\\JGZL\\管道材料材质标识检查记录.frx");
|
||||
List<Model.FastReportItem> FastReportItemList4 = new List<Model.FastReportItem>();
|
||||
foreach (var item in list4)
|
||||
{
|
||||
FastReportItemList4.Add(GetFastReportItem(updateTestPackage, item.Text));
|
||||
}
|
||||
var PathD = Funs.RootPath + "FileUpload/" + this.PTP_ID + "4.docx";
|
||||
BLL.FastReportService.ExportMergeReport(FastReportItemList4, PathD, this.drpPrintType.SelectedValue);
|
||||
Aspose.Words.Document doc4 = new Aspose.Words.Document(PathD);
|
||||
// 合并 Word DOcx 文档
|
||||
doc1.AppendDocument(doc4, Aspose.Words.ImportFormatMode.KeepSourceFormatting);
|
||||
|
||||
ListItem[] list5 = new ListItem[3];
|
||||
list5[0] = new ListItem("7", "File\\Fastreport\\JGZL\\管道焊接工作记录.frx");
|
||||
list5[1] = new ListItem("8", "File\\Fastreport\\JGZL\\管道无损检测数量统计表.frx");
|
||||
list5[2] = new ListItem("9", "File\\Fastreport\\JGZL\\无损检测结果汇总表.frx");
|
||||
List<Model.FastReportItem> FastReportItemList5 = new List<Model.FastReportItem>();
|
||||
foreach (var item in list5)
|
||||
{
|
||||
FastReportItemList5.Add(GetFastReportItem(updateTestPackage, item.Text));
|
||||
}
|
||||
var PathE = Funs.RootPath + "FileUpload/" + this.PTP_ID + "5.docx";
|
||||
BLL.FastReportService.ExportMergeReport(FastReportItemList5, PathE, this.drpPrintType.SelectedValue);
|
||||
Aspose.Words.Document doc5 = new Aspose.Words.Document(PathE);
|
||||
// 合并 Word DOcx 文档
|
||||
doc1.AppendDocument(doc5, Aspose.Words.ImportFormatMode.KeepSourceFormatting);
|
||||
|
||||
//将合并的文档保存为 DOCX 文件
|
||||
doc1.Save(Funs.RootPath + "FileUpload/doc.docx");
|
||||
|
||||
var Path = Funs.RootPath + "FileUpload/doc.docx";
|
||||
FileInfo info = new FileInfo(Path);
|
||||
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("交工资料.docx", System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(Path, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
File.Delete(Path);
|
||||
File.Delete(PathA);
|
||||
File.Delete(PathB);
|
||||
File.Delete(PathC);
|
||||
File.Delete(PathD);
|
||||
File.Delete(PathE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (string.IsNullOrEmpty(ptp_id))
|
||||
{
|
||||
Alert.ShowInTop("请选择要打印的单据!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
//修改试压包打印状态
|
||||
var updateTestPackage = Funs.DB.PTP_TestPackage.FirstOrDefault(x => x.PTP_ID == ptp_id);
|
||||
string exportName = updateTestPackage?.TestPackageNo; //导出文件名称
|
||||
if (updateTestPackage != null)
|
||||
{
|
||||
if (updateTestPackage.PrintState.HasValue && updateTestPackage.PrintState > 0)
|
||||
{
|
||||
updateTestPackage.PrintState = updateTestPackage.PrintState + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
updateTestPackage.PrintState = 1;
|
||||
}
|
||||
BLL.TestPackageEditService.UpdateTestPackagePrintState(updateTestPackage);
|
||||
|
||||
string rootPath = Server.MapPath("~/");
|
||||
BLL.FastReportService.ResetData();
|
||||
|
||||
if (this.drpPrintType.SelectedValue == "1")//pdf格式
|
||||
{
|
||||
ListItem[] list = new ListItem[10];
|
||||
list[0] = new ListItem("0", "File\\Fastreport\\JGZL\\管道试压包文件资料.frx");
|
||||
list[1] = new ListItem("1", "File\\Fastreport\\JGZL\\管道压力试验技术要求.frx");
|
||||
list[2] = new ListItem("2", "File\\Fastreport\\JGZL\\管道压力包文件资料目录.frx");
|
||||
list[3] = new ListItem("3", "File\\Fastreport\\JGZL\\管道系统压力试验条件确认记录.frx");
|
||||
list[4] = new ListItem("4", "File\\Fastreport\\JGZL\\管道试压包尾项清单.frx");
|
||||
list[5] = new ListItem("5", "File\\Fastreport\\JGZL\\管道系统压力试验记录.frx");
|
||||
list[6] = new ListItem("6", "File\\Fastreport\\JGZL\\管道材料材质标识检查记录.frx");
|
||||
list[7] = new ListItem("7", "File\\Fastreport\\JGZL\\管道焊接工作记录.frx");
|
||||
list[8] = new ListItem("8", "File\\Fastreport\\JGZL\\管道无损检测数量统计表.frx");
|
||||
list[9] = new ListItem("9", "File\\Fastreport\\JGZL\\无损检测结果汇总表.frx");
|
||||
|
||||
List<Model.FastReportItem> FastReportItemList = new List<Model.FastReportItem>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
FastReportItemList.Add(GetFastReportItem(updateTestPackage, item.Text));
|
||||
}
|
||||
|
||||
var Path = Funs.RootPath + "FileUpload/" + ptp_id + ".pdf";
|
||||
|
||||
BLL.FastReportService.ExportMergeReport(FastReportItemList, Path, this.drpPrintType.SelectedValue);
|
||||
FileInfo info = new FileInfo(Path);
|
||||
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(exportName + ".pdf", System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(Path, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
File.Delete(Path);
|
||||
}
|
||||
else if (this.drpPrintType.SelectedValue == "2")//word格式
|
||||
{
|
||||
ListItem[] list = new ListItem[3];
|
||||
list[0] = new ListItem("0", "File\\Fastreport\\JGZL\\管道试压包文件资料.frx");
|
||||
list[1] = new ListItem("1", "File\\Fastreport\\JGZL\\管道压力试验技术要求.frx");
|
||||
list[2] = new ListItem("2", "File\\Fastreport\\JGZL\\管道压力包文件资料目录.frx");
|
||||
|
||||
List<Model.FastReportItem> FastReportItemList = new List<Model.FastReportItem>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
FastReportItemList.Add(GetFastReportItem(updateTestPackage, item.Text));
|
||||
}
|
||||
var PathA = Funs.RootPath + "FileUpload/" + ptp_id + ".docx";
|
||||
BLL.FastReportService.ExportMergeReport(FastReportItemList, PathA, this.drpPrintType.SelectedValue);
|
||||
Aspose.Words.Document doc1 = new Aspose.Words.Document(PathA);
|
||||
|
||||
ListItem[] list2 = new ListItem[1];
|
||||
list2[0] = new ListItem("3", "File\\Fastreport\\JGZL\\管道系统压力试验条件确认记录.frx");
|
||||
List<Model.FastReportItem> FastReportItemList2 = new List<Model.FastReportItem>();
|
||||
foreach (var item in list2)
|
||||
{
|
||||
FastReportItemList2.Add(GetFastReportItem(updateTestPackage, item.Text));
|
||||
}
|
||||
var PathB = Funs.RootPath + "FileUpload/" + ptp_id + "2.docx";
|
||||
BLL.FastReportService.ExportMergeReport(FastReportItemList2, PathB, this.drpPrintType.SelectedValue);
|
||||
Aspose.Words.Document doc2 = new Aspose.Words.Document(PathB);
|
||||
|
||||
// 合并 Word DOcx 文档
|
||||
doc1.AppendDocument(doc2, Aspose.Words.ImportFormatMode.KeepSourceFormatting);
|
||||
|
||||
|
||||
ListItem[] list3 = new ListItem[1];
|
||||
list3[0] = new ListItem("4", "File\\Fastreport\\JGZL\\管道试压包尾项清单.frx");
|
||||
List<Model.FastReportItem> FastReportItemList3 = new List<Model.FastReportItem>();
|
||||
foreach (var item in list3)
|
||||
{
|
||||
FastReportItemList3.Add(GetFastReportItem(updateTestPackage, item.Text));
|
||||
}
|
||||
var PathC = Funs.RootPath + "FileUpload/" + ptp_id + "3.docx";
|
||||
BLL.FastReportService.ExportMergeReport(FastReportItemList3, PathC, this.drpPrintType.SelectedValue);
|
||||
Aspose.Words.Document doc3 = new Aspose.Words.Document(PathC);
|
||||
// 合并 Word DOcx 文档
|
||||
doc1.AppendDocument(doc3, Aspose.Words.ImportFormatMode.KeepSourceFormatting);
|
||||
|
||||
ListItem[] list4 = new ListItem[2];
|
||||
list4[0] = new ListItem("5", "File\\Fastreport\\JGZL\\管道系统压力试验记录.frx");
|
||||
list4[1] = new ListItem("6", "File\\Fastreport\\JGZL\\管道材料材质标识检查记录.frx");
|
||||
List<Model.FastReportItem> FastReportItemList4 = new List<Model.FastReportItem>();
|
||||
foreach (var item in list4)
|
||||
{
|
||||
FastReportItemList4.Add(GetFastReportItem(updateTestPackage, item.Text));
|
||||
}
|
||||
var PathD = Funs.RootPath + "FileUpload/" + ptp_id + "4.docx";
|
||||
BLL.FastReportService.ExportMergeReport(FastReportItemList4, PathD, this.drpPrintType.SelectedValue);
|
||||
Aspose.Words.Document doc4 = new Aspose.Words.Document(PathD);
|
||||
// 合并 Word DOcx 文档
|
||||
doc1.AppendDocument(doc4, Aspose.Words.ImportFormatMode.KeepSourceFormatting);
|
||||
|
||||
ListItem[] list5 = new ListItem[3];
|
||||
list5[0] = new ListItem("7", "File\\Fastreport\\JGZL\\管道焊接工作记录.frx");
|
||||
list5[1] = new ListItem("8", "File\\Fastreport\\JGZL\\管道无损检测数量统计表.frx");
|
||||
list5[2] = new ListItem("9", "File\\Fastreport\\JGZL\\无损检测结果汇总表.frx");
|
||||
List<Model.FastReportItem> FastReportItemList5 = new List<Model.FastReportItem>();
|
||||
foreach (var item in list5)
|
||||
{
|
||||
FastReportItemList5.Add(GetFastReportItem(updateTestPackage, item.Text));
|
||||
}
|
||||
var PathE = Funs.RootPath + "FileUpload/" + ptp_id + "5.docx";
|
||||
BLL.FastReportService.ExportMergeReport(FastReportItemList5, PathE, this.drpPrintType.SelectedValue);
|
||||
Aspose.Words.Document doc5 = new Aspose.Words.Document(PathE);
|
||||
// 合并 Word DOcx 文档
|
||||
doc1.AppendDocument(doc5, Aspose.Words.ImportFormatMode.KeepSourceFormatting);
|
||||
|
||||
//将合并的文档保存为 DOCX 文件
|
||||
doc1.Save(Funs.RootPath + "FileUpload/doc.docx");
|
||||
|
||||
var Path = Funs.RootPath + "FileUpload/doc.docx";
|
||||
FileInfo info = new FileInfo(Path);
|
||||
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(exportName + ".docx", System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(Path, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
File.Delete(Path);
|
||||
File.Delete(PathA);
|
||||
File.Delete(PathB);
|
||||
File.Delete(PathC);
|
||||
File.Delete(PathD);
|
||||
File.Delete(PathE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -524,9 +525,9 @@ namespace FineUIPro.Web.HJGL.TestPackage
|
||||
string sql = @"SELECT ptpPipe.PT_PipeId,
|
||||
ptpPipe.PTP_ID,
|
||||
ptpPipe.PipelineId,
|
||||
ptpPipe.DesignPress, --设计压力
|
||||
ptpPipe.DesignTemperature, --设计温度
|
||||
ptpPipe.TestPressure, --试验压力
|
||||
IsoInfo.DesignPress, --设计压力
|
||||
IsoInfo.DesignTemperature, --设计温度
|
||||
IsoInfo.TestPressure, --试验压力
|
||||
IsoInfo.PipelineCode,--管道编号/单线号
|
||||
testMedium.MediumName,--试验介质
|
||||
testPackage.AmbientTemperature,--试验环境温度
|
||||
|
||||
Reference in New Issue
Block a user