230 lines
12 KiB
C#
230 lines
12 KiB
C#
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using BLL;
|
|
|
|
namespace FineUIPro.Web
|
|
{
|
|
public partial class mainMenu_CQMS : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
this.divPersonTrainNum.InnerText = (from x in db.Comprehensive_InspectionPerson
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.IsTrain == true
|
|
select x).Count().ToString();
|
|
var result = (from x in db.Comprehensive_DesignDetails
|
|
where x.ProjectId == this.CurrUser.LoginProjectId
|
|
select x.JoinPersonNum).ToList().Sum(x => x.Value);
|
|
this.divTechnicalDisclosePersonNum.InnerText = result.ToString();
|
|
this.divUseNum.InnerHtml = (from x in db.Comprehensive_InspectionMachine
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.IsOnSite == true && x.InspectionType.Contains("计量")
|
|
select x).Sum(x=>x.UnitsCount).ToString() + "<span>台</span>";
|
|
this.divOKNum.InnerHtml = (from x in db.Comprehensive_InspectionMachine
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.IsOnSite == true && x.InspectionType.Contains("计量") && x.IsCheckOK == true
|
|
select x).Sum(x => x.UnitsCount).ToString() + "<span>台</span>";
|
|
this.divANum.InnerText = (from x in db.WBS_BreakdownProject
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.Class.Contains("A") && x.IsSelected == true
|
|
select x).Count().ToString();
|
|
this.divBNum.InnerText = (from x in db.WBS_BreakdownProject
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.Class.Contains("B") && x.IsSelected == true
|
|
select x).Count().ToString();
|
|
this.divCNum.InnerText = (from x in db.WBS_BreakdownProject
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.Class.Contains("C") && x.IsSelected == true
|
|
select x).Count().ToString();
|
|
var checkControls = from x in Funs.DB.Check_CheckControl
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && (x.State == BLL.Const.CheckControl_Audit2 || x.State == BLL.Const.CheckControl_Audit3 || x.State == BLL.Const.CheckControl_Audit4 || x.State == BLL.Const.CheckControl_Audit5)
|
|
select x;
|
|
string str = string.Empty;
|
|
foreach (var checkControl in checkControls)
|
|
{
|
|
if (checkControl.State == BLL.Const.CheckControl_Audit2 || checkControl.State == BLL.Const.CheckControl_Audit3)
|
|
{
|
|
str += "<div class='row'><span style='color: #FF7474;'>【待整改】</span><span>" + string.Format("{0:yyyy-MM-dd}", checkControl.CheckDate) + "</span><span>" + BLL.UnitService.GetUnitNameByUnitId(checkControl.UnitId) + "</span><span>" + checkControl.CheckSite + "</span></div>";
|
|
}
|
|
else
|
|
{
|
|
str += "<div class='row'><span style='color: #FF7474;'>【待复查验收】</span><span>" + string.Format("{0:yyyy-MM-dd}", checkControl.CheckDate) + "</span><span>" + BLL.UnitService.GetUnitNameByUnitId(checkControl.UnitId) + "</span><span>" + checkControl.CheckSite + "</span></div>";
|
|
}
|
|
}
|
|
this.divToDo.InnerHtml = str;
|
|
}
|
|
}
|
|
|
|
#region 项目质量验收一次合格率
|
|
protected string One
|
|
{
|
|
get
|
|
{
|
|
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
|
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
|
List<string> listCategories = new List<string>();
|
|
businessColumn.title = "质量验收一次合格率";
|
|
businessColumn.xFontNum = 4;
|
|
var units = BLL.UnitService.GetUnitByProjectIdUnitTypeList(this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2);
|
|
var inspectionManagementDetails = from x in Funs.DB.ProcessControl_InspectionManagementDetail
|
|
join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId
|
|
where y.ProjectId == this.CurrUser.LoginProjectId
|
|
select new { x.InspectionDetailId, y.UnitId, y.IsOnceQualified };
|
|
Model.SingleSerie s = new Model.SingleSerie();
|
|
List<double> listdata = new List<double>();
|
|
foreach (var unit in units)
|
|
{
|
|
listCategories.Add(unit.ShortUnitName);
|
|
int unitInspectionManagementDetailsCount = inspectionManagementDetails.Count(x => x.UnitId == unit.UnitId);
|
|
int unitOKInspectionManagementDetailsCount = inspectionManagementDetails.Count(x => x.UnitId == unit.UnitId && x.IsOnceQualified == true);
|
|
double rate = 0;
|
|
if (unitInspectionManagementDetailsCount > 0)
|
|
{
|
|
var a = Convert.ToDouble(unitInspectionManagementDetailsCount);
|
|
var b = Convert.ToDouble(unitOKInspectionManagementDetailsCount);
|
|
rate = Convert.ToDouble(decimal.Round(decimal.Parse((b / a * 100).ToString()), 2));
|
|
}
|
|
listdata.Add(rate);
|
|
}
|
|
s.data = listdata;
|
|
series.Add(s);
|
|
businessColumn.categories = listCategories;
|
|
businessColumn.series = series;
|
|
return JsonConvert.SerializeObject(businessColumn);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 质量问题治理数据
|
|
protected string Two
|
|
{
|
|
get
|
|
{
|
|
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
|
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
|
List<string> listCategories = new List<string>();
|
|
businessColumn.title = "质量问题治理数据";
|
|
businessColumn.xFontNum = 4;
|
|
var units = BLL.UnitService.GetUnitByProjectIdUnitTypeList(this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2);
|
|
var checkControls = from x in Funs.DB.Check_CheckControl
|
|
where x.ProjectId == this.CurrUser.LoginProjectId
|
|
select x;
|
|
Model.SingleSerie s = new Model.SingleSerie();
|
|
Model.SingleSerie s2 = new Model.SingleSerie();
|
|
List<double> listdata = new List<double>();
|
|
List<double> listdata2 = new List<double>();
|
|
foreach (var unit in units)
|
|
{
|
|
listCategories.Add(unit.ShortUnitName);
|
|
var unitChecksCount = checkControls.Count(x => x.UnitId == unit.UnitId);
|
|
var unitOKChecksCount = checkControls.Count(x => x.UnitId == unit.UnitId && x.State == BLL.Const.CheckControl_Complete);
|
|
listdata.Add(unitChecksCount);
|
|
listdata2.Add(unitOKChecksCount);
|
|
}
|
|
s.data = listdata;
|
|
s2.data = listdata2;
|
|
series.Add(s);
|
|
series.Add(s2);
|
|
businessColumn.categories = listCategories;
|
|
businessColumn.series = series;
|
|
return JsonConvert.SerializeObject(businessColumn);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 施工方案
|
|
protected string Three
|
|
{
|
|
get
|
|
{
|
|
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
|
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
|
List<string> listCategories = new List<string>();
|
|
businessColumn.title = "施工方案";
|
|
businessColumn.xFontNum = 4;
|
|
var units = BLL.UnitService.GetUnitByProjectIdUnitTypeList(this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2);
|
|
var constructSolutions = from x in Funs.DB.Solution_CQMSConstructSolution
|
|
where x.ProjectId == this.CurrUser.LoginProjectId
|
|
select x;
|
|
Model.SingleSerie s = new Model.SingleSerie();
|
|
Model.SingleSerie s2 = new Model.SingleSerie();
|
|
Model.SingleSerie s3 = new Model.SingleSerie();
|
|
Model.SingleSerie s4 = new Model.SingleSerie();
|
|
List<double> listdata = new List<double>();
|
|
List<double> listdata2 = new List<double>();
|
|
List<double> listdata3 = new List<double>();
|
|
List<double> listdata4 = new List<double>();
|
|
foreach (var unit in units)
|
|
{
|
|
listCategories.Add(unit.ShortUnitName);
|
|
var unitCount = constructSolutions.Count(x => x.UnitId == unit.UnitId);
|
|
var unitReCompileCount = constructSolutions.Count(x => x.UnitId == unit.UnitId && x.State == BLL.Const.CQMSConstructSolution_ReCompile);
|
|
var unitAuditCount = constructSolutions.Count(x => x.UnitId == unit.UnitId && x.State == BLL.Const.CQMSConstructSolution_Audit);
|
|
var unitCompleteCount = constructSolutions.Count(x => x.UnitId == unit.UnitId && x.State == BLL.Const.CQMSConstructSolution_Complete);
|
|
listdata.Add(unitCount);
|
|
listdata2.Add(unitReCompileCount);
|
|
listdata3.Add(unitAuditCount);
|
|
listdata4.Add(unitCompleteCount);
|
|
}
|
|
s.data = listdata;
|
|
s2.data = listdata2;
|
|
s3.data = listdata3;
|
|
s4.data = listdata4;
|
|
series.Add(s);
|
|
series.Add(s2);
|
|
series.Add(s3);
|
|
series.Add(s4);
|
|
businessColumn.categories = listCategories;
|
|
businessColumn.series = series;
|
|
return JsonConvert.SerializeObject(businessColumn);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 项目施工资料同步率
|
|
protected string One2
|
|
{
|
|
get
|
|
{
|
|
|
|
var list = Funs.DB.WBS_BreakdownProject.Where(x => x.ProjectId == CurrUser.LoginProjectId).Select(x => x.BreakdownProjectId).ToList();
|
|
HashSet<string> set = new HashSet<string>();
|
|
HashSet<string> tokeyset = new HashSet<string>();
|
|
foreach (string id in list)
|
|
{
|
|
set.Add(id);
|
|
}
|
|
var toKeys = Funs.DB.AttachFile.Select(x => x.ToKeyId).ToList();
|
|
int a = 0;
|
|
foreach (var tokey in toKeys)
|
|
{
|
|
if (tokey != null)
|
|
{
|
|
if (set.Contains(tokey))
|
|
{
|
|
tokeyset.Add(tokey);
|
|
}
|
|
else if (tokey.Contains('#'))
|
|
{
|
|
var s = tokey.Split('#')[0];
|
|
if (set.Contains(s))
|
|
{
|
|
tokeyset.Add(s);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (list.Count > 0)
|
|
{
|
|
var result = Convert.ToDouble(decimal.Round(decimal.Parse((tokeyset.Count() / list.Count() * 100).ToString()), 1));
|
|
return JsonConvert.SerializeObject(result);
|
|
}
|
|
else
|
|
return JsonConvert.SerializeObject(0);
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |