增加进度计划编制导出功能

This commit is contained in:
2023-08-04 10:21:33 +08:00
parent c13283b8e1
commit a039bc13c7
7 changed files with 251 additions and 16 deletions
+34 -5
View File
@@ -245,7 +245,7 @@ namespace BLL
/// 获取模拟树表格
/// </summary>
/// <returns></returns>
public static DataTable GetAllTreeDataTable(string projectId)
public static DataTable GetAllTreeDataTable(string projectId, string IsOut)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
@@ -260,7 +260,7 @@ namespace BLL
table.Columns.Add(new DataColumn("WBSType", typeof(String)));
table.Columns.Add(new DataColumn("ProjectId", typeof(String)));
table.Columns.Add(new DataColumn("ShowId", typeof(String)));
table.Columns.Add(new DataColumn("Weights", typeof(String)));
table.Columns.Add(new DataColumn("JDWeights", typeof(String)));
table.Columns.Add(new DataColumn("Unit", typeof(String)));
table.Columns.Add(new DataColumn("PlanProjectQuantity", typeof(String)));
table.Columns.Add(new DataColumn("RealProjectQuantity", typeof(String)));
@@ -271,14 +271,25 @@ namespace BLL
table.Columns.Add(new DataColumn("IsMileStone", typeof(bool)));
table.Columns.Add(new DataColumn("PlanCost", typeof(String)));
table.Columns.Add(new DataColumn("PreWorkCode", typeof(String)));
table.Columns.Add(new DataColumn("Code", typeof(String)));
if (getWBSs.Count() > 0)
{
List<Model.View_WBS> newList = new List<Model.View_WBS>();
var projectTypes = getWBSs.Where(x => x.WBSType == "ProjectType" && x.SupId == "0");
int a = 1;
foreach (var item in projectTypes)
{
item.Code = a.ToString();
newList.Add(item);
AddDetail(newList, getWBSs.ToList(), item.Id);
if (string.IsNullOrEmpty(IsOut))
{
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString());
}
else
{
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString(), string.Empty);
}
a++;
}
DataRow row;
foreach (Model.View_WBS item in newList)
@@ -370,6 +381,7 @@ namespace BLL
}
}
}
row[17] = item.Code;
table.Rows.Add(row);
}
}
@@ -377,13 +389,30 @@ namespace BLL
}
}
private static void AddDetail(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id)
private static void AddDetail(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode)
{
var items = oldList.Where(x => x.SupId == id).OrderBy(x => x.Code);
int b = 1;
foreach (var item in items)
{
item.Code = preCode + "." + b.ToString();
newList.Add(item);
AddDetail(newList, oldList, item.Id);
AddDetail(newList, oldList, item.Id, item.Code);
b++;
}
}
private static void AddDetail(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, string prefix)
{
var items = oldList.Where(x => x.SupId == id).OrderBy(x => x.Code);
int b = 1;
foreach (var item in items)
{
item.Code = preCode + "." + b.ToString();
item.Name = prefix + "...." + item.Name;
newList.Add(item);
AddDetail(newList, oldList, item.Id, item.Code, prefix + "....");
b++;
}
}