修改进度报表及试车管理

This commit is contained in:
2023-06-19 10:20:55 +08:00
parent 78baadfb7f
commit 966843abbe
39 changed files with 3685 additions and 4335 deletions
@@ -420,6 +420,7 @@ namespace FineUIPro.Web.JDGL.CostAnalysis
//按设备材料分类统计
DataTable table5 = new DataTable();
table5.Columns.Add(new DataColumn("Id", typeof(String)));
table5.Columns.Add(new DataColumn("SupId", 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)));
@@ -428,61 +429,214 @@ namespace FineUIPro.Web.JDGL.CostAnalysis
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 cnProfessionInits = from x in db.WBS_CnProfessionInit orderby x.SortIndex select x;
var costControls = from x in db.WBS_CostControl
join z in db.WBS_EquipmentMaterialType on x.EquipmentMaterialTypeId equals z.EquipmentMaterialTypeId
join t in db.Wbs_WbsSet on x.WbsSetId equals t.WbsSetId
where x.ProjectId == this.CurrUser.LoginProjectId
select new
{
x.Unit,
x.TotalNum,
z.EquipmentMaterialBigTypeId,
z.EquipmentMaterialTypeId,
t.InstallationId,
};
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
join t in db.Wbs_WbsSet on y.WbsSetId equals t.WbsSetId
where x.Months <= Funs.GetNewDateTime(date) && y.ProjectId == this.CurrUser.LoginProjectId
orderby x.Months descending
select new
{
x.CostControlDetailId,
t.InstallationId,
y.EquipmentMaterialTypeId,
z.EquipmentMaterialBigTypeId,
z.EquipmentMaterialTypeName,
x.Months,
x.ThisNum,
};
var equipmentMaterialBigTypes = from x in db.WBS_EquipmentMaterialBigType orderby x.EquipmentMaterialBigTypeCode select x;
var equipmentMaterialTypes = from x in db.WBS_EquipmentMaterialType orderby x.EquipmentMaterialTypeCode select x;
if (equipmentMaterialTypes.Count() > 0)
int v = 1, w = 2, d = 1, f = 1;
foreach (var cn in cnProfessionInits)
{
foreach (var equipmentMaterialType in equipmentMaterialTypes)
row5 = table5.NewRow();
row5[0] = v.ToString();
row5[1] = "0";
row5[2] = cn.CnProfessionName;
table5.Rows.Add(row5);
row5 = table5.NewRow();
row5[0] = v.ToString() + ".1";
row5[1] = v.ToString();
row5[2] = "本专业汇总统计";
table5.Rows.Add(row5);
d = 1;
var bigTypes = equipmentMaterialBigTypes.Where(x => x.CnProfessionId == cn.CnProfessionId).OrderBy(x => x.EquipmentMaterialBigTypeCode);
foreach (var bigType in bigTypes)
{
row5 = table5.NewRow();
row5[0] = equipmentMaterialType.EquipmentMaterialTypeId;
row5[1] = equipmentMaterialType.EquipmentMaterialTypeName;
var list = costControls.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId);
row5[0] = v.ToString() + ".1." + d.ToString();
row5[1] = v.ToString() + ".1";
row5[2] = bigType.EquipmentMaterialBigTypeName;
var list = costControls.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId);
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] = "/";
row5[3] = list.First().Unit;
row5[4] = list.ToList().Sum(x => x.TotalNum ?? 0);
var list2 = costControlDetails.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId && x.Months == Funs.GetNewDateTime(date));
row5[5] = list2.ToList().Sum(x => x.ThisNum ?? 0);
var list3 = costControlDetails.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId);
row5[6] = list3.ToList().Sum(x => x.ThisNum ?? 0);
if (row5[4].ToString() != "0" && row5[5].ToString() != "0")
{
row5[7] = (Funs.GetNewDecimalOrZero(row5[5].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
}
else
{
row5[7] = "/";
}
if (row5[4].ToString() != "0" && row5[6].ToString() != "0")
{
row5[8] = (Funs.GetNewDecimalOrZero(row5[6].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
}
else
{
row5[8] = "/";
}
}
table5.Rows.Add(row5);
f = 1;
var types = equipmentMaterialTypes.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId).OrderBy(x => x.EquipmentMaterialTypeCode);
foreach (var equipmentMaterialType in types)
{
row5 = table5.NewRow();
row5[0] = v.ToString() + ".1." + d.ToString() + "." + f.ToString();
row5[1] = v.ToString() + ".1." + d.ToString();
row5[2] = equipmentMaterialType.EquipmentMaterialTypeName;
var lists = costControls.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId);
if (lists.Count() > 0)
{
row5[3] = lists.First().Unit;
row5[4] = lists.ToList().Sum(x => x.TotalNum ?? 0);
var list2s = costControlDetails.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId && x.Months == Funs.GetNewDateTime(date));
row5[5] = list2s.ToList().Sum(x => x.ThisNum ?? 0);
var list3s = costControlDetails.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId);
row5[6] = list3s.ToList().Sum(x => x.ThisNum ?? 0);
if (row5[4].ToString() != "0" && row5[5].ToString() != "0")
{
row5[7] = (Funs.GetNewDecimalOrZero(row5[5].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
}
else
{
row5[7] = "/";
}
if (row5[4].ToString() != "0" && row5[6].ToString() != "0")
{
row5[8] = (Funs.GetNewDecimalOrZero(row5[6].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
}
else
{
row5[8] = "/";
}
}
table5.Rows.Add(row5);
f++;
}
d++;
}
if (table5.Rows.Count > 0)
w = 2;
foreach (var ins in installations)
{
this.Grid5.DataSource = table5;
this.Grid5.DataBind();
row5 = table5.NewRow();
row5[0] = v.ToString() + "." + w.ToString();
row5[1] = v.ToString();
row5[2] = ins.InstallationName;
table5.Rows.Add(row5);
d = 1;
var bigTypes2 = equipmentMaterialBigTypes.Where(x => x.CnProfessionId == cn.CnProfessionId).OrderBy(x => x.EquipmentMaterialBigTypeCode);
foreach (var bigType in bigTypes2)
{
row5 = table5.NewRow();
row5[0] = v.ToString() + "." + w.ToString() + d.ToString();
row5[1] = v.ToString() + "." + w.ToString();
row5[2] = bigType.EquipmentMaterialBigTypeName;
var list = costControls.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId && x.InstallationId == ins.InstallationId);
if (list.Count() > 0)
{
row5[3] = list.First().Unit;
row5[4] = list.ToList().Sum(x => x.TotalNum ?? 0);
var list2 = costControlDetails.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId && x.InstallationId == ins.InstallationId && x.Months == Funs.GetNewDateTime(date));
row5[5] = list2.ToList().Sum(x => x.ThisNum ?? 0);
var list3 = costControlDetails.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId && x.InstallationId == ins.InstallationId);
row5[6] = list3.ToList().Sum(x => x.ThisNum ?? 0);
if (row5[4].ToString() != "0" && row5[5].ToString() != "0")
{
row5[7] = (Funs.GetNewDecimalOrZero(row5[5].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
}
else
{
row5[7] = "/";
}
if (row5[4].ToString() != "0" && row5[6].ToString() != "0")
{
row5[8] = (Funs.GetNewDecimalOrZero(row5[6].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
}
else
{
row5[8] = "/";
}
}
table5.Rows.Add(row5);
f = 1;
var types = equipmentMaterialTypes.Where(x => x.EquipmentMaterialBigTypeId == bigType.EquipmentMaterialBigTypeId).OrderBy(x => x.EquipmentMaterialTypeCode);
foreach (var equipmentMaterialType in types)
{
row5 = table5.NewRow();
row5[0] = v.ToString() + "." + w.ToString() + d.ToString() + "." + f.ToString();
row5[1] = v.ToString() + "." + w.ToString() + d.ToString();
row5[2] = equipmentMaterialType.EquipmentMaterialTypeName;
var lists = costControls.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId && x.InstallationId == ins.InstallationId);
if (lists.Count() > 0)
{
row5[3] = lists.First().Unit;
row5[4] = lists.ToList().Sum(x => x.TotalNum ?? 0);
var list2s = costControlDetails.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId && x.InstallationId == ins.InstallationId && x.Months == Funs.GetNewDateTime(date));
row5[5] = list2s.ToList().Sum(x => x.ThisNum ?? 0);
var list3s = costControlDetails.Where(x => x.EquipmentMaterialTypeId == equipmentMaterialType.EquipmentMaterialTypeId && x.InstallationId == ins.InstallationId);
row5[6] = list3s.ToList().Sum(x => x.ThisNum ?? 0);
if (row5[4].ToString() != "0" && row5[5].ToString() != "0")
{
row5[7] = (Funs.GetNewDecimalOrZero(row5[5].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
}
else
{
row5[7] = "/";
}
if (row5[4].ToString() != "0" && row5[6].ToString() != "0")
{
row5[8] = (Funs.GetNewDecimalOrZero(row5[6].ToString()) / Funs.GetNewDecimalOrZero(row5[4].ToString()) * 100).ToString("0.##") + "%";
}
else
{
row5[8] = "/";
}
}
table5.Rows.Add(row5);
f++;
}
d++;
}
w++;
}
v++;
}
if (table5.Rows.Count > 0)
{
this.Grid5.DataSource = table5;
this.Grid5.DataBind();
}
}
}