From 493fa28b46c365df26a6ef96d6ea74678f3580a2 Mon Sep 17 00:00:00 2001 From: gaofei <181547018@qq.com> Date: Fri, 28 Apr 2023 14:39:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=9B=E5=BA=A6=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BLL/JDGL/WBS/WorkloadStatisticsService.cs | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs b/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs index 3f7f6c3e..315f179e 100644 --- a/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs +++ b/SGGL/BLL/JDGL/WBS/WorkloadStatisticsService.cs @@ -2664,21 +2664,35 @@ namespace BLL { row[11] = costControl.RealEndDate;//实际完成时间 } - for (int i = 0; i < months.Count; i++) + var detail = details.Where(x => x.CostControlId == item.Id).ToList(); + foreach (var item1 in detail) { - Model.View_WBS_CostControlDetail detail = details.FirstOrDefault(x => x.CostControlId == item.Id && x.Months == months[i]); - if (detail != null) + var index = months.FindIndex(x => x.Equals(item1.Months)); + if (item1.PlanNum != 0) { - if (detail.PlanNum != 0) - { - row[12 + i * 2] = decimal.Round(Convert.ToDecimal(detail.PlanNum), 2); - } - if (detail.ThisNum != 0) - { - row[13 + i * 2] = decimal.Round(Convert.ToDecimal(detail.ThisNum), 2); - } + row[12 + index * 2] = decimal.Round(Convert.ToDecimal(item1.PlanNum), 2); } + if (item1.ThisNum != 0) + { + row[13 + index * 2] = decimal.Round(Convert.ToDecimal(item1.ThisNum), 2); + } + } + //for (int i = 0; i < months.Count; i++) + //{ + // Model.View_WBS_CostControlDetail detail = details.FirstOrDefault(x => x.CostControlId == item.Id && x.Months == months[i]); + // if (detail != null) + // { + // if (detail.PlanNum != 0) + // { + // row[12 + i * 2] = decimal.Round(Convert.ToDecimal(detail.PlanNum), 2); + // } + // if (detail.ThisNum != 0) + // { + // row[13 + i * 2] = decimal.Round(Convert.ToDecimal(detail.ThisNum), 2); + // } + // } + //} row[14 + (months.Count-1) * 2] = item.Id; //row[10] = decimal.Round(Convert.ToDecimal(detail.ThisRealCost), 2);//本月实际成本 //row[11] = decimal.Round(Convert.ToDecimal(detail.ThisPlanValue), 2);//本月计划完成预算