Basf_TCC7/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/SuperQueWelding.aspx.cs

142 lines
5.6 KiB
C#
Raw Normal View History

2024-06-11 17:27:06 +08:00
using BLL;
using NPOI.XSSF.UserModel;
using NPOI.SS.UserModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using Newtonsoft.Json.Linq;
using BorderStyle = NPOI.SS.UserModel.BorderStyle;
namespace FineUIPro.Web.WeldingProcess.WeldingManage
{
public partial class SuperQueWelding : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGrid();
}
}
private void BindGrid()
{
DataTable tb = GetDataTable();
this.Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
/// <summary>
/// 数据表
/// </summary>
private DataTable GetDataTable()
{
string strSql = @"SELECT weldJoint.WeldJointId,weldJoint.ProjectId,WorkArea.WorkAreaId,
WorkArea.WorkAreaCode,pipeline.SingleNumber,pipeline.PipelineCode,weldJoint.WeldJointCode,
weldType.WeldTypeCode,wl.WeldingLocationCode,weldJoint.Size,weldJoint.Thickness,
weldJoint.Specification,mat1.MaterialCode AS MaterialCode1,mat2.MaterialCode AS MaterialCode2,
WeldMethod.WeldingMethodName,cw.WelderCode AS CoverWelderCode,fw.WelderCode AS BackingWelderCode,
weldJoint.BackingWelderId,weldJoint.CoverWelderId,weldingDaily.WeldingDate,
weldJoint.IsSuperQueWelding
FROM Pipeline_WeldJoint AS weldJoint
LEFT JOIN Pipeline_Pipeline AS pipeline ON pipeline.PipelineId = weldJoint.PipelineId
LEFT JOIN Project_WorkArea AS WorkArea ON WorkArea.WorkAreaId = pipeline.WorkAreaId
LEFT JOIN Base_Material AS mat1 ON mat1.MaterialId = weldJoint.Material1Id
LEFT JOIN Base_Material AS mat2 ON mat2.MaterialId = weldJoint.Material2Id
LEFT JOIN Base_WeldingMethod AS WeldMethod ON WeldMethod.WeldingMethodId = weldJoint.WeldingMethodId
LEFT JOIN dbo.Base_WeldType weldType ON weldType.WeldTypeId = weldJoint.WeldTypeId
LEFT JOIN dbo.Base_WeldingLocation wl ON wl.WeldingLocationId = weldJoint.WeldingLocationId
LEFT JOIN Pipeline_WeldingDaily AS weldingDaily ON weldingDaily.WeldingDailyId = weldJoint.WeldingDailyId
left join Welder_Welder AS fw on weldJoint.BackingWelderId = fw.WelderId
left join Welder_Welder AS cw on weldJoint.CoverWelderId = cw.WelderId
WHERE weldJoint.WeldingDailyId IS NOT NULL AND weldJoint.ProjectId=@projectId";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
if (!string.IsNullOrEmpty(txtPipeLineCode.Text))
{
strSql += " AND pipeline.PipelineCode LIKE @PipelineCode";
listStr.Add(new SqlParameter("@PipelineCode", "%" + this.txtPipeLineCode.Text.Trim() + "%"));
}
if (rbWarn.SelectedValue != "0")
{
strSql += " AND weldJoint.IsSuperQueWelding=1";
}
if (txtStarTime.Text != "")
{
strSql += " AND weldingDaily.WeldingDate> = @WeldingStartDate";
listStr.Add(new SqlParameter("@WeldingStartDate", txtStarTime.Text.Trim()));
}
if (txtEndTime.Text != "")
{
strSql += " AND weldingDaily.WeldingDate< = @WeldingEndDate";
listStr.Add(new SqlParameter("@WeldingEndDate", txtEndTime.Text.Trim()));
}
strSql += " ORDER BY pipeline.PipelineCode,WeldJointCode";
SqlParameter[] parameter = listStr.ToArray();
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
return dt;
}
#region
/// <summary>
/// 统计
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void BtnAnalyse_Click(object sender, EventArgs e)
{
BindGrid();
}
protected void BtnExtract_Click(object sender, EventArgs e)
{
DataTable dt = GetDataTable();
foreach()
}
#endregion
#region
/// <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();
}
#endregion
}
}