Files
SGGL_SHJ/SGGL/FineUIPro.Web/HJGL/PreWeld/CuttingCheck.aspx.cs
T
lpf 9bc33c3ab7 feat(hjgl): 支持焊前及外观检查记录导出
按当前筛选条件导出检查记录,便于线下查看和汇总。
2026-11-07 15:22:31 +08:00

119 lines
4.4 KiB
C#

using BLL;
using System;
using MiniExcelLibs;
using System.IO;
using System.Linq;
using System.Web;
namespace FineUIPro.Web.HJGL.PreWeld
{
public partial class CuttingCheck : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
BindGrid();
}
}
private void BindGrid()
{
var result = PreWeldInspectionService.GetCuttingCheckList(
CurrUser.LoginProjectId,
txtPipelineCode.Text.Trim(),
txtWeldJointCode.Text.Trim(),
Grid1.PageIndex,
Grid1.PageSize);
Grid1.RecordCount = result.Item2;
Grid1.DataSource = result.Item1;
Grid1.DataBind();
}
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid();
}
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
BindGrid();
}
protected void btnQuery_Click(object sender, EventArgs e)
{
Grid1.PageIndex = 0;
BindGrid();
}
protected void btnNew_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.PersonId, Const.HJGL_PreWeldCuttingCheckMenuId, Const.BtnAdd))
{
PageContext.RegisterStartupScript(Window1.GetShowReference("CuttingCheckEdit.aspx"));
}
}
protected void btnOut_Click(object sender, EventArgs e)
{
var items = PreWeldInspectionService.GetCuttingCheckList(CurrUser.LoginProjectId,
txtPipelineCode.Text.Trim(), txtWeldJointCode.Text.Trim(), 0, int.MaxValue).Item1;
if (items.Count == 0)
{
Alert.ShowInTop(BLL.UiText.Message("无数据,无法导出!"), MessageBoxIcon.Warning);
return;
}
var data = items.Select(x => new
{
管线号 = x.PipelineCode,
焊口号 = x.WeldJointCode,
下料长度 = x.CuttingLength,
坡口形式 = x.GrooveForm,
坡口加工类型 = x.GrooveProcessType,
坡口角度 = x.GrooveAngle,
材料准确 = x.IsMaterialCodeBatchNoAccurate ? "是" : "否",
材料数量准确 = x.IsMaterialQuantityAccurate ? "是" : "否",
检查人 = x.CheckPersonName,
检查时间 = x.CheckTime,
检查结果 = x.CheckResult,
专项审核状态 = x.ReviewStateText,
专项审核办理人 = x.SpecialReviewerName,
创建时间 = x.CreateTime,
不合格原因 = x.UnqualifiedReason,
整改要求 = x.RectifyRequirement,
备注 = x.Remark
}).ToList();
using (var stream = new MemoryStream())
{
MiniExcel.SaveAs(stream, data);
Response.Clear();
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("下料记录.xlsx", System.Text.Encoding.UTF8));
Response.BinaryWrite(stream.ToArray());
Response.End();
}
}
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop(BLL.UiText.Message("请至少选择一条记录!"), MessageBoxIcon.Warning);
return;
}
if (CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.PersonId, Const.HJGL_PreWeldCuttingCheckMenuId, Const.BtnModify))
{
PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("CuttingCheckEdit.aspx?CuttingCheckId={0}", Grid1.SelectedRowID)));
}
}
}
}