修改进度模块

This commit is contained in:
2023-08-25 11:03:03 +08:00
parent 2804d7c4df
commit 112e97ae43
17 changed files with 2615 additions and 3 deletions
+38
View File
@@ -251,8 +251,28 @@ namespace BLL
{
IQueryable<Model.WBS_WorkPackage> workPackages = from x in db.WBS_WorkPackage where x.ProjectId == projectId select x;
IQueryable<Model.WBS_UnitWork> unitWorks = from x in db.WBS_UnitWork where x.ProjectId == projectId select x;
IQueryable<Model.View_WBS_WorkPackageDetail> getDetails = from x in db.View_WBS_WorkPackageDetail where x.ProjectId == projectId select x;
List<Model.View_WBS> getWBSs = (from x in db.View_WBS where x.ProjectId == projectId select x).ToList();
List<Model.View_WBS> WBSList = new List<Model.View_WBS>();
DateTime startDate, endDate, startMonth, endMonth;
List<DateTime> months = new List<DateTime>();
var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == projectId);
if (project.StartDate != null)
{
startDate = Convert.ToDateTime(project.StartDate);
endDate = DateTime.Now;
if (project.EndDate != null)
{
endDate = Convert.ToDateTime(project.EndDate);
}
startMonth = Convert.ToDateTime(startDate.Year + "-" + startDate.Month + "-01");
endMonth = Convert.ToDateTime(endDate.Year + "-" + endDate.Month + "-01");
do
{
months.Add(startMonth);
startMonth = startMonth.AddMonths(1);
} while (startMonth <= endMonth);
}
DataTable table = new DataTable();
table.Columns.Add(new DataColumn("Id", typeof(String)));
table.Columns.Add(new DataColumn("SupId", typeof(String)));
@@ -272,6 +292,11 @@ namespace BLL
table.Columns.Add(new DataColumn("PlanCost", typeof(String)));
table.Columns.Add(new DataColumn("PreWorkCode", typeof(String)));
table.Columns.Add(new DataColumn("Code", typeof(String)));
for (int i = 0; i < months.Count; i++)
{
table.Columns.Add(new DataColumn("PlanNum" + (i + 1).ToString(), typeof(String)));
table.Columns.Add(new DataColumn("ThisNum" + (i + 1).ToString(), typeof(String)));
}
if (getWBSs.Count() > 0)
{
List<Model.View_WBS> newList = new List<Model.View_WBS>();
@@ -347,6 +372,19 @@ namespace BLL
row[15] = decimal.Round(Convert.ToDecimal(workPackage.PlanCost), 2);
}
row[16] = workPackage.PreWorkCode;
var details = getDetails.Where(x => x.WorkPackageId == item.Id).ToList();
foreach (var item1 in details)
{
var index = months.FindIndex(x => x.Equals(item1.Months));
if (item1.PlanNum != 0)
{
row[18 + index * 2] = decimal.Round(Convert.ToDecimal(item1.PlanNum), 2);
}
if (item1.ThisNum != 0)
{
row[19 + index * 2] = decimal.Round(Convert.ToDecimal(item1.ThisNum), 2);
}
}
}
}
}