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

952 lines
38 KiB
C#

using BLL;
using FineUIPro.Web.BaseInfo;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.common
{
public partial class main_new1 : PageBase
{
protected string divProjectImg;
protected string hjallNumber = "0";
protected string hjfinishNumber = "0";
protected string hjzgl = "0";
/// <summary>
/// 公司级项目筛选
/// </summary>
public string[] pids { get; set; }
/// <summary>
/// 页面加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (!string.IsNullOrEmpty(CurrUser.CompanyProjectId))
{
pids = CurrUser.CompanyProjectId.Split(',');
}
else
{
//加载所有在建项目的数据
var pidArray = Funs.DB.Base_Project.Where(x => x.ProjectState == "1").Select(x => x.ProjectId).ToArray();
if (pidArray.Length > 0)
{
pids = pidArray;
}
}
ProjectService.InitProjectShortNameByStateDropDownList(this.drpProject, this.CurrUser.UserId, BLL.Const.ProjectState_1, false);
if (this.drpProject.Items.Count > 0)
{
this.drpProject.SelectedIndex = 0;
}
divProjectImg = "<div class=\"swiper-slide\"><img src=\"./imags/16.png\"></div>";
//质量问题治理数据
getProblemNums();
//质量验收图表
getInspectionManagementInfo();
//NCR数据图表
getNcrInfo();
//资质预警
getEarlyWarningCounts();
//在建项目
var allProjects = ProjectService.GetAllProjectDropDownList();
//焊接数据
double result = 0;
Model.SGGLDB db = Funs.DB;
var ndtLists = from x in db.ProcessControl_NondestructiveTest_New where x.ProfessionalName == "工艺管道" select x;
decimal a = 0, b = 0;
if (ndtLists.Count() > 0)
{
foreach (var project in allProjects)
{
var ndt = (from x in ndtLists
where x.ProjectId == project.ProjectId
orderby x.CreateDate descending
select x).FirstOrDefault();
if (ndt != null)
{
if (ndt.TotalQuantity.HasValue)
{
a += Math.Floor(ndt.TotalQuantity.Value * Funs.GetNewDecimalOrZero(ndt.TotalRate) / 100);
b += ndt.TotalQuantity.Value;
}
}
}
}
if (b > 0)
{
result = Convert.ToDouble(decimal.Round(decimal.Parse((a / b * 100).ToString()), 2));
hjallNumber = b.ToString();
hjfinishNumber = a.ToString();
hjzgl = result.ToString() + "%";
}
}
}
/// <summary>
/// 获取企业总部人数
/// </summary>
/// <returns></returns>
public static int GetCompanyPersonNum()
{
string unitId = string.Empty;
var thisUnit = CommonService.GetIsThisUnit();
if (thisUnit != null)
{
unitId = thisUnit.UnitId;
}
int result = (from x in Funs.DB.Person_CompanyBranchPerson
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
where x.IsOnJob == true && x.UnitId == unitId && y.IsCQMS == true
select x).Count();
return result;
}
/// <summary>
/// 获取分支机构人数
/// </summary>
/// <returns></returns>
public static int GetBranchPersonNum()
{
string unitId = string.Empty;
var thisUnit = CommonService.GetIsThisUnit();
if (thisUnit != null)
{
unitId = thisUnit.UnitId;
}
int result = (from x in Funs.DB.Person_CompanyBranchPerson
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
where x.IsOnJob == true && x.UnitId != unitId && y.IsCQMS == true
select x).Count();
return result;
}
/// <summary>
/// 获取项目部人数
/// </summary>
/// <returns></returns>
public int GetProjectPersonNum()
{
if (pids == null)
{
int result = (from x in Funs.DB.SitePerson_Person
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
where y.IsCQMS == true && x.IsUsed == true
select x).Count();
return result;
}
else {
int result = (from x in Funs.DB.SitePerson_Person
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
where y.IsCQMS == true && x.IsUsed == true && pids.Contains(x.ProjectId)
select x).Count();
return result;
}
}
/// <summary>
/// 获取在用计量器具数
/// </summary>
/// <returns></returns>
public int GetUseNum()
{
if (pids == null)
{
int result = (from x in Funs.DB.Comprehensive_InspectionMachine
where x.IsOnSite == true && x.InspectionType.Contains("计量")
select x).Count();
return result;
}
else {
int result = (from x in Funs.DB.Comprehensive_InspectionMachine
where x.IsOnSite == true && x.InspectionType.Contains("计量") && pids.Contains(x.ProjectId)
select x).Count();
return result;
}
}
/// <summary>
/// 获取校准合格数
/// </summary>
/// <returns></returns>
public int GetOKNum()
{
if (pids == null)
{
int result = (from x in Funs.DB.Comprehensive_InspectionMachine
where x.IsOnSite == true && x.InspectionType.Contains("计量") && x.IsCheckOK == true
select x).Count();
return result;
}
else {
int result = (from x in Funs.DB.Comprehensive_InspectionMachine
where x.IsOnSite == true && x.InspectionType.Contains("计量") && x.IsCheckOK == true && pids.Contains(x.ProjectId)
select x).Count();
return result;
}
}
/// <summary>
/// 机械预警
/// </summary>
/// <returns></returns>
public int GetJxyjNum()
{
if (pids == null)
{
int result = 0;
//机具报验的到期提醒和过期提醒记录数加一起
//机具报验的到期提醒数
//var num1 = Funs.DB.Comprehensive_InspectionMachine.Where(x => x.IsOnSite == true && DateTime.Now < x.NextTestDate
// && ((DateTime)x.NextTestDate).AddDays(-15) < DateTime.Now).Count();
//过期提醒记录数
var num2 = Funs.DB.Comprehensive_InspectionMachine.Where(x => x.IsOnSite == true && x.NextTestDate < DateTime.Now).Count();
//result = num1 + num2;
result = num2;
return result;
}
else {
int result = 0;
//过期提醒记录数
var num2 = Funs.DB.Comprehensive_InspectionMachine.Where(x => x.IsOnSite == true && x.NextTestDate < DateTime.Now
&& pids.Contains(x.ProjectId)).Count();
//result = num1 + num2;
result = num2;
return result;
}
}
/// <summary>
/// 获取质量培训人次数
/// </summary>
/// <returns></returns>
public int GetTrainPersonNum()
{
if (pids == null)
{
int result = (from x in Funs.DB.Comprehensive_InspectionPerson
where x.IsTrain == true
select x).Count();
return result;
}
else {
int result = (from x in Funs.DB.Comprehensive_InspectionPerson
where x.IsTrain == true && pids.Contains(x.ProjectId)
select x).Count();
return result;
}
}
/// <summary>
/// 获取技术交底人次数
/// </summary>
/// <returns></returns>
public int GetTechnicalDisclosePersonNum()
{
if (pids == null)
{
var result = (from x in Funs.DB.Comprehensive_DesignDetails
select x.JoinPersonNum ?? 0).ToList().Sum();
var q = Funs.GetNewIntOrZero(result.ToString());
return q;
}
else {
var result = (from x in Funs.DB.Comprehensive_DesignDetails
where pids.Contains(x.ProjectId)
select x.JoinPersonNum ?? 0).ToList().Sum();
var q = Funs.GetNewIntOrZero(result.ToString());
return q;
}
}
/// <summary>
/// 资质预警
/// </summary>
private void getEarlyWarningCounts()
{
if (pids == null)
{
int allCount = 0;
var getPersonQualitys = from x in Funs.DB.Comprehensive_InspectionPerson
where x.ValidityDate.HasValue && x.ValidityDate < DateTime.Now && x.IsOnSite == true
select x;
//// 预警人数
allCount = getPersonQualitys.Count();
this.spanQualityChartAnalysis.InnerHtml = allCount.ToString();
}
else {
int allCount = 0;
var getPersonQualitys = from x in Funs.DB.Comprehensive_InspectionPerson
where x.ValidityDate.HasValue && x.ValidityDate < DateTime.Now && x.IsOnSite == true && pids.Contains(x.ProjectId)
select x;
//// 预警人数
allCount = getPersonQualitys.Count();
this.spanQualityChartAnalysis.InnerHtml = allCount.ToString();
}
}
#region
/// <summary>
/// 共检总数
/// </summary>
/// <returns></returns>
public int getAllInspectionManagement()
{
if (pids == null)
{
int result = 0;
//统计所给时间段的全部数量
//List<Model.View_CQMS_InspectionManagementDetail> managementListSunNumber =
// BLL.InspectionManagementService.getInspectionManagementDetailListByCNProfessionalIdAndDate(
// null, null, DateTime.Parse("2001-01-01"), DateTime.Now, false);
var num1 = (from x in Funs.DB.ProcessControl_InspectionManagement
select x).Count();
result = num1;
//int result = (from x in Funs.DB.Check_CheckControl
// where x.CheckDate <= DateTime.Now && x.State == "7"
// select x).Count();
return result;
}
else {
int result = 0;
var num1 = (from x in Funs.DB.ProcessControl_InspectionManagement
where pids.Contains(x.ProjectId)
select x).Count();
result = num1;
return result;
}
}
/// <summary>
/// 次合格数量
/// </summary>
/// <returns></returns>
public int getIsOnceInspectionManagement()
{
if (pids == null)
{
int result = 0;
//统计所给时间段的合格数量
//List<Model.View_CQMS_InspectionManagementDetail> managementListOneNumber =
// BLL.InspectionManagementService.getInspectionManagementDetailListByCNProfessionalIdAndDate(
// null, null, DateTime.Parse("2001-01-01"), DateTime.Now, true);
var num2 = (from x in Funs.DB.ProcessControl_InspectionManagement
where x.IsOnceQualified == true
select x).Count();
result = num2;
//int result = (from x in Funs.DB.Check_CheckControl
// where x.CheckDate <= DateTime.Now && x.State != "7"
// select x).Count();
return result;
}
else {
int result = 0;
var num2 = (from x in Funs.DB.ProcessControl_InspectionManagement
where x.IsOnceQualified == true && pids.Contains(x.ProjectId)
select x).Count();
result = num2;
return result;
}
}
/// <summary>
/// 整改率
/// </summary>
/// <returns></returns>
public string GetInspectionManagementZgl()
{
string zgl = String.Format("{0:N2}", 100.0 * getIsOnceInspectionManagement() / getAllInspectionManagement());
return zgl + "%";
}
#endregion
#region
/// <summary>
/// 获取整改完成数
/// </summary>
/// <returns></returns>
public int GetProblemCompletedNum()
{
if (pids == null)
{
int result = (from x in Funs.DB.Check_CheckControl
where x.CheckDate <= DateTime.Now && x.State == "7"
select x).Count();
return result;
}
else {
int result = (from x in Funs.DB.Check_CheckControl
where x.CheckDate <= DateTime.Now && x.State == "7" && pids.Contains(x.ProjectId)
select x).Count();
return result;
}
}
/// <summary>
/// 获取未整改数
/// </summary>
/// <returns></returns>
public int GetProblemNotCompletedNum()
{
if (pids == null)
{
int result = (from x in Funs.DB.Check_CheckControl
where x.CheckDate <= DateTime.Now && x.State != "7"
select x).Count();
return result;
}
else {
int result = (from x in Funs.DB.Check_CheckControl
where x.CheckDate <= DateTime.Now && x.State != "7" && pids.Contains(x.ProjectId)
select x).Count();
return result;
}
}
/// <summary>
/// 整改率
/// </summary>
/// <returns></returns>
public string GetProblemZgl()
{
string zgl = String.Format("{0:N2}", 100.0 * GetProblemCompletedNum() / (GetProblemCompletedNum() + GetProblemNotCompletedNum()));
return zgl + "%";
}
/// <summary>
/// 质量问题治理数据
/// </summary>
protected string ProblemNum;
protected void getProblemNums()
{
var num1 = GetProblemNum();
var num2 = GetProblemCompletedNum();
var num3 = GetProblemNotCompletedNum();
ProblemNum = "'" + num1 + "'," +
"'" + num2 + "'," +
"'" + num3 + "'," +
"'" + String.Format("{0:N2}", 100.0 * num2 / (num2 + num3)) + "'";
}
/// 获取问题个数
/// </summary>
/// <returns></returns>
public int GetProblemNum()
{
if (pids == null)
{
int result = (from x in Funs.DB.Check_CheckControl
where x.CheckDate <= DateTime.Now
select x).Count();
return result;
}
else {
int result = (from x in Funs.DB.Check_CheckControl
where x.CheckDate <= DateTime.Now && pids.Contains(x.ProjectId)
select x).Count();
return result;
}
}
#endregion
/// <summary>
/// 获取焊工总数
/// </summary>
/// <returns></returns>
public int GetWelderNum()
{
if (pids == null)
{
int result = (from x in Funs.DB.BS_Welder
where x.WED_IfOnGuard == true
select x).Count();
return result;
}
else
{
int result = (from x in Funs.DB.BS_Welder
where x.WED_IfOnGuard == true && pids.Contains(x.ProjectId)
select x).Count();
return result;
}
}
/// <summary>
/// 获取总达因数
/// </summary>
/// <returns></returns>
public int GetTotalDineNum()
{
if (pids == null)
{
int result = 0;
var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity
select x;
if (getD1.Count() > 0)
{
foreach (var item in getD1)
{
result += Funs.GetNewIntOrZero(item.TotalWeldQuantity.Split('.')[0]);
}
}
else
{
var getD2 = (from x in Funs.DB.HJGL_FL_Data
orderby x.CompileDate descending
select x).FirstOrDefault();
if (getD2 != null)
{
result = Funs.GetNewIntOrZero(getD2.TotalWeldQuantity.Split('.')[0]);
}
}
return result;
}
else
{
int result = 0;
var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity
where pids.Contains(x.ProjectId)
select x;
if (getD1.Count() > 0)
{
foreach (var item in getD1)
{
result += Funs.GetNewIntOrZero(item.TotalWeldQuantity.Split('.')[0]);
}
}
else
{
var getD2 = (from x in Funs.DB.HJGL_FL_Data
where pids.Contains(x.ProjectId)
orderby x.CompileDate descending
select x).FirstOrDefault();
if (getD2 != null)
{
result = Funs.GetNewIntOrZero(getD2.TotalWeldQuantity.Split('.')[0]);
}
}
return result;
}
}
/// <summary>
/// 获取完成达因数
/// </summary>
/// <returns></returns>
public int GetCompleteDineNum()
{
if (pids == null)
{
int result = 0;
var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity
select x;
if (getD1.Count() > 0)
{
foreach (var item in getD1)
{
result += Funs.GetNewIntOrZero(item.TotalCompleted.Split('.')[0]);
}
}
else
{
var getD2 = (from x in Funs.DB.HJGL_FL_Data
orderby x.CompileDate descending
select x).FirstOrDefault();
if (getD2 != null)
{
result = Funs.GetNewIntOrZero(getD2.TotalCompleted.Split('.')[0]);
}
}
return result;
}
else {
int result = 0;
var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity
where pids.Contains(x.ProjectId)
select x;
if (getD1.Count() > 0)
{
foreach (var item in getD1)
{
result += Funs.GetNewIntOrZero(item.TotalCompleted.Split('.')[0]);
}
}
else
{
var getD2 = (from x in Funs.DB.HJGL_FL_Data
where pids.Contains(x.ProjectId)
orderby x.CompileDate descending
select x).FirstOrDefault();
if (getD2 != null)
{
result = Funs.GetNewIntOrZero(getD2.TotalCompleted.Split('.')[0]);
}
}
return result;
}
}
/// <summary>
/// 获取总片数
/// </summary>
/// <returns></returns>
public int GetTotalFilmNum()
{
if (pids == null)
{
//int result = Convert.ToInt32((from x in Funs.DB.CH_CheckItem
// join y in Funs.DB.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
// select x.CHT_TotalFilm).ToList().Sum());
int result = 0;
var getD2 = (from x in Funs.DB.HJGL_FL_Data
orderby x.CompileDate descending
select x).FirstOrDefault();
if (getD2 != null)
{
result = Funs.GetNewIntOrZero(getD2.OneTimeFilmAmount.Split('.')[0]);
}
return result;
}
else
{
int result = 0;
var getD2 = (from x in Funs.DB.HJGL_FL_Data
where pids.Contains(x.ProjectId)
orderby x.CompileDate descending
select x).FirstOrDefault();
if (getD2 != null)
{
result = Funs.GetNewIntOrZero(getD2.OneTimeFilmAmount.Split('.')[0]);
}
return result;
}
}
/// <summary>
/// 获取合格片数
/// </summary>
/// <returns></returns>
public int GetOKFilmNum()
{
if (pids == null)
{
int result = 0;
var getD2 = (from x in Funs.DB.HJGL_FL_Data
orderby x.CompileDate descending
select x).FirstOrDefault();
if (getD2 != null)
{
result = Funs.GetNewIntOrZero(getD2.OneTimeFilmQualifiedAmount.Split('.')[0]);
}
return result;
}
else
{
int result = 0;
var getD2 = (from x in Funs.DB.HJGL_FL_Data
where pids.Contains(x.ProjectId)
orderby x.CompileDate descending
select x).FirstOrDefault();
if (getD2 != null)
{
result = Funs.GetNewIntOrZero(getD2.OneTimeFilmQualifiedAmount.Split('.')[0]);
}
return result;
}
}
/// <summary>
/// 一次拍片合格率
/// </summary>
/// <returns></returns>
public string GetOKFilmHgl()
{
string zgl = "0";
if (GetOKFilmNum() > 0)
{
zgl = String.Format("{0:N2}", 100.0 * GetOKFilmNum() / GetTotalFilmNum());
}
return zgl + "%";
}
#region
//专业
protected string InspectionManagementZy;
//总计
protected string InspectionManagementSumCount;
//合格
protected string InspectionManagementOkCount;
//一次验收合格率
protected string InspectionManagementOneOkCount;
private void getInspectionManagementInfo()
{
if (this.CurrUser.UserId == BLL.Const.hfnbdId)
{
//var q=(from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId orderby x.SortIndex select x).ToList();
var q = (from x in Funs.DB.Control_PointCropping where x.ParentId == null || x.ParentId == "" orderby x.OperateTime select x).ToList();
foreach (var item in q)
{
//获取专业
InspectionManagementZy += "'" + item.DetectionItems + "',";
//根据专业获取总计
//var num1 = (from x in Funs.DB.ProcessControl_InspectionManagementDetail
// join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId
// where y.CNProfessionalId == item.CNProfessionalId
// select x).ToList().Count;
var num1 = 0;
var num2 = 0;
if (pids == null)
{
num1 = (from x in Funs.DB.ProcessControl_InspectionManagement
where x.CNProfessionalId == item.ControlId
select x).Count();
num2 = (from x in Funs.DB.ProcessControl_InspectionManagement
where x.CNProfessionalId == item.ControlId && x.IsOnceQualified == true
select x).Count();
}
else
{
num1 = (from x in Funs.DB.ProcessControl_InspectionManagement
where x.CNProfessionalId == item.ControlId && pids.Contains(x.ProjectId)
select x).Count();
num2 = (from x in Funs.DB.ProcessControl_InspectionManagement
where x.CNProfessionalId == item.ControlId && x.IsOnceQualified == true && pids.Contains(x.ProjectId)
select x).Count();
}
InspectionManagementSumCount += "'" + num1 + "',";
//根据专业获取合格数
//var num2 = (from x in Funs.DB.ProcessControl_InspectionManagementDetail
// join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId
// where y.CNProfessionalId == item.CNProfessionalId && y.IsOnceQualified==true
// select x).ToList().Count;
InspectionManagementOkCount += "'" + num2 + "',";
//一次验收合格率
var hgl = "0";
if (num1 > 0)
{
hgl += String.Format("{0:N2}", 100.0 * num2 / num1);
}
InspectionManagementOneOkCount += "'" + hgl + "',";
}
}
else
{
var q = (from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId orderby x.SortIndex select x).ToList();
foreach (var item in q)
{
//获取专业
InspectionManagementZy += "'" + item.ProfessionalName + "',";
//根据专业获取总计
//var num1 = (from x in Funs.DB.ProcessControl_InspectionManagementDetail
// join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId
// where y.CNProfessionalId == item.CNProfessionalId
// select x).ToList().Count;
var num1 = 0;
var num2 = 0;
if (pids == null)
{
num1 = (from x in Funs.DB.ProcessControl_InspectionManagement
where x.CNProfessionalId == item.CNProfessionalId
select x).Count();
num2 = (from x in Funs.DB.ProcessControl_InspectionManagement
where x.CNProfessionalId == item.CNProfessionalId && x.IsOnceQualified == true
select x).Count();
}
else
{
num1 = (from x in Funs.DB.ProcessControl_InspectionManagement
where x.CNProfessionalId == item.CNProfessionalId && pids.Contains(x.ProjectId)
select x).Count();
num2 = (from x in Funs.DB.ProcessControl_InspectionManagement
where x.CNProfessionalId == item.CNProfessionalId && x.IsOnceQualified == true && pids.Contains(x.ProjectId)
select x).Count();
}
InspectionManagementSumCount += "'" + num1 + "',";
//根据专业获取合格数
//var num2 = (from x in Funs.DB.ProcessControl_InspectionManagementDetail
// join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId
// where y.CNProfessionalId == item.CNProfessionalId && y.IsOnceQualified==true
// select x).ToList().Count;
InspectionManagementOkCount += "'" + num2 + "',";
//一次验收合格率
var hgl = "0";
if (num1 > 0)
{
hgl += String.Format("{0:N2}", 100.0 * num2 / num1);
}
InspectionManagementOneOkCount += "'" + hgl + "',";
}
}
InspectionManagementZy = InspectionManagementZy.TrimEnd(',');
InspectionManagementSumCount = InspectionManagementSumCount.TrimEnd(',');
InspectionManagementOkCount = InspectionManagementOkCount.TrimEnd(',');
InspectionManagementOneOkCount = InspectionManagementOneOkCount.TrimEnd(',');
}
#endregion
#region NCR数据
//整改闭环项
protected string ncrZgbhx;
//未整改完成项
protected string ncrwZgbhx;
//整改率
protected string ncrZgl = "0%";
//图表数据
//专业
protected string ncrZy;
protected string ncrCount;
private void getNcrInfo()
{
if (pids==null)
{
//闭环项 有完成日期的
//var num1 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.CompleteDate != null).Count();
//var num2 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.CompleteDate == null).Count();
var num1 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.ImplementationFrontState == "已闭合").Count();
var num2 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.ImplementationFrontState == "整改中").Count();
ncrZgbhx = num1.ToString();
ncrwZgbhx = num2.ToString();
if ((num1 + num2) > 0)
{
ncrZgl = String.Format("{0:N2}", 100.0 * num1 / (num1 + num2)) + "%";
}
//加载专业
var list = (from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId orderby x.SortIndex select x).ToList();
foreach (var item in list)
{
ncrZy += "'" + item.ProfessionalName + "',";
//根据专业加载数据量
var num3 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.CNProfessionalId == item.CNProfessionalId).Count();
ncrCount += "'" + num3 + "',";
}
ncrZy = ncrZy.TrimEnd(',');
ncrCount = ncrCount.TrimEnd(',');
}
else
{
var num1 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.ImplementationFrontState == "已闭合" && pids.Contains(x.ProjectId)).Count();
var num2 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.ImplementationFrontState == "整改中" && pids.Contains(x.ProjectId)).Count();
ncrZgbhx = num1.ToString();
ncrwZgbhx = num2.ToString();
if ((num1 + num2) > 0)
{
ncrZgl = String.Format("{0:N2}", 100.0 * num1 / (num1 + num2)) + "%";
}
//加载专业
var list = (from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId orderby x.SortIndex select x).ToList();
foreach (var item in list)
{
ncrZy += "'" + item.ProfessionalName + "',";
//根据专业加载数据量
var num3 = Funs.DB.Comprehensive_NCRManagement.Where(x => x.CNProfessionalId == item.CNProfessionalId && pids.Contains(x.ProjectId)).Count();
ncrCount += "'" + num3 + "',";
}
ncrZy = ncrZy.TrimEnd(',');
ncrCount = ncrCount.TrimEnd(',');
}
}
#endregion
private string GetFileType(string fileName)
{
string fileType = String.Empty;
int lastDotIndex = fileName.LastIndexOf(".");
if (lastDotIndex >= 0)
{
fileType = fileName.Substring(lastDotIndex + 1).ToLower();
}
return fileType;
}
protected void drpProject_SelectedIndexChanged(object sender, EventArgs e)
{
var project = ProjectService.GetProjectByProjectId(this.drpProject.SelectedValue);
var allowExtensions = new List<string>
{
"jpg", "jpeg", "png", "bmp", "gif", // 图片文件类型
};
var getImag = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == project.ProjectId);
if (getImag != null && !string.IsNullOrEmpty(getImag.AttachUrl))
{
string url = getImag.AttachUrl.Replace('\\', '/');
var UrlList = Funs.GetStrListByStr(url, ',');
bool isHiddDefaultImg = false;
foreach (var item in UrlList)
{
if (!string.IsNullOrEmpty(item))
{
string atturl = Funs.RootPath + item.Replace(';', ' ').Trim();
string fileType = GetFileType(atturl);
if (File.Exists(atturl) && allowExtensions.Contains(fileType))
{
isHiddDefaultImg = true;
divProjectImg += string.Format(" <div class=\"swiper-slide\"><img src=\"{0}\"></div>",
atturl.Replace(Funs.RootPath, "/"));
}
}
}
divProjectImg =
divProjectImg.Replace("<div class=\"swiper-slide\"><img src=\"./imags/16.png\"></div>", "");
}
if (string.IsNullOrEmpty(divProjectImg))
{
divProjectImg = "<div class=\"swiper-slide\"><img src=\"./imags/16.png\"></div>";
}
string jsCode = "var swiperWrapper = document.getElementById('swiper-wrapper');";
jsCode += "swiperWrapper.innerHTML = '" + divProjectImg + "';";
string script2 = " createSwiper();";
PageContext.RegisterStartupScript(jsCode);
PageContext.RegisterStartupScript(script2);
}
}
}