136 lines
5.1 KiB
C#
136 lines
5.1 KiB
C#
using BLL;
|
|
using FineUIPro.Web.BaseInfo;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.DataShow
|
|
{
|
|
public partial class QualityAcceptance : PageBase
|
|
{
|
|
#region 加载页面
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
Funs.DropDownPageSize(this.ddlPageSize);
|
|
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|
BLL.ProjectService.InitProjectDropDownList(this.drpProject, true);
|
|
// 绑定表格t
|
|
BindGrid();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载页面
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
string strSql = @"select NEWID() as ID, v.ProjectId,v.ProjectCode,v.ProjectName,v.allcount,v.ccount,isnull(v.allCount,0)-ISNULL(v.cCount,0) as ucCount,
|
|
(case when isnull(v.allCount,0) > 0 then cast((isnull(v.allCount,0)-ISNULL(v.cCount,0)) *1.0 /isnull(v.allCount,0)*100 as decimal(18, 2))
|
|
else 0 end) as rateV
|
|
from (select B.ProjectId,p.ProjectCode,p.ProjectName,COUNT(*) as allCount,
|
|
isnull((select COUNT(*)
|
|
from ProcessControl_InspectionManagementDetail AS Detail
|
|
LEFT JOIN WBS_BreakdownProject AS Breakp ON Detail.ControlPointType=Breakp.BreakdownProjectId
|
|
LEFT JOIN ProcessControl_InspectionManagement AS Inspection ON Detail.InspectionId=Inspection.InspectionId
|
|
where Breakp.CheckAcceptType =@type AND Inspection.IsOnceQualified = 1
|
|
group by Breakp.ProjectId),0) as cCount
|
|
FROM ProcessControl_InspectionManagementDetail AS A
|
|
LEFT JOIN WBS_BreakdownProject AS B ON A.ControlPointType=B.BreakdownProjectId
|
|
left join Base_Project as p on B.ProjectId=p.ProjectId
|
|
where p.projectId is not null AND B.CheckAcceptType =@type ";
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@type", this.rbType.SelectedValue));
|
|
if (this.drpProject.SelectedValue != Const._Null)
|
|
{
|
|
strSql += " AND B.projectId = @projectId"; ///状态为已完成
|
|
listStr.Add(new SqlParameter("@projectId", this.drpProject.SelectedValue));
|
|
}
|
|
|
|
//if (!string.IsNullOrEmpty(this.txtStartTime.Text))
|
|
//{
|
|
// strSql += " AND h.RegisterDate >=@StartTime";
|
|
// listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text));
|
|
//}
|
|
//if (!string.IsNullOrEmpty(this.txtEndTime.Text))
|
|
//{
|
|
// strSql += " AND h.RegisterDate <=@EndTime";
|
|
// listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text));
|
|
//}
|
|
strSql += " group by B.ProjectId,p.ProjectCode,p.ProjectName) as v";
|
|
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();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关闭弹出窗
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
}
|
|
} |