1744 lines
83 KiB
C#
1744 lines
83 KiB
C#
using System.Collections.Generic;
|
||
using System.Diagnostics;
|
||
using System.Linq;
|
||
using System.Web.Http;
|
||
using Aspose.Words.Lists;
|
||
using BLL;
|
||
using Model.Customization._7HJ;
|
||
using System;
|
||
using System.Collections;
|
||
using System.Globalization;
|
||
using Model;
|
||
using System.Web;
|
||
namespace WebAPI.Controllers.Customization._7HJ
|
||
{
|
||
public class Api_7HJ_HsseController : ApiController
|
||
{
|
||
#region 安全人工时
|
||
|
||
/// <summary>
|
||
/// 获取项目安全人工时数据列表
|
||
/// </summary>
|
||
/// <param name="projectId"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getSecureHoursByProjectId(string projectId)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
var getLists = (from x in db.SitePerson_DayReport
|
||
join y in db.Base_Project on x.ProjectId equals y.ProjectId
|
||
where (y.ProjectState == Const.ProjectState_1 && x.ProjectId == projectId &&
|
||
x.CompileDate > Funs.minSysDate)
|
||
select new
|
||
{
|
||
x.DayReportId,
|
||
x.CompileDate,
|
||
SumCost = (from item in db.SitePerson_DayReportDetail
|
||
where item.DayReportId == x.DayReportId
|
||
select item.PersonWorkTime ?? 0m).Sum()
|
||
}).OrderByDescending(x => x.CompileDate).ToList();
|
||
responeData.data = new { getLists };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 根据项目获取安全人工时明细
|
||
/// </summary>
|
||
/// <param name="id"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getSecureHoursById(string id)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
Model.ResponeData responeData = new Model.ResponeData();
|
||
|
||
try
|
||
{
|
||
var getLists = (from x in db.SitePerson_DayReportDetail
|
||
join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||
where (x.DayReportId == id)
|
||
select new
|
||
{
|
||
y.UnitName,
|
||
x.PersonWorkTime,
|
||
}).ToList();
|
||
responeData.data = new { getLists };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 安全费用
|
||
|
||
/// <summary>
|
||
/// 根据项目获取安全费用支出数据列表
|
||
/// </summary>
|
||
/// <param name="projectId"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getSecurityCostByProjectId(string projectId)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
string timeString = "2023-01-01 00:00:00";
|
||
DateTime timeDate = DateTime.Parse(timeString);
|
||
var getLists = (
|
||
from c in db.CostGoods_CostSmallDetail
|
||
join p in db.Base_Project on c.ProjectId equals p.ProjectId into pGroup
|
||
from p in pGroup.DefaultIfEmpty()
|
||
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitGroup
|
||
from unit in unitGroup.DefaultIfEmpty()
|
||
where (c.ProjectId == projectId && c.CompileDate > timeDate)
|
||
let sumCost = (
|
||
from item in db.CostGoods_CostSmallDetailItem
|
||
where (item.CostSmallDetailId == c.CostSmallDetailId)
|
||
select item.CostMoney ?? 0m).Sum() * 1.0m / 10000
|
||
select new Model.Customization._7HJ.SecurityCostInfo
|
||
{
|
||
CostSmallDetailId = c.CostSmallDetailId,
|
||
ProjectId = p.ProjectId,
|
||
ProjectCode = p.ProjectCode,
|
||
ProjectName = p.ProjectName,
|
||
UnitId = c.UnitId,
|
||
UnitName = unit.UnitName,
|
||
Months = c.Months,
|
||
SUMCost = sumCost,
|
||
}
|
||
).ToList();
|
||
Debug.WriteLine(getLists.Count());
|
||
responeData.data = new { getLists };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据主键获取安全费用明细
|
||
/// </summary>
|
||
/// <param name="id"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getSecurityCostById(string id)
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
Model.Customization._7HJ.SecurityCostData securityCostData =
|
||
new Model.Customization._7HJ.SecurityCostData();
|
||
|
||
CostGoods_CostSmallDetail costSmallDetail = BLL.CostSmallDetailService.GetCostSmallDetailById(id);
|
||
if (costSmallDetail != null)
|
||
{
|
||
securityCostData.CostSmallDetailId = costSmallDetail.CostSmallDetailId;
|
||
securityCostData.CostSmallDetailCode = CodeRecordsService.ReturnCodeByDataId(id);
|
||
if (costSmallDetail.Months != null)
|
||
{
|
||
securityCostData.Months = string.Format("{0:yyyy-MM}", costSmallDetail.Months);
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(costSmallDetail.UnitId))
|
||
{
|
||
Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(costSmallDetail.UnitId);
|
||
if (unit != null)
|
||
{
|
||
securityCostData.UnitName = unit.UnitName;
|
||
}
|
||
}
|
||
|
||
if (costSmallDetail.ReportDate != null)
|
||
{
|
||
securityCostData.ReportDate = string.Format("{0:yyyy-MM-dd}", costSmallDetail.ReportDate);
|
||
}
|
||
|
||
decimal totalA = 0, totalB = 0, totalProjectA = 0, totalProjectB = 0;
|
||
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(costSmallDetail.ProjectId);
|
||
if (project != null && costSmallDetail.Months.HasValue)
|
||
{
|
||
List<Model.Customization._7HJ.SecurityCostData.OrderItem> orderItems =
|
||
new List<Model.Customization._7HJ.SecurityCostData.OrderItem>();
|
||
List<Model.CostGoods_CostSmallDetailItem> projectDetails =
|
||
BLL.CostSmallDetailItemService.GetCostDetailsByUnitId(costSmallDetail.ProjectId,
|
||
costSmallDetail.UnitId, project.StartDate, costSmallDetail.Months);
|
||
List<Model.CostGoods_CostSmallDetailItem> details =
|
||
BLL.CostSmallDetailItemService.GetCostSmallDetailItemByCostSmallDetailId(id);
|
||
Model.CostGoods_CostSmallDetailItem a1 = details.FirstOrDefault(x => x.CostType == "A1");
|
||
if (a1 != null)
|
||
{
|
||
Model.Customization._7HJ.SecurityCostData.OrderItem orderItem =
|
||
new Model.Customization._7HJ.SecurityCostData.OrderItem();
|
||
orderItem.CostType = "A1";
|
||
orderItem.CostName = "基础管理";
|
||
orderItem.CostMoney = (a1.CostMoney ?? 0).ToString();
|
||
totalA += Funs.GetNewDecimalOrZero(orderItem.CostMoney);
|
||
orderItem.ProjectCostMoney =
|
||
((from x in projectDetails where x.CostType == "A1" select x.CostMoney ?? 0).Sum() +
|
||
a1.CostMoney ?? 0).ToString();
|
||
totalProjectA += Funs.GetNewDecimalOrZero(orderItem.ProjectCostMoney);
|
||
orderItem.CostDef = a1.CostDef;
|
||
orderItems.Add(orderItem);
|
||
}
|
||
|
||
Model.CostGoods_CostSmallDetailItem a2 = details.FirstOrDefault(x => x.CostType == "A2");
|
||
if (a2 != null)
|
||
{
|
||
Model.Customization._7HJ.SecurityCostData.OrderItem orderItem =
|
||
new Model.Customization._7HJ.SecurityCostData.OrderItem();
|
||
orderItem.CostType = "A2";
|
||
orderItem.CostName = "安全技术";
|
||
orderItem.CostMoney = (a2.CostMoney ?? 0).ToString();
|
||
totalA += Funs.GetNewDecimalOrZero(orderItem.CostMoney);
|
||
orderItem.ProjectCostMoney =
|
||
((from x in projectDetails where x.CostType == "A2" select x.CostMoney ?? 0).Sum() +
|
||
a2.CostMoney ?? 0).ToString();
|
||
totalProjectA += Funs.GetNewDecimalOrZero(orderItem.ProjectCostMoney);
|
||
orderItem.CostDef = a2.CostDef;
|
||
orderItems.Add(orderItem);
|
||
}
|
||
|
||
Model.CostGoods_CostSmallDetailItem a3 = details.FirstOrDefault(x => x.CostType == "A3");
|
||
if (a3 != null)
|
||
{
|
||
Model.Customization._7HJ.SecurityCostData.OrderItem orderItem =
|
||
new Model.Customization._7HJ.SecurityCostData.OrderItem();
|
||
orderItem.CostType = "A3";
|
||
orderItem.CostName = "职业健康";
|
||
orderItem.CostMoney = (a3.CostMoney ?? 0).ToString();
|
||
totalA += Funs.GetNewDecimalOrZero(orderItem.CostMoney);
|
||
orderItem.ProjectCostMoney =
|
||
((from x in projectDetails where x.CostType == "A3" select x.CostMoney ?? 0).Sum() +
|
||
a3.CostMoney ?? 0).ToString();
|
||
totalProjectA += Funs.GetNewDecimalOrZero(orderItem.ProjectCostMoney);
|
||
orderItem.CostDef = a3.CostDef;
|
||
orderItems.Add(orderItem);
|
||
}
|
||
|
||
Model.CostGoods_CostSmallDetailItem a4 = details.FirstOrDefault(x => x.CostType == "A4");
|
||
if (a4 != null)
|
||
{
|
||
Model.Customization._7HJ.SecurityCostData.OrderItem orderItem =
|
||
new Model.Customization._7HJ.SecurityCostData.OrderItem();
|
||
orderItem.CostType = "A4";
|
||
orderItem.CostName = "安全防护";
|
||
orderItem.CostMoney = (a4.CostMoney ?? 0).ToString();
|
||
totalA += Funs.GetNewDecimalOrZero(orderItem.CostMoney);
|
||
orderItem.ProjectCostMoney =
|
||
((from x in projectDetails where x.CostType == "A4" select x.CostMoney ?? 0).Sum() +
|
||
a4.CostMoney ?? 0).ToString();
|
||
totalProjectA += Funs.GetNewDecimalOrZero(orderItem.ProjectCostMoney);
|
||
orderItem.CostDef = a4.CostDef;
|
||
orderItems.Add(orderItem);
|
||
}
|
||
|
||
Model.CostGoods_CostSmallDetailItem a5 = details.FirstOrDefault(x => x.CostType == "A5");
|
||
if (a5 != null)
|
||
{
|
||
Model.Customization._7HJ.SecurityCostData.OrderItem orderItem =
|
||
new Model.Customization._7HJ.SecurityCostData.OrderItem();
|
||
orderItem.CostType = "A5";
|
||
orderItem.CostName = "化工试车";
|
||
orderItem.CostMoney = (a5.CostMoney ?? 0).ToString();
|
||
totalA += Funs.GetNewDecimalOrZero(orderItem.CostMoney);
|
||
orderItem.ProjectCostMoney =
|
||
((from x in projectDetails where x.CostType == "A5" select x.CostMoney ?? 0).Sum() +
|
||
a5.CostMoney ?? 0).ToString();
|
||
totalProjectA += Funs.GetNewDecimalOrZero(orderItem.ProjectCostMoney);
|
||
orderItem.CostDef = a5.CostDef;
|
||
orderItems.Add(orderItem);
|
||
}
|
||
|
||
Model.CostGoods_CostSmallDetailItem a6 = details.FirstOrDefault(x => x.CostType == "A6");
|
||
if (a6 != null)
|
||
{
|
||
Model.Customization._7HJ.SecurityCostData.OrderItem orderItem =
|
||
new Model.Customization._7HJ.SecurityCostData.OrderItem();
|
||
orderItem.CostType = "A6";
|
||
orderItem.CostName = "教育培训";
|
||
orderItem.CostMoney = (a6.CostMoney ?? 0).ToString();
|
||
totalA += Funs.GetNewDecimalOrZero(orderItem.CostMoney);
|
||
orderItem.ProjectCostMoney =
|
||
((from x in projectDetails where x.CostType == "A6" select x.CostMoney ?? 0).Sum() +
|
||
a6.CostMoney ?? 0).ToString();
|
||
totalProjectA += Funs.GetNewDecimalOrZero(orderItem.ProjectCostMoney);
|
||
orderItem.CostDef = a6.CostDef;
|
||
orderItems.Add(orderItem);
|
||
}
|
||
|
||
securityCostData.nbA = totalA.ToString();
|
||
securityCostData.nbProjectA = totalProjectA.ToString();
|
||
Model.CostGoods_CostSmallDetailItem b1 = details.FirstOrDefault(x => x.CostType == "B1");
|
||
if (b1 != null)
|
||
{
|
||
Model.Customization._7HJ.SecurityCostData.OrderItem orderItem =
|
||
new Model.Customization._7HJ.SecurityCostData.OrderItem();
|
||
orderItem.CostType = "B1";
|
||
orderItem.CostName = "文明施工";
|
||
orderItem.CostMoney = (b1.CostMoney ?? 0).ToString();
|
||
totalB += Funs.GetNewDecimalOrZero(orderItem.CostMoney);
|
||
orderItem.ProjectCostMoney =
|
||
((from x in projectDetails where x.CostType == "B1" select x.CostMoney ?? 0).Sum() +
|
||
b1.CostMoney ?? 0).ToString();
|
||
totalProjectB += Funs.GetNewDecimalOrZero(orderItem.ProjectCostMoney);
|
||
orderItem.CostDef = b1.CostDef;
|
||
orderItems.Add(orderItem);
|
||
}
|
||
|
||
Model.CostGoods_CostSmallDetailItem b2 = details.FirstOrDefault(x => x.CostType == "B2");
|
||
if (b2 != null)
|
||
{
|
||
Model.Customization._7HJ.SecurityCostData.OrderItem orderItem =
|
||
new Model.Customization._7HJ.SecurityCostData.OrderItem();
|
||
orderItem.CostType = "B2";
|
||
orderItem.CostName = "临时设施";
|
||
orderItem.CostMoney = (b2.CostMoney ?? 0).ToString();
|
||
totalB += Funs.GetNewDecimalOrZero(orderItem.CostMoney);
|
||
orderItem.ProjectCostMoney =
|
||
((from x in projectDetails where x.CostType == "B2" select x.CostMoney ?? 0).Sum() +
|
||
b2.CostMoney ?? 0).ToString();
|
||
totalProjectB += Funs.GetNewDecimalOrZero(orderItem.ProjectCostMoney);
|
||
orderItem.CostDef = b2.CostDef;
|
||
orderItems.Add(orderItem);
|
||
}
|
||
|
||
Model.CostGoods_CostSmallDetailItem b3 = details.FirstOrDefault(x => x.CostType == "B3");
|
||
if (b3 != null)
|
||
{
|
||
Model.Customization._7HJ.SecurityCostData.OrderItem orderItem =
|
||
new Model.Customization._7HJ.SecurityCostData.OrderItem();
|
||
orderItem.CostType = "B3";
|
||
orderItem.CostName = "环境保护";
|
||
orderItem.CostMoney = (b3.CostMoney ?? 0).ToString();
|
||
totalB += Funs.GetNewDecimalOrZero(orderItem.CostMoney);
|
||
orderItem.ProjectCostMoney =
|
||
((from x in projectDetails where x.CostType == "B3" select x.CostMoney ?? 0).Sum() +
|
||
b3.CostMoney ?? 0).ToString();
|
||
totalProjectB += Funs.GetNewDecimalOrZero(orderItem.ProjectCostMoney);
|
||
orderItem.CostDef = b3.CostDef;
|
||
orderItems.Add(orderItem);
|
||
}
|
||
|
||
securityCostData.nbB = totalB.ToString();
|
||
securityCostData.nbProjectB = totalProjectB.ToString();
|
||
securityCostData.nbAB = (totalA + totalB).ToString();
|
||
securityCostData.nbProjectAB = (totalProjectA + totalProjectB).ToString();
|
||
securityCostData.OrderItems = orderItems;
|
||
}
|
||
}
|
||
|
||
responeData.data = new { securityCostData };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 安全事故及事件
|
||
|
||
/// <summary>
|
||
/// 根据项目获取HSSE事故(对人员记录)数据列表
|
||
/// </summary>
|
||
/// <param name="projectId"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getAccidentPersonRecordByProjectId(string projectId)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
var getLists = (from AccidentPersonRecord in db.Accident_AccidentPersonRecord
|
||
join AccidentType in db.Base_AccidentType on AccidentPersonRecord.AccidentTypeId equals AccidentType.AccidentTypeId into accidentTypeJoin
|
||
from AccidentType in accidentTypeJoin.DefaultIfEmpty()
|
||
join WorkArea in db.WBS_UnitWork on AccidentPersonRecord.WorkAreaId equals WorkArea.UnitWorkId into workAreaJoin
|
||
from WorkArea in workAreaJoin.DefaultIfEmpty()
|
||
join Person in db.SitePerson_Person on AccidentPersonRecord.PersonId equals Person.PersonId into personJoin
|
||
from Person in personJoin.DefaultIfEmpty()
|
||
join WorkPost in db.Base_WorkPost on Person.WorkPostId equals WorkPost.WorkPostId into workPostJoin
|
||
from WorkPost in workPostJoin.DefaultIfEmpty()
|
||
join FlowOperate in db.Sys_FlowOperate on AccidentPersonRecord.AccidentPersonRecordId equals FlowOperate.DataId into flowOperateJoin
|
||
from FlowOperate in flowOperateJoin.DefaultIfEmpty()
|
||
join OperateUser in db.Sys_User on FlowOperate.OperaterId equals OperateUser.UserId into operateUserJoin
|
||
from OperateUser in operateUserJoin.DefaultIfEmpty()
|
||
join Users in db.Sys_User on AccidentPersonRecord.CompileMan equals Users.UserId into usersJoin
|
||
from Users in usersJoin.DefaultIfEmpty()
|
||
where AccidentPersonRecord.ProjectId == projectId
|
||
select new
|
||
{
|
||
AccidentPersonRecord.AccidentPersonRecordId,
|
||
AccidentPersonRecord.ProjectId,
|
||
AccidentPersonRecord.AccidentTypeId,
|
||
AccidentPersonRecord.WorkAreaId,
|
||
AccidentPersonRecord.AccidentDate,
|
||
AccidentPersonRecord.PersonId,
|
||
AccidentPersonRecord.Injury,
|
||
AccidentPersonRecord.InjuryPart,
|
||
AccidentPersonRecord.HssePersons,
|
||
AccidentPersonRecord.InjuryResult,
|
||
AccidentPersonRecord.PreventiveAction,
|
||
AccidentPersonRecord.HandleOpinion,
|
||
AccidentPersonRecord.FileContent,
|
||
AccidentPersonRecord.CompileMan,
|
||
AccidentPersonRecord.CompileDate,
|
||
AccidentPersonRecord.States,
|
||
AccidentType.AccidentTypeName,
|
||
WorkAreaName = WorkArea.UnitWorkName,
|
||
Person.PersonName,
|
||
Person.CardNo,
|
||
Person.IdentityCard,
|
||
WorkPost.WorkPostName,
|
||
FlowOperateName = (AccidentPersonRecord.States == "0" || AccidentPersonRecord.States == null) ? "待[" + OperateUser.UserName + "]提交" :
|
||
(AccidentPersonRecord.States == "2") ? "审核/审批完成" : "待[" + OperateUser.UserName + "]办理"
|
||
}
|
||
).ToList();
|
||
Debug.WriteLine(getLists.Count());
|
||
responeData.data = new { getLists };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据主键获取HSSE事故(对人员记录)明细
|
||
/// </summary>
|
||
/// <param name="id"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getAccidentPersonRecordById(string id)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
Dictionary<string, object> dictionary = new Dictionary<string, object>();
|
||
Model.Accident_AccidentPersonRecord accidentPersonRecord = BLL.AccidentPersonRecordService.GetAccidentPersonRecordById(id);
|
||
if (accidentPersonRecord != null)
|
||
{
|
||
dictionary.Add("AccidentPersonRecordId", accidentPersonRecord.AccidentPersonRecordId);
|
||
if (!string.IsNullOrEmpty(accidentPersonRecord.ProjectId))
|
||
{
|
||
var project = BLL.ProjectService.GetProjectByProjectId(accidentPersonRecord.ProjectId);
|
||
if (project != null)
|
||
{
|
||
dictionary.Add("ProjectName", project.ProjectName);
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(accidentPersonRecord.AccidentTypeId))
|
||
{
|
||
var accidentType = BLL.AccidentTypeService.GetAccidentTypeById(accidentPersonRecord.AccidentTypeId);
|
||
if (accidentType != null)
|
||
{
|
||
dictionary.Add("AccidentTypeName", accidentType.AccidentTypeName);
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(accidentPersonRecord.WorkAreaId))
|
||
{
|
||
dictionary.Add("WorkAreaName", BLL.UnitWorkService.GetNameById(accidentPersonRecord.WorkAreaId));
|
||
}
|
||
if (accidentPersonRecord.AccidentDate != null)
|
||
{
|
||
dictionary.Add("AccidentDate", string.Format("{0:yyyy-MM-dd}", accidentPersonRecord.AccidentDate));
|
||
}
|
||
if (!string.IsNullOrEmpty(accidentPersonRecord.PersonId))
|
||
{
|
||
var person = BLL.PersonService.GetPersonById(accidentPersonRecord.PersonId);
|
||
if (person != null)
|
||
{
|
||
dictionary.Add("PersonName", person.PersonName);
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(accidentPersonRecord.Injury))
|
||
{
|
||
if (accidentPersonRecord.Injury == "1")
|
||
{
|
||
dictionary.Add("Injury", "死亡");
|
||
}
|
||
else if (accidentPersonRecord.Injury == "2")
|
||
{
|
||
dictionary.Add("Injury", "重伤");
|
||
}
|
||
else if (accidentPersonRecord.Injury == "3")
|
||
{
|
||
dictionary.Add("Injury", "轻伤");
|
||
}
|
||
}
|
||
dictionary.Add("InjuryPart", accidentPersonRecord.InjuryPart);
|
||
dictionary.Add("HssePersons", accidentPersonRecord.HssePersons);
|
||
dictionary.Add("InjuryResult", accidentPersonRecord.InjuryResult);
|
||
dictionary.Add("PreventiveAction", accidentPersonRecord.PreventiveAction);
|
||
dictionary.Add("HandleOpinion", accidentPersonRecord.HandleOpinion);
|
||
dictionary.Add("FileContent", HttpUtility.HtmlDecode(accidentPersonRecord.FileContent));
|
||
}
|
||
responeData.data = new { dictionary };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 根据项目获取事故报告登记数据列表
|
||
/// </summary>
|
||
/// <param name="projectId"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getAccidentReportByProjectId(string projectId)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
var getLists = (
|
||
from AccidentReport in db.Accident_AccidentReport
|
||
join Unit in db.Base_Unit on AccidentReport.UnitId equals Unit.UnitId into UnitJoin
|
||
from Unit in UnitJoin.DefaultIfEmpty()
|
||
join CodeRecords in db.Sys_CodeRecords on AccidentReport.AccidentReportId equals CodeRecords.DataId into CodeRecordsJoin
|
||
from CodeRecords in CodeRecordsJoin.DefaultIfEmpty()
|
||
join FlowOperate in db.Sys_FlowOperate on AccidentReport.AccidentReportId equals FlowOperate.DataId into flowOperateJoin
|
||
from FlowOperate in flowOperateJoin.DefaultIfEmpty()
|
||
join FlowOperate2 in db.Sys_FlowOperate on AccidentReport.AccidentReportId equals FlowOperate2.DataId into flowOperate2Join
|
||
from FlowOperate2 in flowOperate2Join.DefaultIfEmpty()
|
||
join OperateUser in db.Sys_User on FlowOperate.OperaterId equals OperateUser.UserId into operateUserJoin
|
||
from OperateUser in operateUserJoin.DefaultIfEmpty()
|
||
join AccidentType in db.Sys_Const on AccidentReport.AccidentTypeId equals AccidentType.ConstValue into AccidentTypeJoin
|
||
from AccidentType in AccidentTypeJoin.DefaultIfEmpty()
|
||
join Users in db.Sys_User on AccidentReport.CompileMan equals Users.UserId into usersJoin
|
||
from Users in usersJoin.DefaultIfEmpty()
|
||
where AccidentReport.ProjectId == projectId && FlowOperate.IsClosed == false && FlowOperate2.State == "2" && AccidentType.GroupId == "AccidentReportRegistration"
|
||
select new
|
||
{
|
||
AccidentReport.AccidentReportId,
|
||
AccidentReport.ProjectId,
|
||
AccidentReportCode = CodeRecords.Code,
|
||
AccidentReport.UnitId,
|
||
AccidentReport.FileContent,
|
||
AccidentReport.CompileMan,
|
||
AccidentReport.CompileDate,
|
||
AccidentReport.States,
|
||
AccidentReport.Abstract,
|
||
AccidentReport.AccidentDate,
|
||
AccidentReport.PeopleNum,
|
||
AccidentReport.WorkingHoursLoss,
|
||
EconomicLoss = (AccidentReport.EconomicLoss + AccidentReport.EconomicOtherLoss),
|
||
AccidentReport.ReportMan,
|
||
AccidentReport.ReporterUnit,
|
||
AccidentReport.ReportDate,
|
||
AuditDate = FlowOperate2.OperaterTime,
|
||
AccidentReport.ProcessDescription,
|
||
AccidentReport.EmergencyMeasures,
|
||
Unit.UnitName,
|
||
CompileManName = Users.UserName,
|
||
AccidentTypeName = AccidentType.ConstText,
|
||
AccidentReport.WorkArea,
|
||
FlowOperateName = (AccidentReport.States == "0" || AccidentReport.States == null) ? "待[" + OperateUser.UserName + "]提交" :
|
||
(AccidentReport.States == "2") ? "审核/审批完成" : "待[" + OperateUser.UserName + "]办理"
|
||
}
|
||
).ToList();
|
||
Debug.WriteLine(getLists.Count());
|
||
responeData.data = new { getLists };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据主键获取事故报告登记明细
|
||
/// </summary>
|
||
/// <param name="id"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getAccidentReportById(string id)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
Dictionary<string, object> dictionary = new Dictionary<string, object>();
|
||
|
||
Model.Accident_AccidentReport accidentReport = BLL.AccidentReportService.GetAccidentReportById(id);
|
||
if (accidentReport != null)
|
||
{
|
||
dictionary.Add("AccidentReportId", accidentReport.AccidentReportId);
|
||
dictionary.Add("AccidentReportCode", BLL.CodeRecordsService.ReturnCodeByDataId(id));
|
||
dictionary.Add("UnitName", BLL.UnitService.GetUnitNameByUnitId(accidentReport.UnitId));
|
||
dictionary.Add("CompileManName", BLL.UserService.GetUserNameByUserId(accidentReport.CompileMan));
|
||
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(accidentReport.ProjectId);
|
||
if (project != null)
|
||
{
|
||
dictionary.Add("ProjectName", project.ProjectName);
|
||
dictionary.Add("ProjectCode", project.ProjectCode);
|
||
}
|
||
if (accidentReport.CompileDate != null)
|
||
{
|
||
dictionary.Add("CompileDate", string.Format("{0:yyyy-MM-dd}", accidentReport.CompileDate));
|
||
}
|
||
if (!string.IsNullOrEmpty(accidentReport.AccidentTypeId))
|
||
{
|
||
Model.Sys_Const c = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_AccidentReportRegistration).FirstOrDefault(x => x.ConstValue == accidentReport.AccidentTypeId);
|
||
if (c != null)
|
||
{
|
||
dictionary.Add("AccidentTypeName", c.ConstText);
|
||
}
|
||
if (accidentReport.IsNotConfirm != null)
|
||
{
|
||
dictionary.Add("IsNotConfirm", accidentReport.IsNotConfirm == true ? "是" : "否");
|
||
}
|
||
}
|
||
dictionary.Add("Abstract", accidentReport.Abstract);
|
||
if (accidentReport.AccidentDate != null)
|
||
{
|
||
dictionary.Add("AccidentDate", string.Format("{0:yyyy-MM-dd}", accidentReport.AccidentDate));
|
||
}
|
||
dictionary.Add("WorkAreaName", accidentReport.WorkArea);
|
||
if (accidentReport.PeopleNum != null)
|
||
{
|
||
dictionary.Add("PeopleNum", Convert.ToString(accidentReport.PeopleNum));
|
||
}
|
||
if (accidentReport.IsNotConfirm == true) //待定
|
||
{
|
||
dictionary.Add("WorkingHoursLoss", accidentReport.NotConfirmWorkingHoursLoss);
|
||
dictionary.Add("EconomicLoss", accidentReport.NotConfirmEconomicLoss);
|
||
dictionary.Add("EconomicOtherLoss", accidentReport.NotConfirmEconomicOtherLoss);
|
||
}
|
||
else
|
||
{
|
||
if (accidentReport.WorkingHoursLoss != null)
|
||
{
|
||
dictionary.Add("WorkingHoursLoss", Convert.ToString(accidentReport.WorkingHoursLoss));
|
||
}
|
||
if (accidentReport.EconomicLoss != null)
|
||
{
|
||
dictionary.Add("EconomicLoss", Convert.ToString(accidentReport.EconomicLoss));
|
||
}
|
||
if (accidentReport.EconomicOtherLoss != null)
|
||
{
|
||
dictionary.Add("EconomicOtherLoss", Convert.ToString(accidentReport.EconomicOtherLoss));
|
||
}
|
||
}
|
||
dictionary.Add("ReportMan", accidentReport.ReportMan);
|
||
dictionary.Add("ReporterUnit", accidentReport.ReporterUnit);
|
||
if (accidentReport.ReportDate != null)
|
||
{
|
||
dictionary.Add("ReportDate", string.Format("{0:yyyy-MM-dd}", accidentReport.ReportDate));
|
||
}
|
||
dictionary.Add("ProcessDescription", accidentReport.ProcessDescription);
|
||
dictionary.Add("EmergencyMeasures", accidentReport.EmergencyMeasures);
|
||
}
|
||
responeData.data = new { dictionary };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
#endregion
|
||
|
||
#region 安全监督检查
|
||
|
||
/// <summary>
|
||
/// 获取安全监督检查报告数据列表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getSuperviseCheckReportList()
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
var getLists = (from s in db.Supervise_SuperviseCheckReport
|
||
join p in db.Base_Project on s.ProjectId equals p.ProjectId into projectJoin
|
||
from pj in projectJoin.DefaultIfEmpty()
|
||
join u in db.Base_Unit on s.UnitId equals u.UnitId into unitJoin
|
||
from uj in unitJoin.DefaultIfEmpty()
|
||
select new
|
||
{
|
||
s.SuperviseCheckReportId,
|
||
s.SuperviseCheckReportCode,
|
||
s.CheckDate,
|
||
s.ProjectId,
|
||
pj.ProjectName,
|
||
s.UnitId,
|
||
uj.UnitName,
|
||
s.CheckTeam,
|
||
s.EvaluationResult,
|
||
s.AttachUrl,
|
||
s.IsIssued,
|
||
CheckTypeName = GetCheckTypeName(s.CheckType) // 方法调用以获取检查类型的名称
|
||
}).ToList();
|
||
|
||
|
||
responeData.data = new { getLists };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
public string GetCheckTypeName(string checkType)
|
||
{
|
||
switch (checkType)
|
||
{
|
||
case "1": return "企业负责人带班检查";
|
||
case "2": return "企业综合检查";
|
||
case "3": return "企业专项检查";
|
||
default: return string.Empty;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据主键查询安全监督检查报告明细
|
||
/// </summary>
|
||
/// <param name="id"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getSuperviseCheckReportById(string id)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
Model.ResponeData responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
Hashtable tb = new Hashtable();
|
||
var superviseCheckReport = BLL.SuperviseCheckReportService.GetSuperviseCheckReportById(id);
|
||
if (superviseCheckReport != null)
|
||
{
|
||
tb.Add("SuperviseCheckReportId", superviseCheckReport.SuperviseCheckReportId);
|
||
tb.Add("SuperviseCheckReportCode", superviseCheckReport.SuperviseCheckReportCode);
|
||
if (superviseCheckReport.CheckDate != null)
|
||
{
|
||
tb.Add("CheckDate", string.Format("{0:yyyy-MM-dd}", superviseCheckReport.CheckDate));
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(superviseCheckReport.CheckType))
|
||
{
|
||
tb.Add("CheckType", superviseCheckReport.CheckType);
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(superviseCheckReport.ProjectId))
|
||
{
|
||
tb.Add("projectId", superviseCheckReport.ProjectId);
|
||
|
||
|
||
if (!string.IsNullOrEmpty(superviseCheckReport.UnitId))
|
||
{
|
||
tb.Add("UnitId", superviseCheckReport.UnitId);
|
||
}
|
||
}
|
||
|
||
tb.Add("CheckTeam", superviseCheckReport.CheckTeam);
|
||
// superviseCheckReportItems = (from x in Funs.DB.View_Supervise_SuperviseCheckReportItem where x.SuperviseCheckReportId == this.SuperviseCheckReportId orderby x.RectifyCode select x).ToList();
|
||
|
||
var report = BLL.SuperviseCheckReportService.GetSuperviseCheckReportById(id);
|
||
if (report != null && report.IsIssued == "1") //已下发
|
||
{
|
||
// this.btnSave.Hidden = true;
|
||
// this.btnSelect.Hidden = true;
|
||
// Grid1.Columns[10].Hidden = true;
|
||
}
|
||
}
|
||
|
||
|
||
responeData.data = new { tb };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 根据项目获取领导待办检查数据列表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getLeaderCheckByProjectId(string projectId)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
IQueryable<Model.Check_ProjectLeaderCheck> getDataList = from x in db.Check_ProjectLeaderCheck
|
||
select x;
|
||
if (!string.IsNullOrEmpty(projectId))
|
||
{
|
||
getDataList = getDataList.Where(x => x.ProjectId == projectId);
|
||
}
|
||
|
||
if (getDataList.Count() == 0)
|
||
{
|
||
return null;
|
||
}
|
||
var getLists = (from x in getDataList
|
||
join y in db.Base_Project on x.ProjectId equals y.ProjectId
|
||
into ps
|
||
from y in ps.DefaultIfEmpty()
|
||
where (y.IsDelete == null || y.IsDelete == false)
|
||
select new
|
||
{
|
||
x.ProjectLeaderCheckId,
|
||
x.ProjectId,
|
||
db.Base_Project.First(u => u.ProjectId == x.ProjectId).ProjectName,
|
||
x.CheckCode,
|
||
x.UnitIds,
|
||
x.LeaderIds,
|
||
x.LeaderNames,
|
||
x.QuestionDef,
|
||
x.CheckDate,
|
||
x.IsHoldMeet,
|
||
IsHoldMeetName = x.IsHoldMeet == true ? "是" : "否",
|
||
x.Requirement,
|
||
}).ToList();
|
||
|
||
|
||
responeData.data = new { getLists };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 根据主键查询领导待办检查明细
|
||
/// </summary>
|
||
/// <param name="id"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getLeaderCheckById(string id)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
Model.ResponeData responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
Dictionary<string, object> dictionary = new Dictionary<string, object>();
|
||
var getProjectLeaderCheck = BLL.Check_ProjectLeaderCheckService.GetProjectLeaderCheckById(id);
|
||
if (getProjectLeaderCheck != null)
|
||
{
|
||
dictionary.Add("ProjectLeaderCheckId", getProjectLeaderCheck.ProjectLeaderCheckId);
|
||
dictionary.Add("Units", UnitService.getUnitNamesUnitIds(getProjectLeaderCheck.UnitIds));
|
||
dictionary.Add("LeaderIds", UserService.getUserNamesUserIds(getProjectLeaderCheck.LeaderIds));
|
||
dictionary.Add("CheckCode", getProjectLeaderCheck.CheckCode);
|
||
dictionary.Add("CheckDate", string.Format("{0:yyyy-MM-dd}", getProjectLeaderCheck.CheckDate));
|
||
dictionary.Add("IsHoldMeet", getProjectLeaderCheck.IsHoldMeet == true ? "是" : "否");
|
||
dictionary.Add("QuestionDef", getProjectLeaderCheck.QuestionDef);
|
||
dictionary.Add("Requirement", getProjectLeaderCheck.Requirement);
|
||
dictionary.Add("LeaderName", getProjectLeaderCheck.LeaderNames);
|
||
}
|
||
|
||
responeData.data = new { dictionary };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 根据项目获取日常巡检数据列表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getDayCheckByProjectId(string projectId)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
var getLists = (from x in db.View_Hazard_HazardRegister
|
||
where x.ProblemTypes == "1" && x.ProjectId == projectId
|
||
select x).ToList();
|
||
|
||
responeData.data = new { getLists };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 根据主键获取日常巡检明细
|
||
/// </summary>
|
||
/// <param name="id"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getDayCheckById(string id)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
Model.ResponeData responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
Dictionary<string, object> dictionary = new Dictionary<string, object>();
|
||
|
||
Model.View_Hazard_HazardRegister registration =
|
||
(from x in Funs.DB.View_Hazard_HazardRegister where x.HazardRegisterId == id select x)
|
||
.FirstOrDefault();
|
||
if (registration != null)
|
||
{
|
||
dictionary.Add("HazardRegisterId", registration.HazardRegisterId);
|
||
dictionary.Add("WorkAreaName", registration.WorkAreaName);
|
||
dictionary.Add("ResponsibilityUnitName", registration.ResponsibilityUnitName);
|
||
dictionary.Add("RegisterTypesName", registration.RegisterTypesName);
|
||
dictionary.Add("ProblemDescription", registration.RegisterDef);
|
||
dictionary.Add("TakeSteps", registration.Rectification);
|
||
dictionary.Add("ResponsibilityManName", registration.ResponsibilityManName);
|
||
dictionary.Add("RectificationPeriod",
|
||
string.Format("{0:yyyy-MM-dd HH:mm:ss}", registration.RectificationPeriod));
|
||
dictionary.Add("CheckManName", registration.CheckManName);
|
||
dictionary.Add("CheckTime", string.Format("{0:yyyy-MM-dd HH:mm:ss}", registration.CheckTime));
|
||
dictionary.Add("RectificationTime",
|
||
string.Format("{0:yyyy-MM-dd HH:mm:ss}", registration.RectificationTime));
|
||
dictionary.Add("States", registration.StatesStr);
|
||
dictionary.Add("ImageUrl", registration.ImageUrl);
|
||
dictionary.Add("RiskLevel", registration.Risk_Level);
|
||
dictionary.Add("RectificationImageUrl", registration.RectificationImageUrl);
|
||
}
|
||
|
||
responeData.data = new { dictionary };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 根据项目获取专项检查数据列表
|
||
/// </summary>
|
||
/// <param name="projectId"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getCheckSpecialByProjectId(string projectId)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
var getLists = (
|
||
from CheckSpecial in db.Check_CheckSpecial
|
||
join CodeRecords in db.Sys_CodeRecords on CheckSpecial.CheckSpecialId equals CodeRecords.DataId into CodeRecordsInfo
|
||
from CodeRecords in CodeRecordsInfo.DefaultIfEmpty()
|
||
join CheckItemSet in db.Technique_CheckItemSet on CheckSpecial.CheckItemSetId equals CheckItemSet.CheckItemSetId into CheckItemSetInfo
|
||
from CheckItemSet in CheckItemSetInfo.DefaultIfEmpty()
|
||
where (CheckSpecial.ProjectId == projectId)
|
||
select new
|
||
{
|
||
CheckSpecial.CheckSpecialId,
|
||
CheckSpecialCode = CodeRecords.Code,
|
||
CheckItemSet.CheckItemName,
|
||
CheckSpecial.CheckTime,
|
||
CheckTypeName = CheckSpecial.CheckType == "1" ? "安全周检" : CheckSpecial.CheckType == "2" ? "安全月检" : CheckSpecial.CheckType == "3" ? "节假日安全检查" : CheckSpecial.CheckType == "0" ? "专项检查" : "专项检查",
|
||
StatesName = CheckSpecial.States == "2" ? "已完成" : CheckSpecial.States == "1" ? "待整改" : "待提交",
|
||
}
|
||
).ToList();
|
||
Debug.WriteLine(getLists.Count());
|
||
responeData.data = new { getLists };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 根据主键获取专项检查明细
|
||
/// </summary>
|
||
/// <param name="id"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getCheckSpecialById(string id)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
Dictionary<string, object> dictionary = new Dictionary<string, object>();
|
||
var checkSpecial = BLL.Check_CheckSpecialService.GetCheckSpecialByCheckSpecialId(id);
|
||
if (checkSpecial != null)
|
||
{
|
||
dictionary.Add("CheckSpecialId", checkSpecial.CheckSpecialId);
|
||
dictionary.Add("CheckSpecialCode", BLL.CodeRecordsService.ReturnCodeByDataId(id));
|
||
if (checkSpecial.CheckTime != null)
|
||
{
|
||
dictionary.Add("CheckDate", string.Format("{0:yyyy-MM-dd}", checkSpecial.CheckTime));
|
||
}
|
||
if (!String.IsNullOrEmpty(checkSpecial.CheckType))
|
||
{
|
||
dictionary.Add("Type", checkSpecial.CheckType);
|
||
}
|
||
dictionary.Add("PartInPersonNames", checkSpecial.PartInPersonNames);
|
||
if (!string.IsNullOrEmpty(checkSpecial.CheckItemSetId))
|
||
{
|
||
var getCheckItem = Funs.DB.Technique_CheckItemSet.FirstOrDefault(x => x.CheckItemSetId == checkSpecial.CheckItemSetId);
|
||
dictionary.Add("SupCheckItemSet", getCheckItem.CheckItemName);
|
||
}
|
||
dictionary.Add("PartInPersons", checkSpecial.PartInPersons);
|
||
List<Model.View_CheckSpecialDetail> checkSpecialDetails = (from x in Funs.DB.View_CheckSpecialDetail
|
||
where x.CheckSpecialId == id
|
||
orderby x.UnitName, x.SortIndex
|
||
select x).ToList();
|
||
dictionary.Add("CheckSpecialDetails", checkSpecialDetails);
|
||
}
|
||
responeData.data = new { dictionary };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 危大/超危大工程情况
|
||
|
||
/// <summary>
|
||
/// 根据项目获取危大工程施工方案清单信息数据列表
|
||
/// </summary>
|
||
/// <param name="projectId"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getLargerHazardByProjectId(string projectId)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
var getLists = (
|
||
from LargerHazard in db.Solution_LargerHazard
|
||
join FlowOperate in db.Sys_FlowOperate on LargerHazard.HazardId equals FlowOperate.DataId into
|
||
fGroup
|
||
from f in fGroup.DefaultIfEmpty()
|
||
join OperateUser in db.Sys_User on f.OperaterId equals OperateUser.UserId into ouGroup
|
||
from ou in ouGroup.DefaultIfEmpty()
|
||
join Users in db.Sys_User on LargerHazard.RecardMan equals Users.UserId into uGroup
|
||
from u in uGroup.DefaultIfEmpty()
|
||
join Const in db.Sys_Const on LargerHazard.HazardType equals Const.ConstValue into cGroup
|
||
from c in cGroup.DefaultIfEmpty()
|
||
join CodeRecords in db.Sys_CodeRecords on LargerHazard.HazardId equals CodeRecords.DataId into
|
||
crGroup
|
||
from cr in crGroup.DefaultIfEmpty()
|
||
where (LargerHazard.ProjectId == projectId && c.GroupId == "LargerHazardType" &&
|
||
f.IsClosed.Value)
|
||
select new
|
||
{
|
||
LargerHazard.HazardName,
|
||
LargerHazard.HazardId,
|
||
LargerHazard.ProjectId,
|
||
HazardCode = cr.Code,
|
||
LargerHazard.Address,
|
||
u.UserName,
|
||
LargerHazard.ExpectedTime,
|
||
LargerHazard.RecordTime,
|
||
StatesStr = LargerHazard.States == "1" ? "审批完成" :
|
||
LargerHazard.States == "2" ? "作业中" :
|
||
LargerHazard.States == "3" ? "已关闭" :
|
||
LargerHazard.States == "0" ? "已取消" : "",
|
||
IsArgumentStr = LargerHazard.IsArgument.Value ? "是" : "否",
|
||
TypeName = c.ConstText
|
||
}
|
||
).ToList();
|
||
Debug.WriteLine(getLists.Count());
|
||
responeData.data = new { getLists };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据主键获取危大工程施工方案清单明细
|
||
/// </summary>
|
||
/// <param name="id"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getLargerHazardById(string id)
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
Hashtable tb = new Hashtable();
|
||
var largerHazard = BLL.LargerHazardService.GetLargerHazardByHazardId(id);
|
||
if (largerHazard != null)
|
||
{
|
||
tb.Add("HazardId", largerHazard.HazardId);
|
||
tb.Add("LargerHazardCode", BLL.CodeRecordsService.ReturnCodeByDataId(id));
|
||
if (!string.IsNullOrEmpty(largerHazard.HazardType))
|
||
{
|
||
var HazardType = ConstValue.drpConstItemList(ConstValue.Group_LargerHazardType)
|
||
.FirstOrDefault(x => x.ConstValue == largerHazard.HazardType).ConstText;
|
||
tb.Add("HazardType", HazardType);
|
||
}
|
||
|
||
tb.Add("Address", largerHazard.Address);
|
||
if (largerHazard.ExpectedTime != null)
|
||
{
|
||
tb.Add("ExpectedTime", string.Format("{0:yyyy-MM-dd}", largerHazard.ExpectedTime));
|
||
}
|
||
|
||
if (largerHazard.RecordTime != null)
|
||
{
|
||
tb.Add("RecordTime", string.Format("{0:yyyy-MM-dd}", largerHazard.RecordTime));
|
||
}
|
||
|
||
if (largerHazard.IsArgument == true)
|
||
{
|
||
tb.Add("IsArgument", "是");
|
||
}
|
||
else
|
||
{
|
||
tb.Add("IsArgument", "否");
|
||
}
|
||
|
||
if (largerHazard.IsSuperLargerHazard == true)
|
||
{
|
||
tb.Add("IsSuperLargerHazard", "是");
|
||
}
|
||
else
|
||
{
|
||
tb.Add("IsSuperLargerHazard", "否");
|
||
}
|
||
|
||
if (largerHazard.TrainPersonNum != null)
|
||
{
|
||
tb.Add("TrainPersonNum", largerHazard.TrainPersonNum.ToString());
|
||
}
|
||
|
||
tb.Add("States", largerHazard.States);
|
||
tb.Add("Descriptions", largerHazard.Descriptions);
|
||
tb.Add("Remark", HttpUtility.HtmlDecode(largerHazard.Remark));
|
||
tb.Add("HazardName", largerHazard.HazardName);
|
||
}
|
||
|
||
responeData.data = new { tb };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 安全培训
|
||
|
||
/// <summary>
|
||
/// 根据项目获取培训记录信息数据列表
|
||
/// </summary>
|
||
/// <param name="projectId"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getTrainRecordByProjectId(string projectId)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
string timeString = "2023-01-01 00:00:00";
|
||
DateTime timeDate = DateTime.Parse(timeString);
|
||
var getLists = (
|
||
from t in db.EduTrain_TrainRecord
|
||
join tt in db.Base_TrainType on t.TrainTypeId equals tt.TrainTypeId into ttGroup
|
||
from tt in ttGroup.DefaultIfEmpty()
|
||
join p in db.Base_Project on t.ProjectId equals p.ProjectId into pGroup
|
||
from p in pGroup.DefaultIfEmpty()
|
||
where (t.ProjectId == projectId && t.TrainStartDate > timeDate && p.ProjectState == "1" &&
|
||
(p.IsDelete.Value == null || !p.IsDelete.Value))
|
||
select new Model.Customization._7HJ.TrainRecordInfo
|
||
{
|
||
TrainingId = t.TrainingId,
|
||
TrainTitle = t.TrainTitle,
|
||
TrainTypeName = tt.TrainTypeName,
|
||
ProjectId = p.ProjectId,
|
||
ProjectCode = p.ProjectCode,
|
||
ProjectName = p.ProjectName,
|
||
TrainStartDate = t.TrainStartDate,
|
||
TrainEndDate = t.TrainEndDate,
|
||
TrainPersonNum = t.TrainPersonNum,
|
||
UnitIds = t.UnitIds,
|
||
IsDelete = p.IsDelete.Value,
|
||
UnitNames = GetUnitNames(t.UnitIds, db.Base_Unit),
|
||
}
|
||
).ToList();
|
||
Debug.WriteLine(getLists.Count());
|
||
responeData.data = new { getLists };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
// 自定义函数模拟PATINDEX和STUFF
|
||
private string GetUnitNames(string unitIds, IQueryable<Base_Unit> units)
|
||
{
|
||
// 使用String.Split分割UnitIds
|
||
var unitIdParts = unitIds.Split(',');
|
||
// 过滤出与unitIdParts匹配的UnitName
|
||
var unitNames = units.Where(u => unitIdParts.Contains(u.UnitId.Trim())).Select(u => u.UnitName);
|
||
// 使用String.Join拼接UnitNames
|
||
return string.Join(",", unitNames);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据主键获取培训记录明细
|
||
/// </summary>
|
||
/// <param name="id"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getTrainRecordById(string id)
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
var trainRecord = BLL.EduTrain_TrainRecordService.GetTrainingByTrainingId(id);
|
||
Model.Customization._7HJ.TrainRecordData data = new Model.Customization._7HJ.TrainRecordData();
|
||
if (trainRecord != null)
|
||
{
|
||
data.TrainingId = trainRecord.TrainingId;
|
||
data.TrainingCode = BLL.CodeRecordsService.ReturnCodeByDataId(id);
|
||
Model.Base_TrainType trainType = BLL.TrainTypeService.GetTrainTypeById(trainRecord.TrainTypeId);
|
||
if (trainType != null)
|
||
{
|
||
data.TrainType = trainType.TrainTypeName;
|
||
}
|
||
|
||
Model.Base_TrainLevel trainLevel =
|
||
BLL.TrainLevelService.GetTrainLevelById(trainRecord.TrainLevelId);
|
||
if (trainLevel != null)
|
||
{
|
||
data.TrainLevel = trainLevel.TrainLevelName;
|
||
}
|
||
|
||
data.TrainTitle = trainRecord.TrainTitle;
|
||
if (!string.IsNullOrEmpty(trainRecord.UnitIds))
|
||
{
|
||
string unitNames = string.Empty;
|
||
string[] unitIds = trainRecord.UnitIds.Split(',');
|
||
foreach (var item in unitIds)
|
||
{
|
||
Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(item);
|
||
if (unit != null)
|
||
{
|
||
unitNames += unit.UnitName + ",";
|
||
}
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(unitNames))
|
||
{
|
||
unitNames = unitNames.Substring(0, unitNames.LastIndexOf(","));
|
||
}
|
||
|
||
data.UnitNames = unitNames;
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(trainRecord.WorkPostIds))
|
||
{
|
||
string WorkPostNames = string.Empty;
|
||
string[] WorkPostIds = trainRecord.WorkPostIds.Split(',');
|
||
foreach (var item in WorkPostIds)
|
||
{
|
||
Model.Base_WorkPost WorkPost = BLL.WorkPostService.GetWorkPostById(item);
|
||
if (WorkPost != null)
|
||
{
|
||
WorkPostNames += WorkPost.WorkPostName + ",";
|
||
}
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(WorkPostNames))
|
||
{
|
||
WorkPostNames = WorkPostNames.Substring(0, WorkPostNames.LastIndexOf(","));
|
||
}
|
||
|
||
data.WorkPostIds = WorkPostNames;
|
||
}
|
||
|
||
data.TeachMan = trainRecord.TeachMan;
|
||
data.TeachAddress = trainRecord.TeachAddress;
|
||
if (trainRecord.TeachHour != null)
|
||
{
|
||
data.TeachHour = trainRecord.TeachHour.ToString();
|
||
}
|
||
|
||
if (trainRecord.TrainStartDate != null)
|
||
{
|
||
data.TrainStartDate = string.Format("{0:yyyy-MM-dd}", trainRecord.TrainStartDate);
|
||
}
|
||
|
||
if (trainRecord.TrainPersonNum != null)
|
||
{
|
||
data.TrainPersonNum = Convert.ToString(trainRecord.TrainPersonNum);
|
||
}
|
||
|
||
data.TrainContent = trainRecord.TrainContent;
|
||
|
||
data.trainRecordDetails = (from x in Funs.DB.View_EduTrain_TrainRecordDetail
|
||
where x.TrainingId == id
|
||
orderby x.UnitName, x.PersonName
|
||
select x).ToList();
|
||
}
|
||
|
||
responeData.data = new { data };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 应急预案
|
||
|
||
/// <summary>
|
||
/// 获取应急预案管理清单信息数据列表type=0公司应急预案,type=1项目应急预案
|
||
/// </summary>
|
||
/// <param name="type"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getEmergencyPlanList(string type)
|
||
{
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
var model = new List<EmergencyOutput>();
|
||
if (type == "0")
|
||
{
|
||
model = HSSEData_HSSEService.GetCompanyComprehensivePlan();
|
||
model.AddRange(HSSEData_HSSEService.GetCompanySpecialPlan());
|
||
model.AddRange(HSSEData_HSSEService.GetCompanyOnSiteDisposalPlan());
|
||
}
|
||
else if (type == "1")
|
||
{
|
||
model = HSSEData_HSSEService.GetProjectComprehensivePlan();
|
||
model.AddRange(HSSEData_HSSEService.GetProjectSpecialPlan());
|
||
model.AddRange(HSSEData_HSSEService.GetProjectOnSiteDisposalPlan());
|
||
}
|
||
|
||
responeData.data = new { model };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 根据主键获取应急预案管理清单明细
|
||
/// </summary>
|
||
/// <param name="id"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getEmergencyPlanById(string type, string id)
|
||
{
|
||
{
|
||
Model.ResponeData responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
Hashtable tb = new Hashtable();
|
||
if (type == "0")
|
||
{
|
||
//企业
|
||
Model.Emergency_EmergencyList_Unit EmergencyList =
|
||
BLL.UnitEmergencyListService.GetEmergencyListById(id);
|
||
if (EmergencyList != null)
|
||
{
|
||
///读取编号
|
||
tb.Add("EmergencyCode", BLL.CodeRecordsService.ReturnCodeByDataId(id));
|
||
tb.Add("EmergencyName", EmergencyList.EmergencyName);
|
||
tb.Add("EmergencyListId", EmergencyList.EmergencyListId);
|
||
tb.Add("Unit", BLL.UnitService.GetUnitNameByUnitId(EmergencyList.UnitId));
|
||
var emergencyType =
|
||
BLL.EmergencyTypeService.GetEmergencyTypeById(EmergencyList.EmergencyTypeId);
|
||
if (emergencyType != null)
|
||
{
|
||
tb.Add("EmergencyType", emergencyType.EmergencyTypeName);
|
||
}
|
||
|
||
tb.Add("VersionCode", EmergencyList.VersionCode);
|
||
tb.Add("CompileMan", BLL.UserService.GetUserNameByUserId(EmergencyList.CompileMan));
|
||
tb.Add("CompileDate", string.Format("{0:yyyy-MM-dd}", EmergencyList.CompileDate));
|
||
tb.Add("EmergencyContents", HttpUtility.HtmlDecode(EmergencyList.EmergencyContents));
|
||
}
|
||
}
|
||
else if (type == "1")
|
||
{
|
||
//项目
|
||
Model.Emergency_EmergencyList EmergencyList = BLL.EmergencyListService.GetEmergencyListById(id);
|
||
if (EmergencyList != null)
|
||
{
|
||
///读取编号
|
||
tb.Add("EmergencyCode", BLL.CodeRecordsService.ReturnCodeByDataId(id));
|
||
tb.Add("EmergencyName", EmergencyList.EmergencyName);
|
||
tb.Add("EmergencyListId", EmergencyList.EmergencyListId);
|
||
tb.Add("Unit", BLL.UnitService.GetUnitNameByUnitId(EmergencyList.UnitId));
|
||
var emergencyType1 =
|
||
BLL.EmergencyTypeService.GetEmergencyTypeById(EmergencyList.EmergencyTypeId);
|
||
if (emergencyType1 != null)
|
||
{
|
||
tb.Add("EmergencyType", emergencyType1.EmergencyTypeName);
|
||
}
|
||
|
||
tb.Add("VersionCode", EmergencyList.VersionCode);
|
||
tb.Add("CompileMan", BLL.UserService.GetUserNameByUserId(EmergencyList.CompileMan));
|
||
tb.Add("CompileDate", string.Format("{0:yyyy-MM-dd}", EmergencyList.CompileDate));
|
||
tb.Add("EmergencyContents", HttpUtility.HtmlDecode(EmergencyList.EmergencyContents));
|
||
}
|
||
}
|
||
|
||
responeData.data = new { tb };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 应急演练
|
||
|
||
/// <summary>
|
||
/// 获取应急演练开展情况信息数据列表type=0公司应急演练,type=1项目应急演练
|
||
/// </summary>
|
||
/// <param name="type"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getEmergencyDrillList(string type)
|
||
{
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
var model = new List<EmergencyOutput>();
|
||
if (type == "0")
|
||
{
|
||
model = HSSEData_HSSEService.GetCompanyDrill();
|
||
}
|
||
else if (type == "1")
|
||
{
|
||
model = HSSEData_HSSEService.GetProjectDrill();
|
||
}
|
||
|
||
responeData.data = new { model };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 根据主键获取应急演练开展情况明细
|
||
/// </summary>
|
||
/// <param name="id"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getEmergencyDrillById(string type, string id)
|
||
{
|
||
{
|
||
Model.ResponeData responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
Hashtable tb = new Hashtable();
|
||
if (type == "0")
|
||
{
|
||
//企业
|
||
Model.Emergency_DrillRecordList_Unit DrillRecordList =
|
||
BLL.UnitDrillRecordListService.GetDrillRecordListById(id);
|
||
if (DrillRecordList != null)
|
||
{
|
||
///读取编号
|
||
tb.Add("DrillRecordName", DrillRecordList.DrillRecordName);
|
||
tb.Add("DrillRecordListId", DrillRecordList.DrillRecordListId);
|
||
tb.Add("DrillRecordDate", string.Format("{0:yyyy-MM-dd}", DrillRecordList.DrillRecordDate));
|
||
tb.Add("Units", DrillRecordList.UnitNames);
|
||
tb.Add("DrillRecordCode", BLL.CodeRecordsService.ReturnCodeByDataId(id));
|
||
|
||
if (!string.IsNullOrEmpty(DrillRecordList.DrillRecordType))
|
||
{
|
||
Model.Sys_Const c = BLL.ConstValue
|
||
.drpConstItemList(BLL.ConstValue.Group_DrillRecordType)
|
||
.FirstOrDefault(x => x.ConstValue == DrillRecordList.DrillRecordType);
|
||
if (c != null)
|
||
{
|
||
tb.Add("DrillRecordType", c.ConstText);
|
||
}
|
||
}
|
||
|
||
if (DrillRecordList.JointPersonNum != null)
|
||
{
|
||
tb.Add("JointPersonNum", DrillRecordList.JointPersonNum.ToString());
|
||
}
|
||
|
||
if (DrillRecordList.DrillCost != null)
|
||
{
|
||
tb.Add("DrillCost", DrillRecordList.DrillCost.ToString());
|
||
}
|
||
|
||
tb.Add("DrillRecordContents", HttpUtility.HtmlDecode(DrillRecordList.DrillRecordContents));
|
||
}
|
||
}
|
||
else if (type == "1")
|
||
{
|
||
//项目
|
||
Model.Emergency_DrillRecordList DrillRecordList =
|
||
BLL.DrillRecordListService.GetDrillRecordListById(id);
|
||
if (DrillRecordList != null)
|
||
{
|
||
///读取编号
|
||
tb.Add("DrillRecordCode", BLL.CodeRecordsService.ReturnCodeByDataId(id));
|
||
tb.Add("DrillRecordName", DrillRecordList.DrillRecordName);
|
||
tb.Add("DrillRecordListId", DrillRecordList.DrillRecordListId);
|
||
tb.Add("DrillRecordDate", string.Format("{0:yyyy-MM-dd}", DrillRecordList.DrillRecordDate));
|
||
tb.Add("Units", DrillRecordList.UnitNames);
|
||
if (!string.IsNullOrEmpty(DrillRecordList.DrillRecordType))
|
||
{
|
||
Model.Sys_Const c = BLL.ConstValue
|
||
.drpConstItemList(BLL.ConstValue.Group_DrillRecordType)
|
||
.FirstOrDefault(x => x.ConstValue == DrillRecordList.DrillRecordType);
|
||
if (c != null)
|
||
{
|
||
tb.Add("DrillRecordType", c.ConstText);
|
||
}
|
||
}
|
||
|
||
if (DrillRecordList.JointPersonNum != null)
|
||
{
|
||
tb.Add("JointPersonNum", DrillRecordList.JointPersonNum.ToString());
|
||
}
|
||
|
||
if (DrillRecordList.DrillCost != null)
|
||
{
|
||
tb.Add("DrillCost", DrillRecordList.DrillCost.ToString());
|
||
}
|
||
|
||
tb.Add("DrillRecordContents", HttpUtility.HtmlDecode(DrillRecordList.DrillRecordContents));
|
||
}
|
||
}
|
||
|
||
responeData.data = new { tb };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 安全隐患整改情况
|
||
|
||
/// <summary>
|
||
/// 获取项目隐患整改情况数据列表type=0重大,type=1一般
|
||
/// </summary>
|
||
/// <param name="type"> </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getHiddenList(string type)
|
||
{
|
||
{
|
||
var responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
var model = new List<Model.HiddenRectificationOutput>();
|
||
if (type == "0")
|
||
{
|
||
model = HSSEData_HSSEService.GetMajorHiddenRectificationOutputs();
|
||
}
|
||
else if (type == "1")
|
||
{
|
||
model = HSSEData_HSSEService.GetGeneralHiddenRectificationOutputs();
|
||
}
|
||
|
||
responeData.data = new { model };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 根据项目获取隐患整改明细
|
||
/// </summary>
|
||
/// <param name="projectId"> </param>
|
||
/// <param name="type"> 0重大 1一般 </param>
|
||
/// <param name="States"> 1待整改 2已整改待复查验收 3已闭环 </param>
|
||
/// <returns></returns>
|
||
public Model.ResponeData getHiddenById(string type, string projectId, string States)
|
||
{
|
||
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
|
||
{
|
||
Model.ResponeData responeData = new Model.ResponeData();
|
||
try
|
||
{
|
||
string timeString = "2023-01-01 00:00:00";
|
||
DateTime timeDate = DateTime.Parse(timeString);
|
||
var query = db.View_Hazard_HazardRegister
|
||
.Where(h => h.ProblemTypes == "1" && h.CheckTime > timeDate)
|
||
.Where(h => h.ProjectId == projectId);
|
||
if (!string.IsNullOrEmpty(States))
|
||
{
|
||
var selectedState = "%" + States + "%";
|
||
query = query.Where(h => h.States.Contains(selectedState)); // 使用Contains替代LIKE
|
||
}
|
||
|
||
if (type == "0")
|
||
{
|
||
query = query.Where(h => h.Risk_Level == "重大");
|
||
}
|
||
else if (type == "1")
|
||
{
|
||
query = query.Where(h => h.Risk_Level == "一般");
|
||
}
|
||
|
||
|
||
var getLists = query.ToList(); // 执行查询并将结果转换为列表
|
||
responeData.data = new { getLists };
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
responeData.code = 0;
|
||
responeData.message = ex.Message;
|
||
}
|
||
|
||
return responeData;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
}
|
||
} |