diff --git a/SGGL/FineUIPro.Web/HSSE/Manager/ManagerMonthC.aspx.cs b/SGGL/FineUIPro.Web/HSSE/Manager/ManagerMonthC.aspx.cs index 666aad99..43a1f5cb 100644 --- a/SGGL/FineUIPro.Web/HSSE/Manager/ManagerMonthC.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/Manager/ManagerMonthC.aspx.cs @@ -25,7 +25,7 @@ namespace FineUIPro.Web.HSSE.Manager { ////权限按钮方法 this.GetButtonPower(); - + this.txtReportYear.Text = string.Format("{0:yyyy}", DateTime.Now); // 绑定表格 //BindGrid(); @@ -43,7 +43,8 @@ namespace FineUIPro.Web.HSSE.Manager this.tvControlItem.Nodes.Add(rootNode); var report = from x in Funs.DB.HSSE_MonthReport - where x.ProjectId == CurrUser.LoginProjectId orderby x.Years + where x.ProjectId == CurrUser.LoginProjectId + orderby x.Years select x; if (report.Count() > 0) { @@ -75,12 +76,12 @@ namespace FineUIPro.Web.HSSE.Manager LEFT JOIN (SELECT a.ReportItem,ISNULL(SUM(ISNULL(a.ProjectTotal,0)),0) AS SumProjectTotal FROM dbo.HSSE_MonthReportItem a LEFT JOIN dbo.HSSE_MonthReport b ON b.MonthReportId = a.MonthReportId - WHERE b.ProjectId=@ProjectId AND b.Years < "+ this.tvControlItem.SelectedNode.Text+ @" + WHERE b.ProjectId=@ProjectId AND b.Years < " + this.tvControlItem.SelectedNode.Text + @" GROUP BY a.ReportItem )t ON t.ReportItem = item.ReportItem WHERE r.ProjectId=@ProjectId AND r.MonthReportId=@MonthReportId ORDER BY item.Sort"; List listStr = new List(); - listStr.Add(new SqlParameter("@ProjectId",CurrUser.LoginProjectId)); + listStr.Add(new SqlParameter("@ProjectId", CurrUser.LoginProjectId)); listStr.Add(new SqlParameter("@MonthReportId", tvControlItem.SelectedNodeID)); SqlParameter[] parameter = listStr.ToArray(); @@ -95,21 +96,17 @@ namespace FineUIPro.Web.HSSE.Manager protected void Grid1_RowDataBound(object sender, GridRowEventArgs e) { - int editMonth = GetCurMonth(); - int cm = 12; - if (DateTime.Now.Year.ToString()== tvControlItem.SelectedNode.Text) - { - cm = DateTime.Now.Month; - } + int cm = GetCurMonth(); + for (int i = 1; i <= 12; i++) { - if (i != editMonth) + if (i != cm) { - string monthC = "Month" + i.ToString(); - RenderField month = Grid1.FindColumn(monthC) as RenderField; - e.CellCssClasses[month.ColumnIndex] = "f-grid-cell-uneditable"; + //string monthC = "Month" + i.ToString(); + //RenderField month = Grid1.FindColumn(monthC) as RenderField; + //e.CellCssClasses[month.ColumnIndex] = "f-grid-cell-uneditable"; } - // else + else { string monthC = "Month" + i.ToString(); RenderField month = Grid1.FindColumn(monthC) as RenderField; @@ -123,7 +120,7 @@ namespace FineUIPro.Web.HSSE.Manager join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId where x.ProjectId == this.CurrUser.LoginProjectId && y.UnitCode == "CHENGDA" select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = person.Count(); } @@ -136,7 +133,7 @@ namespace FineUIPro.Web.HSSE.Manager where x.ProjectId == this.CurrUser.LoginProjectId && y.UnitCode == "CHENGDA" && z.WorkPostName.Contains("安全") select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = person.Count(); } @@ -147,7 +144,7 @@ namespace FineUIPro.Web.HSSE.Manager join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId where x.ProjectId == this.CurrUser.LoginProjectId && y.UnitCode != "CHENGDA" select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = person.Count(); } @@ -160,21 +157,21 @@ namespace FineUIPro.Web.HSSE.Manager where x.ProjectId == this.CurrUser.LoginProjectId && y.UnitCode != "CHENGDA" && z.WorkPostName.Contains("安全") select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = person.Count(); } } - + if (e.RowIndex == 4 || e.RowIndex == 5) // 人工时数,安全生产人工时数 { DateTime? sDate = Convert.ToDateTime(tvControlItem.SelectedNode.Text + "-" + i.ToString()); var dayReports = BLL.SitePerson_MonthReportService.getMonthReports(this.CurrUser.LoginProjectId, sDate); - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "" && dayReports.Count() > 0) + if (e.Values[month.ColumnIndex].ToString() == "" && dayReports.Count() > 0) { e.Values[month.ColumnIndex] = dayReports.First().DayWorkTime; } - else if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + else if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = 0; } @@ -184,10 +181,10 @@ namespace FineUIPro.Web.HSSE.Manager if (e.RowIndex == 6) // HSE记录事故数量 { var accident = from x in Funs.DB.Accident_AccidentPersonRecord - where x.ProjectId == this.CurrUser.LoginProjectId - && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1) - select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + where x.ProjectId == this.CurrUser.LoginProjectId + && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1) + select x; + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = accident.Count(); } @@ -198,9 +195,9 @@ namespace FineUIPro.Web.HSSE.Manager var accident = from x in Funs.DB.Accident_AccidentPersonRecord where x.ProjectId == this.CurrUser.LoginProjectId && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1) - && x.Injury=="1" + && x.Injury == "1" select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = accident.Count(); } @@ -213,7 +210,7 @@ namespace FineUIPro.Web.HSSE.Manager && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1) && x.Injury == "2" select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = accident.Count(); } @@ -226,7 +223,7 @@ namespace FineUIPro.Web.HSSE.Manager && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1) && x.Injury == "3" select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = accident.Count(); } @@ -238,7 +235,7 @@ namespace FineUIPro.Web.HSSE.Manager where x.ProjectId == this.CurrUser.LoginProjectId && x.AccidentDate >= startDate && x.AccidentDate < startDate.AddMonths(1) select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = accident.Count(); } @@ -246,14 +243,14 @@ namespace FineUIPro.Web.HSSE.Manager if (e.RowIndex == 11) // 现场环境事故 { - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = "0"; } } if (e.RowIndex == 12) // 现场发生设备材料盗窃案件 { - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = "0"; } @@ -262,10 +259,10 @@ namespace FineUIPro.Web.HSSE.Manager if (e.RowIndex == 13) // HSE周会 { var weekMeeting = from x in Funs.DB.Meeting_WeekMeeting - where x.ProjectId == this.CurrUser.LoginProjectId - && x.WeekMeetingDate >= startDate && x.WeekMeetingDate < startDate.AddMonths(1) - select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + where x.ProjectId == this.CurrUser.LoginProjectId + && x.WeekMeetingDate >= startDate && x.WeekMeetingDate < startDate.AddMonths(1) + select x; + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = weekMeeting.Count(); } @@ -277,7 +274,7 @@ namespace FineUIPro.Web.HSSE.Manager where x.ProjectId == this.CurrUser.LoginProjectId && x.AttendMeetingDate >= startDate && x.AttendMeetingDate < startDate.AddMonths(1) select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = weekMeeting.Count(); } @@ -285,7 +282,7 @@ namespace FineUIPro.Web.HSSE.Manager if (e.RowIndex == 15) // 施工现场HSE联检 { - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = "0"; } @@ -294,10 +291,10 @@ namespace FineUIPro.Web.HSSE.Manager if (e.RowIndex == 16) // 发布HSE整改通知书 { var check = from x in Funs.DB.Check_RectifyNotices - where x.ProjectId == this.CurrUser.LoginProjectId - && x.CheckedDate >= startDate && x.CheckedDate < startDate.AddMonths(1) - select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + where x.ProjectId == this.CurrUser.LoginProjectId + && x.CheckedDate >= startDate && x.CheckedDate < startDate.AddMonths(1) + select x; + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = check.Count(); } @@ -306,10 +303,10 @@ namespace FineUIPro.Web.HSSE.Manager if (e.RowIndex == 17) // 关闭HSE整改通知书 { var check = from x in Funs.DB.Check_RectifyNotices - where x.ProjectId == this.CurrUser.LoginProjectId - && x.CompleteDate >= startDate && x.CompleteDate < startDate.AddMonths(1) - select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + where x.ProjectId == this.CurrUser.LoginProjectId + && x.CompleteDate >= startDate && x.CompleteDate < startDate.AddMonths(1) + select x; + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = check.Count(); } @@ -321,7 +318,7 @@ namespace FineUIPro.Web.HSSE.Manager where x.ProjectId == this.CurrUser.LoginProjectId && x.PunishNoticeDate >= startDate && x.PunishNoticeDate < startDate.AddMonths(1) select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = check.Count(); } @@ -330,10 +327,10 @@ namespace FineUIPro.Web.HSSE.Manager if (e.RowIndex == 19) // 发布应急预案 { var em = from x in Funs.DB.Emergency_EmergencyList - where x.ProjectId == this.CurrUser.LoginProjectId - && x.CompileDate >= startDate && x.CompileDate < startDate.AddMonths(1) - select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + where x.ProjectId == this.CurrUser.LoginProjectId + && x.CompileDate >= startDate && x.CompileDate < startDate.AddMonths(1) + select x; + if (e.Values[month.ColumnIndex].ToString() == "") { e.Values[month.ColumnIndex] = em.Count(); } @@ -342,10 +339,10 @@ namespace FineUIPro.Web.HSSE.Manager if (e.RowIndex == 20) // 人员培训 { var edu = from x in Funs.DB.EduTrain_TrainRecord - where x.ProjectId == this.CurrUser.LoginProjectId - && x.TrainStartDate >= startDate && x.TrainStartDate < startDate.AddMonths(1) - select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + where x.ProjectId == this.CurrUser.LoginProjectId + && x.TrainStartDate >= startDate && x.TrainStartDate < startDate.AddMonths(1) + select x; + if (e.Values[month.ColumnIndex].ToString() == "") { if (edu.Count() > 0) { @@ -364,9 +361,9 @@ namespace FineUIPro.Web.HSSE.Manager where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileDate >= startDate && x.CompileDate < startDate.AddMonths(1) select x; - if (i <= cm && e.Values[month.ColumnIndex].ToString() == "") + if (e.Values[month.ColumnIndex].ToString() == "") { - if (equ.Count()>0) + if (equ.Count() > 0) { e.Values[month.ColumnIndex] = equ.Sum(x => x.EquipmentSafetyListCount); } @@ -404,10 +401,10 @@ namespace FineUIPro.Web.HSSE.Manager + Convert.ToInt32(e.Values[month12.ColumnIndex].ToString() != "" ? e.Values[month12.ColumnIndex] : 0); // 项目总计 e.Values[projectTotal.ColumnIndex] = Convert.ToInt32(e.Values[yearTotal.ColumnIndex]) + Convert.ToInt32(e.Values[sumProjectTotal.ColumnIndex]); - + } } - + } #endregion @@ -608,58 +605,58 @@ namespace FineUIPro.Web.HSSE.Manager JArray editReport = Grid1.GetMergedData(); if (editReport.Count > 0) { - if (cm != 0) + if (true || cm != 0) { for (int i = 0; i < editReport.Count; i++) { JObject objects = (JObject)editReport[i]; string monthReportItemId = objects["values"]["MonthReportItemId"].ToString(); Model.HSSE_MonthReportItem item = Funs.DB.HSSE_MonthReportItem.FirstOrDefault(x => x.MonthReportItemId == monthReportItemId); - if (cm == 1) + // if (cm == 1) { item.Month1 = Funs.GetNewInt(objects["values"]["Month1"].ToString()); } - if (cm == 2) + // if (cm == 2) { item.Month2 = Funs.GetNewInt(objects["values"]["Month2"].ToString()); } - if (cm == 3) + // if (cm == 3) { item.Month3 = Funs.GetNewInt(objects["values"]["Month3"].ToString()); } - if (cm == 4) + // if (cm == 4) { item.Month4 = Funs.GetNewInt(objects["values"]["Month4"].ToString()); } - if (cm == 5) + // if (cm == 5) { item.Month5 = Funs.GetNewInt(objects["values"]["Month5"].ToString()); } - if (cm == 6) + // if (cm == 6) { item.Month6 = Funs.GetNewInt(objects["values"]["Month6"].ToString()); } - if (cm == 7) + //if (cm == 7) { item.Month7 = Funs.GetNewInt(objects["values"]["Month7"].ToString()); } - if (cm == 8) + // if (cm == 8) { item.Month8 = Funs.GetNewInt(objects["values"]["Month8"].ToString()); } - if (cm == 9) + //if (cm == 9) { item.Month9 = Funs.GetNewInt(objects["values"]["Month9"].ToString()); } - if (cm == 10) + // if (cm == 10) { item.Month10 = Funs.GetNewInt(objects["values"]["Month10"].ToString()); } - if (cm == 11) + //if (cm == 11) { item.Month11 = Funs.GetNewInt(objects["values"]["Month11"].ToString()); } - if (cm == 12) + //if (cm == 12) { item.Month12 = Funs.GetNewInt(objects["values"]["Month12"].ToString()); } @@ -698,7 +695,7 @@ namespace FineUIPro.Web.HSSE.Manager { cm = m; } - if (nd <= 4) + if (nd <= 20) { cm = lm; } diff --git a/SGGL/FineUIPro.Web/Web.config b/SGGL/FineUIPro.Web/Web.config index b37d472d..09ec6db5 100644 --- a/SGGL/FineUIPro.Web/Web.config +++ b/SGGL/FineUIPro.Web/Web.config @@ -1,4 +1,4 @@ - + -
+
- + - + - - - - - + + + + + - - - + + + - + - - - + + + - + - + - - - + + + - - + + - - - + + + - - + + - + - - + + - - + + - - - + + + - + - + - - + + - + - - - + + + - - - - + + + + - + - + - + - + - + - + - - - - + + + + - + - - + + @@ -150,16 +150,16 @@ - - + + - - + + - - + +