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
@@ -1,7 +1,8 @@
using System;
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI.WebControls;
namespace BLL
{
@@ -9,6 +10,124 @@ namespace BLL
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.View_Hazard_HazardRegisterList> getDataLists = from x in db.View_Hazard_HazardRegisterList
where x.ProblemTypes == "1"
select x;
/// <summary>
///
/// </summary>
/// <param name="projetcId"></param>
/// <param name="checkMan"></param>
/// <param name="type"></param>
/// <param name="workAreaName"></param>
/// <param name="responsibilityUnitName"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="startRectificationTime"></param>
/// <param name="endRectificationTime"></param>
/// <param name="states"></param>
/// <param name="personId"></param>
/// <param name="unitId"></param>
/// <param name="Grid1"></param>
/// <returns></returns>
public static IEnumerable getListData(string projectId, string checkMan, string type, string workAreaName, string responsibilityUnitName, DateTime? startTime, DateTime? endTime, DateTime? startRectificationTime, DateTime? endRectificationTime
,string states, string personId, string unitId, Grid Grid1)
{
IQueryable<Model.View_Hazard_HazardRegisterList> getDataList = getDataLists;
if (!string.IsNullOrEmpty(projectId))
{
getDataList = getDataList.Where(e => e.ProjectId == projectId);
}
if (!string.IsNullOrEmpty(checkMan))
{
getDataList = getDataList.Where(e => e.CheckManName.Contains(checkMan));
}
if (!string.IsNullOrEmpty(type))
{
getDataList = getDataList.Where(e => e.RegisterTypesName.Contains(type));
}
if (!string.IsNullOrEmpty(workAreaName))
{
getDataList = getDataList.Where(e => e.WorkAreaName.Contains(workAreaName));
}
if (!string.IsNullOrEmpty(responsibilityUnitName))
{
getDataList = getDataList.Where(e => e.ResponsibilityUnitName.Contains(responsibilityUnitName));
}
if (startTime.HasValue)
{
getDataList = getDataList.Where(e => e.CheckTime >= startTime);
}
if (endTime.HasValue)
{
getDataList = getDataList.Where(e => e.CheckTime <= endTime);
}
if (startRectificationTime.HasValue)
{
getDataList = getDataList.Where(e => e.RectificationTime >= startRectificationTime);
}
if (endRectificationTime.HasValue)
{
getDataList = getDataList.Where(e => e.RectificationTime <= endRectificationTime);
}
if (!string.IsNullOrEmpty(states) && states != Const._Null)
{
getDataList = getDataList.Where(e => e.States.Contains(states));
}
if (!CommonService.IsMainUnitOrAdmin(personId))
{
getDataList = getDataList.Where(e => e.ResponsibleUnit == unitId || e.SendUnitId == unitId);
}
count = getDataList.Count();
if (count == 0)
{
return null;
}
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in getDataList
select new
{
x.HazardRegisterId,
x.CheckTime,
x.RegisterDef,
x.RegisterTypes2Name,
x.RegisterTypesName,
x.RegisterTypes3Name,
x.HazardValue,
x.RegisterTypes4Name,
x.WorkAreaName,
x.ResponsibilityUnitName,
x.ResponsibilityManName,
x.Rectification,
x.RectificationPeriod,
//x.CCManNames,
x.RectificationTime,
x.CheckManName,
x.RegisterDate,
x.StatesStr,
};
}
#endregion
/// <summary>
/// 根据危险观察登记主键获取危险观察登记信息
/// </summary>