Compare commits
4 Commits
b42ae27e20
...
8b3a68f529
Author | SHA1 | Date |
---|---|---|
|
8b3a68f529 | |
|
70707cac4e | |
|
c6783807ff | |
|
4a6e16d5d2 |
Binary file not shown.
|
@ -55,10 +55,6 @@
|
||||||
"$type": "Bookmark",
|
"$type": "Bookmark",
|
||||||
"Name": "ST:129:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
"Name": "ST:129:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{1a46fd64-28d5-434c-8eb3-17a02d419b53}"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"$type": "Bookmark",
|
"$type": "Bookmark",
|
||||||
"Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
"Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||||
|
@ -66,6 +62,14 @@
|
||||||
{
|
{
|
||||||
"$type": "Bookmark",
|
"$type": "Bookmark",
|
||||||
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
|
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$type": "Bookmark",
|
||||||
|
"Name": "ST:0:0:{1a46fd64-28d5-434c-8eb3-17a02d419b53}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$type": "Bookmark",
|
||||||
|
"Name": "ST:0:0:{5726b0e3-1012-5233-81f9-d1fad48e7a56}"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"ExpandedNodes": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"SelectedNode": "\\SGGL.sln",
|
||||||
|
"PreviewInSolutionExplorer": false
|
||||||
|
}
|
|
@ -20,7 +20,9 @@ namespace BLL
|
||||||
var getDayAll = from x in db.SitePerson_PersonInOutNow
|
var getDayAll = from x in db.SitePerson_PersonInOutNow
|
||||||
join y in db.SitePerson_Person on x.PersonId equals y.PersonId
|
join y in db.SitePerson_Person on x.PersonId equals y.PersonId
|
||||||
join z in db.Base_WorkPost on y.WorkPostId equals z.WorkPostId
|
join z in db.Base_WorkPost on y.WorkPostId equals z.WorkPostId
|
||||||
where x.ProjectId == projectId && x.ChangeTime.Value.Year == dateValue.Year && x.ChangeTime.Value.Month == dateValue.Month
|
where x.ProjectId == projectId
|
||||||
|
&& x.ChangeTime.Value.Year == dateValue.Year
|
||||||
|
&& x.ChangeTime.Value.Month == dateValue.Month
|
||||||
&& x.ChangeTime.Value.Day == dateValue.Day
|
&& x.ChangeTime.Value.Day == dateValue.Day
|
||||||
select new { x.PersonId, x.ChangeTime, x.IsIn, z.PostType };
|
select new { x.PersonId, x.ChangeTime, x.IsIn, z.PostType };
|
||||||
if (getDayAll.Count() > 0)
|
if (getDayAll.Count() > 0)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
using BLL;
|
using BLL;
|
||||||
|
using Model;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
@ -17,218 +19,244 @@ namespace FineUIPro.Web.common
|
||||||
public string[] pids { get; set; }
|
public string[] pids { get; set; }
|
||||||
protected void Page_Load(object sender, EventArgs e)
|
protected void Page_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
/* if (!IsPostBack)
|
||||||
|
{
|
||||||
|
Model.SGGLDB db = Funs.DB;
|
||||||
|
if (!string.IsNullOrEmpty(CurrUser.CompanyProjectId))
|
||||||
|
{
|
||||||
|
pids = CurrUser.CompanyProjectId.Split(',');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//加载所有在建项目的数据
|
||||||
|
var pidArray = Funs.DB.Base_Project.Where(x => x.ProjectState == "1").Select(x => x.ProjectId).ToArray();
|
||||||
|
if (pidArray.Length > 0)
|
||||||
|
{
|
||||||
|
pids = pidArray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//未遂事故
|
||||||
|
this.divWS.InnerHtml = GetNearMissNum().ToString();
|
||||||
|
|
||||||
|
//安全人工时
|
||||||
|
var countAqrgsSum = Convert.ToDecimal(0);
|
||||||
|
if (pids == null)
|
||||||
|
{
|
||||||
|
countAqrgsSum = CountAqrgs();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
countAqrgsSum = CountAqrgs(null, null, pids);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (countAqrgsSum > 10000)
|
||||||
|
{
|
||||||
|
countAqrgsSum = countAqrgsSum / Convert.ToDecimal(10000.00);
|
||||||
|
|
||||||
|
this.divSafeWorkTime.InnerHtml = Math.Round(countAqrgsSum, 2).ToString() + "万";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.divSafeWorkTime.InnerHtml = countAqrgsSum.ToString().Split('.')[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//本月安全人工时
|
||||||
|
//int wHoursMonth = 0;
|
||||||
|
//DateTime? sDate = Funs.GetNewDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString());
|
||||||
|
//var dayReports = getMonthReportsByCompany(sDate);
|
||||||
|
//if (dayReports.Count > 0)
|
||||||
|
//{
|
||||||
|
// wHoursMonth = Convert.ToInt32(dayReports[0].DayWorkTime);
|
||||||
|
//}
|
||||||
|
DateTime d1 = getStartMonth();
|
||||||
|
DateTime d2 = getEndMonth();
|
||||||
|
var countMonthAqrgs = Convert.ToDecimal(0);
|
||||||
|
if (pids == null)
|
||||||
|
{
|
||||||
|
countMonthAqrgs = CountAqrgs(d1, d2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
countMonthAqrgs = CountAqrgs(d1, d2, pids);
|
||||||
|
}
|
||||||
|
if (countMonthAqrgs > 10000)
|
||||||
|
{
|
||||||
|
countMonthAqrgs = countMonthAqrgs / Convert.ToDecimal(10000.00);
|
||||||
|
|
||||||
|
this.divSafeWorkTimeMonth.InnerHtml = Math.Round(countMonthAqrgs, 2).ToString() + "万";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.divSafeWorkTimeMonth.InnerHtml = CountAqrgs(d1, d2).ToString().Split('.')[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//int wHoursMonth = db.SitePerson_PersonInOutNumber.Where(x => x.InOutDate > DateTime.Now.AddDays(-Convert.ToInt32(DateTime.Now.Date.Day)))
|
||||||
|
// .Max(x => x.WorkHours) ?? 0;
|
||||||
|
//this.divSafeWorkTimeMonth.InnerHtml = wHoursMonth.ToString();
|
||||||
|
|
||||||
|
//安全培训累计人员
|
||||||
|
var getTrainRecord = 0;
|
||||||
|
var boShengCount = 0;
|
||||||
|
if (pids == null)
|
||||||
|
{
|
||||||
|
getTrainRecord = db.EduTrain_TrainRecord.Sum(x => x.TrainPersonNum) ?? 0;
|
||||||
|
//修改:增加博晟教育中的人数
|
||||||
|
boShengCount = db.Bo_Sheng_TrainPerson.Where(x => (x.DeleteTag == "False" || x.DeleteTag == null)).ToList().Count;
|
||||||
|
this.divSafePersonNum.InnerHtml = (getTrainRecord + boShengCount).ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getTrainRecord = db.EduTrain_TrainRecord.Where(x => pids.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum) ?? 0;
|
||||||
|
//修改:增加博晟教育中的人数
|
||||||
|
boShengCount = db.Bo_Sheng_TrainPerson.Where(x => (x.DeleteTag == "False" || x.DeleteTag == null)
|
||||||
|
&& pids.Contains(x.ProjectId)).ToList().Count;
|
||||||
|
|
||||||
|
this.divSafePersonNum.InnerHtml = (getTrainRecord + boShengCount).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (pids == null)
|
||||||
|
{
|
||||||
|
//安全管理人员
|
||||||
|
var allSum = from x in Funs.DB.SitePerson_Person
|
||||||
|
where x.IsUsed == true && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now)
|
||||||
|
select x;
|
||||||
|
|
||||||
|
var glAllPerson = from x in allSum
|
||||||
|
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
||||||
|
//where (y.PostType == "1" || y.PostType == "4") //一般管理岗位和特种管理人员
|
||||||
|
where y.IsHsse == true
|
||||||
|
select x;
|
||||||
|
this.divSafeManagePersonNum.InnerText = glAllPerson.Count().ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//安全管理人员
|
||||||
|
var allSum = from x in Funs.DB.SitePerson_Person
|
||||||
|
where x.IsUsed == true && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now)
|
||||||
|
&& pids.Contains(x.ProjectId)
|
||||||
|
select x;
|
||||||
|
|
||||||
|
var glAllPerson = from x in allSum
|
||||||
|
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
||||||
|
//where (y.PostType == "1" || y.PostType == "4") //一般管理岗位和特种管理人员
|
||||||
|
where y.IsHsse == true
|
||||||
|
select x;
|
||||||
|
this.divSafeManagePersonNum.InnerText = glAllPerson.Count().ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 质量管理人员,质量培训人员 增加公司级
|
||||||
|
int CqmsManageNum = 0;
|
||||||
|
int CqmsPxNum = 0;
|
||||||
|
//质量培训人员
|
||||||
|
DateTime date = DateTime.Now.AddDays(-1);
|
||||||
|
if (pids == null)
|
||||||
|
{
|
||||||
|
CqmsManageNum = (from x in Funs.DB.Person_CompanyBranchPerson
|
||||||
|
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
||||||
|
where x.IsOnJob == true && y.IsCQMS == true
|
||||||
|
select x).Count() +
|
||||||
|
(from x in Funs.DB.SitePerson_Person
|
||||||
|
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
||||||
|
where x.IsUsed == true && y.IsCQMS == true
|
||||||
|
select x).Count();
|
||||||
|
this.divCqmsManageNum.InnerText = CqmsManageNum.ToString();
|
||||||
|
|
||||||
|
CqmsPxNum = (from x in Funs.DB.Comprehensive_InspectionPerson
|
||||||
|
where x.IsTrain == true
|
||||||
|
select x).Count();
|
||||||
|
divCqmsPxNum.InnerText = CqmsPxNum.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CqmsManageNum = (from x in Funs.DB.SitePerson_Person
|
||||||
|
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
||||||
|
where x.IsUsed == true && y.IsCQMS == true && pids.Contains(x.ProjectId)
|
||||||
|
select x).Count();
|
||||||
|
this.divCqmsManageNum.InnerText = CqmsManageNum.ToString();
|
||||||
|
|
||||||
|
CqmsPxNum = (from x in Funs.DB.Comprehensive_InspectionPerson
|
||||||
|
where x.IsTrain == true && pids.Contains(x.ProjectId)
|
||||||
|
select x).Count();
|
||||||
|
divCqmsPxNum.InnerText = CqmsPxNum.ToString();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//在建项目
|
||||||
|
if (pids == null)
|
||||||
|
{
|
||||||
|
allProjects = ProjectService.GetAllProjectDropDownList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
allProjects = ProjectService.GetAllProjectDropDownList(pids);
|
||||||
|
}
|
||||||
|
|
||||||
|
int acount = allProjects.Count();
|
||||||
|
int pcount1 = 0;
|
||||||
|
int pcount2 = 0;
|
||||||
|
int pcount3 = 0;
|
||||||
|
if (acount > 0)
|
||||||
|
{
|
||||||
|
pcount1 = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Count();
|
||||||
|
var pidzjsg = string.Join(",", allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Select(x => x.ProjectId)).Split(',');
|
||||||
|
if (pids == null)
|
||||||
|
{
|
||||||
|
pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pidzjsg.Contains(x.ProjectId) select x).Count();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pidzjsg = pids;
|
||||||
|
pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pids.Contains(x.ProjectId) select x).Count();
|
||||||
|
}
|
||||||
|
pcount3 = Count3(pidzjsg);
|
||||||
|
}
|
||||||
|
div_zjxmCount.InnerHtml = pcount1.ToString() + "<div class=\"th\">个</div>";
|
||||||
|
div_cjrsCount.InnerHtml = pcount2.ToString() + "<div class=\"th\">人</div>";
|
||||||
|
div_wdgcCount.InnerHtml = pcount3.ToString() + "<div class=\"th\">个</div>";
|
||||||
|
|
||||||
|
//质量问题
|
||||||
|
getZlwt();
|
||||||
|
|
||||||
|
//质量共检
|
||||||
|
getZlgj();
|
||||||
|
|
||||||
|
//焊接
|
||||||
|
getHj();
|
||||||
|
|
||||||
|
//关键事项
|
||||||
|
getGjsx();
|
||||||
|
|
||||||
|
//人员信息
|
||||||
|
getSitePerson();
|
||||||
|
|
||||||
|
//项目人员图表
|
||||||
|
getProjectSitePerson();
|
||||||
|
|
||||||
|
//进度
|
||||||
|
getJd();
|
||||||
|
|
||||||
|
//整改数据
|
||||||
|
getZgsj();
|
||||||
|
|
||||||
|
//材料到货表格
|
||||||
|
getCldh();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
if (!IsPostBack)
|
if (!IsPostBack)
|
||||||
{
|
{
|
||||||
Model.SGGLDB db = Funs.DB;
|
InitializeProjectIds(); // 项目ID初始化封装
|
||||||
if (!string.IsNullOrEmpty(CurrUser.CompanyProjectId))
|
BindSafetyStatistics(); // 安全统计模块
|
||||||
{
|
BindQualityStatistics(); // 质量统计模块
|
||||||
pids = CurrUser.CompanyProjectId.Split(',');
|
BindProjectStatistics(); // 项目统计模块
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//加载所有在建项目的数据
|
|
||||||
var pidArray = Funs.DB.Base_Project.Where(x => x.ProjectState == "1").Select(x => x.ProjectId).ToArray();
|
|
||||||
if (pidArray.Length > 0)
|
|
||||||
{
|
|
||||||
pids = pidArray;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////未遂事故
|
|
||||||
//var wsAccidentList1 = from x in db.Accident_AccidentPersonRecord
|
|
||||||
// join y in db.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
|
|
||||||
// where y.AccidentTypeName.Contains("未遂")
|
|
||||||
// select x;
|
|
||||||
//var wsAccidentList2 = from x in db.Accident_AccidentReportOther
|
|
||||||
// join y in db.Sys_Const on x.AccidentTypeId equals y.ConstValue
|
|
||||||
// where y.ConstText.Contains("未遂")
|
|
||||||
// select x;
|
|
||||||
this.divWS.InnerHtml = GetNearMissNum().ToString();
|
|
||||||
|
|
||||||
//安全人工时
|
|
||||||
int wHours = db.SitePerson_PersonInOutNumber.Max(x => x.WorkHours) ?? 0;
|
|
||||||
var countAqrgsSum = Convert.ToDecimal(0);
|
|
||||||
if (pids == null)
|
|
||||||
{
|
|
||||||
countAqrgsSum = CountAqrgs();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
countAqrgsSum = CountAqrgs(null, null, pids);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (countAqrgsSum > 10000)
|
|
||||||
{
|
|
||||||
countAqrgsSum = countAqrgsSum / Convert.ToDecimal(10000.00);
|
|
||||||
|
|
||||||
this.divSafeWorkTime.InnerHtml = Math.Round(countAqrgsSum, 2).ToString() + "万";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.divSafeWorkTime.InnerHtml = countAqrgsSum.ToString().Split('.')[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//本月安全人工时
|
|
||||||
//int wHoursMonth = 0;
|
|
||||||
//DateTime? sDate = Funs.GetNewDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString());
|
|
||||||
//var dayReports = getMonthReportsByCompany(sDate);
|
|
||||||
//if (dayReports.Count > 0)
|
|
||||||
//{
|
|
||||||
// wHoursMonth = Convert.ToInt32(dayReports[0].DayWorkTime);
|
|
||||||
//}
|
|
||||||
DateTime d1 = getStartMonth();
|
|
||||||
DateTime d2 = getEndMonth();
|
|
||||||
var countMonthAqrgs = Convert.ToDecimal(0);
|
|
||||||
if (pids == null)
|
|
||||||
{
|
|
||||||
countMonthAqrgs = CountAqrgs(d1, d2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
countMonthAqrgs = CountAqrgs(d1, d2, pids);
|
|
||||||
}
|
|
||||||
if (countMonthAqrgs > 10000)
|
|
||||||
{
|
|
||||||
countMonthAqrgs = countMonthAqrgs / Convert.ToDecimal(10000.00);
|
|
||||||
|
|
||||||
this.divSafeWorkTimeMonth.InnerHtml = Math.Round(countMonthAqrgs, 2).ToString() + "万";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.divSafeWorkTimeMonth.InnerHtml = CountAqrgs(d1, d2).ToString().Split('.')[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//int wHoursMonth = db.SitePerson_PersonInOutNumber.Where(x => x.InOutDate > DateTime.Now.AddDays(-Convert.ToInt32(DateTime.Now.Date.Day)))
|
|
||||||
// .Max(x => x.WorkHours) ?? 0;
|
|
||||||
//this.divSafeWorkTimeMonth.InnerHtml = wHoursMonth.ToString();
|
|
||||||
|
|
||||||
//安全培训累计人员
|
|
||||||
var getTrainRecord = 0;
|
|
||||||
var boShengCount = 0;
|
|
||||||
if (pids == null)
|
|
||||||
{
|
|
||||||
getTrainRecord = db.EduTrain_TrainRecord.Sum(x => x.TrainPersonNum) ?? 0;
|
|
||||||
//修改:增加博晟教育中的人数
|
|
||||||
boShengCount = db.Bo_Sheng_TrainPerson.Where(x => (x.DeleteTag == "False" || x.DeleteTag == null)).ToList().Count;
|
|
||||||
this.divSafePersonNum.InnerHtml = (getTrainRecord + boShengCount).ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getTrainRecord = db.EduTrain_TrainRecord.Where(x => pids.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum) ?? 0;
|
|
||||||
//修改:增加博晟教育中的人数
|
|
||||||
boShengCount = db.Bo_Sheng_TrainPerson.Where(x => (x.DeleteTag == "False" || x.DeleteTag == null)
|
|
||||||
&& pids.Contains(x.ProjectId)).ToList().Count;
|
|
||||||
|
|
||||||
this.divSafePersonNum.InnerHtml = (getTrainRecord + boShengCount).ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (pids == null)
|
|
||||||
{
|
|
||||||
//安全管理人员
|
|
||||||
var allSum = from x in Funs.DB.SitePerson_Person
|
|
||||||
where x.IsUsed == true && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now)
|
|
||||||
select x;
|
|
||||||
|
|
||||||
var glAllPerson = from x in allSum
|
|
||||||
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
|
||||||
//where (y.PostType == "1" || y.PostType == "4") //一般管理岗位和特种管理人员
|
|
||||||
where y.IsHsse == true
|
|
||||||
select x;
|
|
||||||
this.divSafeManagePersonNum.InnerText = glAllPerson.Count().ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//安全管理人员
|
|
||||||
var allSum = from x in Funs.DB.SitePerson_Person
|
|
||||||
where x.IsUsed == true && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now)
|
|
||||||
&& pids.Contains(x.ProjectId)
|
|
||||||
select x;
|
|
||||||
|
|
||||||
var glAllPerson = from x in allSum
|
|
||||||
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
|
||||||
//where (y.PostType == "1" || y.PostType == "4") //一般管理岗位和特种管理人员
|
|
||||||
where y.IsHsse == true
|
|
||||||
select x;
|
|
||||||
this.divSafeManagePersonNum.InnerText = glAllPerson.Count().ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
#region 质量管理人员,质量培训人员 增加公司级
|
|
||||||
int CqmsManageNum = 0;
|
|
||||||
int CqmsPxNum = 0;
|
|
||||||
//质量培训人员
|
|
||||||
DateTime date = DateTime.Now.AddDays(-1);
|
|
||||||
if (pids == null)
|
|
||||||
{
|
|
||||||
CqmsManageNum = (from x in Funs.DB.Person_CompanyBranchPerson
|
|
||||||
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
|
||||||
where x.IsOnJob == true && y.IsCQMS == true
|
|
||||||
select x).Count() +
|
|
||||||
(from x in Funs.DB.SitePerson_Person
|
|
||||||
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
|
||||||
where x.IsUsed == true && y.IsCQMS == true
|
|
||||||
select x).Count();
|
|
||||||
this.divCqmsManageNum.InnerText = CqmsManageNum.ToString();
|
|
||||||
|
|
||||||
CqmsPxNum = (from x in Funs.DB.Comprehensive_InspectionPerson
|
|
||||||
where x.IsTrain == true
|
|
||||||
select x).Count();
|
|
||||||
divCqmsPxNum.InnerText = CqmsPxNum.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CqmsManageNum = (from x in Funs.DB.SitePerson_Person
|
|
||||||
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
|
||||||
where x.IsUsed == true && y.IsCQMS == true && pids.Contains(x.ProjectId)
|
|
||||||
select x).Count();
|
|
||||||
this.divCqmsManageNum.InnerText = CqmsManageNum.ToString();
|
|
||||||
|
|
||||||
CqmsPxNum = (from x in Funs.DB.Comprehensive_InspectionPerson
|
|
||||||
where x.IsTrain == true && pids.Contains(x.ProjectId)
|
|
||||||
select x).Count();
|
|
||||||
divCqmsPxNum.InnerText = CqmsPxNum.ToString();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
//在建项目
|
|
||||||
if (pids == null)
|
|
||||||
{
|
|
||||||
allProjects = ProjectService.GetAllProjectDropDownList();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
allProjects = ProjectService.GetAllProjectDropDownList(pids);
|
|
||||||
}
|
|
||||||
|
|
||||||
int acount = allProjects.Count();
|
|
||||||
int pcount1 = 0;
|
|
||||||
int pcount2 = 0;
|
|
||||||
int pcount3 = 0;
|
|
||||||
if (acount > 0)
|
|
||||||
{
|
|
||||||
pcount1 = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Count();
|
|
||||||
var pidzjsg = string.Join(",", allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Select(x => x.ProjectId)).Split(',');
|
|
||||||
if (pids == null)
|
|
||||||
{
|
|
||||||
pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pidzjsg.Contains(x.ProjectId) select x).Count();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pidzjsg = pids;
|
|
||||||
pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pids.Contains(x.ProjectId) select x).Count();
|
|
||||||
}
|
|
||||||
pcount3 = Count3(pidzjsg);
|
|
||||||
}
|
|
||||||
div_zjxmCount.InnerHtml = pcount1.ToString() + "<div class=\"th\">个</div>";
|
|
||||||
div_cjrsCount.InnerHtml = pcount2.ToString() + "<div class=\"th\">人</div>";
|
|
||||||
div_wdgcCount.InnerHtml = pcount3.ToString() + "<div class=\"th\">个</div>";
|
|
||||||
|
|
||||||
//质量问题
|
|
||||||
getZlwt();
|
getZlwt();
|
||||||
|
|
||||||
//质量共检
|
//质量共检
|
||||||
|
@ -255,8 +283,150 @@ namespace FineUIPro.Web.common
|
||||||
//材料到货表格
|
//材料到货表格
|
||||||
getCldh();
|
getCldh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 初始化项目ID集合
|
||||||
|
private void InitializeProjectIds()
|
||||||
|
{
|
||||||
|
var db = Funs.DB;
|
||||||
|
pids = !string.IsNullOrEmpty(CurrUser.CompanyProjectId)
|
||||||
|
? CurrUser.CompanyProjectId.Split(',')
|
||||||
|
: db.Base_Project
|
||||||
|
.Where(x => x.ProjectState == "1")
|
||||||
|
.Select(x => x.ProjectId)
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
// 安全统计模块封装
|
||||||
|
private void BindSafetyStatistics()
|
||||||
|
{
|
||||||
|
var db = Funs.DB;
|
||||||
|
// 未遂事故
|
||||||
|
divWS.InnerHtml = GetNearMissNum().ToString();
|
||||||
|
// 安全人工时(合并重复逻辑)
|
||||||
|
var countAqrgsSum = pids?.Any() == true
|
||||||
|
? CountAqrgs(d1: null, d2: null, pids)
|
||||||
|
: CountAqrgs();
|
||||||
|
|
||||||
|
if (countAqrgsSum > 10000)
|
||||||
|
{
|
||||||
|
countAqrgsSum = countAqrgsSum / Convert.ToDecimal(10000.00);
|
||||||
|
|
||||||
|
this.divSafeWorkTime.InnerHtml = Math.Round(countAqrgsSum, 2).ToString() + "万";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.divSafeWorkTime.InnerHtml = countAqrgsSum.ToString().Split('.')[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当月安全人工时
|
||||||
|
var countMonthAqrgs = pids?.Any() == true
|
||||||
|
? CountAqrgs(getStartMonth(), getEndMonth(), pids)
|
||||||
|
: CountAqrgs(getStartMonth(), getEndMonth());
|
||||||
|
|
||||||
|
|
||||||
|
if (countMonthAqrgs > 10000)
|
||||||
|
{
|
||||||
|
countMonthAqrgs = countMonthAqrgs / Convert.ToDecimal(10000.00);
|
||||||
|
|
||||||
|
this.divSafeWorkTimeMonth.InnerHtml = Math.Round(countMonthAqrgs, 2).ToString() + "万";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.divSafeWorkTimeMonth.InnerHtml = countMonthAqrgs.ToString().Split('.')[0];
|
||||||
|
}
|
||||||
|
// 安全培训人员(合并数据库查询)
|
||||||
|
var trainingQuery = db.EduTrain_TrainRecord
|
||||||
|
.Where(x => pids.Contains(x.ProjectId))
|
||||||
|
.GroupBy(x => 1)
|
||||||
|
.Select(g => new {
|
||||||
|
TrainCount = g.Sum(x => x.TrainPersonNum) ?? 0,
|
||||||
|
BoShengCount = db.Bo_Sheng_TrainPerson
|
||||||
|
.Where(x => (x.DeleteTag == "False" || x.DeleteTag == null))
|
||||||
|
.Where(x => pids.Contains(x.ProjectId))
|
||||||
|
.Count()
|
||||||
|
}).FirstOrDefault();
|
||||||
|
|
||||||
|
|
||||||
|
divSafePersonNum.InnerHtml = trainingQuery != null
|
||||||
|
? (trainingQuery.TrainCount + trainingQuery.BoShengCount).ToString()
|
||||||
|
: "0";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 安全管理人员(优化关联查询)
|
||||||
|
var safetyStaffCount = db.SitePerson_Person
|
||||||
|
.Where(x=> x.IsUsed == true && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now))
|
||||||
|
.Where(x => pids.Contains(x.ProjectId))
|
||||||
|
.Join(db.Base_WorkPost.Where(x => x.IsHsse==true),
|
||||||
|
person => person.WorkPostId,
|
||||||
|
post => post.WorkPostId,
|
||||||
|
(person, post) => person)
|
||||||
|
.Count();
|
||||||
|
divSafeManagePersonNum.InnerText = safetyStaffCount.ToString();
|
||||||
|
}
|
||||||
|
// 质量统计模块封装
|
||||||
|
private void BindQualityStatistics()
|
||||||
|
{
|
||||||
|
var db = Funs.DB;
|
||||||
|
// 质量管理人员(合并公司+项目级查询)
|
||||||
|
var qualityQuery = db.Base_WorkPost
|
||||||
|
.Where(x => x.IsCQMS == true)
|
||||||
|
.GroupJoin(db.SitePerson_Person.Where(x=> x.IsUsed == true),
|
||||||
|
post => post.WorkPostId,
|
||||||
|
person => person.WorkPostId,
|
||||||
|
(post, persons) => new { post, persons })
|
||||||
|
.SelectMany(x => x.persons.DefaultIfEmpty(),
|
||||||
|
(x, person) => new { x.post, person })
|
||||||
|
.Where(x => pids.Contains(x.person.ProjectId));
|
||||||
|
divCqmsManageNum.InnerText = qualityQuery.Count().ToString();
|
||||||
|
// 质量培训人员
|
||||||
|
divCqmsPxNum.InnerText = db.Comprehensive_InspectionPerson
|
||||||
|
.Where(x => pids.Contains(x.ProjectId))
|
||||||
|
.Count(x => x.IsTrain == true).ToString();
|
||||||
|
}
|
||||||
|
// 项目统计优化
|
||||||
|
private void BindProjectStatistics()
|
||||||
|
{
|
||||||
|
var db = Funs.DB;
|
||||||
|
//在建项目
|
||||||
|
if (pids == null)
|
||||||
|
{
|
||||||
|
allProjects = ProjectService.GetAllProjectDropDownList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
allProjects = ProjectService.GetAllProjectDropDownList(pids);
|
||||||
|
}
|
||||||
|
|
||||||
|
int acount = allProjects.Count();
|
||||||
|
int pcount1 = 0;
|
||||||
|
int pcount2 = 0;
|
||||||
|
int pcount3 = 0;
|
||||||
|
if (acount > 0)
|
||||||
|
{
|
||||||
|
pcount1 = allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Count();
|
||||||
|
var pidzjsg = string.Join(",", allProjects.Where(x => x.ProjectState == Const.ProjectState_1 || x.ProjectState == null).Select(x => x.ProjectId)).Split(',');
|
||||||
|
if (pids == null)
|
||||||
|
{
|
||||||
|
pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pidzjsg.Contains(x.ProjectId) select x).Count();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pidzjsg = pids;
|
||||||
|
pcount2 = (from x in Funs.DB.SitePerson_Person where x.IsUsed == true && pids.Contains(x.ProjectId) select x).Count();
|
||||||
|
}
|
||||||
|
pcount3 = Count3(pidzjsg);
|
||||||
|
}
|
||||||
|
div_zjxmCount.InnerHtml = pcount1.ToString() + "<div class=\"th\">个</div>";
|
||||||
|
div_cjrsCount.InnerHtml = pcount2.ToString() + "<div class=\"th\">人</div>";
|
||||||
|
div_wdgcCount.InnerHtml = pcount3.ToString() + "<div class=\"th\">个</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region 当月人工时
|
#region 当月人工时
|
||||||
|
|
||||||
|
|
||||||
|
@ -300,34 +470,28 @@ namespace FineUIPro.Web.common
|
||||||
select x;
|
select x;
|
||||||
if (pids != null)
|
if (pids != null)
|
||||||
{
|
{
|
||||||
getAllPersonInOutList = from x in Funs.DB.SitePerson_PersonInOutNumber
|
getAllPersonInOutList = getAllPersonInOutList.Where(x => pids.Contains(x.ProjectId));
|
||||||
where pids.Contains(x.ProjectId)
|
|
||||||
select x;
|
|
||||||
}
|
}
|
||||||
if (getAllPersonInOutList.Count() > 0)
|
if (datetime1.HasValue)
|
||||||
{
|
{
|
||||||
if (datetime1.HasValue)
|
getAllPersonInOutList = getAllPersonInOutList.Where(x => x.InOutDate >= datetime1);
|
||||||
{
|
|
||||||
getAllPersonInOutList = getAllPersonInOutList.Where(x => x.InOutDate >= datetime1);
|
|
||||||
}
|
|
||||||
if (datetime2.HasValue)
|
|
||||||
{
|
|
||||||
getAllPersonInOutList = getAllPersonInOutList.Where(x => x.InOutDate <= datetime2);
|
|
||||||
}
|
|
||||||
if (pids != null && getAllPersonInOutList.Count() > 0)
|
|
||||||
{
|
|
||||||
//cout1 = getAllPersonInOutList.Sum(x => (long)x.WorkHours);
|
|
||||||
foreach (var pid in pids)
|
|
||||||
{
|
|
||||||
var q1 = getAllPersonInOutList.Where(x => x.ProjectId == pid).OrderByDescending(x => x.InOutDate);
|
|
||||||
var q2 = getAllPersonInOutList.Where(x => x.ProjectId == pid).OrderBy(x => x.InOutDate);
|
|
||||||
if (q1.Count() > 0)
|
|
||||||
{
|
|
||||||
cout1 += (q1.First().WorkHours ?? 0) - (q2.First().WorkHours ?? 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (datetime2.HasValue)
|
||||||
|
{
|
||||||
|
getAllPersonInOutList = getAllPersonInOutList.Where(x => x.InOutDate <= datetime2);
|
||||||
|
}
|
||||||
|
var projects = getAllPersonInOutList
|
||||||
|
.GroupBy(x => x.ProjectId)
|
||||||
|
.Select(g => new
|
||||||
|
{
|
||||||
|
Project = g.Key,
|
||||||
|
Items = g.OrderBy(x => x.InOutDate).ToList()
|
||||||
|
})
|
||||||
|
.Where(g => g.Items.Any());
|
||||||
|
cout1 = projects.ToList().Sum(g =>
|
||||||
|
(g.Items.Last().WorkHours ?? 0) -
|
||||||
|
(g.Items.First().WorkHours ?? 0));
|
||||||
|
|
||||||
|
|
||||||
var getD1 = from x in Funs.DB.Accident_AccidentHandle
|
var getD1 = from x in Funs.DB.Accident_AccidentHandle
|
||||||
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
|
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
|
||||||
|
@ -340,16 +504,9 @@ namespace FineUIPro.Web.common
|
||||||
|
|
||||||
if (pids != null)
|
if (pids != null)
|
||||||
{
|
{
|
||||||
getD1 = from x in Funs.DB.Accident_AccidentHandle
|
getD1 = getD1.Where(x => pids.Contains(x.ProjectId));
|
||||||
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
|
getD2 = getD2.Where(x => pids.Contains(x.ProjectId));
|
||||||
where pids.Contains(x.ProjectId)
|
|
||||||
select x;
|
|
||||||
getD2 = from x in Funs.DB.Accident_AccidentReport
|
|
||||||
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
|
|
||||||
where pids.Contains(x.ProjectId)
|
|
||||||
select x;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (datetime1.HasValue)
|
if (datetime1.HasValue)
|
||||||
{
|
{
|
||||||
getD1 = getD1.Where(x => x.AccidentDate >= datetime1);
|
getD1 = getD1.Where(x => x.AccidentDate >= datetime1);
|
||||||
|
@ -359,20 +516,17 @@ namespace FineUIPro.Web.common
|
||||||
{
|
{
|
||||||
getD1 = getD1.Where(x => x.AccidentDate <= datetime2);
|
getD1 = getD1.Where(x => x.AccidentDate <= datetime2);
|
||||||
getD2 = getD2.Where(x => x.CompileDate <= datetime2);
|
getD2 = getD2.Where(x => x.CompileDate <= datetime2);
|
||||||
}
|
}
|
||||||
|
if (getD1.Any())
|
||||||
|
|
||||||
if (getD1.Count() > 0)
|
|
||||||
{
|
{
|
||||||
cout1 = cout1 - getD1.Sum(x => x.WorkHoursLoss ?? 0);
|
cout1 = cout1 - getD1.Sum(x => x.WorkHoursLoss ?? 0);
|
||||||
}
|
}
|
||||||
if (getD2.Count() > 0)
|
if (getD2.Any())
|
||||||
{
|
{
|
||||||
cout1 = cout1 - getD2.Sum(x => x.WorkingHoursLoss ?? 0);
|
cout1 = cout1 - getD2.Sum(x => x.WorkingHoursLoss ?? 0);
|
||||||
}
|
}
|
||||||
return cout1;
|
return cout1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取出入记录人工时-月报(项目级别)
|
/// 获取出入记录人工时-月报(项目级别)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -823,27 +977,46 @@ namespace FineUIPro.Web.common
|
||||||
var ndtLists = from x in db.ProcessControl_NondestructiveTest_New where x.ProfessionalName == "工艺管道" select x;
|
var ndtLists = from x in db.ProcessControl_NondestructiveTest_New where x.ProfessionalName == "工艺管道" select x;
|
||||||
if (pids != null)
|
if (pids != null)
|
||||||
{
|
{
|
||||||
ndtLists = from x in db.ProcessControl_NondestructiveTest_New where x.ProfessionalName == "工艺管道" && pids.Contains(x.ProjectId) select x;
|
ndtLists = ndtLists.Where(x=>pids.Contains(x.ProjectId));
|
||||||
}
|
}
|
||||||
decimal a = 0, b = 0;
|
decimal a = 0, b = 0;
|
||||||
if (ndtLists.Count() > 0)
|
|
||||||
{
|
|
||||||
foreach (var project in allProjects)
|
var sumResult = ndtLists
|
||||||
{
|
.GroupBy(x => x.ProjectId)
|
||||||
var ndt = (from x in ndtLists
|
.Select(g => new {
|
||||||
where x.ProjectId == project.ProjectId
|
TotalQ = g.OrderByDescending(x => x.CreateDate)
|
||||||
orderby x.CreateDate descending
|
.Select(x => x.TotalQuantity)
|
||||||
select x).FirstOrDefault();
|
.FirstOrDefault(),
|
||||||
if (ndt != null)
|
Rate = g.OrderByDescending(x => x.CreateDate)
|
||||||
{
|
.Select(x => x.TotalRate)
|
||||||
if (ndt.TotalQuantity.HasValue)
|
.FirstOrDefault()
|
||||||
{
|
})
|
||||||
a += Math.Floor(ndt.TotalQuantity.Value * Funs.GetNewDecimalOrZero(ndt.TotalRate) / 100);
|
.Where(x => x.TotalQ.HasValue).ToList()
|
||||||
b += ndt.TotalQuantity.Value;
|
.Select(x => new {
|
||||||
}
|
A = Math.Floor(x.TotalQ.Value * (decimal.Parse(x.Rate)) / 100),
|
||||||
}
|
B = x.TotalQ.Value
|
||||||
}
|
});
|
||||||
}
|
a = sumResult.Sum(x=>x.A);
|
||||||
|
b = sumResult.Sum(x => x.B);
|
||||||
|
/* if (ndtLists.Count() > 0)
|
||||||
|
{
|
||||||
|
foreach (var project in allProjects)
|
||||||
|
{
|
||||||
|
var ndt = (from x in ndtLists
|
||||||
|
where x.ProjectId == project.ProjectId
|
||||||
|
orderby x.CreateDate descending
|
||||||
|
select x).FirstOrDefault();
|
||||||
|
if (ndt != null)
|
||||||
|
{
|
||||||
|
if (ndt.TotalQuantity.HasValue)
|
||||||
|
{
|
||||||
|
a += Math.Floor(ndt.TotalQuantity.Value * Funs.GetNewDecimalOrZero(ndt.TotalRate) / 100);
|
||||||
|
b += ndt.TotalQuantity.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
if (b > 0)
|
if (b > 0)
|
||||||
{
|
{
|
||||||
result = Convert.ToDouble(decimal.Round(decimal.Parse((a / b * 100).ToString()), 2));
|
result = Convert.ToDouble(decimal.Round(decimal.Parse((a / b * 100).ToString()), 2));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||||
|
|
Loading…
Reference in New Issue