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

323 lines
21 KiB
C#

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 mainIII : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string roleCNs = Request.Params["roleCNs"];
List<string> cns = Funs.GetStrListByStr(roleCNs, ',');
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;
var licenses = from x in db.License_LicenseManager where x.ProjectId == this.CurrUser.LoginProjectId && cns.Contains(x.CNProfessionalId) select x;
this.divZY.InnerHtml = (licenses.Count()).ToString();
//隐患整改
var getRectify = db.Check_RectifyNotices.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && cns.Contains(x.CNProfessionalId));
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 && cns.Contains(x.CNProfessionalId) select x;
this.divPX.InnerHtml = getTrainRecord.Count().ToString();
//质量问题
var checkList = from x in db.Check_CheckControl where x.ProjectId == this.CurrUser.LoginProjectId && cns.Contains(x.CNProfessionalCode) select x;
this.divZLWT.InnerHtml = checkList.Count().ToString();
//质量共检数据
var inspectionManagements = from x in db.ProcessControl_InspectionManagement where x.ProjectId == this.CurrUser.LoginProjectId && cns.Contains(x.CNProfessionalId) select x;
this.divZLGJ.InnerHtml = inspectionManagements.Count().ToString();
//验收数据
this.divYS.InnerHtml = inspectionManagements.Count(x => x.IsOnceQualified == true).ToString();
//焊工过期人数统计
var welders = from x in db.Comprehensive_InspectionPerson
join y in db.Base_Post on x.PostId equals y.PostId
where x.ProjectId == this.CurrUser.LoginProjectId && y.PostName == "焊工" && x.ValidityDate < DateTime.Now && cns.Contains(x.CNProfessionalId)
select x;
this.divHG.InnerHtml = welders.Count().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 && cns.Contains(x.CNProfessionalId) select x;
this.divNCR.InnerHtml = NCRManagements.Count().ToString();
//变更单
var designChangeOrders = from x in db.Comprehensive_DesignChangeOrder where x.ProjectId == this.CurrUser.LoginProjectId && cns.Contains(x.CNProfessionalId) select x;
this.divBG.InnerHtml = designChangeOrders.Count().ToString();
//签证
var siteVisas = from x in db.Comprehensive_SiteVisaManagement where x.ProjectId == this.CurrUser.LoginProjectId && cns.Contains(x.CNProfessionalId) select x;
this.divQZ.InnerHtml = siteVisas.Count().ToString();
//材料到货情况
string contractQuantitySheetsStr = string.Empty;
long projectId = BLL.ProjectService.GetCLProjectCodeByProjectId(this.CurrUser.LoginProjectId);
var contractQuantitySheets = from x in Funs.DB.CLGL_ContractQuantitySheet where x.ProjectId == projectId.ToString() select x;
if (contractQuantitySheets.Count() > 0)
{
contractQuantitySheetsStr = "<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>";
int i = 1;
foreach (var item in contractQuantitySheets)
{
contractQuantitySheetsStr += "<div class='jd-item'><div class='item'>"
+ i + "</div><div class='item'>"
+ item.MaterialUse + "</div><div class='item'>"
+ item.ContractCode + "</div><div class='item'>"
+ item.Major + "</div><div class='item'>"
+ item.MaterialCode + "</div><div class='item'>"
+ item.TagNo + "</div><div class='item'>"
+ item.BuyQuantity + "</div><div class='item'>"
+ item.DeviceCode + "</div><div class='item'>"
+ item.MainItemCode + "</div><div class='item'>"
+ item.UnitName + "</div><div class='item'>"
+ item.Remark + "</div></div>";
i++;
}
}
this.divGZL.InnerHtml= contractQuantitySheetsStr;
this.hdContractQuantitySheets.Value = contractQuantitySheetsStr;
//材料出库情况
string materialRecordsStr = string.Empty;
var materialRecords= from x in db.CLGL_PickMaterialRecord where x.ProjectId == projectId.ToString() select x;
if (contractQuantitySheets.Count() > 0)
{
materialRecordsStr = "<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 class='item jd-title'>装置号</div><div class='item jd-title'>主项号</div><div class='item jd-title'>发料备注</div></div>";
int i = 1;
foreach (var item in materialRecords)
{
materialRecordsStr += "<div class='jd-item'><div class='item'>"
+ i + "</div><div class='item'>"
+ item.PickCode + "</div><div class='item'>"
+ (item.PickDate.HasValue?string.Format("{0:yyyy-MM-dd}", item.PickDate.Value) :"") + "</div><div class='item'>"
+ item.PickUnit + "</div><div class='item'>"
+ (item.PickLimitDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.PickLimitDate.Value) : "") + "</div><div class='item'>"
+ item.Major + "</div><div class='item'>"
+ item.MaterialCode + "</div><div class='item'>"
+ item.TagNo + "</div><div class='item'>"
+ item.ClaimQuantity + "</div><div class='item'>"
+ item.ApproveQuantity + "</div><div class='item'>"
+ item.ActualQuantity + "</div><div class='item'>"
+ item.DeviceCode + "</div><div class='item'>"
+ item.MainItemCode + "</div><div class='item'>"
+ item.Remark + "</div></div>";
i++;
}
}
this.hdMaterialRecords.Value = materialRecordsStr;
}
}
protected string swiper_One1
{
get
{
string contractQuantitySheetsStr = string.Empty;
long projectId = BLL.ProjectService.GetCLProjectCodeByProjectId(this.CurrUser.LoginProjectId);
var contractQuantitySheets = from x in Funs.DB.CLGL_ContractQuantitySheet where x.ProjectId == projectId.ToString() select x;
if (contractQuantitySheets.Count() > 0)
{
contractQuantitySheetsStr = "<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>";
int i = 1;
foreach (var item in contractQuantitySheets)
{
contractQuantitySheetsStr += "<div class='jd-item'><div class='item'>"
+ i + "</div><div class='item'>"
+ item.MaterialUse + "</div><div class='item'>"
+ item.ContractCode + "</div><div class='item'>"
+ item.Major + "</div><div class='item'>"
+ item.MaterialCode + "</div><div class='item'>"
+ item.TagNo + "</div><div class='item'>"
+ item.BuyQuantity + "</div><div class='item'>"
+ item.DeviceCode + "</div><div class='item'>"
+ item.MainItemCode + "</div><div class='item'>"
+ item.UnitName + "</div><div class='item'>"
+ item.Remark + "</div></div>";
i++;
}
}
return contractQuantitySheetsStr;
}
}
#region 线
protected string Two
{
get
{
List<Model.SingleSerie> series = new List<Model.SingleSerie>();
Model.BusinessColumn businessColumn = new Model.BusinessColumn();
List<string> listCategories = new List<string>();
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<double> listdata = new List<double>();
List<double> listdata2 = new List<double>();
List<double> listdata3 = new List<double>();
List<double> listdata4 = new List<double>();
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
{
string roleCNs = Request.Params["roleCNs"];
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;
persons = persons.Where(x => roleCNs.Split(',').Contains(x.MainCNProfessionalId));
Model.SingleSerie s = new Model.SingleSerie();
List<double> listdata = new List<double>();
//木工
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
{
string roleCNs = Request.Params["roleCNs"];
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" && roleCNs.Split(',').Contains(x.CNProfessional_ID)
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;
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);
}
}
}
}