diff --git a/SGGL/FineUIPro.Web/CQMS/Solution/EditConstructSolution.aspx.cs b/SGGL/FineUIPro.Web/CQMS/Solution/EditConstructSolution.aspx.cs index 44d331e3..f551f717 100644 --- a/SGGL/FineUIPro.Web/CQMS/Solution/EditConstructSolution.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/Solution/EditConstructSolution.aspx.cs @@ -173,7 +173,7 @@ namespace FineUIPro.Web.CQMS.Solution txtSolutionName.Enabled = false; txtCNProfessional.Enabled = false; txtUnitWork.Enabled = false; - ContactImg = -1; + ContactImg = 0; Panel2.Enabled = false; } //提交版本人多次修改 diff --git a/SGGL/FineUIPro.Web/common/mainProject2.aspx.cs b/SGGL/FineUIPro.Web/common/mainProject2.aspx.cs index 16ec59c2..5eb994b6 100644 --- a/SGGL/FineUIPro.Web/common/mainProject2.aspx.cs +++ b/SGGL/FineUIPro.Web/common/mainProject2.aspx.cs @@ -45,9 +45,13 @@ namespace FineUIPro.Web.common this.divSafeWorkTime.InnerHtml = wHours.ToString(); //本月安全人工时 - int wHoursMonth = db.SitePerson_PersonInOutNumber.Where(x => x.InOutDate > DateTime.Now.AddDays(-Convert.ToInt32(DateTime.Now.Date.Day)) - && x.ProjectId == ProjectId) - .Max(x => x.WorkHours) ?? 0; + int wHoursMonth = 0; + DateTime? sDate = Funs.GetNewDateTime(DateTime.Now.Year.ToString()+"-"+ DateTime.Now.Month.ToString()); + var dayReports = BLL.SitePerson_MonthReportService.getMonthReports(this.ProjectId, sDate); + if (dayReports.Count>0) + { + wHoursMonth = Convert.ToInt32(dayReports[0].DayWorkTime); + } this.divSafeWorkTimeMonth.InnerHtml = wHoursMonth.ToString(); //安全培训累计人员 diff --git a/SGGL/FineUIPro.Web/common/main_new.aspx.cs b/SGGL/FineUIPro.Web/common/main_new.aspx.cs index b80aea12..ce922ece 100644 --- a/SGGL/FineUIPro.Web/common/main_new.aspx.cs +++ b/SGGL/FineUIPro.Web/common/main_new.aspx.cs @@ -34,10 +34,19 @@ namespace FineUIPro.Web.common this.divSafeWorkTime.InnerHtml = wHours.ToString(); //本月安全人工时 - int wHoursMonth = db.SitePerson_PersonInOutNumber.Where(x => x.InOutDate > DateTime.Now.AddDays(-Convert.ToInt32(DateTime.Now.Date.Day))) - .Max(x => x.WorkHours) ?? 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 = 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 = db.EduTrain_TrainRecord.Max(x=>x.TrainPersonNum)??0; this.divSafePersonNum.InnerHtml = getTrainRecord.ToString(); @@ -110,6 +119,50 @@ namespace FineUIPro.Web.common } } + #region 当月人工时 + /// + /// 获取出入记录人工时-月报(项目级别) + /// + /// + public static List getMonthReportsByCompany(DateTime? sDate) + { + Model.SGGLDB db = Funs.DB; + List reports = new List(); + var getAllPersonInOutList = from x in db.SitePerson_PersonInOutNumber + + select x; + if (getAllPersonInOutList.Count() > 0) + { + var getInMonths = (from x in getAllPersonInOutList select new { x.InOutDate.Year, x.InOutDate.Month }).Distinct(); + if (sDate.HasValue) + { + getInMonths = getInMonths.Where(x => x.Year == sDate.Value.Year && x.Month == sDate.Value.Month); + } + foreach (var item in getInMonths) + { + DateTime compileDate = Funs.GetNewDateTimeOrNow(item.Year.ToString() + "-" + item.Month.ToString()); + var getNow = getAllPersonInOutList.Where(x => x.InOutDate.Year == compileDate.Year && x.InOutDate.Month == compileDate.Month).Max(x => x.WorkHours); + if (getNow.HasValue) + { + Model.SitePerson_MonthReport reportItem = new Model.SitePerson_MonthReport + { + MonthReportId = SQLHelper.GetNewID(), + + CompileDate = Funs.GetNewDateTime(item.Year.ToString() + "-" + item.Month.ToString()), + TotalPersonWorkTime = getNow, + }; + DateTime upDate = compileDate.AddMonths(-1); + var getMax = getAllPersonInOutList.Where(x => x.InOutDate.Year == upDate.Year && x.InOutDate.Month == upDate.Month).Max(x => x.WorkHours) ?? 0; + reportItem.DayWorkTime = (getNow ?? 0) - getMax; + reports.Add(reportItem); + } + + } + } + return reports; + } + #endregion + #region 项目信息 protected string Project {