818 lines
37 KiB
C#
818 lines
37 KiB
C#
using BLL;
|
||
using FineUIPro.Web.DataShow;
|
||
using Microsoft.Office.Interop.Word;
|
||
using Model;
|
||
using Newtonsoft.Json;
|
||
using NPOI.SS.Formula.Functions;
|
||
using NPOI.XWPF.UserModel;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Configuration;
|
||
using System.Data;
|
||
using System.Data.SqlClient;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using System.Runtime.InteropServices.ComTypes;
|
||
using System.Web.Services;
|
||
|
||
namespace FineUIPro.Web.common
|
||
{
|
||
public partial class mainProject : PageBase
|
||
{
|
||
#region 项目ID
|
||
/// <summary>
|
||
/// 项目ID
|
||
/// </summary>
|
||
public string ProjectId
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["ProjectId"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["ProjectId"] = value;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
this.ProjectId = string.Empty;
|
||
if (this.CurrUser != null)
|
||
{
|
||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||
}
|
||
/// 获取安全人工时
|
||
//getPersonWorkTime();
|
||
///劳务统计
|
||
getSitePerson();
|
||
///项目概况
|
||
getProjectInfo();
|
||
/// 获取质量问题
|
||
getCQMSProblem();
|
||
///
|
||
getSchedule();
|
||
this.divQualityWarningNum.InnerHtml = (from x in Funs.DB.QualityAudit_PersonQuality
|
||
join y in Funs.DB.SitePerson_Person on x.PersonId equals y.PersonId
|
||
where y.ProjectId == this.ProjectId && x.LimitDate < DateTime.Now
|
||
select x).Count().ToString();
|
||
///产值
|
||
getOutputValues();
|
||
///获取天气
|
||
getWeatherValues();
|
||
/// 获取风险管控
|
||
getHazard();
|
||
//整改率、合格率、焊接一次合格率
|
||
getRate();
|
||
}
|
||
}
|
||
|
||
protected void DatePicker1_TextChanged(object sender, EventArgs e)
|
||
{
|
||
|
||
}
|
||
|
||
#region 获取项目劳务数据
|
||
[WebMethod]
|
||
public static Object GetServiceData(string ProjectId, string startdate, string enddate)
|
||
{
|
||
DateTime startd = Funs.GetNewDateTimeOrNow(string.Format("{0} {1}", startdate, "00:00:00"));
|
||
DateTime endd = Funs.GetNewDateTimeOrNow(string.Format("{0} {1}", enddate, "23:59:59"));
|
||
int m_count = Funs.DB.Project_ProjectUser.Count(x => x.ProjectId == ProjectId);
|
||
int job_count = (from x in Funs.DB.Meeting_ClassMeeting
|
||
where x.ProjectId == ProjectId && x.ClassMeetingDate >= startd && x.ClassMeetingDate <= endd
|
||
|
||
select new Model.MeetingItem
|
||
{
|
||
AttentPersonNum = x.AttentPersonNum ?? 0,
|
||
|
||
}).ToList().Sum(s => s.AttentPersonNum);
|
||
|
||
return new {
|
||
m_count = m_count,
|
||
job_count = job_count,
|
||
all_count = job_count + m_count,
|
||
};
|
||
}
|
||
#endregion
|
||
|
||
|
||
#region 按项目时间段获取安全问题统计
|
||
[WebMethod]
|
||
public static Object GetSafetyProblemStatistics(string ProjectId, string startdate, string enddate)
|
||
{
|
||
DateTime startd = Funs.GetNewDateTimeOrNow(string.Format("{0} {1}", startdate, "00:00:00"));
|
||
DateTime endd = Funs.GetNewDateTimeOrNow(string.Format("{0} {1}", enddate, "23:59:59"));
|
||
// 日常巡检总数
|
||
List<Model.HSSE_Hazard_HazardRegister > HAllList = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId == ProjectId&&x.ProblemTypes == "1"&& x.CheckTime > startd&& x.CheckTime < endd).ToList();
|
||
int HAllCount = HAllList.Where(x=>x.States != "4").Count();
|
||
int HDoneCount = HAllList.Where(x => x.States == "3").Count();
|
||
int HUnDoneCount = HAllCount - HDoneCount;
|
||
// 专项检查
|
||
List<Model.Inspect_InspectionItem> SpecialList = (from x in Funs.DB.Inspect_InspectionItem
|
||
join i in Funs.DB.Inspect_Inspection on x.InspectionId equals i.InspectionId
|
||
where i.ProjectId == ProjectId && i.InspectType == "1" && x.CompileTime > startd && x.CompileTime < endd
|
||
select new Model.Inspect_InspectionItem()).ToList();
|
||
int SAllCount = SpecialList.Count();
|
||
int SDoneCount = SpecialList.Where(x => x.States == "3").Count();
|
||
int SUnDoneCount = SAllCount - SDoneCount;
|
||
|
||
// 检查列表
|
||
var query =
|
||
(from hsse in Funs.DB.HSSE_Hazard_HazardRegister
|
||
where hsse.RectifyName != null && hsse.ProjectId == ProjectId && hsse.RegisterDate> startd && hsse.RegisterDate < endd
|
||
group hsse by hsse.RectifyName into g1
|
||
select new { type = g1.Key, count = g1.Count() }).Union((from i in Funs.DB.Inspect_Inspection
|
||
join itm in Funs.DB.Inspect_InspectionItem on i.InspectionId equals itm.InspectionId
|
||
where i.ProblemTypeName != null && i.ProjectId == ProjectId && i.CreateTime > startd && i.CreateTime < endd && i.InspectType == "1"
|
||
group i by i.ProblemTypeName into g2
|
||
select new { type = g2.Key, count = g2.Count() })).ToList();
|
||
|
||
|
||
return new
|
||
{
|
||
AllCount = HAllCount+ SAllCount,
|
||
DoneCount = HDoneCount+ SDoneCount,
|
||
UnDoneCount = HUnDoneCount+ SUnDoneCount,
|
||
CheckList = query
|
||
};
|
||
}
|
||
#endregion
|
||
|
||
#region 待办事项
|
||
protected string swiper_One
|
||
{
|
||
get
|
||
{
|
||
var getDataList = Funs.DB.Sp_APP_GetToDoItems(this.CurrUser.LoginProjectId, CurrUser.UserId).ToList();
|
||
string strNoticeHtml = string.Empty;
|
||
foreach (var item in getDataList)
|
||
{
|
||
string url = item.PCUrl;
|
||
strNoticeHtml += "<li data-id=\"" + url + "\" notice-id=\"" + item.DataId + "\" class=\"c-item swiper-slide\"><div class=\"tit\" style=\"color:#63CAFF;\" title=\"" + item.MenuName + "\"><div class=\"flex\" ><div class=\"tit-t flex1\">" + item.MenuName + "</div><div class=\"tit-v\">" + string.Format("{0:yyyy-MM-dd}", item.DataTime) + "</div></div></div></li>";
|
||
}
|
||
return "<ul class=\"content-ul swiper-wrapper\">" + strNoticeHtml + "</ul>";
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 安全人工时
|
||
/// <summary>
|
||
/// 获取安全人工时
|
||
/// </summary>
|
||
private void getPersonWorkTime()
|
||
{
|
||
var monthReportB = from y in Funs.DB.Manager_MonthReportB
|
||
where y.ProjectId == this.CurrUser.LoginProjectId
|
||
orderby y.Months descending
|
||
select y.MonthReportId;
|
||
//var getMax = from x in Funs.DB.Manager_ManhoursSortB
|
||
// where x.MonthReportId == monthReportB.FirstOrDefault()
|
||
// select x;
|
||
int wHours = 0;
|
||
|
||
//wHours = Convert.ToInt32(getMax.Sum(x => x.TotalManhoursTotal) ?? 0);
|
||
|
||
//if (wHours > 0)
|
||
//{
|
||
// //this.divSafeWorkTime.InnerHtml = ((wHours % 100000000) / 10000000).ToString() + ((wHours % 10000000) / 1000000).ToString() + ((wHours % 1000000) / 100000).ToString()
|
||
// // + ((wHours % 100000) / 10000).ToString() + ((wHours % 10000) / 1000).ToString() + ((wHours % 1000) / 100).ToString() + ((wHours % 100) / 10).ToString() + (wHours % 10).ToString();
|
||
// this.divSafeWorkTime.InnerHtml = wHours.ToString("N0");
|
||
//}
|
||
var getMax = from x in Funs.DB.SitePerson_DayReportDetail
|
||
join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId
|
||
where y.ProjectId == this.CurrUser.LoginProjectId
|
||
select x;
|
||
if (getMax.Count() > 0)
|
||
{
|
||
wHours = Convert.ToInt32(getMax.Sum(x => x.PersonWorkTime) ?? 0);
|
||
}
|
||
///整改单
|
||
var getRectify = from x in Funs.DB.Check_RectifyNotices
|
||
where x.ProjectId == this.ProjectId && x.States != Const.State_0 && x.States != null
|
||
select x;
|
||
int allcout = getRectify.Count();
|
||
if (allcout > 0)
|
||
{
|
||
|
||
int ccount = getRectify.Where(x => x.States == Const.State_5).Count();
|
||
}
|
||
|
||
var environment = Funs.DB.Environmental_EnvironmentalMonitoring.Where(x => x.ProjectId == CurrUser.LoginProjectId).OrderByDescending(x => x.CompileDate).FirstOrDefault();
|
||
if (environment != null)
|
||
{
|
||
try
|
||
{
|
||
divHJ1.InnerHtml = environment.Tem.Value.ToString("#.##");
|
||
divHJ2.InnerHtml = environment.Noise.Value.ToString("#.##");
|
||
divHJ3.InnerHtml = environment.Hum.Value.ToString("#.##");
|
||
divHJ4.InnerHtml = environment.Pm25.Value.ToString("#.##");
|
||
divHJ5.InnerHtml = environment.Ws.Value.ToString("#.##");
|
||
divHJ6.InnerHtml = environment.Pm10.Value.ToString("#.##");
|
||
}
|
||
catch (Exception ex) { }
|
||
}
|
||
else
|
||
{
|
||
divHJ1.InnerHtml = "0";
|
||
divHJ2.InnerHtml = "0";
|
||
divHJ3.InnerHtml = "0";
|
||
divHJ4.InnerHtml = "0";
|
||
divHJ5.InnerHtml = "0";
|
||
divHJ6.InnerHtml = "0";
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 劳务统计
|
||
protected string WorkPostS;
|
||
protected string InPostCounts;
|
||
protected string InDutyCounts;
|
||
/// <summary>
|
||
/// 劳务统计
|
||
/// </summary>
|
||
private void getSitePerson()
|
||
{
|
||
try
|
||
{
|
||
int AllCount = 0;
|
||
int MCount = 0;
|
||
//var getallin = APIPageDataService.getPersonInOutNum(this.ProjectId, DateTime.Now.AddDays(-1));
|
||
DateTime dateValue = DateTime.Now.AddDays(-1);
|
||
List<Model.PageDataPersonInOutItem> getallin = new List<Model.PageDataPersonInOutItem>();
|
||
var getInMaxs = from x in Funs.DB.SitePerson_Person
|
||
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
|
||
where x.ProjectId == this.CurrUser.LoginProjectId && x.IsUsed == true
|
||
select new Model.PageDataPersonInOutItem
|
||
{
|
||
PersonId = x.PersonId,
|
||
PostType = y.PostType,
|
||
WorkPostId = x.WorkPostId,
|
||
IdentityCard = x.IdentityCard
|
||
|
||
};
|
||
if (getInMaxs.Count() > 0)
|
||
{
|
||
getallin = getInMaxs.Distinct().ToList();
|
||
}
|
||
var AllInOut = (from x in Funs.DB.T_d_EmployInOutRecord
|
||
join y in Funs.DB.SitePerson_Person on new { ss1 = x.ProjectId, ss = x.IDCardNo } equals new { ss1 = y.ProjectId, ss = y.IdentityCard }
|
||
where y.ProjectId == this.CurrUser.LoginProjectId && y.IsUsed == true && x.ProjectId == this.CurrUser.LoginProjectId && x.RecordDate.Value == DateTime.Now.Date
|
||
select x.IDCardNo).Distinct();
|
||
AllCount = AllInOut.Count();
|
||
if (AllCount > 0)
|
||
{
|
||
|
||
HashSet<string> idCardNoSet = new HashSet<string>();
|
||
foreach (string idCardNo in AllInOut)
|
||
{
|
||
idCardNoSet.Add(idCardNo);
|
||
}
|
||
foreach (var i in getallin)
|
||
{
|
||
if (i.PostType == Const.PostType_1 && idCardNoSet.Contains(i.IdentityCard))
|
||
{
|
||
MCount++;
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
|
||
WorkPostS = "[]";
|
||
InPostCounts = "[]";
|
||
InDutyCounts = "[]";
|
||
List<int> InPostCountList = new List<int>();
|
||
List<int> InDutyCountList = new List<int>();
|
||
List<string> worksList = new List<string>();
|
||
//if (this.CurrUser.UserId != Const.hfnbdId)
|
||
//{
|
||
var getPersons = Funs.DB.SitePerson_Person.Where(x => x.ProjectId == this.ProjectId && x.IsUsed == true && x.InTime <= DateTime.Now
|
||
&& !x.OutTime.HasValue);
|
||
if (getPersons.Count() > 0)
|
||
{
|
||
var getWorkIds = getPersons.Where(x => x.WorkPostId != null).Select(x => x.WorkPostId).Distinct();
|
||
if (getWorkIds.Count() > 0)
|
||
{
|
||
foreach (var item in getWorkIds)
|
||
{
|
||
worksList.Add(WorkPostService.getWorkPostNameById(item));
|
||
int isPost = getPersons.Where(x => x.WorkPostId == item).Count();
|
||
InPostCountList.Add(isPost);
|
||
int inDuty = 0;
|
||
if (getallin.Count() > 0)
|
||
{
|
||
inDuty = getallin.Where(x => x.WorkPostId == item).Count();
|
||
}
|
||
InDutyCountList.Add(inDuty);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
worksList.Add(" ");
|
||
InPostCountList.Add(0);
|
||
InDutyCountList.Add(0);
|
||
}
|
||
//}
|
||
|
||
WorkPostS = JsonConvert.SerializeObject(worksList);
|
||
InPostCounts = JsonConvert.SerializeObject(InPostCountList);
|
||
InDutyCounts = JsonConvert.SerializeObject(InDutyCountList);
|
||
} catch (Exception ex)
|
||
{
|
||
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 项目概况
|
||
protected string divProjectNameTitle;
|
||
protected string divProjectAddressTitle;
|
||
protected string divProjectRemarkTitle;
|
||
protected string divProjectMoneyTitle;
|
||
protected string divOwnUnitTitle;
|
||
protected string divSGUnitTitle;
|
||
protected string divSGUnitTitle2;
|
||
protected string divJLUnitTitle;
|
||
protected string divJLUnitTitle2;
|
||
protected string divProjectImg;
|
||
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
private void getProjectInfo()
|
||
{
|
||
divProjectNameTitle = "";
|
||
divProjectAddressTitle = "";
|
||
divProjectRemarkTitle = "";
|
||
divProjectMoneyTitle = "";
|
||
divOwnUnitTitle = "";
|
||
divSGUnitTitle = "";
|
||
divSGUnitTitle2 = "";
|
||
divJLUnitTitle = "";
|
||
divJLUnitTitle2 = "";
|
||
divProjectImg = "../res/images/m01.png";
|
||
var project = ProjectService.GetProjectByProjectId(this.ProjectId);
|
||
if (project != null)
|
||
{
|
||
divProjectRemarkTitle = project.Remark;
|
||
if (!string.IsNullOrEmpty(project.Remark))
|
||
{
|
||
this.lbRemark.Text = project.Remark.Length > 53 ? project.Remark.Substring(0, 53) + "..." : project.Remark;
|
||
}
|
||
this.lbRemark.ToolTip= project.Remark;
|
||
//this.divProjectName.InnerHtml = project.ShortName;
|
||
divProjectNameTitle = project.ProjectName;
|
||
if (!string.IsNullOrEmpty(project.ProjectAddress))
|
||
{
|
||
//this.divProjectAddress.InnerHtml = project.ProjectAddress.Length > 8 ? project.ProjectAddress.Substring(0, 8) + "..." : project.ProjectAddress;
|
||
divProjectAddressTitle = project.ProjectAddress;
|
||
}
|
||
string unit_yz = ProjectService.getProjectUnitNameByUnitType(project.ProjectId, Const.ProjectUnitType_4);
|
||
if (!string.IsNullOrEmpty(unit_yz))
|
||
{
|
||
//this.divOwnUnit.InnerHtml = unit_yz.Length > 8 ? unit_yz.Substring(0, 8) + "..." : unit_yz;
|
||
divOwnUnitTitle = unit_yz;
|
||
}
|
||
string unit_JL = ProjectService.getProjectUnitNameByUnitType(project.ProjectId, Const.ProjectUnitType_3);
|
||
if (!string.IsNullOrEmpty(unit_JL))
|
||
{
|
||
divJLUnitTitle2 = unit_JL.Length > 12 ? unit_JL.Substring(0, 12) + "..." : unit_JL;
|
||
divJLUnitTitle = unit_JL;
|
||
}
|
||
|
||
string unit_FB = ProjectService.getProjectUnitNameByUnitType(project.ProjectId, Const.ProjectUnitType_2);
|
||
if (!string.IsNullOrEmpty(unit_FB))
|
||
{
|
||
divSGUnitTitle2 = unit_FB.Length > 12 ? unit_FB.Substring(0, 12) + "..." : unit_FB + "...";
|
||
}
|
||
|
||
var getSGName = from x in Funs.DB.Project_ProjectUnit
|
||
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
|
||
where x.ProjectId == project.ProjectId && x.UnitType == Const.ProjectUnitType_2
|
||
select y.UnitName;
|
||
foreach (var item in getSGName)
|
||
{
|
||
divSGUnitTitle += item + ",";
|
||
}
|
||
//this.divProjectMoney.InnerHtml = divProjectMoneyTitle = project.ProjectMoney.ToString();
|
||
if (project.EndDate.HasValue)
|
||
{
|
||
this.divEndDate.InnerHtml = string.Format("{0:yyyy-MM-dd}", project.EndDate);
|
||
int endDays = (project.EndDate.Value - DateTime.Now).Days;
|
||
if (endDays >= 0)
|
||
{
|
||
this.divRemainingDays.InnerHtml = endDays.ToString();
|
||
}
|
||
if (project.StartDate.HasValue)
|
||
{
|
||
int pdays = (project.EndDate.Value - project.StartDate.Value).Days;
|
||
if (pdays >= 0)
|
||
{
|
||
this.divProjectDays.InnerHtml = pdays.ToString();
|
||
}
|
||
}
|
||
}
|
||
|
||
var getImag = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == project.ProjectId);
|
||
if (getImag != null && !string.IsNullOrEmpty(getImag.AttachUrl))
|
||
{
|
||
string url = getImag.AttachUrl.Replace('\\', '/');
|
||
string firtstUrl = Funs.GetStrListByStr(url, ',').FirstOrDefault();
|
||
if (!string.IsNullOrEmpty(firtstUrl))
|
||
{
|
||
string atturl = Funs.RootPath + firtstUrl.Replace(';', ' ').Trim();
|
||
if (File.Exists(atturl))
|
||
{
|
||
divProjectImg = "../" + firtstUrl.Replace(';', ' ').Trim();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取质量问题
|
||
///整改率
|
||
protected double CRectificationRate;
|
||
///合格率
|
||
protected double CQualifiedRate;
|
||
/// 焊接一次合格率
|
||
protected double FirstPassRate;
|
||
/// <summary>
|
||
/// 获取质量问题
|
||
/// </summary>
|
||
private void getCQMSProblem()
|
||
{
|
||
CRectificationRate = 0;
|
||
CQualifiedRate = 0;
|
||
FirstPassRate = 0;
|
||
var getJointCheckDetail = from x in Funs.DB.Check_JointCheckDetail
|
||
join y in Funs.DB.Check_JointCheck on x.JointCheckId equals y.JointCheckId
|
||
where y.ProjectId == this.ProjectId
|
||
select x;
|
||
var getCheckControl = from x in Funs.DB.Check_CheckControl
|
||
where x.ProjectId == this.ProjectId
|
||
select x;
|
||
///问题总数
|
||
int AllCount = getJointCheckDetail.Count() + getCheckControl.Count();
|
||
this.divCQMSAllNum.InnerHtml = AllCount.ToString();
|
||
if (AllCount > 0)
|
||
{
|
||
///问题完成数
|
||
var getJOk = getJointCheckDetail.Where(x => x.State == "6").Count();
|
||
var getCOk = getCheckControl.Where(x => x.State == "7").Count();
|
||
int CCount = getJOk + getCOk;
|
||
this.divCQMSCAllNum.InnerHtml = CCount.ToString();
|
||
this.divCQMSUCAllNum.InnerHtml = (AllCount - CCount).ToString();
|
||
if (CCount > 0)
|
||
{
|
||
CRectificationRate = Math.Round(CCount * 1.0 / AllCount * 100, 1);
|
||
}
|
||
}
|
||
|
||
//var getSpotCheckDetail = from x in Funs.DB.Check_SpotCheckDetail
|
||
// // join z in Funs.DB.Check_SpotCheck on x.SpotCheckCode equals z.SpotCheckCode
|
||
// join y in Funs.DB.WBS_ControlItemAndCycle on x.ControlItemAndCycleId equals y.ControlItemAndCycleId
|
||
// where y.ProjectId == this.ProjectId && x.IsOK != null
|
||
// && y.ControlPoint != "C" && y.ControlPoint != "CR"
|
||
// //&& z.ProjectId == this.ProjectId
|
||
// select x;
|
||
//int AllSpotCount = getSpotCheckDetail.Count();
|
||
//if (AllSpotCount > 0)
|
||
//{
|
||
// int okSpotCount = getSpotCheckDetail.Where(x => x.IsOK == true).Count();
|
||
// if (okSpotCount > 0)
|
||
// {
|
||
// CQualifiedRate = Math.Round(okSpotCount * 1.0 / AllSpotCount * 100, 1);
|
||
// }
|
||
//}
|
||
var imids = Funs.DB.ProcessControl_InspectionManagementDetail.Select(y => y.InspectionId).Distinct();
|
||
var inspectionManagements = from x in Funs.DB.ProcessControl_InspectionManagement where x.ProjectId == this.ProjectId && imids.Contains(x.InspectionId) select x;
|
||
if (inspectionManagements.Count() > 0)
|
||
{
|
||
int okInspectionManagements = inspectionManagements.Where(x => x.IsOnceQualified == true).Count();
|
||
if (okInspectionManagements > 0)
|
||
{
|
||
CQualifiedRate = Math.Round(okInspectionManagements * 1.0 / inspectionManagements.Count() * 100, 1);
|
||
}
|
||
}
|
||
|
||
///焊接一次合格率
|
||
//var getJots = from x in Funs.DB.HJGL_Batch_NDEItem
|
||
// join y in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId
|
||
// join z in Funs.DB.HJGL_Batch_PointBatchItem on y.PointBatchItemId equals z.PointBatchItemId
|
||
// join a in Funs.DB.HJGL_Batch_NDE on x.NDEID equals a.NDEID
|
||
// where z.PointDate != null && z.PointState == "1" && y.RepairRecordId == null
|
||
// && a.ProjectId == this.ProjectId
|
||
// select x;
|
||
//int allHJCount = getJots.Count();
|
||
//if (allHJCount > 0)
|
||
//{
|
||
// var getOk = getJots.Where(x => x.CheckResult == "1");
|
||
// int okHJCount = getOk.Count();
|
||
// if (okHJCount > 0)
|
||
// {
|
||
// FirstPassRate = Math.Round(okHJCount * 1.0 / allHJCount * 100, 1);
|
||
// }
|
||
//}
|
||
string strSql = "";
|
||
|
||
if (CurrUser.UnitId == Const.UnitId_TCC || CurrUser.UserId == Const.hfnbdId)
|
||
{
|
||
|
||
strSql = @"select SUM(cht_totalfilm) AS current_total_film
|
||
, SUM(cht_passfilm) AS current_pass_film from CH_CheckItem ch_checkitem left
|
||
join PW_JointInfo JointInfo on JointInfo.JOT_ID = ch_checkitem.JOT_ID
|
||
where ProjectId = '" + CurrUser.LoginProjectId + "'";
|
||
}
|
||
else
|
||
{
|
||
strSql = @"select SUM(cht_totalfilm) AS current_total_film
|
||
, SUM(cht_passfilm) AS current_pass_film from CH_CheckItem ch_checkitem left
|
||
join PW_JointInfo JointInfo on JointInfo.JOT_ID = ch_checkitem.JOT_ID
|
||
left join PW_IsoInfo IsoInfo on IsoInfo.ISO_ID=JointInfo.ISO_ID
|
||
where JointInfo.ProjectId = '" + CurrUser.LoginProjectId + "' and UnitId='" + CurrUser.UnitId + "'";
|
||
}
|
||
// SqlParameter[] parameter = listStr.ToArray();
|
||
System.Data.DataTable tb = SQLHelper.GetDataTableRunText(strSql);
|
||
if (tb != null && tb.Rows.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
var rate = 100 * double.Parse(tb.Rows[0]["current_pass_film"].ToString()) / double.Parse(tb.Rows[0]["current_total_film"].ToString());
|
||
FirstPassRate = Math.Round(rate, 1);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
FirstPassRate = 0;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 产值统计
|
||
protected string SubUnitNames;
|
||
protected string OutputValues;
|
||
private void getOutputValues()
|
||
{
|
||
SubUnitNames = "[]";
|
||
OutputValues = "[]";
|
||
List<string> UnitNameList = new List<string>();
|
||
List<int> OutputValueList = new List<int>();
|
||
var getUnits = from x in Funs.DB.Project_ProjectUnit
|
||
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
|
||
where x.ProjectId == this.ProjectId && x.UnitType == Const.ProjectUnitType_2
|
||
select new { x.UnitId, y.ShortUnitName };
|
||
if (getUnits.Count() > 0)
|
||
{
|
||
Random ro = new Random();
|
||
foreach (var item in getUnits)
|
||
{
|
||
UnitNameList.Add(item.ShortUnitName ?? " ");
|
||
int OutputValue = ro.Next(100);////获取分包单位产值
|
||
OutputValueList.Add(OutputValue);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
UnitNameList.Add(" ");
|
||
OutputValueList.Add(0);
|
||
}
|
||
SubUnitNames = JsonConvert.SerializeObject(UnitNameList);
|
||
OutputValues = JsonConvert.SerializeObject(OutputValueList);
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 获取天气
|
||
/// </summary>
|
||
private void getWeatherValues()
|
||
{
|
||
var getW = WeatherService.GetWeather(this.CurrUser.LoginProjectId);
|
||
if (getW != null)
|
||
{
|
||
//this.divInfo.InnerHtml = getW.WeatherRef;
|
||
//this.divTEMP.InnerHtml = getW.AllTem;
|
||
}
|
||
}
|
||
|
||
#region 风险管控
|
||
/// <summary>
|
||
/// 获取风险管控
|
||
/// </summary>
|
||
private void getHazard()
|
||
{
|
||
var getHazards = from x in Funs.DB.Hazard_HazardSelectedItem
|
||
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
|
||
where x.ProjectId == this.ProjectId
|
||
select new { x.HazardSelectedItemId, y.RiskLevel };
|
||
var riskLevels = from x in Funs.DB.Base_RiskLevel select x;
|
||
//this.divHazard1.InnerHtml = riskLevels.FirstOrDefault(x => x.RiskLevel == 1).RiskLevelName;
|
||
this.divHazard1Num.InnerHtml = getHazards.Count(x => x.RiskLevel == 1).ToString();
|
||
//this.divHazard2.InnerHtml = riskLevels.FirstOrDefault(x => x.RiskLevel == 2).RiskLevelName;
|
||
this.divHazard2Num.InnerHtml = getHazards.Count(x => x.RiskLevel == 2).ToString();
|
||
//this.divHazard3.InnerHtml = riskLevels.FirstOrDefault(x => x.RiskLevel == 3).RiskLevelName;
|
||
this.divHazard3Num.InnerHtml = getHazards.Count(x => x.RiskLevel == 3).ToString();
|
||
//this.divHazard4.InnerHtml = riskLevels.FirstOrDefault(x => x.RiskLevel == 4).RiskLevelName;
|
||
this.divHazard4Num.InnerHtml = getHazards.Count(x => x.RiskLevel == 4).ToString();
|
||
}
|
||
#endregion
|
||
|
||
|
||
#region 智慧进度
|
||
private bool isBoolDates(DateTime? date1)
|
||
{
|
||
if (date1 <= DateTime.Now)
|
||
{
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 加载智慧进度
|
||
/// </summary>
|
||
private void getSchedule()
|
||
{
|
||
|
||
var scheduleList = Funs.DB.Sys_Schedule.Where(x => x.ProjectId == ProjectId).OrderBy(x => x.SortId).ToList();
|
||
if (scheduleList.Count > 0)
|
||
{
|
||
var Pmodel = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == ProjectId);
|
||
//开工日期
|
||
if (Pmodel.StartDate != null)
|
||
{
|
||
scheDate0.InnerText = string.Format("{0:yyyy-MM-dd}", Pmodel.StartDate);
|
||
if (!isBoolDates(Pmodel.StartDate))
|
||
{
|
||
scheline0.Attributes["class"] = "jd-line-dot flex-column flex-center jd-line-dot-red";
|
||
scheDate0.Style.Add("color", "#FF7474");
|
||
scheName0.Style.Add("color", "#FF7474");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
scheDate0.InnerText = "";
|
||
}
|
||
|
||
//竣工日期
|
||
if (Pmodel.EndDate != null)
|
||
{
|
||
scheDate7.InnerText = string.Format("{0:yyyy-MM-dd}", Pmodel.EndDate);
|
||
if (!isBoolDates(Pmodel.EndDate))
|
||
{
|
||
scheline7.Attributes["class"] = "jd-line-dot flex-column flex-center jd-line-dot-red";
|
||
scheDate7.Style.Add("color", "#FF7474");
|
||
scheName7.Style.Add("color", "#FF7474");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
scheDate7.InnerText = "";
|
||
}
|
||
|
||
if (scheduleList.Count > 0)
|
||
{
|
||
//节点1
|
||
if (scheduleList.FirstOrDefault(x => x.SortId == 1) != null)
|
||
{
|
||
scheName1.InnerText = scheduleList.FirstOrDefault(x => x.SortId == 1).ScheduleName;
|
||
var NowDate = scheduleList.FirstOrDefault(x => x.SortId == 1).ScheduleDate;
|
||
scheDate1.InnerText = string.Format("{0:yyyy-MM-dd}", NowDate);
|
||
|
||
if (!isBoolDates(NowDate))
|
||
{
|
||
scheline1.Attributes["class"] = "jd-line-dot flex-column flex-center jd-line-dot-red";
|
||
scheDate1.Style.Add("color", "#FF7474");
|
||
scheName1.Style.Add("color", "#FF7474");
|
||
}
|
||
}
|
||
//节点2
|
||
if (scheduleList.FirstOrDefault(x => x.SortId == 2) != null)
|
||
{
|
||
scheName2.InnerText = scheduleList.FirstOrDefault(x => x.SortId == 2).ScheduleName;
|
||
var NowDate = scheduleList.FirstOrDefault(x => x.SortId == 2).ScheduleDate;
|
||
scheDate2.InnerText = string.Format("{0:yyyy-MM-dd}", NowDate);
|
||
|
||
if (!isBoolDates(NowDate))
|
||
{
|
||
scheline2.Attributes["class"] = "jd-line-dot flex-column flex-center jd-line-dot-red";
|
||
scheDate2.Style.Add("color", "#FF7474");
|
||
scheName2.Style.Add("color", "#FF7474");
|
||
}
|
||
}
|
||
//节点3
|
||
if (scheduleList.FirstOrDefault(x => x.SortId == 3) != null)
|
||
{
|
||
scheName3.InnerText = scheduleList.FirstOrDefault(x => x.SortId == 3).ScheduleName;
|
||
var NowDate = scheduleList.FirstOrDefault(x => x.SortId == 3).ScheduleDate;
|
||
scheDate3.InnerText = string.Format("{0:yyyy-MM-dd}", NowDate);
|
||
if (!isBoolDates(NowDate))
|
||
{
|
||
scheline3.Attributes["class"] = "jd-line-dot flex-column flex-center jd-line-dot-red";
|
||
scheDate3.Style.Add("color", "#FF7474");
|
||
scheName3.Style.Add("color", "#FF7474");
|
||
}
|
||
}
|
||
//节点4
|
||
if (scheduleList.FirstOrDefault(x => x.SortId == 4) != null)
|
||
{
|
||
scheName4.InnerText = scheduleList.FirstOrDefault(x => x.SortId == 4).ScheduleName;
|
||
var NowDate = scheduleList.FirstOrDefault(x => x.SortId == 4).ScheduleDate;
|
||
scheDate4.InnerText = string.Format("{0:yyyy-MM-dd}", NowDate);
|
||
if (!isBoolDates(NowDate))
|
||
{
|
||
scheline4.Attributes["class"] = "jd-line-dot flex-column flex-center jd-line-dot-red";
|
||
scheDate4.Style.Add("color", "#FF7474");
|
||
scheName4.Style.Add("color", "#FF7474");
|
||
}
|
||
}
|
||
//节点5
|
||
if (scheduleList.FirstOrDefault(x => x.SortId == 5) != null)
|
||
{
|
||
scheName5.InnerText = scheduleList.FirstOrDefault(x => x.SortId == 5).ScheduleName;
|
||
var NowDate = scheduleList.FirstOrDefault(x => x.SortId == 5).ScheduleDate;
|
||
scheDate5.InnerText = string.Format("{0:yyyy-MM-dd}", NowDate);
|
||
if (!isBoolDates(NowDate))
|
||
{
|
||
scheline5.Attributes["class"] = "jd-line-dot flex-column flex-center jd-line-dot-red";
|
||
scheDate5.Style.Add("color", "#FF7474");
|
||
scheName5.Style.Add("color", "#FF7474");
|
||
}
|
||
}//节点6
|
||
if (scheduleList.FirstOrDefault(x => x.SortId == 6) != null)
|
||
{
|
||
scheName6.InnerText = scheduleList.FirstOrDefault(x => x.SortId == 6).ScheduleName;
|
||
var NowDate = scheduleList.FirstOrDefault(x => x.SortId == 6).ScheduleDate;
|
||
scheDate6.InnerText = string.Format("{0:yyyy-MM-dd}", NowDate);
|
||
if (!isBoolDates(NowDate))
|
||
{
|
||
scheline6.Attributes["class"] = "jd-line-dot flex-column flex-center jd-line-dot-red";
|
||
scheDate6.Style.Add("color", "#FF7474");
|
||
scheName6.Style.Add("color", "#FF7474");
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
#endregion
|
||
|
||
protected string VideoHost
|
||
{
|
||
get
|
||
{
|
||
string video_Url = ConfigurationManager.AppSettings["Video_URL"];
|
||
return video_Url;
|
||
|
||
}
|
||
}
|
||
protected string VideoPassWord
|
||
{
|
||
get
|
||
{
|
||
string video_PassWord = string.Empty;
|
||
var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId);
|
||
if (!string.IsNullOrEmpty(project.MonitorPW))
|
||
{
|
||
video_PassWord = Funs.EncryptionPassword(project.MonitorPW);
|
||
}
|
||
return video_PassWord;
|
||
}
|
||
}
|
||
protected string VideoUserName
|
||
{
|
||
get
|
||
{
|
||
string video_UserName = string.Empty;
|
||
var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId);
|
||
video_UserName = project.ProjectCode;
|
||
return video_UserName;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 整改率、合格率、焊接一次合格率
|
||
/// </summary>
|
||
protected string RectificationRate = string.Empty;
|
||
protected string PassRate = string.Empty;
|
||
protected string FistPassRateWelding = string.Empty;
|
||
private void getRate()
|
||
{
|
||
RectificationRate = Resources.Lan.RectificationRate;
|
||
PassRate = Resources.Lan.PassRate;
|
||
FistPassRateWelding = Resources.Lan.FistPassRateWelding;
|
||
}
|
||
}
|
||
}
|