提交代码
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FineUIPro;
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
@@ -320,6 +321,19 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteProject_HSSEData_HSSEByDate(DateTime? reportDate)
|
||||
{
|
||||
using (var db = new SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var table = db.Project_HSSEData_HSSE.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
|
||||
if (table != null)
|
||||
{
|
||||
db.Project_HSSEData_HSSE.DeleteAllOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断该项目的该日期是否统计数据
|
||||
/// </summary>
|
||||
@@ -371,7 +385,7 @@ namespace BLL
|
||||
/// </summary>
|
||||
public static void StatisticalAllProjectData()
|
||||
{
|
||||
var projectlist = ProjectService.GetCNCECShowProjectList();
|
||||
var projectlist = ProjectService.GetProjectWorkList();
|
||||
foreach (var item in projectlist) StatisticalData(item.ProjectId, HSSEDateType.All);
|
||||
}
|
||||
|
||||
@@ -606,7 +620,7 @@ namespace BLL
|
||||
public static int GetJoinConstructionPersonNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.SitePerson_Person
|
||||
where x.ProjectId == projectid && x.States=="1"
|
||||
where x.ProjectId == projectid && x.States == "1"
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -629,11 +643,10 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static int GetTotalWorkingHour(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.SeDin_MonthReport2
|
||||
join y in Funs.DB.SeDin_MonthReport on x.MonthReportId equals y.MonthReportId
|
||||
where y.ProjectId == projectid
|
||||
orderby y.ReporMonth descending
|
||||
select x.ProjectWorkTime ?? 0).FirstOrDefault();
|
||||
var result = (from x in Funs.DB.SitePerson_DayReportDetail
|
||||
join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId
|
||||
where y.ProjectId == projectid && y.CompileDate > Const.DtmarkTime
|
||||
select x.PersonWorkTime ?? 0).ToList().Sum();
|
||||
var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]);
|
||||
|
||||
return q;
|
||||
@@ -665,11 +678,10 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static int GetSafeWorkingHour(string projectid)
|
||||
{
|
||||
var result1 = (from x in Funs.DB.SeDin_MonthReport2
|
||||
join y in Funs.DB.SeDin_MonthReport on x.MonthReportId equals y.MonthReportId
|
||||
where y.ProjectId == projectid
|
||||
orderby y.ReporMonth descending
|
||||
select x.ProjectWorkTime ?? 0).FirstOrDefault();
|
||||
var result1 = (from x in Funs.DB.SitePerson_DayReportDetail
|
||||
join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId
|
||||
where y.ProjectId == projectid && y.CompileDate > Const.DtmarkTime
|
||||
select x.PersonWorkTime ?? 0).ToList().Sum();
|
||||
var result2 =
|
||||
(from x in Funs.DB.Accident_AccidentHandle
|
||||
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
|
||||
@@ -694,7 +706,7 @@ namespace BLL
|
||||
var result = (from x in Funs.DB.EduTrain_TrainRecord
|
||||
join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId
|
||||
where x.ProjectId == projectid && y.TrainType == "1" && x.TrainStartDate > Const.DtmarkTime
|
||||
select x).Count();
|
||||
select x.TrainPersonNum ?? 0).ToList().Sum();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -707,7 +719,7 @@ namespace BLL
|
||||
var result = (from x in Funs.DB.EduTrain_TrainRecord
|
||||
join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId
|
||||
where x.ProjectId == projectid && y.TrainType == "2" && x.TrainStartDate > Const.DtmarkTime
|
||||
select x).Count();
|
||||
select x.TrainPersonNum ?? 0).ToList().Sum();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -720,7 +732,7 @@ namespace BLL
|
||||
var result = (from x in Funs.DB.EduTrain_TrainRecord
|
||||
join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId
|
||||
where x.ProjectId == projectid && y.TrainType == "3" && x.TrainStartDate > Const.DtmarkTime
|
||||
select x).Count();
|
||||
select x.TrainPersonNum ?? 0).ToList().Sum();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -801,7 +813,7 @@ namespace BLL
|
||||
public static int GetProjectInspectorGeneralNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.SitePerson_Person
|
||||
where x.ProjectId == projectid && x.WorkPostId == Const.WorkPost_ProjectHSSEDirector && x.States=="1"
|
||||
where x.ProjectId == projectid && x.WorkPostId == Const.WorkPost_ProjectHSSEDirector && x.States == "1"
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -851,8 +863,9 @@ namespace BLL
|
||||
public static int GetCertificateANum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.SitePerson_Person
|
||||
join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId
|
||||
where x.ProjectId == projectid && y.CertificateType == "A" && x.States == "1"
|
||||
join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId
|
||||
join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId
|
||||
where x.ProjectId == projectid && z.CertificateType == "A" && x.States == "1"
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -864,8 +877,9 @@ namespace BLL
|
||||
public static int GetCertificateBNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.SitePerson_Person
|
||||
join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId
|
||||
where x.ProjectId == projectid && y.CertificateType == "B" && x.States == "1"
|
||||
join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId
|
||||
join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId
|
||||
where x.ProjectId == projectid && z.CertificateType == "B" && x.States == "1"
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -877,8 +891,9 @@ namespace BLL
|
||||
public static int GetCertificateCNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.SitePerson_Person
|
||||
join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId
|
||||
where x.ProjectId == projectid && y.CertificateType == "C" && x.States == "1"
|
||||
join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId
|
||||
join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId
|
||||
where x.ProjectId == projectid && z.CertificateType == "C" && x.States == "1"
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -968,7 +983,7 @@ namespace BLL
|
||||
public static int GetProjectLeadShiftCheckNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.Check_ProjectLeaderCheck
|
||||
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
|
||||
where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -1202,7 +1217,7 @@ namespace BLL
|
||||
(from x in Funs.DB.InApproveManager_GeneralEquipmentInItem
|
||||
join y in Funs.DB.InApproveManager_GeneralEquipmentIn on x.GeneralEquipmentInId equals y
|
||||
.GeneralEquipmentInId
|
||||
where y.ProjectId == projectid
|
||||
where y.ProjectId == projectid
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -1227,34 +1242,9 @@ namespace BLL
|
||||
public static int GetLicensesNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.License_LicenseManager
|
||||
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
|
||||
where x.ProjectId == projectid && x.IsHighRisk == true && x.CompileDate > Const.DtmarkTime
|
||||
select x).Count();
|
||||
var result1 = (from x in Funs.DB.License_BreakGround
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
var result2 = (from x in Funs.DB.License_FireWork
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
var result3 = (from x in Funs.DB.License_HeightWork
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
var result4 = (from x in Funs.DB.License_LiftingWork
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
var result5 = (from x in Funs.DB.License_LimitedSpace
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
var result6 = (from x in Funs.DB.License_NightWork
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
var result7 = (from x in Funs.DB.License_OpenCircuit
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
var result8 = (from x in Funs.DB.License_RadialWork
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
|
||||
return (result+ result1+ result2+ result3+ result4+ result5+ result6+ result7+ result8);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1264,36 +1254,10 @@ namespace BLL
|
||||
public static int GetLicensesCloseNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.License_LicenseManager
|
||||
where x.ProjectId == projectid && x.WorkStates == "3" &&
|
||||
where x.ProjectId == projectid && x.IsHighRisk == true && x.WorkStates == "3" &&
|
||||
x.CompileDate > Const.DtmarkTime
|
||||
select x).Count();
|
||||
|
||||
var result1 = (from x in Funs.DB.License_BreakGround
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
|
||||
select x).Count();
|
||||
var result2 = (from x in Funs.DB.License_FireWork
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
|
||||
select x).Count();
|
||||
var result3 = (from x in Funs.DB.License_HeightWork
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
|
||||
select x).Count();
|
||||
var result4 = (from x in Funs.DB.License_LiftingWork
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
|
||||
select x).Count();
|
||||
var result5 = (from x in Funs.DB.License_LimitedSpace
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
|
||||
select x).Count();
|
||||
var result6 = (from x in Funs.DB.License_NightWork
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
|
||||
select x).Count();
|
||||
var result7 = (from x in Funs.DB.License_OpenCircuit
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
|
||||
select x).Count();
|
||||
var result8 = (from x in Funs.DB.License_RadialWork
|
||||
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
|
||||
select x).Count();
|
||||
|
||||
return (result + result1 + result2 + result3 + result4 + result5 + result6 + result7 + result8);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1303,7 +1267,8 @@ namespace BLL
|
||||
public static int GetGeneralClosedNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
|
||||
where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States == "3" && x.CheckTime > Const.DtmarkTime
|
||||
where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States == "3" &&
|
||||
x.CheckTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -1315,7 +1280,7 @@ namespace BLL
|
||||
public static int GetGeneralNotClosedNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
|
||||
where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States != "3" &&
|
||||
where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States != "3" && x.States != "-1" &&
|
||||
x.CheckTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
@@ -1328,7 +1293,7 @@ namespace BLL
|
||||
public static int GetMajorClosedNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
|
||||
where x.ProjectId == projectid && x.HazardValue == "3" && x.States == "3" &&
|
||||
where x.ProjectId == projectid && x.HazardValue == "3" && x.States == "3" &&
|
||||
x.CheckTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
@@ -1341,7 +1306,7 @@ namespace BLL
|
||||
public static int GetMajorNotClosedNum(string projectid)
|
||||
{
|
||||
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
|
||||
where x.ProjectId == projectid && x.HazardValue == "3" && x.States != "3" &&
|
||||
where x.ProjectId == projectid && x.HazardValue == "3" && x.States != "3" && x.States != "-1" &&
|
||||
x.CheckTime > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
@@ -1355,8 +1320,7 @@ namespace BLL
|
||||
{
|
||||
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
|
||||
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
|
||||
join z in Funs.DB.Hazard_HazardList on x.HazardListId equals z.HazardListId
|
||||
where z.ProjectId == projectid && y.RiskLevel == 2 && z.CompileDate.Value.Year >= 2023
|
||||
where x.ProjectId == projectid && (y.RiskLevel == 2 || x.HazardLevel == "2") && x.IsStart == true
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -1369,8 +1333,7 @@ namespace BLL
|
||||
{
|
||||
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
|
||||
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
|
||||
join z in Funs.DB.Hazard_HazardList on x.HazardListId equals z.HazardListId
|
||||
where z.ProjectId == projectid && y.RiskLevel == 1 && z.CompileDate.Value.Year >= 2023
|
||||
where x.ProjectId == projectid && (y.RiskLevel == 1 || x.HazardLevel == "1") && x.IsStart == true
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -1383,8 +1346,7 @@ namespace BLL
|
||||
{
|
||||
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
|
||||
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
|
||||
join z in Funs.DB.Hazard_HazardList on x.HazardListId equals z.HazardListId
|
||||
where z.ProjectId == projectid && y.RiskLevel == 3 && z.CompileDate.Value.Year >= 2023
|
||||
where x.ProjectId == projectid && (y.RiskLevel == 3 || x.HazardLevel == "3") && x.IsStart == true
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -1397,8 +1359,7 @@ namespace BLL
|
||||
{
|
||||
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
|
||||
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
|
||||
join z in Funs.DB.Hazard_HazardList on x.HazardListId equals z.HazardListId
|
||||
where z.ProjectId == projectid && y.RiskLevel == 4 && z.CompileDate.Value.Year >= 2023
|
||||
where x.ProjectId == projectid && y.RiskLevel == 4 && x.IsStart == true
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -1621,5 +1582,38 @@ namespace BLL
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 推送项目安全隐患风险数据
|
||||
|
||||
/// <summary>
|
||||
/// 推送项目安全隐患风险数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ReturnData PushProjectHSSEData()
|
||||
{
|
||||
var items = (from x in db.Project_HSSEData_HSSE
|
||||
where x.ReportDate == DateTime.Now.Date
|
||||
select x).ToList();
|
||||
var detailItems = (from x in db.Project_HSSEData_HiddenDangerDetail
|
||||
where x.ReportDate == DateTime.Now.Date
|
||||
select x).ToList();
|
||||
Model.ReturnData responeData = new Model.ReturnData();
|
||||
if (items.Count() > 0 || detailItems.Count() > 0)
|
||||
{
|
||||
var thisUnit = CommonService.GetIsThisUnit();
|
||||
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items, DetailItems = detailItems };
|
||||
var str = JsonConvert.SerializeObject(newItem);
|
||||
var baseurl = "/api/HSSEData/SaveProjectHSSEData";
|
||||
responeData = ServerService.PushCNCEC(str, baseurl);
|
||||
}
|
||||
else
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "当前没有项目安全隐患风险数据";
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user