225 lines
8.9 KiB
C#
225 lines
8.9 KiB
C#
|
using BLL;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using System.Data.SqlClient;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Web;
|
|||
|
using System.Web.UI;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
|
|||
|
namespace FineUIPro.Web.HJGL.WeldingManage
|
|||
|
{
|
|||
|
public partial class JointInfoOut : PageBase
|
|||
|
{
|
|||
|
#region 加载页面
|
|||
|
/// <summary>
|
|||
|
/// 加载页面
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|||
|
// 绑定表格
|
|||
|
this.BindGrid();
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 绑定数据
|
|||
|
/// <summary>
|
|||
|
/// 绑定数据
|
|||
|
/// </summary>
|
|||
|
private void BindGrid()
|
|||
|
{
|
|||
|
string isoId = Request.Params["ISO_ID"];
|
|||
|
string strSql = @"SELECT 0 [index],jointInfo.JOT_ID,
|
|||
|
jointInfo.ProjectId,
|
|||
|
jointInfo.JOT_JointNo,
|
|||
|
jointInfo.is_hj,
|
|||
|
jointInfo.JointStatusName,
|
|||
|
jointInfo.JOT_TrustFlagName,
|
|||
|
jointInfo.JOT_CheckFlagName,
|
|||
|
jointInfo.ISO_ID,
|
|||
|
jointInfo.ISO_IsoNo,
|
|||
|
jointInfo.WorkAreaId,
|
|||
|
jointInfo.WorkAreaCode,
|
|||
|
jointInfo.JOT_WeldDate,
|
|||
|
jointInfo.JOT_DailyReportNo,
|
|||
|
jointInfo.STE_Name1,
|
|||
|
jointInfo.STE_Name2,
|
|||
|
jointInfo.Component1,
|
|||
|
jointInfo.Component2,
|
|||
|
jointInfo.WED_Code1,
|
|||
|
jointInfo.WED_Name1,
|
|||
|
jointInfo.WED_Code2,
|
|||
|
jointInfo.WED_Name2,
|
|||
|
jointInfo.JOT_JointDesc,
|
|||
|
jointInfo.JOT_Dia,
|
|||
|
jointInfo.JOT_Size,
|
|||
|
jointInfo.JOT_Sch,
|
|||
|
jointInfo.JOT_FactSch,
|
|||
|
jointInfo.GrooveTypeName,
|
|||
|
jointInfo.JOTY_ID,
|
|||
|
jointInfo.WeldTypeName,
|
|||
|
jointInfo.WME_ID,
|
|||
|
jointInfo.WeldingMethodName,
|
|||
|
jointInfo.WeldSilk,
|
|||
|
jointInfo.WeldMat,
|
|||
|
jointInfo.WLO_Code,
|
|||
|
jointInfo.WeldingLocationName,
|
|||
|
jointInfo.JOT_DoneDin,
|
|||
|
jointInfo.JOT_PrepareTemp,
|
|||
|
jointInfo.JOT_JointAttribute,
|
|||
|
jointInfo.JOT_CellTemp,
|
|||
|
jointInfo.JOT_LastTemp,
|
|||
|
jointInfo.JOT_HeartNo1,
|
|||
|
jointInfo.JOT_HeartNo2,
|
|||
|
jointInfo.PointDate,
|
|||
|
jointInfo.PointNo,
|
|||
|
jointInfo.CH_TrustCode,
|
|||
|
jointInfo.CH_TrustDate,
|
|||
|
jointInfo.JOT_FaceCheckResult,
|
|||
|
jointInfo.JOT_FaceCheckDate,
|
|||
|
jointInfo.JOT_FaceChecker,
|
|||
|
jointInfo.IS_Proess,
|
|||
|
jointInfo.JOT_BelongPipe,
|
|||
|
jointInfo.JOT_Electricity,
|
|||
|
jointInfo.JOT_Voltage,
|
|||
|
jointInfo.JOT_ProessDate,
|
|||
|
jointInfo.JOT_HotRpt,
|
|||
|
jointInfo.JOT_Remark"
|
|||
|
+ @" from View_JointInfo as jointInfo "
|
|||
|
+ @" WHERE jointInfo.ProjectId= @projectId AND jointInfo.ISO_ID=@isoId";
|
|||
|
List<SqlParameter> listStr = new List<SqlParameter>
|
|||
|
{
|
|||
|
new SqlParameter("@projectId", this.CurrUser.LoginProjectId),
|
|||
|
new SqlParameter("@isoId", isoId),
|
|||
|
};
|
|||
|
SqlParameter[] parameter = listStr.ToArray();
|
|||
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|||
|
if (tb != null)
|
|||
|
{
|
|||
|
foreach (DataRow row in tb.Rows)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
row["index"] = int.Parse(System.Text.RegularExpressions.Regex.Replace(row["JOT_JointNo"].ToString(), @"[^0-9]+", ""));
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
row["index"] = 0;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
// 2.获取当前分页数据
|
|||
|
//var table = this.GetPagedDataTable(Grid1, tb1);
|
|||
|
Grid1.RecordCount = tb.Rows.Count;
|
|||
|
//tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|||
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|||
|
Grid1.DataSource = table;
|
|||
|
Grid1.DataBind();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 分页排序
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|||
|
{
|
|||
|
Grid1.PageIndex = e.NewPageIndex;
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 分页下拉选择
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 排序
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
|||
|
{
|
|||
|
Grid1.SortDirection = e.SortDirection;
|
|||
|
Grid1.SortField = e.SortField;
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 导出按钮
|
|||
|
/// 导出按钮
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnOut_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
Response.ClearContent();
|
|||
|
string filename = Funs.GetNewFileName();
|
|||
|
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("管线焊口信息" + filename, System.Text.Encoding.UTF8) + ".xls");
|
|||
|
Response.ContentType = "application/excel";
|
|||
|
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
|||
|
this.Grid1.PageSize = 100000;
|
|||
|
this.BindGrid();
|
|||
|
Response.Write(GetGridTableHtml(Grid1));
|
|||
|
Response.End();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 导出方法
|
|||
|
/// </summary>
|
|||
|
/// <param name="grid"></param>
|
|||
|
/// <returns></returns>
|
|||
|
private string GetGridTableHtml(Grid grid)
|
|||
|
{
|
|||
|
StringBuilder sb = new StringBuilder();
|
|||
|
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
|
|||
|
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
|
|||
|
sb.Append("<tr>");
|
|||
|
foreach (GridColumn column in grid.Columns)
|
|||
|
{
|
|||
|
if (column.HeaderText != "序号")
|
|||
|
{
|
|||
|
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
|
|||
|
}
|
|||
|
}
|
|||
|
sb.Append("</tr>");
|
|||
|
foreach (GridRow row in grid.Rows)
|
|||
|
{
|
|||
|
sb.Append("<tr>");
|
|||
|
foreach (GridColumn column in grid.Columns)
|
|||
|
{
|
|||
|
string html = row.Values[column.ColumnIndex].ToString();
|
|||
|
if (column.ColumnID != "tfNumber")
|
|||
|
{
|
|||
|
//html = (row.FindControl("lblNumber") as AspNet.Label).Text;
|
|||
|
sb.AppendFormat("<td x:str>{0}</td>", html);
|
|||
|
}
|
|||
|
//sb.AppendFormat("<td>{0}</td>", html);
|
|||
|
}
|
|||
|
|
|||
|
sb.Append("</tr>");
|
|||
|
}
|
|||
|
|
|||
|
sb.Append("</table>");
|
|||
|
|
|||
|
return sb.ToString();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|