125 lines
5.0 KiB
C#
125 lines
5.0 KiB
C#
using FineUIPro;
|
|
using NPOI.SS.Formula.Functions;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.Util;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// WBS分析
|
|
/// </summary>
|
|
public static class ProjectWBSAnalysisService
|
|
{
|
|
public static Model.SGGLDB db = Funs.DB;
|
|
|
|
#region WBS分析
|
|
/// <summary>
|
|
/// 记录数
|
|
/// </summary>
|
|
public static int count
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 定义变量
|
|
/// </summary>
|
|
private static IQueryable<Model.WBS_WorkPackage> getDataLists = from x in db.WBS_WorkPackage
|
|
where x.IsApprove == true
|
|
select x;
|
|
|
|
/// <summary>
|
|
/// 合同管理数据仓库
|
|
/// </summary>
|
|
/// <param name="projectId"></param>
|
|
/// <param name="startTime"></param>
|
|
/// <param name="endTime"></param>
|
|
/// <param name="Grid1"></param>
|
|
/// <returns></returns>
|
|
public static IEnumerable getDataDWList(string projectId, string workPackageId, Grid Grid1)
|
|
{
|
|
var getDataList = getDataLists.Where(x => x.ProjectId == projectId);
|
|
if (string.IsNullOrEmpty(workPackageId))
|
|
{
|
|
List<Model.WBS_WorkPackage> listWork = new List<Model.WBS_WorkPackage>();
|
|
Model.WBS_WorkPackage work1 = new Model.WBS_WorkPackage
|
|
{
|
|
WorkPackageId = "Type1",
|
|
PackageContent = "建筑工程",
|
|
ProjectId = projectId,
|
|
};
|
|
listWork.Add(work1);
|
|
Model.WBS_WorkPackage work2 = new Model.WBS_WorkPackage
|
|
{
|
|
WorkPackageId = "Type2",
|
|
PackageContent = "安装工程",
|
|
ProjectId = projectId,
|
|
};
|
|
listWork.Add(work2);
|
|
getDataList = listWork.AsQueryable();
|
|
}
|
|
else
|
|
{
|
|
if (workPackageId != "1" && workPackageId != "2")
|
|
{
|
|
var getUnitWork = db.WBS_UnitWork.FirstOrDefault(x => x.ProjectId == projectId && x.UnitWorkId == workPackageId);
|
|
if (getUnitWork != null)
|
|
{
|
|
getDataList = getDataList.Where(x => x.UnitWorkId == workPackageId && x.SuperWorkPack == null);
|
|
}
|
|
else
|
|
{
|
|
getDataList = getDataList.Where(x => x.SuperWorkPack == workPackageId);
|
|
if (getDataList.Count() == 0)
|
|
{
|
|
getDataList = getDataLists.Where(x => x.WorkPackageId == workPackageId);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var getUnitWork = from x in db.WBS_UnitWork
|
|
where x.ProjectId == projectId && x.SuperUnitWork == null && x.ProjectType == workPackageId
|
|
select x;
|
|
List<Model.WBS_WorkPackage> listWork = new List<Model.WBS_WorkPackage>();
|
|
foreach (var item in getUnitWork)
|
|
{
|
|
Model.WBS_WorkPackage workItem = new Model.WBS_WorkPackage
|
|
{
|
|
WorkPackageId = item.UnitWorkId,
|
|
PackageContent = item.UnitWorkCode + "-" + item.UnitWorkName,
|
|
ProjectId = item.ProjectId,
|
|
};
|
|
listWork.Add(workItem);
|
|
}
|
|
|
|
getDataList = listWork.AsQueryable();
|
|
}
|
|
}
|
|
|
|
count = getDataList.Count();
|
|
if (count == 0)
|
|
{
|
|
return null;
|
|
}
|
|
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
|
return from x in getDataList
|
|
select new
|
|
{
|
|
x.WorkPackageId,
|
|
x.PackageContent,
|
|
Count1 = WBSAnalysisService.getWBSExpertArgumentCount(projectId,x.WorkPackageId),
|
|
Count2 = WBSAnalysisService.getWBSAccidentCount(projectId, x.WorkPackageId),
|
|
Count3 = WBSAnalysisService.getWBSHSEProblemCount(projectId, x.WorkPackageId),
|
|
Count4 = WBSAnalysisService.getWBSSpotCheckRate(projectId, x.WorkPackageId),
|
|
Count5 = WBSAnalysisService.getWBSSpotCheckDataRate(projectId, x.WorkPackageId),
|
|
Count6 = WBSAnalysisService.getWBSCheckControlCount(projectId, x.WorkPackageId),
|
|
};
|
|
}
|
|
#endregion
|
|
}
|
|
} |