修改安全月报
This commit is contained in:
@@ -369,5 +369,6 @@ namespace BLL
|
||||
db.SubmitChanges();
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -972,5 +972,44 @@ namespace BLL
|
||||
maxId = GetIntValue(str);
|
||||
return maxId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过存储过程获取数据
|
||||
/// </summary>
|
||||
/// <param name="storedProcName"></param>
|
||||
/// <returns></returns>
|
||||
public static int RunProcGetHsseKq(string ProjectId,DateTime startTime,DateTime endTime,string UnitId)
|
||||
{
|
||||
string str = "";
|
||||
using (SqlConnection Connection = new SqlConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
Connection.Open();
|
||||
SqlCommand command = new SqlCommand("SpGetHsseKq", Connection)
|
||||
{
|
||||
CommandTimeout = 0,
|
||||
CommandType = CommandType.StoredProcedure
|
||||
};
|
||||
SqlParameter[] values = new SqlParameter[]
|
||||
{
|
||||
new SqlParameter("@ProjectId", ProjectId),
|
||||
new SqlParameter("@startTime", startTime.ToString()),
|
||||
new SqlParameter("@endTime", endTime.ToString()),
|
||||
new SqlParameter("@UnitId", UnitId),
|
||||
new SqlParameter("@returnVal", SqlDbType.Int)
|
||||
};
|
||||
command.Parameters.AddRange(values);
|
||||
command.Parameters["@returnVal"].Direction = ParameterDirection.Output;
|
||||
command.ExecuteNonQuery();
|
||||
str = command.Parameters["@returnVal"].Value.ToString();
|
||||
}
|
||||
finally
|
||||
{
|
||||
Connection.Close();
|
||||
}
|
||||
return Convert.ToInt32(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19232,7 +19232,7 @@
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@@ -1775,7 +1775,8 @@ namespace FineUIPro.Web.HSSE.Manager
|
||||
int totalSumPersonNum = 0;//总部
|
||||
int totalSumOutPersonNum = 0;//外聘
|
||||
int totalHSEPersonNum = 0;
|
||||
var spckList = db.SitePerson_Checking.Where(x => x.ProjectId == ProjectId && x.IntoOut == "1");
|
||||
var spckList = db.SitePerson_Checking.Where(x => x.IntoOutTime >= startTime
|
||||
&& x.IntoOutTime <= endTime && x.ProjectId == ProjectId && x.IntoOut == "1");
|
||||
if (units.Count() > 0)
|
||||
{
|
||||
foreach (Model.Project_ProjectUnit u in units)
|
||||
@@ -1789,8 +1790,7 @@ namespace FineUIPro.Web.HSSE.Manager
|
||||
};
|
||||
//本部本月人数,本年考勤人数除当前月份,取平均数
|
||||
//年度
|
||||
var yearList = spckList.Where(x => x.IntoOutTime >= startTime
|
||||
&& x.IntoOutTime <= endTime && x.UnitId == u.UnitId).ToList().Select(x => new hseDayItem()
|
||||
var yearList = spckList.Where(x => x.UnitId == u.UnitId).ToList().Select(x => new hseDayItem()
|
||||
{
|
||||
IdentityCard = x.IdentityCard,
|
||||
IntoOutTime = getShortTime(x.IntoOutTime)
|
||||
@@ -1896,7 +1896,13 @@ namespace FineUIPro.Web.HSSE.Manager
|
||||
|
||||
private void getMonthReportCHSEDay()
|
||||
{
|
||||
var spckList = db.SitePerson_Checking.Where(x => x.ProjectId == ProjectId && x.IntoOut == "1");
|
||||
//数据了太大,查起来有点问题。
|
||||
|
||||
//var spckList = db.SitePerson_Checking.Where(x => x.ProjectId == ProjectId && x.IntoOut == "1").Select(x=>new {
|
||||
// IntoOutTime=x.IntoOutTime,
|
||||
// IdentityCard=x.IdentityCard,
|
||||
// UnitId=x.UnitId
|
||||
//});
|
||||
//本月项目现场HSE人工日统计
|
||||
Model.MonthReportCHSEDay hseDay = new Model.MonthReportCHSEDay
|
||||
{
|
||||
@@ -1905,63 +1911,71 @@ namespace FineUIPro.Web.HSSE.Manager
|
||||
//累计安全工作天数(当前日期-项目开始日期)
|
||||
hseDay.SumHSEDay = (endTime - projectStartTime).Days;
|
||||
|
||||
//本月HSE人工日、年度累计HSE人工日、总累计HSE人工日,考勤中取
|
||||
//本月
|
||||
var list = spckList.Where(x => x.IntoOutTime >= startTime
|
||||
&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
|
||||
{
|
||||
IdentityCard = x.IdentityCard,
|
||||
IntoOutTime = getShortTime(x.IntoOutTime)
|
||||
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||||
.ToList();
|
||||
////本月HSE人工日、年度累计HSE人工日、总累计HSE人工日,考勤中取
|
||||
////本月
|
||||
//var list = spckList.Where(x => x.IntoOutTime >= startTime
|
||||
//&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
|
||||
//{
|
||||
// IdentityCard = x.IdentityCard,
|
||||
// IntoOutTime = getShortTime(x.IntoOutTime)
|
||||
//}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||||
// .ToList();
|
||||
|
||||
//本月HSE人工日
|
||||
hseDay.MonthHSEWorkDay = list.Count();
|
||||
//本月安全人工时(五环)
|
||||
hseDay.HseManhours = spckList.Where(x => x.IntoOutTime >= startTime
|
||||
&& x.IntoOutTime <= endTime && x.UnitId == Const.UnitId_CWCEC).ToList().Select(x => new hseDayItem()
|
||||
{
|
||||
IdentityCard = x.IdentityCard,
|
||||
IntoOutTime = getShortTime(x.IntoOutTime)
|
||||
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||||
.ToList().Count() * 8;
|
||||
hseDay.MonthHSEWorkDay = SQLHelper.RunProcGetHsseKq(ProjectId, startTime, endTime, "0");
|
||||
|
||||
//list.Count();
|
||||
//本月安全人工时(五环)
|
||||
//hseDay.HseManhours = spckList.Where(x => x.IntoOutTime >= startTime
|
||||
//&& x.IntoOutTime <= endTime && x.UnitId == Const.UnitId_CWCEC).ToList().Select(x => new hseDayItem()
|
||||
//{
|
||||
// IdentityCard = x.IdentityCard,
|
||||
// IntoOutTime = getShortTime(x.IntoOutTime)
|
||||
//}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||||
// .ToList().Count() * 8;
|
||||
hseDay.HseManhours = SQLHelper.RunProcGetHsseKq(ProjectId, startTime, endTime, "3");
|
||||
//本月安全人工时(分包商)
|
||||
hseDay.SubcontractManHours= spckList.Where(x => x.IntoOutTime >= startTime
|
||||
&& x.IntoOutTime <= endTime && x.UnitId != Const.UnitId_CWCEC).ToList().Select(x => new hseDayItem()
|
||||
{
|
||||
IdentityCard = x.IdentityCard,
|
||||
IntoOutTime = getShortTime(x.IntoOutTime)
|
||||
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||||
.ToList().Count() * 8;
|
||||
hseDay.SubcontractManHours = SQLHelper.RunProcGetHsseKq(ProjectId, startTime, endTime, "1");
|
||||
|
||||
// spckList.Where(x => x.IntoOutTime >= startTime
|
||||
//&& x.IntoOutTime <= endTime && x.UnitId != Const.UnitId_CWCEC).ToList().Select(x => new hseDayItem()
|
||||
//{
|
||||
// IdentityCard = x.IdentityCard,
|
||||
// IntoOutTime = getShortTime(x.IntoOutTime)
|
||||
//}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||||
// .ToList().Count() * 8;
|
||||
|
||||
//年度
|
||||
var yearList = spckList.Where(x => x.IntoOutTime >= yearStartTime
|
||||
&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
|
||||
{
|
||||
IdentityCard = x.IdentityCard,
|
||||
IntoOutTime = getShortTime(x.IntoOutTime)
|
||||
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||||
.ToList();
|
||||
//var yearList = spckList.Where(x => x.IntoOutTime >= yearStartTime
|
||||
// && x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
|
||||
// {
|
||||
// IdentityCard = x.IdentityCard,
|
||||
// IntoOutTime = getShortTime(x.IntoOutTime)
|
||||
// }).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||||
// .ToList();
|
||||
|
||||
|
||||
//年度累计人工日
|
||||
hseDay.YearHSEWorkDay = yearList.Count;
|
||||
hseDay.YearHSEWorkDay = SQLHelper.RunProcGetHsseKq(ProjectId, yearStartTime, endTime, "0"); ;
|
||||
//yearList.Count;
|
||||
//年度累计HSE人工时
|
||||
hseDay.TotalHseManhoursYear = yearList.Count * 8;
|
||||
hseDay.TotalHseManhoursYear = hseDay.YearHSEWorkDay*8;
|
||||
//yearList.Count * 8;
|
||||
|
||||
// //项目累计
|
||||
var pList = spckList.Where(x => x.IntoOutTime >= projectStartTime
|
||||
&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
|
||||
{
|
||||
IdentityCard = x.IdentityCard,
|
||||
IntoOutTime = getShortTime(x.IntoOutTime)
|
||||
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||||
.ToList();
|
||||
// // //项目累计
|
||||
// var pList = spckList.Where(x => x.IntoOutTime >= projectStartTime
|
||||
//&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
|
||||
//{
|
||||
// IdentityCard = x.IdentityCard,
|
||||
// IntoOutTime = getShortTime(x.IntoOutTime)
|
||||
//}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
|
||||
// .ToList();
|
||||
|
||||
hseDay.SumHSEWorkDay = pList.Count;
|
||||
hseDay.SumHSEWorkDay = SQLHelper.RunProcGetHsseKq(ProjectId, projectStartTime, endTime, "0");
|
||||
//pList.Count;
|
||||
|
||||
hseDay.TotalHseManhours = pList.Count * 8;
|
||||
hseDay.TotalHseManhours = hseDay.SumHSEWorkDay*8;
|
||||
//pList.Count * 8;
|
||||
|
||||
List<Model.MonthReportCHSEDay> listCHSEDay = new List<Model.MonthReportCHSEDay>();
|
||||
listCHSEDay.Add(hseDay);
|
||||
|
||||
Reference in New Issue
Block a user