9bc33c3ab7
按当前筛选条件导出检查记录,便于线下查看和汇总。
112 lines
4.0 KiB
C#
112 lines
4.0 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 FitupCheck : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|
BindGrid();
|
|
}
|
|
}
|
|
|
|
private void BindGrid()
|
|
{
|
|
var result = PreWeldInspectionService.GetFitupCheckList(
|
|
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_PreWeldFitupCheckMenuId, Const.BtnAdd))
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference("FitupCheckEdit.aspx"));
|
|
}
|
|
}
|
|
|
|
protected void btnOut_Click(object sender, EventArgs e)
|
|
{
|
|
var items = PreWeldInspectionService.GetFitupCheckList(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.FitupGap,
|
|
错边量 = x.Misalignment,
|
|
检查结果 = x.CheckResult,
|
|
检查人 = x.CheckPersonName,
|
|
检查时间 = x.CheckTime,
|
|
不合格原因 = 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_PreWeldFitupCheckMenuId, Const.BtnModify))
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("FitupCheckEdit.aspx?FitupCheckId={0}", Grid1.SelectedRowID)));
|
|
}
|
|
}
|
|
}
|
|
}
|