This commit is contained in:
2023-09-25 10:15:51 +08:00
parent afce1cfc6a
commit 8bafdef064
7 changed files with 447 additions and 73 deletions
+133 -8
View File
@@ -1,5 +1,7 @@
using FineUIPro;
using Microsoft.SqlServer.Dts.Runtime;
using NPOI.SS.Formula.Functions;
using Org.BouncyCastle.Crypto.Tls;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -46,13 +48,13 @@ namespace BLL
List<Model.WBS_WorkPackageInit> listWork = new List<Model.WBS_WorkPackageInit>();
Model.WBS_WorkPackageInit work1 = new Model.WBS_WorkPackageInit
{
WorkPackageCode = "1",
WorkPackageCode = "Type1",
PackageContent = "建筑工程",
};
listWork.Add(work1);
Model.WBS_WorkPackageInit work2 = new Model.WBS_WorkPackageInit
{
WorkPackageCode = "2",
WorkPackageCode = "Type2",
PackageContent = "安装工程",
};
listWork.Add(work2);
@@ -85,15 +87,138 @@ namespace BLL
{
x.WorkPackageCode,
x.PackageContent,
Count1=0,
Count2 = 0,
Count3 = 0,
Count4 = 0,
Count5 = 0,
Count6 = 0,
Count1= getWBSExpertArgumentCount(null, x.WorkPackageCode),
Count2 = getWBSAccidentCount(null,x.WorkPackageCode),
Count3 = getWBSHSEProblemCount(null, x.WorkPackageCode),
Count4 = getWBSSpotCheckRate(null, x.WorkPackageCode),
Count5 = getWBSSpotCheckDataRate(null, x.WorkPackageCode),
Count6 = getWBSCheckControlCount(null, x.WorkPackageCode),
};
}
#endregion
/// <summary>
/// 危大工程数量
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static int getWBSExpertArgumentCount(string projectId,string workPackageId)
{
var getLargerHazardListItem = from x in Funs.DB.Solution_LargerHazardListItem
join y in Funs.DB.Solution_LargerHazardList on x.LargerHazardListId equals y.LargerHazardListId
where x.WorkPackageId.Contains(workPackageId)
&& y.States == Const.State_1
select new {x.LargerHazardListItemId,y.LargerHazardListId,y.ProjectId,x.WorkPackageId };
if (!string.IsNullOrEmpty(projectId))
{
getLargerHazardListItem = getLargerHazardListItem.Where(x => x.ProjectId == projectId);
}
return getLargerHazardListItem.Count();
}
/// <summary>
/// 安全事故数量
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static int getWBSAccidentCount(string projectId, string workPackageId)
{
var getAccidentPersonRecord = from x in Funs.DB.Accident_AccidentPersonRecord
where x.WorkPackageId.Contains(workPackageId)
&& x.States == Const.State_2
select x;
if (!string.IsNullOrEmpty(projectId))
{
getAccidentPersonRecord = getAccidentPersonRecord.Where(x => x.ProjectId == projectId);
}
return getAccidentPersonRecord.Count();
}
/// <summary>
/// 安全巡检问题总数
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static int getWBSHSEProblemCount(string projectId, string workPackageId)
{
var getHazardRegister = from x in Funs.DB.HSSE_Hazard_HazardRegister
where x.States != "4" && x.States != "0"
&& x.WorkPackageId.Contains(workPackageId)
select x;
if (!string.IsNullOrEmpty(projectId))
{
getHazardRegister = getHazardRegister.Where(x => x.ProjectId == projectId);
}
return getHazardRegister.Count();
}
/// <summary>
/// 实体验收一次合格率
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static string getWBSSpotCheckRate(string projectId, string workPackageId)
{
var getSpotCheckDetail = from x in Funs.DB.Check_SpotCheckDetail
join y in Funs.DB.Check_SpotCheck on x.SpotCheckCode equals y.SpotCheckCode
where x.WorkPackageId.Contains(workPackageId) && (projectId ==null || y.ProjectId == projectId)
&& y.State == "8"
select new { x.SpotCheckCode ,y.ProjectId,x.IsDataOK,x.IsOnesOK};
if (!string.IsNullOrEmpty(projectId))
{
getSpotCheckDetail = getSpotCheckDetail.Where(x => x.ProjectId == projectId);
}
int all = getSpotCheckDetail.Count();
// this.lbSpotCheck1.Text = all.ToString();
int onesOKCount = getSpotCheckDetail.Where(x => x.IsOnesOK == true).Count(); //一次合格
return (all > 0 ? Math.Round(onesOKCount * 100.0 / (all * 1.0)).ToString() + "%" : "0%");
}
/// <summary>
/// 施工资料同步率
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static string getWBSSpotCheckDataRate(string projectId, string workPackageId)
{
//// 实体验收 资料验收
var getSpotCheckDetail = from x in Funs.DB.Check_SpotCheckDetail
join y in Funs.DB.Check_SpotCheck on x.SpotCheckCode equals y.SpotCheckCode
where x.WorkPackageId.Contains(workPackageId)
&& y.State == "8"
select new { x.SpotCheckCode, y.ProjectId, x.IsDataOK, x.IsOnesOK,x.IsOK };
if (!string.IsNullOrEmpty(projectId))
{
getSpotCheckDetail = getSpotCheckDetail.Where(x => x.ProjectId == projectId);
}
/// 资料验收合格项目
var getOKSpotCheckDetail = getSpotCheckDetail.Where(x => x.IsOK == true);
int okYSCount = getOKSpotCheckDetail.Count(); //验收合格
int okDateCount = getSpotCheckDetail.Where(x => x.IsDataOK == "1").Count(); //资料合格
return (okYSCount > 0 ? Math.Round(okDateCount * 100.0 / (okYSCount * 1.0)).ToString() + "%" : "0%");
}
/// <summary>
/// 质量问题数
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static int getWBSCheckControlCount(string projectId, string workPackageId)
{
var getCheck_CheckControl = from x in Funs.DB.Check_CheckControl
where x.WorkPackageId.Contains(workPackageId)
select x;
if (!string.IsNullOrEmpty(projectId))
{
getCheck_CheckControl = getCheck_CheckControl.Where(x => x.ProjectId == projectId);
}
return getCheck_CheckControl.Count();
}
}
}