2022-09-05 16:36:31 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using AspNet = System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.HJGL.WeldingReport
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class DefectStatistics : PageBase
|
|
|
|
|
|
{
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
2022-09-08 20:14:51 +08:00
|
|
|
|
this.drpJointAttribute.DataTextField = "Text";
|
|
|
|
|
|
this.drpJointAttribute.DataValueField = "Value";
|
|
|
|
|
|
this.drpJointAttribute.DataSource = BLL.DropListService.HJGL_JointAttribute();
|
|
|
|
|
|
this.drpJointAttribute.DataBind();
|
|
|
|
|
|
Funs.FineUIPleaseSelect(drpJointAttribute);
|
|
|
|
|
|
|
|
|
|
|
|
BLL.UnitWorkService.InitUnitWorkDropDownList(this.drpUnitWorkId, this.CurrUser.LoginProjectId, true);
|
|
|
|
|
|
BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(this.drpUnitId, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
|
{
|
|
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
2022-09-08 20:14:51 +08:00
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
|
2022-09-08 20:14:51 +08:00
|
|
|
|
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@unitcode", this.drpUnitId.SelectedValue));
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@unitcode", null));
|
|
|
|
|
|
}
|
|
|
|
|
|
if (drpUnitWorkId.SelectedValue != Const._Null)
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@UnitWork", drpUnitWorkId.SelectedValue));
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@UnitWork", null));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtMaterialCode.Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@MaterialCode", "%" + this.txtMaterialCode.Text + "%"));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@MaterialCode", null));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtSingleName.Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@SingleName ", "%" + this.txtSingleName.Text + "%"));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@SingleName ", null));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtThickness.Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@Thickness", "%" + this.txtThickness.Text + "%"));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@Thickness", null));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtSpecification.Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@Specification", "%" + this.txtSpecification.Text + "%"));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@Specification", null));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtWeldTypeCode.Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@WeldTypeCode", "%" + this.txtWeldTypeCode.Text + "%"));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@WeldTypeCode", null));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (drpJointAttribute.SelectedValue != Const._Null)
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@JointAttribute", drpJointAttribute.SelectedValue));
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@JointAttribute", null));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtPersonName.Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@PersonName", "%" + this.txtPersonName.Text + "%"));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
listStr.Add(new SqlParameter("@PersonName", null));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
|
|
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
|
|
|
|
DataTable tb = SQLHelper.GetDataTableRunProc("HJGL_rpt_CheckDefects", parameter);
|
|
|
|
|
|
this.Grid1.RecordCount = tb.Rows.Count;
|
|
|
|
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
|
|
Grid1.DataSource = table;
|
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 改变索引事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
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)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 统计按钮事件
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 统计
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void BtnAnalyse_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
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;
|
|
|
|
|
|
Response.Write(GetGridTableHtml(Grid1));
|
|
|
|
|
|
Response.End();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 导出方法
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="grid"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private string GetGridTableHtml(Grid grid)
|
|
|
|
|
|
{
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
grid.PageSize = 10000;
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
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)
|
|
|
|
|
|
{
|
|
|
|
|
|
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("labNumber") as AspNet.Label).Text;
|
|
|
|
|
|
}
|
|
|
|
|
|
sb.AppendFormat("<td>{0}</td>", html);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sb.Append("</tr>");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sb.Append("</table>");
|
|
|
|
|
|
|
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|