2023/10/31
This commit is contained in:
@@ -27,21 +27,24 @@ namespace FineUIPro.Web.common
|
||||
join y in db.Sys_Const on x.AccidentTypeId equals y.ConstValue
|
||||
where y.ConstText.Contains("未遂")
|
||||
select x;
|
||||
this.divWS.InnerHtml = (wsAccidentList1.Count() + wsAccidentList2.Count()).ToString();
|
||||
this.divWS.InnerHtml = GetNearMissNum().ToString();
|
||||
|
||||
//安全人工时
|
||||
int wHours = db.SitePerson_PersonInOutNumber.Max(x => x.WorkHours) ?? 0;
|
||||
this.divSafeWorkTime.InnerHtml = wHours.ToString();
|
||||
this.divSafeWorkTime.InnerHtml = CountAqrgs().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);
|
||||
}
|
||||
this.divSafeWorkTimeMonth.InnerHtml = wHoursMonth.ToString();
|
||||
//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();
|
||||
|
||||
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;
|
||||
@@ -70,7 +73,7 @@ namespace FineUIPro.Web.common
|
||||
//质量培训人员
|
||||
DateTime date = DateTime.Now.AddDays(-1);
|
||||
int CqmsPxNum = (from x in Funs.DB.Comprehensive_InspectionPerson
|
||||
where x.IsTrain == true && x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month && x.CompileDate.Value.Day == date.Day
|
||||
where x.IsTrain == true
|
||||
select x).Count();
|
||||
divCqmsPxNum.InnerText = CqmsPxNum.ToString();
|
||||
|
||||
@@ -120,6 +123,94 @@ namespace FineUIPro.Web.common
|
||||
}
|
||||
|
||||
#region 当月人工时
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前月的月末日期
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DateTime getEndMonth()
|
||||
{
|
||||
|
||||
int span = Convert.ToInt32(System.DateTime.Now.Day);
|
||||
System.DateTime dateEnd = System.DateTime.Now.AddMonths(1).AddDays(-span);
|
||||
return dateEnd;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取当前月初日期
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DateTime getStartMonth()
|
||||
{
|
||||
int span = Convert.ToInt32(System.DateTime.Now.Day);
|
||||
span = span - 1;
|
||||
System.DateTime dateStart = System.DateTime.Now.AddDays(-span);
|
||||
return dateStart;
|
||||
}
|
||||
|
||||
//安全人工时(穿透)
|
||||
/// <summary>
|
||||
/// 安全工时数
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
protected decimal CountAqrgs(DateTime? d1 = null, DateTime? d2 = null)
|
||||
{
|
||||
decimal cout1 = 0;
|
||||
|
||||
var datetime1 = d1;
|
||||
var datetime2 = d2;
|
||||
var getAllPersonInOutList = from x in Funs.DB.SitePerson_PersonInOutNumber
|
||||
|
||||
select x;
|
||||
if (getAllPersonInOutList.Count() > 0)
|
||||
{
|
||||
if (datetime1.HasValue)
|
||||
{
|
||||
getAllPersonInOutList = getAllPersonInOutList.Where(x => x.InOutDate >= datetime1);
|
||||
}
|
||||
if (datetime2.HasValue)
|
||||
{
|
||||
getAllPersonInOutList = getAllPersonInOutList.Where(x => x.InOutDate <= datetime2);
|
||||
}
|
||||
if (getAllPersonInOutList.Count() > 0)
|
||||
{
|
||||
cout1 = getAllPersonInOutList.Sum(x => (long)x.WorkHours);
|
||||
}
|
||||
}
|
||||
|
||||
var getD1 = from x in Funs.DB.Accident_AccidentHandle
|
||||
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
|
||||
where y.ProjectState == Const.ProjectState_1
|
||||
select x;
|
||||
var getD2 = from x in Funs.DB.Accident_AccidentReport
|
||||
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
|
||||
where y.ProjectState == Const.ProjectState_1
|
||||
select x;
|
||||
|
||||
if (datetime1.HasValue)
|
||||
{
|
||||
getD1 = getD1.Where(x => x.AccidentDate >= datetime1);
|
||||
getD2 = getD2.Where(x => x.CompileDate >= datetime1);
|
||||
}
|
||||
if (datetime2.HasValue)
|
||||
{
|
||||
getD1 = getD1.Where(x => x.AccidentDate <= datetime2);
|
||||
getD2 = getD2.Where(x => x.CompileDate <= datetime2);
|
||||
}
|
||||
|
||||
|
||||
if (getD1.Count() > 0)
|
||||
{
|
||||
cout1 = cout1 - getD1.Sum(x => x.WorkHoursLoss ?? 0);
|
||||
}
|
||||
if (getD2.Count() > 0)
|
||||
{
|
||||
cout1 = cout1 - getD2.Sum(x => x.WorkingHoursLoss ?? 0);
|
||||
}
|
||||
return cout1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取出入记录人工时-月报(项目级别)
|
||||
/// </summary>
|
||||
@@ -343,7 +434,25 @@ namespace FineUIPro.Web.common
|
||||
mapStr += money1.ToString("0.##") + ",";
|
||||
mapStr += money2 + ",";
|
||||
mapStr += item.ShortName + ",";
|
||||
mapStr += item.ProjectId;
|
||||
|
||||
//修改日期 2023-10-30 10:43:57
|
||||
//内容:项目名称、开工日期、完工日期、剩余天数、进度
|
||||
mapStr += item.ProjectId+",";
|
||||
|
||||
mapStr += string.Format("{0:yyyy-MM-dd}", item.StartDate) + ",";
|
||||
if (string.IsNullOrEmpty(item.EndDate.ToString()))
|
||||
{
|
||||
mapStr += ",";
|
||||
}
|
||||
else {
|
||||
//获取剩余天数
|
||||
var residueDay = DateDiff(DateTime.Now, Convert.ToDateTime(item.EndDate)).ToString();
|
||||
mapStr += string.Format("{0:yyyy-MM-dd}", item.EndDate) + ","+residueDay;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
loc.Add(mapStr);
|
||||
}
|
||||
}
|
||||
@@ -358,6 +467,20 @@ namespace FineUIPro.Web.common
|
||||
return JsonConvert.SerializeObject(series);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算时间的相差天数
|
||||
/// </summary>
|
||||
/// <param name="dateStart"></param>
|
||||
/// <param name="dateEnd"></param>
|
||||
/// <returns></returns>
|
||||
private int DateDiff(DateTime dateStart, DateTime dateEnd)
|
||||
{
|
||||
DateTime start = Convert.ToDateTime(dateStart.ToShortDateString());
|
||||
DateTime end = Convert.ToDateTime(dateEnd.ToShortDateString());
|
||||
TimeSpan sp = end.Subtract(start);
|
||||
return sp.Days;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 在施危大工程数量
|
||||
@@ -534,7 +657,7 @@ namespace FineUIPro.Web.common
|
||||
protected string ProjectPersonMc;
|
||||
private void getProjectSitePerson()
|
||||
{
|
||||
var list = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null) && x.Progress != null).ToList();
|
||||
var list = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null)).ToList();
|
||||
foreach (var item in list)
|
||||
{
|
||||
ProjectPersonMc += "'" + item.ShortName + "',";
|
||||
@@ -609,9 +732,9 @@ namespace FineUIPro.Web.common
|
||||
#region 管道材料
|
||||
gdclHtml += " <div class=\"tr\">";
|
||||
var pname = item.ShortName;
|
||||
if (item.ShortName.Length > 4)
|
||||
if (item.ShortName.Length > 3)
|
||||
{
|
||||
pname = item.ShortName.Substring(0, 4) + "...";
|
||||
pname = item.ShortName.Substring(0, 3) + "...";
|
||||
}
|
||||
|
||||
gdclHtml += "<span title=\"" + item.ShortName + "\">" + pname + "</span>";
|
||||
@@ -669,9 +792,9 @@ namespace FineUIPro.Web.common
|
||||
#region 设备材料
|
||||
sbclHtml += " <div class=\"tr\">";
|
||||
pname=item.ShortName;
|
||||
if (item.ShortName.Length > 6)
|
||||
if (item.ShortName.Length > 5)
|
||||
{
|
||||
pname = item.ShortName.Substring(0, 6) + "...";
|
||||
pname = item.ShortName.Substring(0, 5) + "...";
|
||||
}
|
||||
sbclHtml += "<span title=\"" + item.ShortName + "\">" + pname + "</span>";
|
||||
//采购量
|
||||
@@ -717,5 +840,18 @@ namespace FineUIPro.Web.common
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 获取未遂事件数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetNearMissNum()
|
||||
{
|
||||
var result = (from x in Funs.DB.Accident_AccidentPersonRecord
|
||||
join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
|
||||
where x.IsAttempt == "1" && x.CompileDate > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user