进度管理增加设备材料分类

This commit is contained in:
2023-05-26 10:24:02 +08:00
parent 64cce0e5b6
commit ea1634cbc7
29 changed files with 1866 additions and 64 deletions
@@ -29,7 +29,6 @@ namespace FineUIPro.Web.JDGL.CostAnalysis
private void SetEmpty()
{
this.SimpleForm1.Title = string.Empty;
txt5.Text = string.Empty;
}
#endregion
@@ -350,6 +349,74 @@ namespace FineUIPro.Web.JDGL.CostAnalysis
this.Grid4.DataSource = table4;
this.Grid4.DataBind();
}
//按专业统计
DataTable table5 = new DataTable();
table5.Columns.Add(new DataColumn("Id", typeof(String)));
table5.Columns.Add(new DataColumn("Name", typeof(String)));
table5.Columns.Add(new DataColumn("Unit", typeof(String)));
table5.Columns.Add(new DataColumn("TotalNum", typeof(String)));
table5.Columns.Add(new DataColumn("mThisNum", typeof(String)));
table5.Columns.Add(new DataColumn("tThisNum", typeof(String)));
table5.Columns.Add(new DataColumn("mRate", typeof(String)));
table5.Columns.Add(new DataColumn("tRate", typeof(String)));
DataRow row5;
var costControls = from x in db.WBS_CostControl where x.ProjectId == this.CurrUser.LoginProjectId select x;
var costControlDetails = from x in db.WBS_CostControlDetail
join y in db.WBS_CostControl on x.CostControlId equals y.CostControlId
join z in db.WBS_EquipmentMaterialType on y.EquipmentMaterialTypeId equals z.EquipmentMaterialTypeId
where x.Months <= Funs.GetNewDateTime(date) && y.ProjectId == this.CurrUser.LoginProjectId
orderby x.Months descending
select new
{
x.CostControlDetailId,
y.EquipmentMaterialTypeId,
z.EquipmentMaterialTypeName,
x.Months,
x.ThisNum,
};
var equipmentMaterialTypes = from x in db.WBS_EquipmentMaterialType orderby x.EquipmentMaterialTypeCode select x;
if (equipmentMaterialTypes.Count() > 0)
{
foreach (var equipmentMaterialType in equipmentMaterialTypes)
{
row5 = table5.NewRow();
row5[0] = equipmentMaterialType.EquipmentMaterialTypeId;
row5[1] = equipmentMaterialType.EquipmentMaterialTypeName;
var list = costControls.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId);
if (list.Count() > 0)
{
row5[2] = list.First().Unit;
}
row5[3] = list.ToList().Sum(x => x.TotalNum ?? 0);
var list2 = costControlDetails.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId && x.Months == Funs.GetNewDateTime(date));
row5[4] = list2.ToList().Sum(x => x.ThisNum ?? 0);
var list3 = costControlDetails.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId);
row5[5] = list3.ToList().Sum(x => x.ThisNum ?? 0);
if (row5[3].ToString() != "0" && row5[4].ToString() != "0")
{
row5[6] = (Funs.GetNewDecimalOrZero(row5[4].ToString()) / Funs.GetNewDecimalOrZero(row5[3].ToString()) * 100).ToString("0.##") + "%";
}
else
{
row5[6] = "/";
}
if (row5[3].ToString() != "0" && row5[5].ToString() != "0")
{
row5[7] = (Funs.GetNewDecimalOrZero(row5[5].ToString()) / Funs.GetNewDecimalOrZero(row5[3].ToString()) * 100).ToString("0.##") + "%";
}
else
{
row5[7] = "/";
}
table5.Rows.Add(row5);
}
if (table5.Rows.Count > 0)
{
this.Grid5.DataSource = table5;
this.Grid5.DataBind();
}
}
}
}
}