大数据数据绑定
This commit is contained in:
@@ -26,7 +26,7 @@ namespace BLL
|
||||
/// 定义变量
|
||||
/// </summary>
|
||||
private static IQueryable<Model.Base_Project> getDataLists = from x in db.Base_Project
|
||||
select x;
|
||||
select x;
|
||||
|
||||
/// <summary>
|
||||
/// 进度数据仓库
|
||||
@@ -36,7 +36,7 @@ namespace BLL
|
||||
/// <param name="endTime"></param>
|
||||
/// <param name="Grid1"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable getDataDWList( string projectId, DateTime? startTime, DateTime? endTime, Grid Grid1)
|
||||
public static IEnumerable getDataDWList(string projectId, DateTime? startTime, DateTime? endTime, Grid Grid1)
|
||||
{
|
||||
var getDataList = from x in Funs.DB.Base_Project select x;
|
||||
if (!string.IsNullOrEmpty(projectId) && projectId != Const._Null)
|
||||
@@ -56,10 +56,44 @@ namespace BLL
|
||||
x.ProjectId,
|
||||
x.ProjectName,
|
||||
x.ProjectCode,
|
||||
JDRate = "0%", //项目进度完成百分比
|
||||
JDRate = getJDRate(x.ProjectId, startTime, endTime), //项目进度完成百分比
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 进度百分比
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string getJDRate(string projectId, DateTime? startTime, DateTime? endTime)
|
||||
{
|
||||
double totalSJCost = 0; ////累计实际费用
|
||||
decimal totalPlanCost = 0; ////计划费用
|
||||
var getViewWorkPackageParentDetail = from x in Funs.DB.View_WBS_WorkPackageParentDetail
|
||||
where (x.ProjectId == projectId || projectId == null) && (x.ParentId == "1" || x.ParentId == "2")
|
||||
select x;
|
||||
if (startTime.HasValue)
|
||||
{
|
||||
getViewWorkPackageParentDetail = getViewWorkPackageParentDetail.Where(x => x.Months >= startTime);
|
||||
}
|
||||
if (endTime.HasValue)
|
||||
{
|
||||
getViewWorkPackageParentDetail = getViewWorkPackageParentDetail.Where(x => x.Months <= endTime);
|
||||
}
|
||||
if (getViewWorkPackageParentDetail.Count() > 0)
|
||||
{
|
||||
totalSJCost = getViewWorkPackageParentDetail.Sum(x => x.TotalThisValue ?? 0);
|
||||
}
|
||||
|
||||
var getUnitWork = from x in Funs.DB.WBS_UnitWork where x.ProjectId == projectId select x;
|
||||
if (getUnitWork.Count() > 0)
|
||||
{
|
||||
totalPlanCost = getUnitWork.Sum(x => x.PlanCost ?? 0);
|
||||
}
|
||||
|
||||
///项目进度完成百分比
|
||||
decimal s = Convert.ToDecimal(totalSJCost);
|
||||
return totalPlanCost > 0 ? Math.Round(s / totalPlanCost).ToString() + "%" : "0%";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user