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(); } /// /// 数据表 /// 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 listStr = new List(); 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 按钮事件 /// /// 统计 /// /// /// protected void BtnAnalyse_Click(object sender, EventArgs e) { BindGrid(); } protected void BtnExtract_Click(object sender, EventArgs e) { DataTable dt = GetDataTable(); foreach() } #endregion #region /// /// 改变索引事件 /// /// /// protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) { BindGrid(); } /// /// 分页下拉选择事件 /// /// /// protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) { Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); BindGrid(); } /// /// 排序 /// /// /// protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) { this.BindGrid(); } #endregion } }