using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BLL; namespace FineUIPro.Web.common { public partial class mainProject : PageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Model.SGGLDB db = Funs.DB; //未遂事故 var wsAccidentList1 = from x in db.Accident_AccidentPersonRecord join y in db.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId where y.AccidentTypeName.Contains("未遂") && x.ProjectId == this.CurrUser.LoginProjectId 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("未遂") && x.ProjectId == this.CurrUser.LoginProjectId select x; this.divWS.InnerHtml = (wsAccidentList1.Count() + wsAccidentList2.Count()).ToString(); //隐患整改 var getRectify = db.Check_RectifyNotices.Where(x => x.ProjectId == this.CurrUser.LoginProjectId); this.divYH.InnerHtml = getRectify.Count().ToString(); //安全人工时 int wHours = db.SitePerson_PersonInOutNumber.Where(x => x.ProjectId == this.CurrUser.LoginProjectId).Max(x => x.WorkHours) ?? 0; this.divRGS.InnerHtml = wHours.ToString(); //教育培训 var getTrainRecord = from x in db.EduTrain_TrainRecord where x.ProjectId == this.CurrUser.LoginProjectId select x; this.divPX.InnerHtml = getTrainRecord.Count().ToString(); //质量问题 var checkList = from x in db.Check_CheckControl where x.ProjectId == this.CurrUser.LoginProjectId select x; this.divZLWT.InnerHtml = checkList.Count().ToString(); //质量共检数据 var inspectionManagements = from x in db.ProcessControl_InspectionManagement where x.ProjectId == this.CurrUser.LoginProjectId select x; this.divZLGJ.InnerHtml = inspectionManagements.Count().ToString(); //验收数据 this.divYS.InnerHtml = inspectionManagements.Count(x => x.IsOnceQualified == true).ToString(); //竣工资料 this.divJGZL.InnerHtml = inspectionManagements.Count(x => x.IsOnceQualified == true).ToString(); //NCR var NCRManagements = from x in db.Comprehensive_NCRManagement where x.ProjectId == this.CurrUser.LoginProjectId select x; this.divNCR.InnerHtml = NCRManagements.Count().ToString(); //变更单 var designChangeOrders = from x in db.Comprehensive_DesignChangeOrder where x.ProjectId == this.CurrUser.LoginProjectId select x; this.divBG.InnerHtml = designChangeOrders.Count().ToString(); //工程量完成情况 string date = string.Empty; var quantityCompletions = from x in Funs.DB.View_JDGL_QuantityCompletion where x.ProjectId == this.CurrUser.LoginProjectId orderby x.SortIndex, x.Name select x; if (quantityCompletions.Count() > 0) { string quantityCompletionStr = "
序号
类型
单位
设计数量
计划完成
实际完成
计划完成率
累计计划完成
累计实际完成
累计计划完成率
总完成率
"; int i = 1; foreach (var item in quantityCompletions) { quantityCompletionStr += "
" + i + "
" + item.Name + "
" + item.Unit + "
" + (item.DesignNum != null ? item.DesignNum.Value.ToString("F0") : "0") + "
" + (item.PlanNum != null ? item.PlanNum.Value.ToString("F0") : "0") + "
" + (item.RealNum != null ? item.RealNum.Value.ToString("F0") : "0") + "
" + item.Rate + "
" + item.TotalPlanNum + "
" + item.TotalRealNum + "
" + item.TotalRate + "
" + item.SumRate + "
"; i++; } divGZL.InnerHtml = quantityCompletionStr; if (quantityCompletions.Count() > 0) { if (quantityCompletions.First() != null && quantityCompletions.First().EndDate != null) { date = " (" + string.Format("{0:yyyy-MM}", quantityCompletions.First().EndDate) + ")"; } } } else //低温储罐项目显示低温储罐数据 { var lowTankCompletions = from x in Funs.DB.View_JDGL_LowTankCompletion where x.ProjectId == this.CurrUser.LoginProjectId orderby x.Code select x; string quantityCompletionStr = "
序号
储罐编号
类型
单位
设计数量
计划完成
实际完成
计划完成率
累计计划完成
累计实际完成
累计计划完成率
总完成率
"; int i = 1; foreach (var item in lowTankCompletions) { quantityCompletionStr += "
" + i + "
" + item.Code + "
" + item.Name + "
" + item.Unit + "
" + (item.TotalNum != null ? item.TotalNum.Value.ToString("F0") : "0") + "
" + (item.PlanNum != null ? item.PlanNum.Value.ToString("F0") : "0") + "
" + (item.RealNum != null ? item.RealNum.Value.ToString("F0") : "0") + "
" + item.Rate + "
" + item.TotalPlanNum + "
" + item.TotalRealNum + "
" + item.TotalRate + "
" + item.SumRate + "
"; i++; } divGZL.InnerHtml = quantityCompletionStr; if (lowTankCompletions.Count() > 0) { if (lowTankCompletions.First() != null && lowTankCompletions.First().EndDate != null) { date = " (" + string.Format("{0:yyyy-MM}", lowTankCompletions.First().EndDate) + ")"; } } } divMonth.InnerHtml = "专业工作量表" + date; } } #region 赢得值曲线 protected string Two { get { List series = new List(); Model.BusinessColumn businessColumn = new Model.BusinessColumn(); List listCategories = new List(); businessColumn.title = "赢得值曲线"; var views = (from x in Funs.DB.View_JDGL_ProgressCompletion where x.ProjectId == this.CurrUser.LoginProjectId orderby x.Months select x).ToList(); Model.SingleSerie s = new Model.SingleSerie(); Model.SingleSerie s2 = new Model.SingleSerie(); Model.SingleSerie s3 = new Model.SingleSerie(); Model.SingleSerie s4 = new Model.SingleSerie(); List listdata = new List(); List listdata2 = new List(); List listdata3 = new List(); List listdata4 = new List(); for (int i = 0; i < views.Count; i++) { listCategories.Add(views[i].MonthStr); listdata.Add(Convert.ToDouble(views[i].PlanNum)); listdata2.Add(Convert.ToDouble(views[i].TotalPlanNum)); listdata3.Add(Convert.ToDouble(views[i].RealNum)); listdata4.Add(Convert.ToDouble(views[i].TotalRealNum)); } s.data = listdata; s2.data = listdata2; s3.data = listdata3; s4.data = listdata4; series.Add(s); series.Add(s2); series.Add(s3); series.Add(s4); businessColumn.categories = listCategories; businessColumn.series = series; return JsonConvert.SerializeObject(businessColumn); } } #endregion #region 人力情况 protected string Person { get { Model.SGGLDB db = Funs.DB; List series = new List(); Model.BusinessColumn businessColumn = new Model.BusinessColumn(); List listCategories = new List(); var persons = from x in db.SitePerson_Person where x.ProjectId == this.CurrUser.LoginProjectId && x.IsUsed == true select x; var posts = (from x in persons join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId select y).Distinct(); Model.SingleSerie s = new Model.SingleSerie(); List listdata = new List(); //木工 listCategories.Add("木工"); int workPostCount1 = persons.Count(x => x.WorkPostId == Const.WorkPost_Carpentry); listdata.Add(workPostCount1); //钢筋工 listCategories.Add("钢筋工"); int workPostCount2 = persons.Count(x => x.WorkPostId == Const.WorkPost_SteelWorker); listdata.Add(workPostCount2); //瓦工 listCategories.Add("瓦工"); int workPostCount3 = persons.Count(x => x.WorkPostId == Const.WorkPost_Bricklayer); listdata.Add(workPostCount3); //混凝土工 listCategories.Add("混凝土工"); int workPostCount4 = persons.Count(x => x.WorkPostId == Const.WorkPost_ConcreteWorker); listdata.Add(workPostCount4); //钳工 listCategories.Add("钳工"); int workPostCount5 = persons.Count(x => x.WorkPostId == Const.WorkPost_Fitter1 || x.WorkPostId == Const.WorkPost_Fitter2); listdata.Add(workPostCount5); //焊工 listCategories.Add("焊工"); int workPostCount6 = persons.Count(x => x.WorkPostId == Const.WorkPost_Welder1 || x.WorkPostId == Const.WorkPost_Welder2 || x.WorkPostId == Const.WorkPost_Welder3 || x.WorkPostId == Const.WorkPost_Welder4 || x.WorkPostId == Const.WorkPost_Welder5); listdata.Add(workPostCount6); //铆工 listCategories.Add("铆工"); int workPostCount7 = persons.Count(x => x.WorkPostId == Const.WorkPost_Riveter); listdata.Add(workPostCount7); //管工 listCategories.Add("管工"); int workPostCount8 = persons.Count(x => x.WorkPostId == Const.WorkPost_Foreman); listdata.Add(workPostCount8); //电工 listCategories.Add("电工"); int workPostCount9 = persons.Count(x => x.WorkPostId == Const.WorkPost_Electrician1 || x.WorkPostId == Const.WorkPost_Electrician2 || x.WorkPostId == Const.WorkPost_Electrician3); listdata.Add(workPostCount9); //仪表工 listCategories.Add("仪表工"); int workPostCount10 = persons.Count(x => x.WorkPostId == Const.WorkPost_Instrumentalist); listdata.Add(workPostCount10); //防腐保温工 listCategories.Add("防腐保温工"); int workPostCount11 = persons.Count(x => x.WorkPostId == Const.WorkPost_AnticorrosionWorker); listdata.Add(workPostCount11); //防腐保温工 listCategories.Add("管理人员"); int workPostCount12 = (from x in persons join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId where y.PostType == Const.PostType_1 select x).Count(); listdata.Add(workPostCount12); //其他 listCategories.Add("其他"); int workPostCount13 = persons.Count() - workPostCount1 - workPostCount2 - workPostCount3 - workPostCount4 - workPostCount5 - workPostCount6 - workPostCount7 - workPostCount8 - workPostCount9 - workPostCount10 - workPostCount11 - workPostCount12; listdata.Add(workPostCount13); s.data = listdata; series.Add(s); businessColumn.categories = listCategories; businessColumn.title = persons.Count().ToString(); businessColumn.series = series; return JsonConvert.SerializeObject(businessColumn); } } #endregion #region 关键事项 protected string swiper_One { get { var getGJSX = (from x in Funs.DB.GJSX join y in Funs.DB.Base_QuestionType on x.QuestionTypeID equals y.QuestionTypeID where x.ProjectId == this.CurrUser.LoginProjectId && x.State != "0" orderby x.CreateDate select new { x.GJSXID, x.Detail, x.CreateDate, x.ProjectId, y.QuestionTypeName }).Distinct().Take(20); string strNoticeHtml = string.Empty; var readIds = from x in Funs.DB.Sys_UserRead where x.UserId == this.CurrUser.UserId select x.DataId; foreach (var item in getGJSX) { string url = "../PZHGL/GJSX/GJSXListEdit.aspx?EditType=Edit&Id=" + item.GJSXID; //var attachFile = BLL.AttachFileService.GetAttachFile(item.NoticeId, BLL.Const.ServerNoticeMenuId); //if (attachFile != null && !string.IsNullOrEmpty(attachFile.AttachUrl)) //{ // url = "../" + attachFile.AttachUrl.Split(',')[0].Replace("\\", "/"); //} if (item.QuestionTypeName.Contains("紧急")) { strNoticeHtml += "
  • " + item.Detail + "
    " + string.Format("{0:yyyy-MM-dd}", item.CreateDate) + "
  • "; } else if (item.QuestionTypeName.Contains("重要")) { strNoticeHtml += "
  • " + item.Detail + "
    " + string.Format("{0:yyyy-MM-dd}", item.CreateDate) + "
  • "; } else { strNoticeHtml += "
  • " + item.Detail + "
    " + string.Format("{0:yyyy-MM-dd}", item.CreateDate) + "
  • "; } } return "
      " + strNoticeHtml + "
    "; } } #endregion protected void imgBtn_Click(object sender, EventArgs e) { Model.GJSX gjsx = BLL.GJSXService.GetGJSXById(this.hdNoticeId.Value); if (gjsx != null) { BLL.APIUserService.getSaveUserRead(BLL.Const.GJSXMenuId, gjsx.ProjectId, this.CurrUser.UserId, gjsx.GJSXID); } } } }