Compare commits
3 Commits
b4ac5a5204
...
16cbb25ead
| Author | SHA1 | Date | |
|---|---|---|---|
| 16cbb25ead | |||
| 2471c8b18b | |||
| 098c1ccacc |
@@ -55,22 +55,27 @@ namespace FineUIPro.Web.Door
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void GetPersonStatistic()
|
private void GetPersonStatistic()
|
||||||
{
|
{
|
||||||
string strSql = @"WITH CTE AS (
|
string strSql = @"
|
||||||
SELECT ROW_NUMBER() OVER (PARTITION BY Record.IDCardNo,RecordDate ORDER BY OffDuty3 desc,WorkIn3,OffDuty2 desc,WorkIn2,OffDuty1 desc,WorkIn1) as rn
|
SELECT NewID,ManOverHours, ManHours
|
||||||
,NewID,Record.ProjectId,InstallationName,P.UnitId,U.UnitName,P.PersonName,RecordDate,Record.EmployName
|
|
||||||
,IDCardNo,P.Nation,B.dictName AS NationName ,PostName,WorkIn1,OffDuty1,WorkIn2,OffDuty2,WorkIn3,OffDuty3,ManHours
|
|
||||||
,T.TeamGroupId,T.TeamGroupName,P.WorkPostId,W.WorkPostName, ManOverHours
|
|
||||||
FROM dbo.t_d_EmployInOutRecord AS Record
|
FROM dbo.t_d_EmployInOutRecord AS Record
|
||||||
LEFT JOIN SitePerson_Person AS P ON Record.ProjectId=P.ProjectId AND Record.IDCardNo=P.IdentityCard
|
";
|
||||||
LEFT JOIN Base_Unit AS U ON P.UnitId =U.UnitId
|
|
||||||
LEFT JOIN ProjectData_TeamGroup AS T ON P.TeamGroupId=T.TeamGroupId
|
|
||||||
LEFT JOIN Base_WorkPost AS W ON P.WorkPostId =W.WorkPostId
|
|
||||||
LEFT JOIN RealName_BasicData AS B ON B.dictTypeCode='MINZU_TYPE' AND B.dictCode=P.Nation
|
|
||||||
WHERE Record.ProjectId = @ProjectId";
|
|
||||||
List<SqlParameter> listStr = new List<SqlParameter>
|
List<SqlParameter> listStr = new List<SqlParameter>
|
||||||
{
|
{
|
||||||
new SqlParameter("@ProjectId", this.ProjectId)
|
new SqlParameter("@ProjectId", this.ProjectId)
|
||||||
};
|
};
|
||||||
|
if ("-1" != rbPost.SelectedValue)
|
||||||
|
{
|
||||||
|
strSql += " LEFT JOIN SitePerson_Person AS P ON Record.ProjectId=P.ProjectId AND Record.IDCardNo=P.IdentityCard ";
|
||||||
|
}
|
||||||
|
strSql += " WHERE Record.ProjectId = @ProjectId ";
|
||||||
|
if (rbPost.SelectedValue == "0")
|
||||||
|
{
|
||||||
|
strSql += " AND P.OutTime IS NOT NULL";
|
||||||
|
}
|
||||||
|
else if (rbPost.SelectedValue == "1")
|
||||||
|
{
|
||||||
|
strSql += " AND P.OutTime IS NULL";
|
||||||
|
}
|
||||||
|
|
||||||
if (this.drpUnit.SelectedValue != Const._Null && !string.IsNullOrEmpty(this.drpUnit.SelectedValue))
|
if (this.drpUnit.SelectedValue != Const._Null && !string.IsNullOrEmpty(this.drpUnit.SelectedValue))
|
||||||
{
|
{
|
||||||
@@ -79,11 +84,11 @@ namespace FineUIPro.Web.Door
|
|||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
strSql += " AND ( P.UnitId = @UnitId" + i.ToString();
|
strSql += " AND ( Record.UnitId = @UnitId" + i.ToString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strSql += " OR P.UnitId = @UnitId" + i.ToString();
|
strSql += " OR Record.UnitId = @UnitId" + i.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
listStr.Add(new SqlParameter("@UnitId" + i.ToString(), item.Value));
|
listStr.Add(new SqlParameter("@UnitId" + i.ToString(), item.Value));
|
||||||
@@ -99,17 +104,17 @@ namespace FineUIPro.Web.Door
|
|||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
strSql += " AND ( P.WorkPostId = @WorkPostId" + i.ToString();
|
strSql += " AND ( Record.PostId = @WorkPostId" + i.ToString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strSql += " OR P.WorkPostId = @WorkPostId" + i.ToString();
|
strSql += " OR Record.PostId = @WorkPostId" + i.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
listStr.Add(new SqlParameter("@WorkPostId" + i.ToString(), item.Value));
|
listStr.Add(new SqlParameter("@WorkPostId" + i.ToString(), item.Value));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
strSql += " ) ";
|
strSql += " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.drpWorkTeam.SelectedValue != Const._Null && !string.IsNullOrEmpty(this.drpWorkTeam.SelectedValue))
|
if (this.drpWorkTeam.SelectedValue != Const._Null && !string.IsNullOrEmpty(this.drpWorkTeam.SelectedValue))
|
||||||
@@ -119,11 +124,11 @@ namespace FineUIPro.Web.Door
|
|||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
strSql += " AND ( T.TeamGroupId = @TeamGroupId" + i.ToString();
|
strSql += " AND ( Record.DepartmentID = @TeamGroupId" + i.ToString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strSql += " OR T.TeamGroupId = @TeamGroupId" + i.ToString();
|
strSql += " OR Record.DepartmentID = @TeamGroupId" + i.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
listStr.Add(new SqlParameter("@TeamGroupId" + i.ToString(), item.Value));
|
listStr.Add(new SqlParameter("@TeamGroupId" + i.ToString(), item.Value));
|
||||||
@@ -134,39 +139,60 @@ namespace FineUIPro.Web.Door
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(this.txtStartDate.Text))
|
if (!string.IsNullOrEmpty(this.txtStartDate.Text))
|
||||||
{
|
{
|
||||||
strSql += " AND RecordDate >= @StartDate";
|
strSql += " AND Record.RecordDate >= @StartDate";
|
||||||
listStr.Add(new SqlParameter("@StartDate", this.txtStartDate.Text));
|
listStr.Add(new SqlParameter("@StartDate", this.txtStartDate.Text));
|
||||||
}
|
}
|
||||||
if (rbPost.SelectedValue == "0")
|
|
||||||
{
|
|
||||||
strSql += " AND P.OutTime IS NOT NULL";
|
|
||||||
}
|
|
||||||
else if (rbPost.SelectedValue == "1")
|
|
||||||
{
|
|
||||||
strSql += " AND P.OutTime IS NULL";
|
|
||||||
}
|
|
||||||
if (!string.IsNullOrEmpty(this.txtEndDate.Text))
|
if (!string.IsNullOrEmpty(this.txtEndDate.Text))
|
||||||
{
|
{
|
||||||
strSql += " AND RecordDate <= @EndDate";
|
strSql += " AND Record.RecordDate <= @EndDate";
|
||||||
listStr.Add(new SqlParameter("@EndDate", this.txtEndDate.Text));
|
listStr.Add(new SqlParameter("@EndDate", this.txtEndDate.Text));
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(this.txtName.Text.Trim()))
|
if (!string.IsNullOrEmpty(this.txtName.Text.Trim()))
|
||||||
{
|
{
|
||||||
strSql += " AND P.PersonName LIKE @PersonName";
|
strSql += " AND Record.EmployName LIKE @PersonName";
|
||||||
listStr.Add(new SqlParameter("@PersonName", "%" + this.txtName.Text.Trim() + "%"));
|
listStr.Add(new SqlParameter("@PersonName", "%" + this.txtName.Text.Trim() + "%"));
|
||||||
}
|
}
|
||||||
|
|
||||||
strSql += @" )
|
strSql += @" order by Record.RecordDate desc, OffDuty3 desc,WorkIn3,OffDuty2 desc,WorkIn2,OffDuty1 desc,WorkIn1 ";
|
||||||
SELECT NewID,ProjectId,InstallationName,UnitId,UnitName,PersonName,RecordDate,EmployName,IDCardNo,Nation,NationName ,PostName,WorkIn1,OffDuty1,WorkIn2,OffDuty2,WorkIn3,OffDuty3,ManHours,TeamGroupId,TeamGroupName,WorkPostId,WorkPostName, ManOverHours
|
|
||||||
FROM CTE
|
|
||||||
WHERE rn = 1; ";
|
|
||||||
|
|
||||||
SqlParameter[] parameter = listStr.ToArray();
|
SqlParameter[] parameter = listStr.ToArray();
|
||||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
DataTable tbres = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||||
Grid1.RecordCount = tb.Rows.Count;
|
|
||||||
|
List<string> resId = new List<string>();
|
||||||
|
if (tbres != null)
|
||||||
|
{
|
||||||
|
int pageIndex = Grid1.PageIndex;
|
||||||
|
int pageSize = Grid1.PageSize;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int rowbegin = pageIndex * pageSize;
|
||||||
|
int rowend = (pageIndex + 1) * pageSize;
|
||||||
|
if (rowend > tbres.Rows.Count)
|
||||||
|
{
|
||||||
|
rowend = tbres.Rows.Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = rowbegin; i < rowend; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
DataRow row = tbres.Rows[i];
|
||||||
|
resId.Add(row["NewID"].ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string sqlData = @"SELECT NewID,ProjectId,InstallationName,UnitId,UnitName, EmployName as PersonName,RecordDate,EmployName,IDCardNo,Nation,NationName ,PostName,WorkIn1,OffDuty1,WorkIn2,OffDuty2,WorkIn3,OffDuty3,ManHours,DepartmentID TeamGroupId,DepartName TeamGroupName,PostId WorkPostId,postname WorkPostName, ManOverHours
|
||||||
|
FROM t_d_EmployInOutRecord
|
||||||
|
where NewID in('"+string.Join("','",resId)+"')";
|
||||||
|
|
||||||
|
DataTable tb = SQLHelper.GetDataTableRunText(sqlData, null);
|
||||||
|
Grid1.RecordCount = tbres.Rows.Count;
|
||||||
var table = this.GetPagedDataTable(Grid1, tb);
|
var table = this.GetPagedDataTable(Grid1, tb);
|
||||||
this.OutputSummaryData(tb); ///取合计值
|
this.OutputSummaryData(tbres); ///取合计值
|
||||||
Grid1.DataSource = table;
|
|
||||||
|
Grid1.DataSource = tb;
|
||||||
Grid1.DataBind();
|
Grid1.DataBind();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,6 +202,8 @@ WHERE rn = 1; ";
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void OutputSummaryData( DataTable tb)
|
private void OutputSummaryData( DataTable tb)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
int PSum = 0;
|
int PSum = 0;
|
||||||
int OverHoursSum = 0;
|
int OverHoursSum = 0;
|
||||||
int ManHoursSum = 0;
|
int ManHoursSum = 0;
|
||||||
|
|||||||
@@ -115,19 +115,109 @@ namespace FineUIPro.Web
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
//List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
||||||
|
//Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
||||||
|
//List<string> listCategories = new List<string>();
|
||||||
|
//businessColumn.title = "作业许可数量统计";
|
||||||
|
//Model.SingleSerie s = new Model.SingleSerie();
|
||||||
|
//List<double> listdata = new List<double>();
|
||||||
|
//var getStates = LicensePublicService.drpStatesItem().Where(x => x.Value != Const._Null);
|
||||||
|
//var getLicense = APILicenseDataService.getLicenseDataListByStates(this.ProjectId, Const.UnitId_CWCEC, null);
|
||||||
|
//foreach (var itemStates in getStates)
|
||||||
|
//{
|
||||||
|
// listCategories.Add(itemStates.Text);
|
||||||
|
// listdata.Add(getLicense.Where(x => x.States == itemStates.Value).Count());
|
||||||
|
//}
|
||||||
|
//s.data = listdata;
|
||||||
|
//series.Add(s);
|
||||||
|
//businessColumn.categories = listCategories;
|
||||||
|
//businessColumn.series = series;
|
||||||
|
//return JsonConvert.SerializeObject(businessColumn);
|
||||||
|
|
||||||
|
Model.SGGLDB db = Funs.DB;
|
||||||
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
||||||
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
||||||
List<string> listCategories = new List<string>();
|
List<string> listCategories = new List<string>();
|
||||||
businessColumn.title = "作业许可数量统计";
|
businessColumn.title = "作业许可数量统计";
|
||||||
Model.SingleSerie s = new Model.SingleSerie();
|
Model.SingleSerie s = new Model.SingleSerie();
|
||||||
List<double> listdata = new List<double>();
|
List<double> listdata = new List<double>();
|
||||||
var getStates = LicensePublicService.drpStatesItem().Where(x => x.Value != Const._Null);
|
|
||||||
var getLicense = APILicenseDataService.getLicenseDataListByStates(this.ProjectId, Const.UnitId_CWCEC, null);
|
var qLicenseManager = (from x in db.License_LicenseManager.Where(xx => xx.ProjectId == CurrUser.LoginProjectId)
|
||||||
foreach (var itemStates in getStates)
|
join y in db.Base_LicenseType
|
||||||
|
on x.LicenseTypeId equals y.LicenseTypeId into z
|
||||||
|
from zz in z
|
||||||
|
select new
|
||||||
{
|
{
|
||||||
listCategories.Add(itemStates.Text);
|
x.LicenseTypeId,
|
||||||
listdata.Add(getLicense.Where(x => x.States == itemStates.Value).Count());
|
zz.LicenseTypeCode
|
||||||
|
|
||||||
|
}).ToList();
|
||||||
|
int FireWork = db.License_FireWork.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||||
|
int HeightWork = db.License_HeightWork.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||||
|
int LimitedSpace = db.License_LimitedSpace.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||||
|
int RadialWork = db.License_RadialWork.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||||
|
int OpenCircuit = db.License_OpenCircuit.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||||
|
int BreakGround = db.License_BreakGround.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||||
|
int NightWork = db.License_NightWork.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||||
|
int LiftingWork = db.License_LiftingWork.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == Const.State_3).Count();
|
||||||
|
|
||||||
|
foreach (var item in qLicenseManager)
|
||||||
|
{
|
||||||
|
switch (item.LicenseTypeCode)
|
||||||
|
{
|
||||||
|
case "01":
|
||||||
|
case "4"://动火
|
||||||
|
FireWork++;
|
||||||
|
break;
|
||||||
|
case "06":
|
||||||
|
case "18":
|
||||||
|
case "2"://高处
|
||||||
|
HeightWork++;
|
||||||
|
break;
|
||||||
|
case "03":
|
||||||
|
case "7"://受限
|
||||||
|
LimitedSpace++;
|
||||||
|
break;
|
||||||
|
case "14":
|
||||||
|
case "04"://射线
|
||||||
|
RadialWork++;
|
||||||
|
break;
|
||||||
|
case "09":
|
||||||
|
case "5"://断路
|
||||||
|
OpenCircuit++;
|
||||||
|
break;
|
||||||
|
case "02":
|
||||||
|
case "8"://动土
|
||||||
|
BreakGround++;
|
||||||
|
break;
|
||||||
|
case ""://夜间
|
||||||
|
NightWork++;
|
||||||
|
break;
|
||||||
|
case "19":
|
||||||
|
case "05":
|
||||||
|
case "3"://吊装
|
||||||
|
LiftingWork++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
listCategories.Add("动火");
|
||||||
|
listdata.Add(FireWork);
|
||||||
|
listCategories.Add("高处");
|
||||||
|
listdata.Add(HeightWork);
|
||||||
|
listCategories.Add("受限");
|
||||||
|
listdata.Add(LimitedSpace);
|
||||||
|
listCategories.Add("射线");
|
||||||
|
listdata.Add(RadialWork);
|
||||||
|
listCategories.Add("断路");
|
||||||
|
listdata.Add(OpenCircuit);
|
||||||
|
listCategories.Add("动土");
|
||||||
|
listdata.Add(BreakGround);
|
||||||
|
listCategories.Add("夜间");
|
||||||
|
listdata.Add(NightWork);
|
||||||
|
listCategories.Add("吊装");
|
||||||
|
listdata.Add(LiftingWork);
|
||||||
|
|
||||||
s.data = listdata;
|
s.data = listdata;
|
||||||
series.Add(s);
|
series.Add(s);
|
||||||
businessColumn.categories = listCategories;
|
businessColumn.categories = listCategories;
|
||||||
@@ -150,57 +240,84 @@ namespace FineUIPro.Web
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
//List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
||||||
|
//Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
||||||
|
//List<string> listCategories = new List<string>();
|
||||||
|
//Model.SingleSerie s = new Model.SingleSerie();
|
||||||
|
//Model.SingleSerie s2 = new Model.SingleSerie();
|
||||||
|
//List<double> listdata = new List<double>();
|
||||||
|
//List<double> listdata2 = new List<double>();
|
||||||
|
//businessColumn.title = "安全检查问题统计";
|
||||||
|
//var units = getHazardRegisterLists.Select(x => x.ResponsibleUnit).Distinct();
|
||||||
|
////UnitService.GetUnitByProjectIdUnitTypeList(this.ProjectId, BLL.Const.ProjectUnitType_2);
|
||||||
|
//if (units.Count() > 0)
|
||||||
|
//{
|
||||||
|
// foreach (var unitId in units)
|
||||||
|
// {
|
||||||
|
// var getPuUnit = Funs.DB.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == this.ProjectId && x.UnitId == unitId);
|
||||||
|
// if (getPuUnit != null)
|
||||||
|
// {
|
||||||
|
// var getunits = UnitService.GetUnitByUnitId(unitId);
|
||||||
|
// if (getunits != null)
|
||||||
|
// {
|
||||||
|
// listCategories.Add(getunits.ShortUnitName ?? getunits.UnitCode);
|
||||||
|
// var unitHazardRegisters = getHazardRegisterLists.Where(x => x.ResponsibleUnit == getunits.UnitId);
|
||||||
|
// //var noW = unitHazardRegisters.Where(x => x.States != "3");
|
||||||
|
// //listdata.Add(unitHazardRegisters.Count() - noW.Count());
|
||||||
|
// //listdata2.Add(unitHazardRegisters.Count());
|
||||||
|
|
||||||
|
// listdata.Add(unitHazardRegisters.Where(x => x.States == "1").Count());
|
||||||
|
// listdata2.Add(unitHazardRegisters.Count());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// var getunits = UnitService.GetUnitByProjectIdUnitTypeList(this.ProjectId, BLL.Const.ProjectUnitType_2).Take(10);
|
||||||
|
// foreach (var unit in getunits)
|
||||||
|
// {
|
||||||
|
// listCategories.Add(unit.ShortUnitName ?? unit.UnitCode);
|
||||||
|
// var unitHazardRegisters = getHazardRegisterLists.Where(x => x.ResponsibleUnit == unit.UnitId);
|
||||||
|
// //var noW = unitHazardRegisters.Where(x => x.States != "3");
|
||||||
|
// //listdata.Add(unitHazardRegisters.Count() - noW.Count());
|
||||||
|
// //listdata2.Add(unitHazardRegisters.Count());
|
||||||
|
// listdata.Add(unitHazardRegisters.Where(x => x.States == "1").Count());
|
||||||
|
// listdata2.Add(unitHazardRegisters.Count());
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//s.data = listdata;
|
||||||
|
//series.Add(s);
|
||||||
|
|
||||||
|
//s2.data = listdata2;
|
||||||
|
//series.Add(s2);
|
||||||
|
//businessColumn.categories = listCategories;
|
||||||
|
//businessColumn.series = series;
|
||||||
|
//return JsonConvert.SerializeObject(businessColumn);
|
||||||
|
|
||||||
|
Model.SGGLDB db = Funs.DB;
|
||||||
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
||||||
List<string> listCategories = new List<string>();
|
List<string> listCategories = new List<string>();
|
||||||
|
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
||||||
Model.SingleSerie s = new Model.SingleSerie();
|
Model.SingleSerie s = new Model.SingleSerie();
|
||||||
Model.SingleSerie s2 = new Model.SingleSerie();
|
|
||||||
List<double> listdata = new List<double>();
|
List<double> listdata = new List<double>();
|
||||||
List<double> listdata2 = new List<double>();
|
List<double> listdata2 = new List<double>();
|
||||||
businessColumn.title = "安全检查问题统计";
|
var hazardRegisters = from x in db.View_Hazard_HazardRegister where x.ProjectId == this.CurrUser.LoginProjectId select x;
|
||||||
var units = getHazardRegisterLists.Select(x => x.ResponsibleUnit).Distinct();
|
if (hazardRegisters.Count() > 0)
|
||||||
//UnitService.GetUnitByProjectIdUnitTypeList(this.ProjectId, BLL.Const.ProjectUnitType_2);
|
|
||||||
if (units.Count() > 0)
|
|
||||||
{
|
{
|
||||||
foreach (var unitId in units)
|
var units = hazardRegisters.Select(x => x.ResponsibleUnit).Distinct();
|
||||||
|
foreach (var unit in units)
|
||||||
{
|
{
|
||||||
var getPuUnit = Funs.DB.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == this.ProjectId && x.UnitId == unitId);
|
listCategories.Add(UnitService.GetShortUnitNameByUnitId(unit));
|
||||||
if (getPuUnit != null)
|
int state1 = hazardRegisters.Count(x => x.ResponsibleUnit == unit && x.States == "1");
|
||||||
{
|
int state2 = hazardRegisters.Count(x => x.ResponsibleUnit == unit);
|
||||||
var getunits = UnitService.GetUnitByUnitId(unitId);
|
listdata.Add(Convert.ToDouble(state1));
|
||||||
if (getunits != null)
|
listdata2.Add(Convert.ToDouble(state2));
|
||||||
{
|
|
||||||
listCategories.Add(getunits.ShortUnitName ?? getunits.UnitCode);
|
|
||||||
var unitHazardRegisters = getHazardRegisterLists.Where(x => x.ResponsibleUnit == getunits.UnitId);
|
|
||||||
//var noW = unitHazardRegisters.Where(x => x.States != "3");
|
|
||||||
//listdata.Add(unitHazardRegisters.Count() - noW.Count());
|
|
||||||
//listdata2.Add(unitHazardRegisters.Count());
|
|
||||||
|
|
||||||
listdata.Add(unitHazardRegisters.Where(x => x.States == "1").Count());
|
|
||||||
listdata2.Add(unitHazardRegisters.Count());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var getunits = UnitService.GetUnitByProjectIdUnitTypeList(this.ProjectId, BLL.Const.ProjectUnitType_2).Take(10);
|
|
||||||
foreach (var unit in getunits)
|
|
||||||
{
|
|
||||||
listCategories.Add(unit.ShortUnitName ?? unit.UnitCode);
|
|
||||||
var unitHazardRegisters = getHazardRegisterLists.Where(x => x.ResponsibleUnit == unit.UnitId);
|
|
||||||
//var noW = unitHazardRegisters.Where(x => x.States != "3");
|
|
||||||
//listdata.Add(unitHazardRegisters.Count() - noW.Count());
|
|
||||||
//listdata2.Add(unitHazardRegisters.Count());
|
|
||||||
listdata.Add(unitHazardRegisters.Where(x => x.States == "1").Count());
|
|
||||||
listdata2.Add(unitHazardRegisters.Count());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
s.data = listdata;
|
s.data = listdata;
|
||||||
|
s.data2 = listdata2;
|
||||||
series.Add(s);
|
series.Add(s);
|
||||||
|
}
|
||||||
s2.data = listdata2;
|
|
||||||
series.Add(s2);
|
|
||||||
businessColumn.categories = listCategories;
|
businessColumn.categories = listCategories;
|
||||||
businessColumn.series = series;
|
businessColumn.series = series;
|
||||||
return JsonConvert.SerializeObject(businessColumn);
|
return JsonConvert.SerializeObject(businessColumn);
|
||||||
@@ -214,46 +331,73 @@ namespace FineUIPro.Web
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
//List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
||||||
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
//Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
||||||
List<string> listCategories = new List<string>();
|
//List<string> listCategories = new List<string>();
|
||||||
Model.SingleSerie s = new Model.SingleSerie();
|
//Model.SingleSerie s = new Model.SingleSerie();
|
||||||
List<double> listdata = new List<double>();
|
//List<double> listdata = new List<double>();
|
||||||
Model.SingleSerie s2 = new Model.SingleSerie();
|
//Model.SingleSerie s2 = new Model.SingleSerie();
|
||||||
List<double> listdata2 = new List<double>();
|
//List<double> listdata2 = new List<double>();
|
||||||
businessColumn.title = "安全检查问题统计";
|
//businessColumn.title = "安全检查问题统计";
|
||||||
|
|
||||||
//隐患类型
|
////隐患类型
|
||||||
var getTypes = (from x in Funs.DB.Sys_Const
|
//var getTypes = (from x in Funs.DB.Sys_Const
|
||||||
where x.GroupId == "Hiddendangertype"
|
// where x.GroupId == "Hiddendangertype"
|
||||||
orderby x.SortIndex
|
// orderby x.SortIndex
|
||||||
select x).ToList();
|
// select x).ToList();
|
||||||
foreach (var item in getTypes)
|
|
||||||
{
|
|
||||||
listCategories.Add(item.ConstText);
|
|
||||||
var unitHazardRegisters = getHazardRegisterLists.Where(x => x.HiddenType == item.ConstValue);
|
|
||||||
//var noW = unitHazardRegisters.Where(x => x.States != "3");
|
|
||||||
//listdata.Add(unitHazardRegisters.Count() - noW.Count());
|
|
||||||
listdata.Add(unitHazardRegisters.Where(x => x.States == "1").Count());
|
|
||||||
listdata2.Add(unitHazardRegisters.Count());
|
|
||||||
}
|
|
||||||
|
|
||||||
//问题类别
|
|
||||||
//var getTypes = HSSE_Hazard_HazardRegisterTypesService.GetHazardRegisterTypesList("1");
|
|
||||||
//foreach (var item in getTypes)
|
//foreach (var item in getTypes)
|
||||||
//{
|
//{
|
||||||
// listCategories.Add(item.RegisterTypesName);
|
// listCategories.Add(item.ConstText);
|
||||||
// var unitHazardRegisters = getHazardRegisterLists.Where(x => x.RegisterTypesId == item.RegisterTypesId);
|
// var unitHazardRegisters = getHazardRegisterLists.Where(x => x.HiddenType == item.ConstValue);
|
||||||
// //var noW = unitHazardRegisters.Where(x => x.States != "3");
|
// //var noW = unitHazardRegisters.Where(x => x.States != "3");
|
||||||
// //listdata.Add(unitHazardRegisters.Count() - noW.Count());
|
// //listdata.Add(unitHazardRegisters.Count() - noW.Count());
|
||||||
// listdata.Add(unitHazardRegisters.Where(x => x.States == "1").Count());
|
// listdata.Add(unitHazardRegisters.Where(x => x.States == "1").Count());
|
||||||
// listdata2.Add(unitHazardRegisters.Count());
|
// listdata2.Add(unitHazardRegisters.Count());
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
////问题类别
|
||||||
|
////var getTypes = HSSE_Hazard_HazardRegisterTypesService.GetHazardRegisterTypesList("1");
|
||||||
|
////foreach (var item in getTypes)
|
||||||
|
////{
|
||||||
|
//// listCategories.Add(item.RegisterTypesName);
|
||||||
|
//// var unitHazardRegisters = getHazardRegisterLists.Where(x => x.RegisterTypesId == item.RegisterTypesId);
|
||||||
|
//// //var noW = unitHazardRegisters.Where(x => x.States != "3");
|
||||||
|
//// //listdata.Add(unitHazardRegisters.Count() - noW.Count());
|
||||||
|
//// listdata.Add(unitHazardRegisters.Where(x => x.States == "1").Count());
|
||||||
|
//// listdata2.Add(unitHazardRegisters.Count());
|
||||||
|
////}
|
||||||
|
|
||||||
|
//s.data = listdata;
|
||||||
|
//series.Add(s);
|
||||||
|
//s2.data = listdata2;
|
||||||
|
//series.Add(s2);
|
||||||
|
//businessColumn.categories = listCategories;
|
||||||
|
//businessColumn.series = series;
|
||||||
|
//return JsonConvert.SerializeObject(businessColumn);
|
||||||
|
|
||||||
|
Model.SGGLDB db = Funs.DB;
|
||||||
|
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
|
||||||
|
List<string> listCategories = new List<string>();
|
||||||
|
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
|
||||||
|
Model.SingleSerie s = new Model.SingleSerie();
|
||||||
|
List<double> listdata = new List<double>();
|
||||||
|
List<double> listdata2 = new List<double>();
|
||||||
|
var hazardRegisters = from x in db.View_Hazard_HazardRegister where x.ProjectId == this.CurrUser.LoginProjectId select x;
|
||||||
|
if (hazardRegisters.Count() > 0)
|
||||||
|
{
|
||||||
|
var types = hazardRegisters.Select(x => x.RegisterTypesName).Distinct().ToList();
|
||||||
|
foreach (var type in types)
|
||||||
|
{
|
||||||
|
listCategories.Add(type);
|
||||||
|
int state1 = hazardRegisters.Count(x => x.RegisterTypesName == type && x.States == "1");
|
||||||
|
int state2 = hazardRegisters.Count(x => x.RegisterTypesName == type);
|
||||||
|
listdata.Add(Convert.ToDouble(state1));
|
||||||
|
listdata2.Add(Convert.ToDouble(state2));
|
||||||
|
}
|
||||||
s.data = listdata;
|
s.data = listdata;
|
||||||
|
s.data2 = listdata2;
|
||||||
series.Add(s);
|
series.Add(s);
|
||||||
s2.data = listdata2;
|
}
|
||||||
series.Add(s2);
|
|
||||||
businessColumn.categories = listCategories;
|
businessColumn.categories = listCategories;
|
||||||
businessColumn.series = series;
|
businessColumn.series = series;
|
||||||
return JsonConvert.SerializeObject(businessColumn);
|
return JsonConvert.SerializeObject(businessColumn);
|
||||||
|
|||||||
Reference in New Issue
Block a user