提交代码
This commit is contained in:
@@ -59,37 +59,66 @@ namespace FineUIPro.Web.HSSE.InformationAnalysis
|
||||
dtCheck.Columns.Add("检查类型", typeof(string));
|
||||
dtCheck.Columns.Add("数量", typeof(string));
|
||||
|
||||
List<Model.SpResourceCollection> newCheckAnalyseView = new List<Model.SpResourceCollection>();
|
||||
var checkAnalyseView = from x in Funs.DB.View_CheckAnalysis
|
||||
where x.ProjectId == this.ProjectId
|
||||
select x;
|
||||
if (!string.IsNullOrEmpty(this.txtStarTime.Text))
|
||||
{
|
||||
checkAnalyseView = checkAnalyseView.Where(x => x.CheckTime >= Funs.GetNewDateTime(this.txtStarTime.Text));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtEndTime.Text))
|
||||
{
|
||||
checkAnalyseView = checkAnalyseView.Where(x => x.CheckTime <= Funs.GetNewDateTime(this.txtEndTime.Text));
|
||||
}
|
||||
if (checkAnalyseView.Count() > 0)
|
||||
{
|
||||
foreach (var item in checkAnalyseView)
|
||||
{
|
||||
Model.SpResourceCollection view = new Model.SpResourceCollection
|
||||
{
|
||||
UnitName = BLL.Check_ProjectCheckItemSetService.ConvertCheckItemType(item.CheckItem),
|
||||
TotalCount = 1
|
||||
};
|
||||
newCheckAnalyseView.Add(view);
|
||||
}
|
||||
}
|
||||
//List<Model.SpResourceCollection> newCheckAnalyseView = new List<Model.SpResourceCollection>();
|
||||
//var checkAnalyseView = from x in Funs.DB.View_CheckAnalysis
|
||||
// where x.ProjectId == this.ProjectId
|
||||
// select x;
|
||||
//if (!string.IsNullOrEmpty(this.txtStarTime.Text))
|
||||
//{
|
||||
// checkAnalyseView = checkAnalyseView.Where(x => x.CheckTime >= Funs.GetNewDateTime(this.txtStarTime.Text));
|
||||
//}
|
||||
//if (!string.IsNullOrEmpty(this.txtEndTime.Text))
|
||||
//{
|
||||
// checkAnalyseView = checkAnalyseView.Where(x => x.CheckTime <= Funs.GetNewDateTime(this.txtEndTime.Text));
|
||||
//}
|
||||
//if (checkAnalyseView.Count() > 0)
|
||||
//{
|
||||
// foreach (var item in checkAnalyseView)
|
||||
// {
|
||||
// Model.SpResourceCollection view = new Model.SpResourceCollection
|
||||
// {
|
||||
// UnitName = BLL.Check_ProjectCheckItemSetService.ConvertCheckItemType(item.CheckItem),
|
||||
// TotalCount = 1
|
||||
// };
|
||||
// newCheckAnalyseView.Add(view);
|
||||
// }
|
||||
//}
|
||||
|
||||
var checkType = newCheckAnalyseView.Select(x => x.UnitName).Distinct();
|
||||
foreach (var itemType in checkType)
|
||||
//var checkType = newCheckAnalyseView.Select(x => x.UnitName).Distinct();
|
||||
string[] TypeArray = { "HSE巡检", "专项检查", "综合检查", "开工前检查", "季节性/节假日前检查" };
|
||||
#region 加载各项数据的子数据
|
||||
var count1 = Funs.DB.View_Hazard_HazardRegister.Where(x => x.ProjectId == this.ProjectId).ToList().Count();
|
||||
|
||||
var count2 = (from x in Funs.DB.Check_CheckSpecialDetail
|
||||
join y in Funs.DB.Check_CheckSpecial on x.CheckSpecialId equals y.CheckSpecialId
|
||||
select x).ToList().Count();
|
||||
|
||||
var count3 = (from x in Funs.DB.Check_CheckColligationDetail
|
||||
join y in Funs.DB.Check_CheckColligation on x.CheckColligationId equals y.CheckColligationId
|
||||
where y.ProjectId == this.ProjectId
|
||||
select x).ToList().Count();
|
||||
|
||||
var count4 = (from x in Funs.DB.Check_CheckWorkDetail
|
||||
join y in Funs.DB.Check_CheckWork on x.CheckWorkId equals y.CheckWorkId
|
||||
where y.ProjectId == this.ProjectId
|
||||
select x).ToList().Count;
|
||||
|
||||
var count5 = (from x in Funs.DB.Check_CheckHolidayDetail
|
||||
join y in Funs.DB.Check_CheckHoliday on x.CheckHolidayId equals y.CheckHolidayId
|
||||
select x).ToList().Count();
|
||||
|
||||
List<CheckAnalysisModel> list = new List<CheckAnalysisModel>();
|
||||
list.Add(new CheckAnalysisModel() { itemType = TypeArray[0], count = count1 });
|
||||
list.Add(new CheckAnalysisModel() { itemType = TypeArray[1], count = count2 });
|
||||
list.Add(new CheckAnalysisModel() { itemType = TypeArray[2], count = count3 });
|
||||
list.Add(new CheckAnalysisModel() { itemType = TypeArray[3], count = count4 });
|
||||
list.Add(new CheckAnalysisModel() { itemType = TypeArray[4], count = count5 });
|
||||
#endregion
|
||||
foreach (var itemType in list)
|
||||
{
|
||||
DataRow rowUnit = dtCheck.NewRow();
|
||||
rowUnit["检查类型"] = itemType;
|
||||
rowUnit["数量"] = newCheckAnalyseView.Where(x => x.UnitName == itemType).Count();
|
||||
rowUnit["检查类型"] = itemType.itemType;
|
||||
rowUnit["数量"] = itemType.count;
|
||||
dtCheck.Rows.Add(rowUnit);
|
||||
}
|
||||
|
||||
@@ -97,6 +126,11 @@ namespace FineUIPro.Web.HSSE.InformationAnalysis
|
||||
this.gvCheck.DataBind();
|
||||
this.ChartCostTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtCheck, "危险因素分析", this.drpChartType.SelectedValue, 1150, 450, this.ckbShow.Checked));
|
||||
}
|
||||
|
||||
public class CheckAnalysisModel {
|
||||
public string itemType { get; set; }
|
||||
public int count { get; set; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 统计查询
|
||||
|
||||
Reference in New Issue
Block a user