20231205获取企业安全巡检接口

This commit is contained in:
2023-12-05 15:39:39 +08:00
parent ff33611987
commit ec842ca27f
4 changed files with 141 additions and 1 deletions
@@ -133,5 +133,51 @@ namespace BLL
}
}
}
/// <summary>
/// 安全巡检
/// </summary>
/// <param name="pageIndex"></param>
/// <returns></returns>
public static List<Model.HazardRegisterItem> getHazardRegisterByProjectIdStates(int pageIndex)
{
string unitName = null, unitId = null;
var getUnit = CommonService.GetIsThisUnit();
if (getUnit != null)
{
unitId = getUnit.UnitId;
unitName = getUnit.UnitName;
}
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var hazardRegisters = (from x in db.HSSE_Hazard_HazardRegister
join y in db.Base_Project on x.ProjectId equals y.ProjectId
join u in db.Base_Unit on x.ResponsibleUnit equals u.UnitId
where x.ProjectId != null && x.States != null
select new Model.HazardRegisterItem
{
HazardRegisterId = x.HazardRegisterId,
ProjectId = x.ProjectId,
ProjectName = y.ProjectName,
ProjectAddress = y.ProjectAddress,
UnitId = unitId,
UnitName = unitName,
PUnitId = y.UnitId,
PUnitName = db.Base_Unit.First(U => y.UnitId == U.UnitId).UnitName,
States = x.States,
WorkAreaName = db.WBS_UnitWork.First(w => x.Place == w.UnitWorkId).UnitWorkName,
CheckTime = x.CheckTime,
RegisterDef = x.RegisterDef,
RegisterTypesName = db.HSSE_Hazard_HazardRegisterTypes.First(T => x.RegisterTypesId == T.RegisterTypesId).RegisterTypesName,
Rectification = x.Rectification,
ResponsibilityUnitName = db.Base_Unit.First(U => x.ResponsibleUnit == U.UnitId).UnitName,
ResponsibilityManName = "",
RectificationTime = x.RectificationTime,
Risk_Level = (x.HazardValue =="3"?"重大":"一般"),
}).OrderBy(x => x.CheckTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
return hazardRegisters;
}
}
}
}