1113 lines
		
	
	
		
			45 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			1113 lines
		
	
	
		
			45 KiB
		
	
	
	
		
			C#
		
	
	
	
using BLL;
 | 
						|
using FineUIPro.Web.BaseInfo;
 | 
						|
using FineUIPro.Web.DataShow;
 | 
						|
using Model;
 | 
						|
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();
 | 
						|
 | 
						|
                getCNEN();
 | 
						|
 | 
						|
                //焊接达因数
 | 
						|
                GetWeldDineOutput();
 | 
						|
 | 
						|
                //焊接数据
 | 
						|
                double result = 0;
 | 
						|
                Model.SGGLDB db = Funs.DB;
 | 
						|
                var ndtLists = (from x in db.ProcessControl_NondestructiveTest_New select x).ToList();
 | 
						|
                if (pids != null)
 | 
						|
                {
 | 
						|
                    ndtLists = ndtLists.Where(x => pids.Contains(x.ProjectId)).ToList();
 | 
						|
                }
 | 
						|
                decimal a = 0, b = 0;
 | 
						|
 | 
						|
                if (ndtLists.Count > 0)
 | 
						|
                {
 | 
						|
                    //取每个项目、单位、专业最新的一条数据
 | 
						|
                    var datalist = ndtLists.GroupBy(r => new { r.ProjectId, r.UnitId, r.ProfessionalName }).Select(g => g.OrderByDescending(r => r.CreateDate).First()).ToList();
 | 
						|
                    foreach (var item in datalist)
 | 
						|
                    {
 | 
						|
                        if (item.TotalQuantity.HasValue)
 | 
						|
                        {
 | 
						|
                            a += Math.Floor(item.TotalQuantity.Value * Funs.GetNewDecimalOrZero(item.TotalRate) / 100);
 | 
						|
                            b += item.TotalQuantity.Value;
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                    //result = Convert.ToDouble(Convert.ToDecimal(100.0) * a / b);
 | 
						|
                    result = Convert.ToDouble(decimal.Round(decimal.Parse((a / b * 100).ToString()), 2));
 | 
						|
 | 
						|
                }
 | 
						|
                if (b > 0)
 | 
						|
                {
 | 
						|
                    hjallNumber = b.ToString();
 | 
						|
                    hjfinishNumber = a.ToString();
 | 
						|
                    hjzgl = result.ToString() + "%";
 | 
						|
                }
 | 
						|
 | 
						|
                /****** 焊接数据
 | 
						|
 | 
						|
                //在建项目
 | 
						|
                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 && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now)
 | 
						|
                              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 && x.InTime < DateTime.Now && (x.OutTime == null || x.OutTime > DateTime.Now) && 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.QualityAudit_PersonQuality
 | 
						|
                                        join y in Funs.DB.SitePerson_Person on x.PersonId equals y.PersonId
 | 
						|
                                        join z in Funs.DB.Base_WorkPost on y.WorkPostId equals z.WorkPostId
 | 
						|
                                        where x.LimitDate.HasValue && x.LimitDate < DateTime.Now && y.OutTime == null && z.PostType == Const.PostType_2
 | 
						|
                                        select x;
 | 
						|
                //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.QualityAudit_PersonQuality
 | 
						|
                                        join y in Funs.DB.SitePerson_Person on x.PersonId equals y.PersonId
 | 
						|
                                        join z in Funs.DB.Base_WorkPost on y.WorkPostId equals z.WorkPostId
 | 
						|
                                        where x.LimitDate.HasValue && x.LimitDate < DateTime.Now && y.OutTime == null && z.PostType == Const.PostType_2 && pids.Contains(y.ProjectId)
 | 
						|
                                        select x;
 | 
						|
                //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 == null || 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 == null || 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)
 | 
						|
                              .GroupBy(p => p.WED_WorkCode)
 | 
						|
                             .Select(g => g.First())
 | 
						|
                             .Count();
 | 
						|
                return result;
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                int result = (from x in Funs.DB.BS_Welder
 | 
						|
                              where x.WED_IfOnGuard == true && pids.Contains(x.ProjectId)
 | 
						|
                              select x)
 | 
						|
                              .GroupBy(p => p.WED_WorkCode)
 | 
						|
                             .Select(g => g.First())
 | 
						|
                             .Count();
 | 
						|
                return result;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        protected WeldDineOutput WeldDine = new WeldDineOutput();
 | 
						|
        /// <summary>
 | 
						|
        /// 获取总达因数和完成达因数
 | 
						|
        /// </summary>
 | 
						|
        /// <returns></returns>
 | 
						|
        public WeldDineOutput GetWeldDineOutput()
 | 
						|
        {
 | 
						|
            var projectIds = new List<string>();
 | 
						|
            if (pids == null)
 | 
						|
            {
 | 
						|
                //加载所有在建项目的数据
 | 
						|
                projectIds = Funs.DB.Base_Project.Where(x => x.ProjectState == "1").Select(x => x.ProjectId).ToList();
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                projectIds = new List<string>(pids);
 | 
						|
            }
 | 
						|
 | 
						|
            var result = new List<WeldDineOutput>();
 | 
						|
            var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity
 | 
						|
                        where projectIds.Contains(x.ProjectId)
 | 
						|
                        select x;
 | 
						|
            var proIds = getD1.Select(x => x.ProjectId).Distinct();
 | 
						|
            foreach (var pro in proIds)
 | 
						|
            {
 | 
						|
                double pTotalWeldQuantity = 0;
 | 
						|
                double pTotalCompleted = 0;
 | 
						|
                var proD1 = getD1.Where(x => x.ProjectId == pro);
 | 
						|
                foreach (var item in getD1)
 | 
						|
                {
 | 
						|
                    var dAll = !string.IsNullOrWhiteSpace(item.TotalWeldQuantity) ? Convert.ToDouble(item.TotalWeldQuantity) : 0;
 | 
						|
                    var dCompleted = !string.IsNullOrWhiteSpace(item.TotalCompleted) ? Convert.ToDouble(item.TotalCompleted) : 0;
 | 
						|
                    pTotalWeldQuantity += dAll;
 | 
						|
                    pTotalCompleted += dCompleted;
 | 
						|
                }
 | 
						|
                result.Add(new WeldDineOutput
 | 
						|
                {
 | 
						|
                    ProjectId = pro,
 | 
						|
                    Size = pTotalWeldQuantity,
 | 
						|
                    DoneDin = pTotalCompleted
 | 
						|
                });
 | 
						|
            }
 | 
						|
 | 
						|
            var differenceProjectIds = projectIds.Except(proIds).ToList();
 | 
						|
            foreach (var pro in differenceProjectIds)
 | 
						|
            {
 | 
						|
                double pTotalWeldQuantity = 0;
 | 
						|
                double pTotalCompleted = 0;
 | 
						|
                var getD2 = (from x in Funs.DB.HJGL_FL_Data
 | 
						|
                             where x.ProjectId == pro
 | 
						|
                             orderby x.CompileDate descending
 | 
						|
                             select x).FirstOrDefault();
 | 
						|
                if (getD2 != null)
 | 
						|
                {
 | 
						|
                    pTotalWeldQuantity = !string.IsNullOrWhiteSpace(getD2.TotalWeldQuantity) ? Convert.ToDouble(getD2.TotalWeldQuantity) : 0;
 | 
						|
                    pTotalCompleted = !string.IsNullOrWhiteSpace(getD2.TotalCompleted) ? Convert.ToDouble(getD2.TotalCompleted) : 0;
 | 
						|
                }
 | 
						|
                result.Add(new WeldDineOutput
 | 
						|
                {
 | 
						|
                    ProjectId = pro,
 | 
						|
                    Size = pTotalWeldQuantity,
 | 
						|
                    DoneDin = pTotalCompleted
 | 
						|
                });
 | 
						|
            }
 | 
						|
            WeldDine.Size = Convert.ToInt32(result.Sum(x => x.Size));
 | 
						|
            WeldDine.DoneDin = Convert.ToInt32(result.Sum(x => x.DoneDin));
 | 
						|
            return WeldDine;
 | 
						|
        }
 | 
						|
 | 
						|
        /// <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 && 1 == 2)
 | 
						|
            {
 | 
						|
                //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 == null || 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 == null || 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 == null || 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 == null || 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);
 | 
						|
 | 
						|
        }
 | 
						|
 | 
						|
        protected string Number_of_questions = string.Empty;
 | 
						|
        protected string Number_of_corrections_completed = string.Empty;
 | 
						|
        protected string Uncorrected_number = string.Empty;
 | 
						|
        protected string RectificationRate = string.Empty;
 | 
						|
        protected string total = string.Empty;
 | 
						|
        protected string Up_to_standard = string.Empty;
 | 
						|
        protected string construction_quality_pass_rate = string.Empty;
 | 
						|
        protected void getCNEN()
 | 
						|
        {
 | 
						|
            Number_of_questions = Resources.Lan.Number_of_questions;
 | 
						|
            Number_of_corrections_completed = Resources.Lan.Number_of_corrections_completed;
 | 
						|
            Uncorrected_number = Resources.Lan.Uncorrected_number;
 | 
						|
            RectificationRate = Resources.Lan.RectificationRate;
 | 
						|
            total = Resources.Lan.total;
 | 
						|
            Up_to_standard = Resources.Lan.Up_to_standard;
 | 
						|
            construction_quality_pass_rate = Resources.Lan.construction_quality_pass_rate;
 | 
						|
        }
 | 
						|
    }
 | 
						|
} |