This commit is contained in:
parent
c8077dc07c
commit
20de71f91a
|
@ -40,7 +40,47 @@ namespace BLL
|
|||
return ObjectMapperManager.DefaultInstance.GetMapper<List<Model.View_Hazard_HazardRegister>, List<Model.HazardRegisterItem>>().Map(hazardRegisters.ToList());
|
||||
}
|
||||
}
|
||||
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
|
||||
join user in db.Sys_User on x.ResponsibleMan equals user.UserId
|
||||
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 = db.Sys_User.First(User => x.ResponsibleMan == User.UserId).UserName,
|
||||
RectificationTime = x.RectificationTime,
|
||||
Risk_Level = x.Risk_Level,
|
||||
|
||||
}).OrderBy(x => x.CheckTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
|
||||
return hazardRegisters;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存HazardRegister
|
||||
/// </summary>
|
||||
|
@ -90,7 +130,7 @@ namespace BLL
|
|||
{
|
||||
newHazardRegister.HazardRegisterId = SQLHelper.GetNewID();
|
||||
}
|
||||
db.HSSE_Hazard_HazardRegister.InsertOnSubmit(newHazardRegister);
|
||||
db.HSSE_Hazard_HazardRegister.InsertOnSubmit(newHazardRegister);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -107,8 +147,8 @@ namespace BLL
|
|||
isUpdate.HandleIdea = newHazardRegister.HandleIdea;
|
||||
isUpdate.SafeSupervisionIsOK = newHazardRegister.SafeSupervisionIsOK;
|
||||
}
|
||||
isUpdate.RectificationPeriod = newHazardRegister.RectificationPeriod;
|
||||
isUpdate.States = newHazardRegister.States;
|
||||
isUpdate.RectificationPeriod = newHazardRegister.RectificationPeriod;
|
||||
isUpdate.States = newHazardRegister.States;
|
||||
isUpdate.Risk_Level = newHazardRegister.Risk_Level;
|
||||
}
|
||||
db.SubmitChanges();
|
||||
|
|
|
@ -324,6 +324,45 @@ namespace Model
|
|||
/// 风险等级
|
||||
/// </summary>
|
||||
public string Risk_Level
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}/// <summary>
|
||||
/// 单位ID
|
||||
/// </summary>
|
||||
public string UnitId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 单位名称
|
||||
/// </summary>
|
||||
public string UnitName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 项目单位ID
|
||||
/// </summary>
|
||||
public string PUnitId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 项目单位名称
|
||||
/// </summary>
|
||||
public string PUnitName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 项目名称
|
||||
/// </summary>
|
||||
public string ProjectAddress
|
||||
{
|
||||
get;
|
||||
set;
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace WebAPI.Controllers
|
|||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
responeData.data = BLL.APIHazardRegisterService.getHazardRegisterByHazardRegisterId(hazardRegisterId);
|
||||
responeData.data = BLL.APIHazardRegisterService.getHazardRegisterByHazardRegisterId(hazardRegisterId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ namespace WebAPI.Controllers
|
|||
/// 根据projectId、states获取风险信息
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="states"></param>
|
||||
/// <param name="states"></param>
|
||||
/// <param name="pageIndex">页码</param>
|
||||
/// <returns></returns>
|
||||
public Model.ResponeData getHazardRegisterByProjectIdStates(string projectId, string states, int pageIndex)
|
||||
|
@ -70,6 +70,7 @@ namespace WebAPI.Controllers
|
|||
/// 根据projectId获取各状态风险数
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="type">0 日常巡检 1 常规巡检</param>
|
||||
/// <returns></returns>
|
||||
public Model.ResponeData getHazardRegisterCount(string projectId)
|
||||
{
|
||||
|
@ -108,11 +109,57 @@ namespace WebAPI.Controllers
|
|||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public Model.ResponeData SaveHazardRegister([FromBody] Model.HazardRegisterItem hazardRegister)
|
||||
{
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
BLL.APIHazardRegisterService.SaveHazardRegister(hazardRegister);
|
||||
BLL.APIHazardRegisterService.SaveHazardRegister(hazardRegister);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取总安全巡检
|
||||
/// <summary>
|
||||
/// 获取总安全巡检
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Model.ResponeData getHazardRegisterTotalCount()
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
//总数
|
||||
responeData.data = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId != null && x.States != null).Count();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取总安全巡检
|
||||
/// <summary>
|
||||
/// 获取总安全巡检
|
||||
/// </summary>
|
||||
/// <param name="pageIndex">页码</param>
|
||||
/// <returns></returns>
|
||||
public Model.ResponeData getHazardRegisterByProjectIdStates(int pageIndex)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
responeData.data = APIHazardRegisterService.getHazardRegisterByProjectIdStates(pageIndex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -76,6 +76,7 @@ namespace WebAPI.Filter
|
|||
{
|
||||
if (BLL.Funs.DBList.ContainsKey(System.Threading.Thread.CurrentThread.ManagedThreadId))
|
||||
{
|
||||
BLL.Funs.DBList[System.Threading.Thread.CurrentThread.ManagedThreadId].Dispose();
|
||||
BLL.Funs.DBList.Remove(System.Threading.Thread.CurrentThread.ManagedThreadId);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue