20231110优化安全巡检、作业票列表速度优化

This commit is contained in:
2023-11-10 10:54:55 +08:00
parent 6409a865b0
commit f68955d921
6 changed files with 878 additions and 119 deletions
@@ -57,76 +57,84 @@ namespace FineUIPro.Web.HSSE.HiddenInspection
/// </summary>
private void BindGrid()
{
string strSql = "SELECT * FROM View_Hazard_HazardRegister WHERE ProblemTypes='1' ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
{
strSql += " AND ProjectId = @ProjectId";
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
}
if (!string.IsNullOrEmpty(this.txtCheckMan.Text.Trim()))
{
strSql += " AND CheckManName LIKE @CheckMan";
listStr.Add(new SqlParameter("@CheckMan", "%" + this.txtCheckMan.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(this.txtType.Text.Trim()))
{
strSql += " AND RegisterTypesName LIKE @Type";
listStr.Add(new SqlParameter("@Type", "%" + this.txtType.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(this.txtWorkAreaName.Text.Trim()))
{
strSql += " AND WorkAreaName LIKE @WorkAreaName";
listStr.Add(new SqlParameter("@WorkAreaName", "%" + this.txtWorkAreaName.Text.Trim() + "%"));
}
//if (this.ckType.SelectedValue != "0")
//string strSql = "SELECT * FROM View_Hazard_HazardRegister WHERE ProblemTypes='1' ";
//List<SqlParameter> listStr = new List<SqlParameter>();
//if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
//{
// strSql += " AND CheckCycle=@CheckCycle";
// listStr.Add(new SqlParameter("@CheckCycle", this.ckType.SelectedValue));
// strSql += " AND ProjectId = @ProjectId";
// listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
//}
if (!string.IsNullOrEmpty(this.txtResponsibilityUnitName.Text.Trim()))
{
strSql += " AND ResponsibilityUnitName LIKE @ResponsibilityUnitName";
listStr.Add(new SqlParameter("@ResponsibilityUnitName", "%" + this.txtResponsibilityUnitName.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(txtStartTime.Text.Trim()))
{
strSql += " AND CheckTime >= @StartTime";
listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
{
strSql += " AND CheckTime <= @EndTime";
listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text.Trim()));
}
if (!string.IsNullOrEmpty(txtStartRectificationTime.Text.Trim()))
{
strSql += " AND RectificationTime >= @StartRectificationTime";
listStr.Add(new SqlParameter("@StartRectificationTime", this.txtStartRectificationTime.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.txtEndRectificationTime.Text.Trim()))
{
strSql += " AND RectificationTime <= @EndRectificationTime";
listStr.Add(new SqlParameter("@EndRectificationTime", this.txtEndRectificationTime.Text.Trim()));
}
if (this.drpStates.SelectedValue != BLL.Const._Null)
{
strSql += " AND States LIKE @States";
listStr.Add(new SqlParameter("@States", "%" + this.drpStates.SelectedValue + "%"));
}
if (!CommonService.IsMainUnitOrAdmin(this.CurrUser.PersonId))
{
strSql += " AND (ResponsibleUnit =@ResponsibleUnit OR SendUnitId=@SendUnitId)";
listStr.Add(new SqlParameter("@ResponsibleUnit", this.CurrUser.UnitId));
listStr.Add(new SqlParameter("@SendUnitId", this.CurrUser.UnitId));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
//if (!string.IsNullOrEmpty(this.txtCheckMan.Text.Trim()))
//{
// strSql += " AND CheckManName LIKE @CheckMan";
// listStr.Add(new SqlParameter("@CheckMan", "%" + this.txtCheckMan.Text.Trim() + "%"));
//}
//if (!string.IsNullOrEmpty(this.txtType.Text.Trim()))
//{
// strSql += " AND RegisterTypesName LIKE @Type";
// listStr.Add(new SqlParameter("@Type", "%" + this.txtType.Text.Trim() + "%"));
//}
//if (!string.IsNullOrEmpty(this.txtWorkAreaName.Text.Trim()))
//{
// strSql += " AND WorkAreaName LIKE @WorkAreaName";
// listStr.Add(new SqlParameter("@WorkAreaName", "%" + this.txtWorkAreaName.Text.Trim() + "%"));
//}
////if (this.ckType.SelectedValue != "0")
////{
//// strSql += " AND CheckCycle=@CheckCycle";
//// listStr.Add(new SqlParameter("@CheckCycle", this.ckType.SelectedValue));
////}
//if (!string.IsNullOrEmpty(this.txtResponsibilityUnitName.Text.Trim()))
//{
// strSql += " AND ResponsibilityUnitName LIKE @ResponsibilityUnitName";
// listStr.Add(new SqlParameter("@ResponsibilityUnitName", "%" + this.txtResponsibilityUnitName.Text.Trim() + "%"));
//}
//if (!string.IsNullOrEmpty(txtStartTime.Text.Trim()))
//{
// strSql += " AND CheckTime >= @StartTime";
// listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text.Trim()));
//}
//if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
//{
// strSql += " AND CheckTime <= @EndTime";
// listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text.Trim()));
//}
//if (!string.IsNullOrEmpty(txtStartRectificationTime.Text.Trim()))
//{
// strSql += " AND RectificationTime >= @StartRectificationTime";
// listStr.Add(new SqlParameter("@StartRectificationTime", this.txtStartRectificationTime.Text.Trim()));
//}
//if (!string.IsNullOrEmpty(this.txtEndRectificationTime.Text.Trim()))
//{
// strSql += " AND RectificationTime <= @EndRectificationTime";
// listStr.Add(new SqlParameter("@EndRectificationTime", this.txtEndRectificationTime.Text.Trim()));
//}
//if (this.drpStates.SelectedValue != BLL.Const._Null)
//{
// strSql += " AND States LIKE @States";
// listStr.Add(new SqlParameter("@States", "%" + this.drpStates.SelectedValue + "%"));
//}
//if (!CommonService.IsMainUnitOrAdmin(this.CurrUser.PersonId))
//{
// strSql += " AND (ResponsibleUnit =@ResponsibleUnit OR SendUnitId=@SendUnitId)";
// listStr.Add(new SqlParameter("@ResponsibleUnit", this.CurrUser.UnitId));
// listStr.Add(new SqlParameter("@SendUnitId", this.CurrUser.UnitId));
//}
//SqlParameter[] parameter = listStr.ToArray();
//DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
//Grid1.RecordCount = tb.Rows.Count;
//var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
//Grid1.DataSource = table;
//Grid1.DataBind();
var getData = HSSE_Hazard_HazardRegisterService.getListData(this.CurrUser.LoginProjectId, this.txtCheckMan.Text.Trim(), this.txtType.Text.Trim(), this.txtWorkAreaName.Text.Trim(),
this.txtResponsibilityUnitName.Text.Trim(),Funs.GetNewDateTime(txtStartTime.Text.Trim()),Funs.GetNewDateTime(this.txtEndTime.Text.Trim()), Funs.GetNewDateTime(this.txtStartRectificationTime.Text.Trim()), Funs.GetNewDateTime(this.txtEndRectificationTime.Text.Trim()),
this.drpStates.SelectedValue, this.CurrUser.PersonId, this.CurrUser.UnitId, Grid1);
Grid1.RecordCount = HSSE_Hazard_HazardRegisterService.count;
Grid1.DataSource = getData;
Grid1.DataBind();
}
#endregion