feat(hjgl): 完善检测结果导入与焊接质量管理

通过批量导入、标准化打印和材料导出,减少检测结果及材料信息的人工整理,确保检测单、委托状态和焊口质量资料保持一致。
This commit is contained in:
2026-08-21 15:22:24 +08:00
parent 42787c1520
commit fdaf615194
20 changed files with 1236 additions and 171 deletions
@@ -28,6 +28,11 @@
<Toolbars>
<f:Toolbar runat="server">
<Items>
<f:DropDownList ID="ddlCheckCode" runat="server" Label="检测编号" Width="300px"
LabelWidth="80px" EnableEdit="true" AutoSelectFirstItem="false"
EmptyText="请选择检测编号">
<f:ListItem Text="全部" Value="" />
</f:DropDownList>
<f:TextBox ID="txtPipelineCode" runat="server" Label="管线号" Width="250px"
LabelWidth="70px" />
<f:TextBox ID="txtWeldJointCode" runat="server" Label="焊口号" Width="220px"
@@ -41,6 +46,8 @@
<f:Button ID="btnQuery" runat="server" Text="查询" Icon="SystemSearch"
OnClick="btnQuery_Click" />
<f:ToolbarFill runat="server" />
<f:Button ID="btnPrint" runat="server" Text="打印" Icon="Printer"
OnClick="btnPrint_Click" />
<f:Button ID="btnNew" runat="server" Text="新增" Icon="Add"
OnClick="btnNew_Click" />
<f:Button ID="btnEdit" runat="server" Text="修改" Icon="Pencil"
@@ -52,6 +59,7 @@
</Toolbars>
<Columns>
<f:RowNumberField Width="60px" HeaderText="序号" TextAlign="Center" />
<f:RenderField Width="210px" DataField="CheckCode" HeaderText="检测编号" />
<f:RenderField Width="220px" DataField="PipelineCode" HeaderText="管线号" />
<f:RenderField Width="130px" DataField="WeldJointCode" HeaderText="焊口号" />
<f:RenderField Width="100px" DataField="QualifiedText" HeaderText="外观是否合格"
@@ -81,6 +89,9 @@
<f:Window ID="Window1" Title="焊缝外观检测" Hidden="true" EnableIFrame="true"
EnableMaximize="true" Target="Top" runat="server" OnClose="Window1_Close" IsModal="true"
Width="760px" Height="560px" />
<f:Window ID="Window2" Title="打印预览" Hidden="true" EnableIFrame="true"
EnableMaximize="true" Target="Top" EnableResize="false" runat="server"
IsModal="true" Width="1100px" Height="700px" />
</form>
<script type="text/javascript">
var gridImageSelector = '#<%= Grid1.ClientID %> img.img';
@@ -107,6 +118,7 @@
});
});
});
</script>
</body>
</html>
@@ -1,5 +1,8 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Web;
namespace FineUIPro.Web.HJGL.WeldingManage
@@ -8,18 +11,37 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) BindGrid();
if (!IsPostBack)
{
BindCheckCodes();
BindGrid();
}
}
private void BindCheckCodes()
{
foreach (string checkCode in WeldAppearanceCheckService.GetCheckCodes(CurrUser.LoginProjectId))
{
ddlCheckCode.Items.Add(new FineUIPro.ListItem(checkCode, checkCode));
}
}
private void BindGrid()
{
var result = WeldAppearanceCheckService.GetList(CurrUser.LoginProjectId, txtPipelineCode.Text.Trim(),
txtWeldJointCode.Text.Trim(), ddlQualified.SelectedValue, Grid1.PageIndex, Grid1.PageSize);
var result = GetCurrentPageData();
Grid1.RecordCount = result.Item2;
Grid1.DataSource = result.Item1;
Grid1.DataBind();
}
private Tuple<List<Model.WeldAppearanceCheckItem>, int> GetCurrentPageData()
{
return WeldAppearanceCheckService.GetList(CurrUser.LoginProjectId,
(ddlCheckCode.SelectedValue ?? string.Empty).Trim(),
txtPipelineCode.Text.Trim(), txtWeldJointCode.Text.Trim(), ddlQualified.SelectedValue,
Grid1.PageIndex, Grid1.PageSize);
}
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) { Grid1.PageIndex = e.NewPageIndex; BindGrid(); }
protected void btnQuery_Click(object sender, EventArgs e) { Grid1.PageIndex = 0; BindGrid(); }
protected void Window1_Close(object sender, WindowCloseEventArgs e) { BindGrid(); }
@@ -61,6 +83,100 @@ namespace FineUIPro.Web.HJGL.WeldingManage
BindGrid();
}
protected void btnPrint_Click(object sender, EventArgs e)
{
string checkCode = (ddlCheckCode.SelectedValue ?? string.Empty).Trim();
if (string.IsNullOrEmpty(checkCode))
{
Alert.ShowInTop("请选择检测编号!", MessageBoxIcon.Warning);
return;
}
if (!HasPower(Const.BtnPrint))
{
return;
}
var printResult = WeldAppearanceCheckService.GetList(CurrUser.LoginProjectId, checkCode,
txtPipelineCode.Text.Trim(), txtWeldJointCode.Text.Trim(), ddlQualified.SelectedValue,
0, int.MaxValue);
List<Model.WeldAppearanceCheckItem> printItems = printResult.Item1;
if (printItems.Count == 0)
{
Alert.ShowInTop("当前筛选条件没有可打印的焊口记录!", MessageBoxIcon.Warning);
return;
}
DataTable reportData = CreateReportData(printItems);
var parameters = new Dictionary<string, string>
{
{ "ProjectName", ProjectService.GetProjectNameByProjectId(CurrUser.LoginProjectId) },
{ "CheckCode", checkCode },
{ "NDTMethod", "RT" },
// 报检数量使用本次实际打印的焊口总数,不包含版式补齐的空行。
{ "InspectionCount", printItems.Count.ToString() },
{ "DetectionRate", string.Empty }
};
FastReportService.ResetData();
FastReportService.AddFastreportTable(reportData);
FastReportService.AddFastreportParameter(parameters);
string rootPath = Server.MapPath("~/");
string initTemplatePath = Const.WeldAppearanceCheckReportTemplateUrl;
if (File.Exists(rootPath + initTemplatePath))
{
PageContext.RegisterStartupScript(Window2.GetShowReference(string.Format(
"~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
}
else
{
Alert.ShowInTop("打印模板不存在!", MessageBoxIcon.Warning);
}
}
private static DataTable CreateReportData(List<Model.WeldAppearanceCheckItem> items)
{
var table = new DataTable("Data");
table.Columns.Add("RowNumber", typeof(int));
table.Columns.Add("PipelineCode", typeof(string));
table.Columns.Add("WeldJointCode", typeof(string));
table.Columns.Add("WelderCode", typeof(string));
table.Columns.Add("Specification", typeof(string));
table.Columns.Add("MaterialCode", typeof(string));
table.Columns.Add("WeldingLocation", typeof(string));
table.Columns.Add("WeldingMethodCode", typeof(string));
table.Columns.Add("WeldingMaterial", typeof(string));
table.Columns.Add("ItemCode", typeof(string));
table.Columns.Add("BatchCode", typeof(string));
table.Columns.Add("Remark", typeof(string));
const int regularPageRowCount = 14;
const int lastPageRowCount = 12;
int reportRowCount = items.Count <= lastPageRowCount
? lastPageRowCount
: lastPageRowCount + (int)Math.Ceiling((items.Count - lastPageRowCount)
/ (decimal)regularPageRowCount) * regularPageRowCount;
for (int i = 0; i < reportRowCount; i++)
{
if (i < items.Count)
{
Model.WeldAppearanceCheckItem item = items[i];
// 明细字段严格对应检查表模板;物料代码和炉批号当前业务无来源,保持空白待签填。
table.Rows.Add(i + 1, item.PipelineCode, item.WeldJointCode, item.WelderCode,
item.Specification, item.MaterialCode, item.WeldingLocation, item.WeldingMethodCode,
item.WeldingMaterial, string.Empty, string.Empty, item.Remark);
}
else
{
// 普通页显示14行、末页显示12行,不足部分补空行,使签字区紧跟末页数据区。
table.Rows.Add(i + 1, string.Empty, string.Empty, string.Empty, string.Empty,
string.Empty, string.Empty, string.Empty, string.Empty, string.Empty,
string.Empty, string.Empty);
}
}
return table;
}
private void OpenSelectedRecord()
{
if (!EnsureSelected() || !HasPower(Const.BtnModify)) return;
@@ -50,6 +50,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// ddlCheckCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlCheckCode;
/// <summary>
/// txtPipelineCode 控件。
/// </summary>
@@ -86,6 +95,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage
/// </remarks>
protected global::FineUIPro.Button btnQuery;
/// <summary>
/// btnPrint 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnPrint;
/// <summary>
/// btnNew 控件。
/// </summary>
@@ -130,5 +148,14 @@ namespace FineUIPro.Web.HJGL.WeldingManage
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Window2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window2;
}
}