feat(hjgl): 完善检测结果导入与焊接质量管理
通过批量导入、标准化打印和材料导出,减少检测结果及材料信息的人工整理,确保检测单、委托状态和焊口质量资料保持一致。
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user