CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/common/mainProject.aspx.cs

156 lines
9.7 KiB
C#
Raw Normal View History

2021-04-30 10:28:37 +08:00
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 inspectionManagements = from x in db.ProcessControl_InspectionManagement where x.ProjectId == this.CurrUser.LoginProjectId select x;
this.divZLWT.InnerHtml = inspectionManagements.Count().ToString();
//质量共检数据
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 quantityCompletionStr = "<div class='jd-item'><div class='item jd-title'>序号</div><div class='item jd-title'>类型</div><div class='item jd-title'>单位</div><div class='item jd-title'>设计数量</div><div class='item jd-title'>计划完成</div><div class='item jd-title'>实际完成</div><div class='item jd-title'>计划完成率</div><div class='item jd-title'>累计计划完成</div><div class='item jd-title'>累计实际完成</div><div class='item jd-title'>累计计划完成率</div><div class='item jd-title'>总完成率</div></div>";
//DateTime months = Convert.ToDateTime(DateTime.Now.Year + "-" + DateTime.Now.Month + "-01");
//var quantityCompletions = from x in Funs.DB.View_JDGL_QuantityCompletion where x.ProjectId == this.CurrUser.LoginProjectId && x.Months == months orderby x.SortIndex,x.Name select x;
//int i = 1;
//foreach (var item in quantityCompletions)
//{
// quantityCompletionStr += "<div class='jd-item'><div class='item'>"
// + i + "</div><div class='item'>"
// + item.Name + "</div><div class='item'>"
// + item.Unit + "</div><div class='item'>"
// + item.DesignNum + "</div><div class='item'>"
// + item.PlanNum + "</div><div class='item'>"
// + item.RealNum + "</div><div class='item'>"
// + item.Rate + "</div><div class='item'>"
// + item.TotalPlanNum + "</div><div class='item'>"
// + item.TotalRealNum + "</div><div class='item'>"
// + item.TotalRate + "</div><div class='item'>"
// + item.SumRate + "</div></div>";
// i++;
//}
//divGZL.InnerHtml = quantityCompletionStr;
}
}
#region
protected string Person
{
get
{
Model.SGGLDB db = Funs.DB;
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
List<string> listCategories = new List<string>();
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().ToList();
Model.SingleSerie s = new Model.SingleSerie();
List<double> listdata = new List<double>();
foreach (var post in posts)
{
listCategories.Add(post.WorkPostName);
int workPostCount = persons.Count(x => x.WorkPostId == post.WorkPostId);
listdata.Add(workPostCount);
}
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
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 += "<li data-id=\"" + url + "\" notice-id=\"" + item.GJSXID + "\" class=\"c-item swiper-slide\"><div class=\"tit\" title=\"" + item.Detail + "\"><div class=\"flex\" ><div class=\"tit-t flex1\" style=\"color:red;\">" + item.Detail + "</div><div class=\"tit-v\">" + string.Format("{0:yyyy-MM-dd}", item.CreateDate) + "</div></div></div></li>";
}
else if (item.QuestionTypeName.Contains("重要"))
{
strNoticeHtml += "<li data-id=\"" + url + "\" notice-id=\"" + item.GJSXID + "\" class=\"c-item swiper-slide\"><div class=\"tit\" title=\"" + item.Detail + "\"><div class=\"flex\" ><div class=\"tit-t flex1\" style=\"color:yellow;\">" + item.Detail + "</div><div class=\"tit-v\">" + string.Format("{0:yyyy-MM-dd}", item.CreateDate) + "</div></div></div></li>";
}
else
{
strNoticeHtml += "<li data-id=\"" + url + "\" notice-id=\"" + item.GJSXID + "\" class=\"c-item swiper-slide\"><div class=\"tit\" title=\"" + item.Detail + "\"><div class=\"flex\" ><div class=\"tit-t flex1\">" + item.Detail + "</div><div class=\"tit-v\">" + string.Format("{0:yyyy-MM-dd}", item.CreateDate) + "</div></div></div></li>";
}
}
return "<ul class=\"content-ul swiper-wrapper\">" + strNoticeHtml + "</ul>";
}
}
#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);
}
}
}
}