提交代码

This commit is contained in:
2024-01-30 15:26:48 +08:00
parent fdf500e8d0
commit 77f19c4965
5 changed files with 345 additions and 125 deletions
@@ -38,110 +38,107 @@ namespace FineUIPro.Web.Transfer.Chart
/// </summary>
private void AnalyseData()
{
var hazardRegisters = (from x in Funs.DB.HSSE_Hazard_HazardRegister
where x.ProjectId == this.CurrUser.LoginProjectId
&& x.States != "4" && x.ProblemTypes == "1"
select x);
if (!string.IsNullOrEmpty(this.txtStartRectificationTime.Text.Trim()))
var forms = from x in Funs.DB.Transfer_PunchlistFrom
where x.ProjectId == this.CurrUser.LoginProjectId
select x;
if (!string.IsNullOrEmpty(this.txtStartTime.Text.Trim()))
{
hazardRegisters = hazardRegisters.Where(x => x.CheckTime >= Funs.GetNewDateTime(this.txtStartRectificationTime.Text.Trim()));
forms = forms.Where(x => x.PUNCH_ITEM_FINISH_DATE >= Funs.GetNewDateTime(this.txtStartTime.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.txtEndRectificationTime.Text.Trim()))
if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
{
hazardRegisters = hazardRegisters.Where(x => x.CheckTime <= Funs.GetNewDateTime(this.txtEndRectificationTime.Text.Trim()));
forms = forms.Where(x => x.PUNCH_ITEM_FINISH_DATE <= Funs.GetNewDateTime(this.txtEndTime.Text.Trim()));
}
var list = new List<string> { "Testing", "Pre-Commissioning", "PSSR", "Commissioning" };
if (this.rblState.SelectedValue == "0")
{
#region
#region Identified during/by统计
if (this.drpChartType.SelectedValue != "Pie") //非饼形图
{
///按单位统计
DataTable dtTime = new DataTable();
dtTime.Columns.Add("单位", typeof(string));
dtTime.Columns.Add("Identified during/by", typeof(string));
dtTime.Columns.Add("总数量", typeof(string));
dtTime.Columns.Add("待整改", typeof(string));
dtTime.Columns.Add("已整改", typeof(string));
var units = BLL.UnitService.GetUnitByProjectIdUnitTypeList(this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2);
foreach (var item in units)
dtTime.Columns.Add("A数量", typeof(string));
dtTime.Columns.Add("B数量", typeof(string));
dtTime.Columns.Add("C数量", typeof(string));
foreach (var item in list)
{
DataRow rowTime = dtTime.NewRow();
Model.SpTDesktopItem newspItem = new Model.SpTDesktopItem();
rowTime["单位"] = item.UnitName;
var unitHazad = hazardRegisters.Where(x => x.ResponsibleUnit == item.UnitId);
rowTime["总数量"] = unitHazad.Count();
rowTime["待整改"] = unitHazad.Where(x => x.States == "1" || x.States == null).Count();
rowTime["已整改"] = unitHazad.Where(x => x.States == "3" || x.States == "2").Count();
rowTime["Identified during/by"] = item;
var types = forms.Where(x => x.Identified == item);
rowTime["总数量"] = types.Count();
rowTime["A数量"] = types.Where(x => x.Category == "A").Count();
rowTime["B数量"] = types.Where(x => x.Category == "B").Count();
rowTime["C数量"] = types.Where(x => x.Category == "C").Count();
dtTime.Rows.Add(rowTime);
}
this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "单位巡检分析", this.drpChartType.SelectedValue, 1100, 300, this.ckbShow.Checked));
this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "尾项分析", this.drpChartType.SelectedValue, 1100, 550, this.ckbShow.Checked));
}
else //饼形图
{
DataTable dtTime = new DataTable();
dtTime.Columns.Add("单位", typeof(string));
dtTime.Columns.Add("Identified during/by", typeof(string));
dtTime.Columns.Add("总数量", typeof(string));
var units = BLL.UnitService.GetUnitByProjectIdUnitTypeList(this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2);
foreach (var item in units)
foreach (var item in list)
{
DataRow rowTime = dtTime.NewRow();
Model.SpTDesktopItem newspItem = new Model.SpTDesktopItem();
rowTime["单位"] = item.UnitName;
var unitHazad = hazardRegisters.Where(x => x.ResponsibleUnit == item.UnitId);
rowTime["总数量"] = unitHazad.Count();
rowTime["Identified during/by"] = item;
var types = forms.Where(x => x.Identified == item);
rowTime["总数量"] = types.Count();
dtTime.Rows.Add(rowTime);
}
this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "单位巡检分析", this.drpChartType.SelectedValue, 1130, 450, this.ckbShow.Checked));
this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "尾项分析", this.drpChartType.SelectedValue, 1130, 550, this.ckbShow.Checked));
}
#endregion
}
else
{
#region
#region Discipline
var disciplines = from x in Funs.DB.Base_TransferMajor orderby x.DisciplineCode select x;
if (this.drpChartType.SelectedValue != "Pie") //非饼形图
{
///按检查项
DataTable dtTime = new DataTable();
dtTime.Columns.Add("检查项", typeof(string));
dtTime.Columns.Add("Discipline", typeof(string));
dtTime.Columns.Add("总数量", typeof(string));
dtTime.Columns.Add("待整改", typeof(string));
dtTime.Columns.Add("已整改", typeof(string));
var types = from x in Funs.DB.HSSE_Hazard_HazardRegisterTypes where x.HazardRegisterType == "1" orderby x.TypeCode select x;
foreach (var item in types)
dtTime.Columns.Add("A数量", typeof(string));
dtTime.Columns.Add("B数量", typeof(string));
dtTime.Columns.Add("C数量", typeof(string));
foreach (var item in disciplines)
{
DataRow rowTime = dtTime.NewRow();
Model.SpTDesktopItem newspItem = new Model.SpTDesktopItem();
rowTime["检查项"] = item.RegisterTypesName;
var typeHazad = hazardRegisters.Where(x => x.RegisterTypesId == item.RegisterTypesId);
rowTime["总数量"] = typeHazad.Count();
rowTime["待整改"] = typeHazad.Where(x => x.States == "1" || x.States == null).Count();
rowTime["已整改"] = typeHazad.Where(x => x.States == "3" || x.States == "2").Count();
rowTime["Discipline"] = item.Discipline;
var types = forms.Where(x => x.Discipline == item.Discipline);
rowTime["总数量"] = types.Count();
rowTime["A数量"] = types.Where(x => x.Category == "A").Count();
rowTime["B数量"] = types.Where(x => x.Category == "B").Count();
rowTime["C数量"] = types.Where(x => x.Category == "C").Count();
dtTime.Rows.Add(rowTime);
}
this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "巡检问题分析", this.drpChartType.SelectedValue, 1100, 330, this.ckbShow.Checked));
this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "尾项分析", this.drpChartType.SelectedValue, 1100, 550, this.ckbShow.Checked));
}
else //饼形图
{
///按问题类型
DataTable dtTime = new DataTable();
dtTime.Columns.Add("检查项", typeof(string));
dtTime.Columns.Add("Discipline", typeof(string));
dtTime.Columns.Add("总数量", typeof(string));
var types = from x in Funs.DB.HSSE_Hazard_HazardRegisterTypes where x.HazardRegisterType == "1" orderby x.TypeCode select x;
foreach (var item in types)
foreach (var item in disciplines)
{
DataRow rowTime = dtTime.NewRow();
Model.SpTDesktopItem newspItem = new Model.SpTDesktopItem();
rowTime["检查项"] = item.RegisterTypesName;
var typeHazad = hazardRegisters.Where(x => x.RegisterTypesId == item.RegisterTypesId);
rowTime["总数量"] = typeHazad.Count();
rowTime["Discipline"] = item.Discipline;
var types = forms.Where(x => x.Discipline == item.Discipline);
rowTime["总数量"] = types.Count();
dtTime.Rows.Add(rowTime);
}
this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "巡检问题分析", this.drpChartType.SelectedValue, 1100, 330, this.ckbShow.Checked));
this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "尾项分析", this.drpChartType.SelectedValue, 1100, 550, this.ckbShow.Checked));
}
#endregion
}