20260918 管道系统泄漏性试验记录

This commit is contained in:
2026-09-18 11:31:28 +08:00
parent 2a50577412
commit 2b3539cd85
5 changed files with 255 additions and 240 deletions
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Created="01/29/2026 10:23:50" ReportInfo.Modified="09/15/2026 16:22:39" ReportInfo.CreatorVersion="2017.1.16.0"> <Report ScriptLanguage="CSharp" ReportInfo.Created="01/29/2026 10:23:50" ReportInfo.Modified="09/18/2026 11:22:49" ReportInfo.CreatorVersion="2017.1.16.0">
<ScriptText>using System; <ScriptText>using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@@ -42,7 +42,7 @@ namespace FastReport
} }
</ScriptText> </ScriptText>
<Dictionary> <Dictionary>
<MsSqlDataConnection Name="Connection" ConnectionString="rijcmlqtRsOalcXxDhVt62rPEPNYjaATUoMqziRYvJtgNsyJKYAG7kXKvNAMI/qBkgJNPccFsWrhiII6oyX1HS+uwN7YigxVjqUq3vIet2zpPnmWhwvYEvWOOCZZGx6EC4BfGfWX8aPj6bmoF52Z0fnUA9g71duxa/gvChTW/nzu9qsYVuvlVHliMnnu6jEIF9n+/QF9KaaYnf752kTTcgAAMfUGw=="> <MsSqlDataConnection Name="Connection" ConnectionString="rijcmlqtRsOalcXxDhVt62rPEPNYjaATUoMqziRYvJtgNsyJKYAG7kXKvNAMI/qBkgJNPccFsWrhiII6oyX1HS+uwN7YigxVjqUq3vIet2zpPnmWhwvYEvWOOCZZGx6EC4BfGfWX8aPj6bmoF52Z0fnUA9g71duxa/gvChTW/nzu9qsYVuvlVHliMnnu6jEIF9n+/QFlDGVCtBD9EyVLKcJ6YVUug==">
<TableDataSource Name="Data" DataType="System.Int32" PropName="Attach_Image" Enabled="true" TableName="Data"> <TableDataSource Name="Data" DataType="System.Int32" PropName="Attach_Image" Enabled="true" TableName="Data">
<Column Name="PipelineNo" DataType="System.String" PropName="attach_image_id"/> <Column Name="PipelineNo" DataType="System.String" PropName="attach_image_id"/>
<Column Name="DesignPressure" DataType="System.String" PropName="image_series"/> <Column Name="DesignPressure" DataType="System.String" PropName="image_series"/>
+67 -55
View File
@@ -45,7 +45,7 @@
<f:Button ID="btnPrint" Text="打印" Icon="Printer" runat="server" OnClick="btnPrint_Click"> <f:Button ID="btnPrint" Text="打印" Icon="Printer" runat="server" OnClick="btnPrint_Click">
</f:Button> </f:Button>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="导出" ToolTip="导出Word" Icon="FolderUp" <f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="导出" ToolTip="导出Word" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false" Hidden="true"> EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button> </f:Button>
</Items> </Items>
</f:Toolbar> </f:Toolbar>
@@ -62,62 +62,74 @@
</f:TextBox> </f:TextBox>
</Items> </Items>
</f:FormRow> </f:FormRow>
<f:FormRow>
<Items>
<%-- <f:SimpleForm ID="SimpleForm2" runat="server"
ShowHeader="false" ShowBorder="false" EnableTableStyle="true" MessageTarget="Qtip">
<Items>
<f:FormRow>
<Items>--%>
<f:DropDownList ID="drpCheckResult1" runat="server" Label="管道压力试验合格" LabelAlign="Right" LabelWidth="350px">
<f:ListItem Value="合格" Text="合格" Selected="true" />
<f:ListItem Value="不合格" Text="不合格" />
<f:ListItem Value="/" Text="/" />
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpCheckResult2" runat="server" Label="压力试验采用的临时法兰、螺栓、垫片等均已更换" LabelAlign="Right" LabelWidth="350px">
<f:ListItem Value="合格" Text="合格" Selected="true" />
<f:ListItem Value="不合格" Text="不合格" />
<f:ListItem Value="/" Text="/" />
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpCheckResult3" runat="server" Label="未参与压力试验的安全附件及仪表等已安装复位" LabelAlign="Right" LabelWidth="350px">
<f:ListItem Value="合格" Text="合格" Selected="true" />
<f:ListItem Value="不合格" Text="不合格" />
<f:ListItem Value="/" Text="/" />
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpCheckResult4" runat="server" Label="试验管道系统的阀门已全部开启" LabelAlign="Right" LabelWidth="350px">
<f:ListItem Value="合格" Text="合格" Selected="true" />
<f:ListItem Value="不合格" Text="不合格" />
<f:ListItem Value="/" Text="/" />
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpCheckResult5" runat="server" Label="试压用压力表、精度等级、检定状态符合规范要求" LabelAlign="Right" LabelWidth="350px">
<f:ListItem Value="合格" Text="合格" Selected="true" />
<f:ListItem Value="不合格" Text="不合格" />
<f:ListItem Value="/" Text="/" />
</f:DropDownList>
</Items>
</f:FormRow>
<%-- </Items>
</f:SimpleForm>
</Items>
</f:FormRow>--%>
</Rows> </Rows>
</f:Form> </f:Form>
<f:SimpleForm ID="SimpleForm2" runat="server" BodyPadding="10px"
ShowHeader="false" ShowBorder="false" EnableTableStyle="true" MessageTarget="Qtip">
<Items>
<f:Form ID="Form2" ShowBorder="true" ShowHeader="false" AutoScroll="true" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:Label Label="Label2" runat="server" Text="检查项目与要求" ShowLabel="false" CssStyle="text-align:center;"></f:Label>
<f:Label Label="Label5" runat="server" Text="检查结果" ShowLabel="false" CssStyle="text-align:center;"></f:Label>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Label Label="Label1" runat="server" Text="管道压力试验合格" ShowLabel="false"></f:Label>
<f:DropDownList ID="drpCheckResult1" runat="server">
<f:ListItem Value="合格" Text="合格" Selected="true" />
<f:ListItem Value="不合格" Text="不合格" />
<f:ListItem Value="/" Text="/" />
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Label Label="Label1" runat="server" Text="压力试验采用的临时法兰、螺栓、垫片等均已更换" ShowLabel="false"></f:Label>
<f:DropDownList ID="drpCheckResult2" runat="server">
<f:ListItem Value="合格" Text="合格" Selected="true" />
<f:ListItem Value="不合格" Text="不合格" />
<f:ListItem Value="/" Text="/" />
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Label Label="Label1" runat="server" Text="未参与压力试验的安全附件及仪表等已安装复位" ShowLabel="false"></f:Label>
<f:DropDownList ID="drpCheckResult3" runat="server">
<f:ListItem Value="合格" Text="合格" Selected="true" />
<f:ListItem Value="不合格" Text="不合格" />
<f:ListItem Value="/" Text="/" />
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Label Label="Label1" runat="server" Text="试验管道系统的阀门已全部开启" ShowLabel="false"></f:Label>
<f:DropDownList ID="drpCheckResult4" runat="server">
<f:ListItem Value="合格" Text="合格" Selected="true" />
<f:ListItem Value="不合格" Text="不合格" />
<f:ListItem Value="/" Text="/" />
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Label Label="Label1" runat="server" Text="试压用压力表、精度等级、检定状态符合规范要求" ShowLabel="false"></f:Label>
<f:DropDownList ID="drpCheckResult5" runat="server">
<f:ListItem Value="合格" Text="合格" Selected="true" />
<f:ListItem Value="不合格" Text="不合格" />
<f:ListItem Value="/" Text="/" />
</f:DropDownList>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</Items>
</f:SimpleForm>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="试验记录" EnableCollapse="true" <f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="试验记录" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="LeakageVacuumTestRecordId" AllowCellEditing="true" runat="server" BoxFlex="1" DataKeyNames="LeakageVacuumTestRecordId" AllowCellEditing="true"
EnableColumnLines="true" ClicksToEdit="1" DataIDField="LeakageVacuumTestRecordId" AllowSorting="true" EnableColumnLines="true" ClicksToEdit="1" DataIDField="LeakageVacuumTestRecordId" AllowSorting="true"
+168 -183
View File
@@ -110,6 +110,7 @@ namespace FineUIPro.Web.JGZL
itemLists.Clear(); itemLists.Clear();
if (!string.IsNullOrEmpty(this.ProjectId)) if (!string.IsNullOrEmpty(this.ProjectId))
{ {
var isoInfos = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByProjectId(this.ProjectId);
var record = BLL.LeakageVacuumService.GetLeakageVacuumByProjectId(this.ProjectId); var record = BLL.LeakageVacuumService.GetLeakageVacuumByProjectId(this.ProjectId);
if (record != null) if (record != null)
{ {
@@ -121,8 +122,7 @@ namespace FineUIPro.Web.JGZL
this.drpCheckResult3.SelectedValue = record.CheckItemResult3; this.drpCheckResult3.SelectedValue = record.CheckItemResult3;
this.drpCheckResult4.SelectedValue = record.CheckItemResult4; this.drpCheckResult4.SelectedValue = record.CheckItemResult4;
this.drpCheckResult5.SelectedValue = record.CheckItemResult5; this.drpCheckResult5.SelectedValue = record.CheckItemResult5;
var isoInfos = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByProjectId(this.ProjectId);
itemLists = BLL.LeakageVacuumTestRecordServic.GetLeakageVacuumTestRecordByLeakageVacuumId(this.LeakageVacuumId); itemLists = BLL.LeakageVacuumTestRecordServic.GetLeakageVacuumTestRecordByLeakageVacuumId(this.LeakageVacuumId);
if (itemLists.Count > 0) if (itemLists.Count > 0)
{ {
@@ -143,7 +143,7 @@ namespace FineUIPro.Web.JGZL
} }
} }
else else
{ {
foreach (var item in isoInfos) foreach (var item in isoInfos)
{ {
Model.JGZL_LeakageVacuumTestRecord newItem = new JGZL_LeakageVacuumTestRecord(); Model.JGZL_LeakageVacuumTestRecord newItem = new JGZL_LeakageVacuumTestRecord();
@@ -156,9 +156,23 @@ namespace FineUIPro.Web.JGZL
itemLists.Add(newItem); itemLists.Add(newItem);
} }
} }
this.Grid1.DataSource = itemLists;
this.Grid1.DataBind();
} }
else
{
foreach (var item in isoInfos)
{
Model.JGZL_LeakageVacuumTestRecord newItem = new JGZL_LeakageVacuumTestRecord();
newItem.LeakageVacuumTestRecordId = SQLHelper.GetNewID(typeof(Model.JGZL_LeakageVacuumTestRecord));
newItem.PipelineId = item.ISO_ID;
newItem.PipelineCode = item.ISO_IsoNo;
newItem.DesignPressure = item.ISO_DesignPress.HasValue ? item.ISO_DesignPress.Value.ToString("0.##########") : "";
newItem.DesignTem = item.ISO_DesignTemperature.HasValue ? item.ISO_DesignTemperature.Value.ToString("0.##########") : "";
newItem.LeakPressure = item.LeakageTest.ToString();
itemLists.Add(newItem);
}
}
this.Grid1.DataSource = itemLists;
this.Grid1.DataBind();
} }
} }
#endregion #endregion
@@ -579,192 +593,163 @@ namespace FineUIPro.Web.JGZL
protected void btnOut_Click(object sender, EventArgs e) protected void btnOut_Click(object sender, EventArgs e)
{ {
string rootPath = Server.MapPath("~/"); string rootPath = Server.MapPath("~/");
string initTemplatePath = string.Empty; string initTemplatePath = Const.JGZL_LeakageVacuumUrl;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
string filePath = string.Empty;
//每页显示的固定数据行数
int rowsPerPage = 8;
string projectId = this.tvControlItem.SelectedNodeID; string projectId = this.tvControlItem.SelectedNodeID;
if (!string.IsNullOrEmpty(projectId))
{
var report = BLL.LeakageVacuumService.GetLeakageVacuumByProjectId(projectId);
if (report != null)
{
initTemplatePath = Const.JGZL_LeakageVacuumUrl;
uploadfilepath = rootPath + initTemplatePath;
newUrl = uploadfilepath.Replace("管道系统泄漏性试验记录导出模板", "管道系统泄漏性试验记录"); if (string.IsNullOrEmpty(projectId))
if (File.Exists(newUrl))
{
File.Delete(newUrl);
}
File.Copy(uploadfilepath, newUrl);
//更新书签内容
Document doc = new Aspose.Words.Document(newUrl);
DocumentBuilder builder = new DocumentBuilder(doc);
Aspose.Words.Tables.Table table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, 0, true);
Bookmark projectName = doc.Range.Bookmarks["ProjectName"];
if (projectName != null)
{
projectName.Text = BLL.Base_ProjectService.GetProjectByProjectId(report.ProjectId).ProjectName;
}
Bookmark systemName = doc.Range.Bookmarks["SystemName"];
if (systemName != null)
{
systemName.Text = report.SystemName;
}
Bookmark systemCode = doc.Range.Bookmarks["SystemCode"];
if (systemCode != null)
{
systemCode.Text = report.SystemCode;
}
Bookmark checkItemResult1 = doc.Range.Bookmarks["CheckItemResult1"];
if (checkItemResult1 != null)
{
checkItemResult1.Text = report.CheckItemResult1;
}
Bookmark checkItemResult2 = doc.Range.Bookmarks["CheckItemResult2"];
if (checkItemResult2 != null)
{
checkItemResult2.Text = report.CheckItemResult2;
}
Bookmark checkItemResult3 = doc.Range.Bookmarks["CheckItemResult3"];
if (checkItemResult3 != null)
{
checkItemResult3.Text = report.CheckItemResult3;
}
Bookmark checkItemResult4 = doc.Range.Bookmarks["CheckItemResult4"];
if (checkItemResult4 != null)
{
checkItemResult4.Text = report.CheckItemResult4;
}
Bookmark checkItemResult5 = doc.Range.Bookmarks["CheckItemResult5"];
if (checkItemResult5 != null)
{
checkItemResult5.Text = report.CheckItemResult5;
}
// 设置表头行重复显示
table.Rows[0].RowFormat.HeadingFormat = true;
table.Rows[1].RowFormat.HeadingFormat = true;
table.Rows[2].RowFormat.HeadingFormat = true;
table.Rows[3].RowFormat.HeadingFormat = true;
table.Rows[4].RowFormat.HeadingFormat = true;
table.Rows[5].RowFormat.HeadingFormat = true;
table.Rows[6].RowFormat.HeadingFormat = true;
table.Rows[7].RowFormat.HeadingFormat = true;
table.Rows[8].RowFormat.HeadingFormat = true;
table.Rows[9].RowFormat.HeadingFormat = true;
table.Rows[10].RowFormat.HeadingFormat = true;
// ====固定表格布局=====
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
table.AllowAutoFit = false;
table.Alignment = TableAlignment.Center;
// 先记录页尾行,并从表格中移除
//Row footerRow = table.Rows[table.Rows.Count - 1];
//table.Rows.RemoveAt(table.Rows.Count - 1);
var recordLists = BLL.LeakageVacuumTestRecordServic.GetLeakageVacuumTestRecordByLeakageVacuumId(report.LeakageVacuumId);
if (recordLists.Count == Grid1.GetMergedData().Count)
{
int i = 0;
foreach (var item in recordLists)
{
//创建行
Aspose.Words.Tables.Row row = new Aspose.Words.Tables.Row(doc);
row.Cells.Add(CreateCell(item.PipelineCode, doc, 128.42, "", ""));//管道编号/单线号
row.Cells.Add(CreateCell(item.DesignPressure, doc, 35.72, "", ""));//设计压力
row.Cells.Add(CreateCell(item.DesignTem, doc, 41.96, "", ""));//设计温度
row.Cells.Add(CreateCell(item.TestAmbientTemp, doc, 52.73, "", ""));//试验环境温度℃
row.Cells.Add(CreateCell(item.TestMediumTemp, doc, 41.96, "", ""));//试验介质温度℃
row.Cells.Add(CreateCell(item.LeakPressure, doc, 39.4, "", ""));//泄漏性试验-压力
row.Cells.Add(CreateCell(item.LeakMedium, doc, 41.96, "", ""));//泄漏性试验-介质
row.Cells.Add(CreateCell(item.VacuumPressure, doc, 45.07, "", ""));//真空试验-压力
row.Cells.Add(CreateCell(item.VacuumMedium, doc, 41.39, "", ""));//真空试验-介质
table.Rows.Insert(i + 11, row);
}
// 计算并插入空白行,填满整页
// 计算总数据行数
int totalDataRows = recordLists.Count;
// 计算需要补充的空白行数量
int remainder = totalDataRows % rowsPerPage;
int needBlankRows = remainder == 0 ? 0 : rowsPerPage - remainder;
// 插入空白行(和数据行格式保持一致,仅内容为空)
//for (int i = 0; i < needBlankRows - 1; i++)
//{
// Aspose.Words.Tables.Row blankRow = new Aspose.Words.Tables.Row(doc);
// 空白行的单元格宽度和数据行保持一致
//blankRow.Cells.Add(CreateCell("", doc, 22.68, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 65.49, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 37.14, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 27.78, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 28.06, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 28, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 34.87, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 43.66, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 59.82, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 34.58, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 33.74, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 27, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 45.93, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 37.14, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 30.62, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 48.76, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 25.23, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 28.92, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 48.76, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 26.08, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 56.7, "", ""));
//blankRow.Cells.Add(CreateCell("", doc, 22.11, "", ""));
// 插入到表格最后一行
// table.Rows.Add(blankRow);
//}
//把页尾行重新加回表格最后
//table.Rows.Add(footerRow);
doc.Save(newUrl);
}
else
{
Alert.ShowInTop("请先保存数据!", MessageBoxIcon.Warning);
return;
}
string fileName = Path.GetFileName(newUrl);
FileInfo info = new FileInfo(newUrl);
long fileSize = info.Length;
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.AddHeader("Content-Length", fileSize.ToString());
Response.TransmitFile(newUrl, 0, fileSize);
Response.Flush();
Response.Close();
File.Delete(newUrl);
}
else
{
Alert.ShowInTop("没有要导出的数据!", MessageBoxIcon.Warning);
return;
}
}
else
{ {
Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning); Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning);
return; return;
} }
var report = BLL.LeakageVacuumService.GetLeakageVacuumByProjectId(projectId);
if (report == null)
{
Alert.ShowInTop("请先保存数据!", MessageBoxIcon.Warning);
return;
}
else
{
var lists = BLL.LeakageVacuumTestRecordServic.GetLeakageVacuumTestRecordByLeakageVacuumId(report.LeakageVacuumId);
if (lists.Count != Grid1.GetMergedData().Count)
{
Alert.ShowInTop("请先保存数据!", MessageBoxIcon.Warning);
return;
}
}
string templateFullPath = Path.Combine(rootPath, initTemplatePath);
if (!File.Exists(templateFullPath))
{
Alert.ShowInTop("导出模板文件不存在!", MessageBoxIcon.Warning);
return;
}
Document doc = new Aspose.Words.Document(templateFullPath);
Aspose.Words.Tables.Table table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, 0, true);
#region 顶层书签赋值(工程名称、系统、检查项)
SafeSetBookmarkText(doc, "ProjectName", BLL.Base_ProjectService.GetProjectByProjectId(report.ProjectId)?.ProjectName);
SafeSetBookmarkText(doc, "SystemName", report.SystemName);
SafeSetBookmarkText(doc, "SystemCode", report.SystemCode);
SafeSetBookmarkText(doc, "CheckItemResult1", report.CheckItemResult1);
SafeSetBookmarkText(doc, "CheckItemResult2", report.CheckItemResult2);
SafeSetBookmarkText(doc, "CheckItemResult3", report.CheckItemResult3);
SafeSetBookmarkText(doc, "CheckItemResult4", report.CheckItemResult4);
SafeSetBookmarkText(doc, "CheckItemResult5", report.CheckItemResult5);
#endregion
#region 表头跨页重复设置
for (int r = 0; r <= 10; r++)
{
table.Rows[r].RowFormat.HeadingFormat = true;
}
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
table.AllowAutoFit = false;
table.Alignment = TableAlignment.Center;
#endregion
var recordLists = BLL.LeakageVacuumTestRecordServic.GetLeakageVacuumTestRecordByLeakageVacuumId(report.LeakageVacuumId);
Aspose.Words.Tables.Row templateDataRow = table.Rows[11];
if (recordLists.Count > 0)
{
foreach (var item in recordLists)
{
Aspose.Words.Tables.Row newDataRow = (Aspose.Words.Tables.Row)templateDataRow.Clone(true);
SafeSetRowBookmarkText(newDataRow, "Bk_PipelineCode", item.PipelineCode);
SafeSetRowBookmarkText(newDataRow, "Bk_DesignPressure", item.DesignPressure);
SafeSetRowBookmarkText(newDataRow, "Bk_DesignTem", item.DesignTem);
SafeSetRowBookmarkText(newDataRow, "Bk_TestAmbientTemp", item.TestAmbientTemp);
SafeSetRowBookmarkText(newDataRow, "Bk_TestMediumTemp", item.TestMediumTemp);
SafeSetRowBookmarkText(newDataRow, "Bk_LeakPressure", item.LeakPressure);
SafeSetRowBookmarkText(newDataRow, "Bk_LeakMedium", item.LeakMedium);
SafeSetRowBookmarkText(newDataRow, "Bk_VacuumPressure", item.VacuumPressure);
SafeSetRowBookmarkText(newDataRow, "Bk_VacuumMedium", item.VacuumMedium);
table.InsertBefore(newDataRow, templateDataRow);
}
}
#region 补充空白行填满每页8行
int rowsPerPage = 8;
int totalDataRows = recordLists.Count;
int remainder = totalDataRows % rowsPerPage;
int needBlankRows = remainder == 0 ? 0 : rowsPerPage - remainder;
for (int i = 0; i < needBlankRows; i++)
{
Aspose.Words.Tables.Row blankRow = (Aspose.Words.Tables.Row)templateDataRow.Clone(true);
SafeSetRowBookmarkText(blankRow, "Bk_PipelineCode", "");
SafeSetRowBookmarkText(blankRow, "Bk_DesignPressure", "");
SafeSetRowBookmarkText(blankRow, "Bk_DesignTem", "");
SafeSetRowBookmarkText(blankRow, "Bk_TestAmbientTemp", "");
SafeSetRowBookmarkText(blankRow, "Bk_TestMediumTemp", "");
SafeSetRowBookmarkText(blankRow, "Bk_LeakPressure", "");
SafeSetRowBookmarkText(blankRow, "Bk_LeakMedium", "");
SafeSetRowBookmarkText(blankRow, "Bk_VacuumPressure", "");
SafeSetRowBookmarkText(blankRow, "Bk_VacuumMedium", "");
table.InsertBefore(blankRow, templateDataRow);
}
#endregion
templateDataRow.Remove();
using (MemoryStream ms = new MemoryStream())
{
doc.Save(ms, Aspose.Words.SaveFormat.Docx);
ms.Position = 0;
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
string downloadFileName = "管道系统泄漏性试验记录.docx";
Response.AddHeader("Content-Disposition", $"attachment;filename={System.Web.HttpUtility.UrlEncode(downloadFileName, System.Text.Encoding.UTF8)}");
Response.BinaryWrite(ms.ToArray());
Response.Flush();
Response.End();
}
} }
/// <summary>
/// 设置文档全局书签文本
/// </summary>
private static void SafeSetBookmarkText(Document doc, string bookmarkName, string text)
{
Bookmark bm = doc.Range.Bookmarks[bookmarkName];
if (bm == null) return;
bm.Text = text ?? "";
}
/// <summary>
/// 在指定Row行节点范围内查找书签并赋值
/// </summary>
private static void SafeSetRowBookmarkText(Row row, string bookmarkName, string text)
{
text = text ?? "";
BookmarkStart bkStart = null;
NodeCollection childNodes = row.GetChildNodes(NodeType.BookmarkStart, true);
foreach (Node childNode in childNodes)
{
BookmarkStart bs = childNode as BookmarkStart;
if (bs != null && bs.Name == bookmarkName)
{
bkStart = bs;
break;
}
}
if (bkStart == null) return;
Node cur = bkStart.NextSibling;
while (cur != null && cur.NodeType != NodeType.BookmarkEnd)
{
Node next = cur.NextSibling;
cur.Remove();
cur = next;
}
Run run = new Run(row.Document, text);
bkStart.ParentNode.InsertAfter(run, bkStart);
}
public static Cell CreateCell(String value, Document doc, double cellWidth, string cellMerge = "", string CenterPage = "", string cellUnitLeft = "") public static Cell CreateCell(String value, Document doc, double cellWidth, string cellMerge = "", string CenterPage = "", string cellUnitLeft = "")
{ {
Cell cell = new Cell(doc); Cell cell = new Cell(doc);
@@ -167,6 +167,24 @@ namespace FineUIPro.Web.JGZL
/// </remarks> /// </remarks>
protected global::FineUIPro.TextBox txtSystemCode; protected global::FineUIPro.TextBox txtSystemCode;
/// <summary>
/// SimpleForm2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.SimpleForm SimpleForm2;
/// <summary>
/// Form2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form Form2;
/// <summary> /// <summary>
/// drpCheckResult1 控件。 /// drpCheckResult1 控件。
/// </summary> /// </summary>