提交代码
This commit is contained in:
@@ -245,7 +245,7 @@ namespace BLL
|
||||
/// 获取模拟树表格
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable GetAllTreeDataTable(string projectId, string IsOut, string startTime, string endTime, string isOK)
|
||||
public static DataTable GetAllTreeDataTable0(string projectId, string IsOut, string startTime, string endTime, string isOK)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
@@ -292,11 +292,6 @@ 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>();
|
||||
@@ -372,19 +367,6 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -454,6 +436,168 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Model.View_WBS> GetAllTreeDataTable2(string projectId, string IsOut, string startTime, string endTime, string isOK)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
List<Model.View_WBS> getWBSs = (from x in db.View_WBS where x.ProjectId == projectId select x).ToList();
|
||||
List<Model.View_WBS> newList = new List<Model.View_WBS>();
|
||||
if (getWBSs.Count() > 0)
|
||||
{
|
||||
|
||||
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);
|
||||
if (string.IsNullOrEmpty(IsOut))
|
||||
{
|
||||
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString(), startTime, endTime, isOK);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString(), string.Empty, startTime, endTime, isOK);
|
||||
}
|
||||
a++;
|
||||
}
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取模拟树表格
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable GetAllTreeDataTable(string projectId, string IsOut, string startTime, string endTime, string isOK)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
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();
|
||||
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)));
|
||||
table.Columns.Add(new DataColumn("Name", typeof(String)));
|
||||
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("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)));
|
||||
table.Columns.Add(new DataColumn("PlanStartDate", typeof(DateTime)));
|
||||
table.Columns.Add(new DataColumn("PlanEndDate", typeof(DateTime)));
|
||||
table.Columns.Add(new DataColumn("RealStartDate", typeof(DateTime)));
|
||||
table.Columns.Add(new DataColumn("RealEndDate", typeof(DateTime)));
|
||||
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)));
|
||||
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>();
|
||||
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);
|
||||
if (string.IsNullOrEmpty(IsOut))
|
||||
{
|
||||
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString(), startTime, endTime, isOK);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString(), string.Empty, startTime, endTime, isOK);
|
||||
}
|
||||
a++;
|
||||
}
|
||||
DataRow row;
|
||||
foreach (Model.View_WBS item in newList)
|
||||
{
|
||||
row = table.NewRow();
|
||||
row[0] = item.Id;
|
||||
row[1] = item.SupId;
|
||||
row[2] = item.Name;
|
||||
row[3] = item.WBSType;
|
||||
row[4] = item.ProjectId;
|
||||
row[5] = item.ShowId;
|
||||
row[6] = item.JDWeights;
|
||||
row[7] = item.Unit;
|
||||
row[8] = item.PlanProjectQuantity;
|
||||
row[9] = item.RealProjectQuantity;
|
||||
if (item.PlanStartDate != null)
|
||||
{
|
||||
row[10] = item.PlanStartDate;
|
||||
}
|
||||
if (item.PlanEndDate != null)
|
||||
{
|
||||
row[11] = item.PlanEndDate;
|
||||
}
|
||||
if (item.RealStartDate != null)
|
||||
{
|
||||
row[12] = item.RealStartDate;
|
||||
}
|
||||
if (item.RealEndDate != null)
|
||||
{
|
||||
row[13] = item.RealEndDate;
|
||||
}
|
||||
if (item.IsMileStone != null)
|
||||
{
|
||||
row[14] = item.IsMileStone;
|
||||
}
|
||||
row[15] = item.PlanCost;
|
||||
row[16] = item.PreWorkCode;
|
||||
row[17] = item.Code;
|
||||
if (!string.IsNullOrEmpty(item.ShowId))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
table.Rows.Add(row);
|
||||
}
|
||||
}
|
||||
return table;
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddDetail(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, string startTime, string endTime, string isOK)
|
||||
{
|
||||
if (isOK == "0")
|
||||
@@ -760,7 +904,7 @@ namespace BLL
|
||||
public static string getWorkPageNamesByControlItemAndCycle(string workPackageId, string controlItemAndCycleId)
|
||||
{
|
||||
string returnValues = string.Empty;
|
||||
string ControlItemName=string.Empty;
|
||||
string ControlItemName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(controlItemAndCycleId))
|
||||
{
|
||||
var getControlItemAndCycle = Funs.DB.WBS_ControlItemAndCycle.FirstOrDefault(x => x.ControlItemAndCycleId == controlItemAndCycleId);
|
||||
@@ -802,7 +946,7 @@ namespace BLL
|
||||
var getSupWorkPackage = Funs.DB.WBS_WorkPackage.FirstOrDefault(x => x.WorkPackageId == getWorkPackage.SuperWorkPackageId);
|
||||
if (getSupWorkPackage != null)
|
||||
{
|
||||
returnValues = getWorkPackage.PackageContent + "|" + returnValues;
|
||||
returnValues = getWorkPackage.PackageContent + "|" + returnValues;
|
||||
returnValues = getSelectIds(getWorkPackage.SuperWorkPackageId, returnValues);
|
||||
}
|
||||
|
||||
@@ -820,7 +964,7 @@ namespace BLL
|
||||
{
|
||||
returnValues = "安装工程|" + getUnitWork.UnitWorkName + "|" + returnValues;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1093,7 +1237,7 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddDetail2(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, DateTime startTime, DateTime endTime,List<string> ids)
|
||||
private static void AddDetail2(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, DateTime startTime, DateTime endTime, List<string> ids)
|
||||
{
|
||||
var items = oldList.Where(x => x.SupId == id && ((x.PlanEndDate > startTime && x.PlanEndDate <= endTime) || ids.Contains(x.Id))).OrderBy(x => x.Code);
|
||||
int b = 1;
|
||||
|
||||
Reference in New Issue
Block a user