CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/DataShow/HJGLWeldingItem.aspx.cs

189 lines
8.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.DataShow
{
public partial class HJGLWeldingItem : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string projectId = Request.Params["projectId"];
this.txtProject.Text=ProjectService.GetProjectNameByProjectId(projectId);
Funs.DropDownPageSize(this.ddlPageSize);
btnClose.OnClientClick = ActiveWindow.GetHideReference();
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
// 绑定表格
BindGrid();
this.Panel1.Title = "焊接数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CWCEC) + "";
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT 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,
detectionRate.DetectionRateValue,
jointInfo.IS_Proess,
jointInfo.JOT_BelongPipe,
jointInfo.JOT_Electricity,
detectionType.DetectionTypeName,
jointInfo.JOT_Voltage,
jointInfo.JOT_ProessDate,
jointInfo.JOT_HotRpt,
jointInfo.Extend_Length,
(select top 1 CHT_CheckDate from CH_Check c left join CH_CheckItem ci on ci.CHT_CheckID=c.CHT_CheckID where ci.JOT_ID=jointInfo.JOT_ID order by CHT_CheckDate desc) as CHT_CheckDate,
(select top 1 CHT_CheckCode from CH_Check c left join CH_CheckItem ci on ci.CHT_CheckID=c.CHT_CheckID where ci.JOT_ID=jointInfo.JOT_ID order by CHT_CheckDate desc) as CHT_CheckCode,
jointInfo.JOT_Remark
from View_JointInfo as jointInfo
LEFT JOIN Base_DetectionRate AS detectionRate ON detectionRate.DetectionRateId = jointInfo.DetectionRateId
LEFT JOIN Base_DetectionType AS detectionType ON detectionType.DetectionTypeId = jointInfo.DetectionTypeId
WHERE 1=1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
strSql += " AND jointInfo.ProjectId = @ProjectId";
listStr.Add(new SqlParameter("@ProjectId", Request.Params["projectId"]));
if (!string.IsNullOrEmpty(txtStartTime.Text.Trim()))
{
strSql += " AND jointInfo.JOT_WeldDate >= @StartTime";
listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
{
strSql += " AND jointInfo.JOT_WeldDate <= @EndTime";
listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text.Trim()));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
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 TextBox_TextChanged(object sender, EventArgs e)
{
this.BindGrid();
}
#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 Grid1_Sort(object sender, GridSortEventArgs 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();
}
#endregion
/// <summary>
/// 转换当日人工时
/// </summary>
/// <param name="workStage"></param>
/// <returns></returns>
protected string ConvertPersonWorkTimeSum(object dayReportId)
{
if (dayReportId != null)
{
return (Funs.DB.SitePerson_DayReportDetail.Where(x => x.DayReportId == dayReportId.ToString()).Sum(x => x.PersonWorkTime) ?? 0).ToString();
}
return "";
}
}
}