修改安全实施计划导出及进度功能
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
@@ -30,6 +32,14 @@ namespace BLL
|
||||
newWorkPackage.IsApprove = WorkPackage.IsApprove;
|
||||
newWorkPackage.Costs = WorkPackage.Costs;
|
||||
newWorkPackage.SubItemType = WorkPackage.SubItemType;
|
||||
newWorkPackage.PreJobId = WorkPackage.PreJobId;
|
||||
newWorkPackage.PlanProjectQuantity = WorkPackage.PlanProjectQuantity;
|
||||
newWorkPackage.RealProjectQuantity = WorkPackage.RealProjectQuantity;
|
||||
newWorkPackage.PlanStartDate = WorkPackage.PlanStartDate;
|
||||
newWorkPackage.PlanEndDate = WorkPackage.PlanEndDate;
|
||||
newWorkPackage.RealStartDate = WorkPackage.RealStartDate;
|
||||
newWorkPackage.RealEndDate = WorkPackage.RealEndDate;
|
||||
newWorkPackage.Unit = WorkPackage.Unit;
|
||||
|
||||
db.WBS_WorkPackage.InsertOnSubmit(newWorkPackage);
|
||||
db.SubmitChanges();
|
||||
@@ -54,6 +64,15 @@ namespace BLL
|
||||
newWorkPackage.IsApprove = WorkPackage.IsApprove;
|
||||
newWorkPackage.Costs = WorkPackage.Costs;
|
||||
newWorkPackage.SubItemType = WorkPackage.SubItemType;
|
||||
newWorkPackage.PreJobId = WorkPackage.PreJobId;
|
||||
newWorkPackage.PlanProjectQuantity = WorkPackage.PlanProjectQuantity;
|
||||
newWorkPackage.RealProjectQuantity = WorkPackage.RealProjectQuantity;
|
||||
newWorkPackage.PlanStartDate = WorkPackage.PlanStartDate;
|
||||
newWorkPackage.PlanEndDate = WorkPackage.PlanEndDate;
|
||||
newWorkPackage.RealStartDate = WorkPackage.RealStartDate;
|
||||
newWorkPackage.RealEndDate = WorkPackage.RealEndDate;
|
||||
newWorkPackage.Unit = WorkPackage.Unit;
|
||||
newWorkPackage.IsMileStone = WorkPackage.IsMileStone;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
@@ -218,5 +237,136 @@ namespace BLL
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取模拟树表格
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable GetAllTreeDataTable(string projectId)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
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;
|
||||
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>();
|
||||
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("Weights", 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)));
|
||||
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");
|
||||
foreach (var item in projectTypes)
|
||||
{
|
||||
newList.Add(item);
|
||||
AddDetail(newList, getWBSs.ToList(), item.Id);
|
||||
}
|
||||
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;
|
||||
if (item.WBSType == "WorkPackage")
|
||||
{
|
||||
var childWorkPackages = from x in workPackages where x.SuperWorkPackageId == item.Id && x.IsApprove == true select x;
|
||||
if (childWorkPackages.Count() == 0)
|
||||
{
|
||||
row[5] = item.Id;
|
||||
var workPackage = workPackages.FirstOrDefault(x => x.WorkPackageId == item.Id);
|
||||
if (workPackage != null)
|
||||
{
|
||||
if (workPackage.Weights != null)
|
||||
{
|
||||
row[6] = decimal.Round(Convert.ToDecimal(workPackage.Weights), 2);
|
||||
}
|
||||
row[7] = workPackage.Unit;
|
||||
if (workPackage.PlanProjectQuantity != null)
|
||||
{
|
||||
row[8] = decimal.Round(Convert.ToDecimal(workPackage.PlanProjectQuantity), 2);
|
||||
}
|
||||
if (workPackage.RealProjectQuantity != null)
|
||||
{
|
||||
row[9] = decimal.Round(Convert.ToDecimal(workPackage.RealProjectQuantity), 2);
|
||||
}
|
||||
if (workPackage.PlanStartDate != null)
|
||||
{
|
||||
row[10] = workPackage.PlanStartDate;
|
||||
}
|
||||
if (workPackage.PlanEndDate != null)
|
||||
{
|
||||
row[11] = workPackage.PlanEndDate;
|
||||
}
|
||||
if (workPackage.RealStartDate != null)
|
||||
{
|
||||
row[12] = workPackage.RealStartDate;
|
||||
}
|
||||
if (workPackage.RealEndDate != null)
|
||||
{
|
||||
row[13] = workPackage.RealEndDate;
|
||||
}
|
||||
if (workPackage.IsMileStone != null)
|
||||
{
|
||||
row[14] = workPackage.IsMileStone;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (item.WBSType == "UnitWork")
|
||||
{
|
||||
var unitWork = unitWorks.FirstOrDefault(x => x.UnitWorkId == item.Id);
|
||||
if (unitWork != null)
|
||||
{
|
||||
if (unitWork.PlanStartDate != null)
|
||||
{
|
||||
row[10] = unitWork.PlanStartDate;
|
||||
}
|
||||
if (unitWork.PlanEndDate != null)
|
||||
{
|
||||
row[11] = unitWork.PlanEndDate;
|
||||
}
|
||||
if (unitWork.RealStartDate != null)
|
||||
{
|
||||
row[12] = unitWork.RealStartDate;
|
||||
}
|
||||
if (unitWork.RealEndDate != null)
|
||||
{
|
||||
row[13] = unitWork.RealEndDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
table.Rows.Add(row);
|
||||
}
|
||||
}
|
||||
return table;
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddDetail(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id)
|
||||
{
|
||||
var items = oldList.Where(x => x.SupId == id).OrderBy(x => x.Code);
|
||||
foreach (var item in items)
|
||||
{
|
||||
newList.Add(item);
|
||||
AddDetail(newList, oldList, item.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user