614 lines
		
	
	
		
			28 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			614 lines
		
	
	
		
			28 KiB
		
	
	
	
		
			C#
		
	
	
	
using BLL;
 | 
						|
using Newtonsoft.Json.Linq;
 | 
						|
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Data;
 | 
						|
using System.Data.SqlClient;
 | 
						|
using System.Linq;
 | 
						|
using System.Text;
 | 
						|
using System.Web;
 | 
						|
using System.Web.UI;
 | 
						|
using System.Web.UI.WebControls;
 | 
						|
using static FineUIPro.Web.CQMS.Performance.Performance;
 | 
						|
using AspNet = System.Web.UI.WebControls;
 | 
						|
 | 
						|
namespace FineUIPro.Web.Transfer.Chart
 | 
						|
{
 | 
						|
    public partial class Systemstatus : PageBase
 | 
						|
    {
 | 
						|
        #region 加载
 | 
						|
        /// <summary>
 | 
						|
        /// 加载页面
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Page_Load(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (!IsPostBack)
 | 
						|
            {
 | 
						|
                var systemCode = Funs.DB.Transfer_LHCSystemList
 | 
						|
                    .Where(x => x.ProjectId == CurrUser.LoginProjectId)
 | 
						|
                    .GroupBy(p => new { p.SubCommissioningsystem })
 | 
						|
                    .Select(p => new { SubCommissioningsystem = p.Key.SubCommissioningsystem }).ToList();
 | 
						|
                int indexRow = 1;
 | 
						|
                ddlSubSysNo.Items.Insert(0, new FineUIPro.ListItem("ALL", ""));
 | 
						|
                foreach (var t in systemCode)
 | 
						|
                {
 | 
						|
                    ddlSubSysNo.Items.Insert(indexRow, new FineUIPro.ListItem(t.SubCommissioningsystem, t.SubCommissioningsystem));
 | 
						|
                    indexRow++;
 | 
						|
                }
 | 
						|
 | 
						|
                BindGrid();
 | 
						|
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        public DataTable DataSql()
 | 
						|
        {
 | 
						|
            string strSql = @"select f.SubSysNo,lhcs.CommissioningCodeDescription,f.ProjectId,tpi3.TotalFactor,tpi3.CompleteFactor,ts.ElectricHeatTracing,ts.Insulation,
 | 
						|
case ISNULL(tpi3.TotalFactor,0) when 0 then 0
 | 
						|
else CONVERT(DECIMAL(10,2),100*(ISNULL(tpi3.CompleteFactor,0)*1.0/ISNULL(tpi3.TotalFactor,0)))  end CompleteProportion,
 | 
						|
 | 
						|
ISNULL(tpi.PipingCount,0) PipingCount,ISNULL(tpi1.PipingScount,0) PipingScount,
 | 
						|
case ISNULL(tpi.PipingCount,0)
 | 
						|
when 0 then 0
 | 
						|
else  CONVERT(DECIMAL(10,2),100*(ISNULL(tpi1.PipingScount,0)*1.0/ISNULL(tpi.PipingCount,0)))  end PipingPercent,
 | 
						|
ISNULL(tpi.PipingCount,0) ReinstateCount,ISNULL(tpi2.ReinstateScount,0) ReinstateScount,
 | 
						|
case ISNULL(tpi.PipingCount,0)
 | 
						|
when 0 then 0
 | 
						|
else  CONVERT(DECIMAL(10,2),100*(ISNULL(tpi2.ReinstateScount,0)*1.0/ISNULL(tpi.PipingCount,0)))  end ReinstatePercent,
 | 
						|
 | 
						|
(ISNULL(TseCount,0)+ISNULL(TreCount,0)) as EqCount,ISNULL((ISNULL(TseSCount,0)+ISNULL(TreSCount,0)),0) as EqScount,
 | 
						|
case (ISNULL(TseCount,0)+ISNULL(TreCount,0))
 | 
						|
when 0 then 0
 | 
						|
else  CONVERT(DECIMAL(10,2),100 *(((ISNULL(TseSCount,0)+ISNULL(TreSCount,0))*1.0/(ISNULL(TseCount,0)+ISNULL(TreCount,0))))) end EqPercent,
 | 
						|
 | 
						|
ISNULL(TeCount,0) TeCount,ISNULL(TeScount,0) TeScount,
 | 
						|
case ISNULL(TeCount,0)
 | 
						|
when 0 then 0
 | 
						|
else  CONVERT(DECIMAL(10,2),100*(ISNULL(TeScount,0)*1.0/ISNULL(TeCount,0)))  end TePercent,
 | 
						|
 | 
						|
ISNULL(TiCount,0) TiCount,ISNULL(TiScount,0) TiScount,
 | 
						|
case ISNULL(TiCount,0)
 | 
						|
when 0 then 0
 | 
						|
else  CONVERT(DECIMAL(10,2),100*(ISNULL(TiScount,0)*1.0/ISNULL(TiCount,0)))  end TiPercent,
 | 
						|
 | 
						|
ISNULL(TcsCount,0) TcsCount,ISNULL(TcsScount,0) TcsScount,
 | 
						|
case ISNULL(TcsCount,0)
 | 
						|
when 0 then 0
 | 
						|
else  CONVERT(DECIMAL(10,2),100*(ISNULL(TcsScount,0)*1.0/ISNULL(TcsCount,0)))  end TcsPercent,
 | 
						|
 | 
						|
ISNULL(TtCount,0) TtCount,ISNULL(TtScount,0) TtScount,
 | 
						|
case ISNULL(TtCount,0)
 | 
						|
when 0 then 0
 | 
						|
else  CONVERT(DECIMAL(10,2),100*(ISNULL(TtScount,0)*1.0/ISNULL(TtCount,0)))  end TtPercent,
 | 
						|
 | 
						|
ts.PlanPWD,PlanJWD,McPlan,SubmitPackage,ActualPWD,ActualJWD,ActualMC,Commissioning,IaQian,TcccQ,SystemStatus,TurnoverDescription,ts.Remark
 | 
						|
 | 
						|
from(
 | 
						|
SELECT SubCommissioningsystem as SubSysNo,ProjectId FROM Transfer_LHCSystemList where ProjectId = @ProjectId group by SubCommissioningsystem,ProjectId
 | 
						|
) f
 | 
						|
left join Transfer_LHCSystemList lhcs on f.ProjectId=lhcs.ProjectId and f.SubSysNo=lhcs.SubCommissioningsystem
 | 
						|
left join Transfer_SystemControl ts on f.ProjectId=ts.ProjectId and f.SubSysNo=ts.SystemNo
 | 
						|
--piping
 | 
						|
 | 
						|
left join (select count(*)as PipingCount,ProjectId,TestPackage from Transfer_Piping
 | 
						|
group by ProjectId,TestPackage)
 | 
						|
tpi on f.ProjectId=tpi.ProjectId and f.SubSysNo=tpi.TestPackage
 | 
						|
 | 
						|
left join (select count(*)as PipingScount,ProjectId,TestPackage from Transfer_Piping where PressureTestCompleted='Completed'
 | 
						|
group by ProjectId,TestPackage)
 | 
						|
tpi1 on f.ProjectId=tpi1.ProjectId and f.SubSysNo=tpi1.TestPackage
 | 
						|
 | 
						|
left join (select count(*)as ReinstateScount,ProjectId,TestPackage from Transfer_Piping where Reduction='Completed'
 | 
						|
group by ProjectId,TestPackage)
 | 
						|
tpi2 on f.ProjectId=tpi2.ProjectId and f.SubSysNo=tpi2.TestPackage
 | 
						|
 | 
						|
left join (select sum(TotalFactor) as TotalFactor,sum(CompleteFactor) as CompleteFactor,ProjectId,TestPackage from Transfer_Piping 
 | 
						|
group by ProjectId,TestPackage)
 | 
						|
tpi3 on f.ProjectId=tpi3.ProjectId and f.SubSysNo=tpi3.TestPackage
 | 
						|
 | 
						|
--设备测试包
 | 
						|
left join (select count(*)as TseCount,ProjectId,TestPackage from Transfer_StaticEquipment
 | 
						|
group by ProjectId,TestPackage)
 | 
						|
tse on f.ProjectId=tse.ProjectId and f.SubSysNo=tse.TestPackage
 | 
						|
 | 
						|
left join (select count(*)as TseSCount,ProjectId,TestPackage from Transfer_StaticEquipment where MechanicalFINALStatus='Completed'
 | 
						|
group by ProjectId,TestPackage)
 | 
						|
tse1 on f.ProjectId=tse1.ProjectId and f.SubSysNo=tse1.TestPackage
 | 
						|
--
 | 
						|
left join (select count(*)as TreCount,ProjectId,TestPackage from Transfer_RotatingEquipment
 | 
						|
group by ProjectId,TestPackage)
 | 
						|
tre on f.ProjectId=tre.ProjectId and f.SubSysNo=tre.TestPackage
 | 
						|
 | 
						|
left join (select count(*)as TreSCount,ProjectId,TestPackage from Transfer_RotatingEquipment where MechanicalFINALStatus='Completed'
 | 
						|
group by ProjectId,TestPackage)
 | 
						|
tre1 on f.ProjectId=tre1.ProjectId and f.SubSysNo=tre1.TestPackage
 | 
						|
 | 
						|
--Transfer_Electrical
 | 
						|
left join (select count(*)as TeCount,ProjectId,Test_Package from Transfer_Electrical
 | 
						|
group by ProjectId,Test_Package)
 | 
						|
te on f.ProjectId=te.ProjectId and f.SubSysNo=te.Test_Package
 | 
						|
 | 
						|
left join (select count(*)as TeScount,ProjectId,Test_Package from Transfer_Electrical where FINAL_Status='Completed'
 | 
						|
group by ProjectId,Test_Package)
 | 
						|
te1 on f.ProjectId=te1.ProjectId and f.SubSysNo=te1.Test_Package
 | 
						|
 | 
						|
--Transfer_Instrumentation
 | 
						|
left join (select count(*)as TiCount,ProjectId,Test_Package from Transfer_Instrumentation
 | 
						|
group by ProjectId,Test_Package)
 | 
						|
ti on f.ProjectId=ti.ProjectId and f.SubSysNo=ti.Test_Package
 | 
						|
 | 
						|
left join (select count(*)as TiScount,ProjectId,Test_Package from Transfer_Instrumentation where FINAL_Status='Completed'
 | 
						|
group by ProjectId,Test_Package)
 | 
						|
ti1 on f.ProjectId=ti1.ProjectId and f.SubSysNo=ti1.Test_Package
 | 
						|
 | 
						|
--Transfer_Civil_Structure
 | 
						|
left join (select count(*)as TcsCount,ProjectId,Test_Package from Transfer_Civil_Structure
 | 
						|
group by ProjectId,Test_Package)
 | 
						|
tcs on f.ProjectId=tcs.ProjectId and f.SubSysNo=tcs.Test_Package
 | 
						|
 | 
						|
left join (select count(*)as TcsScount,ProjectId,Test_Package from Transfer_Civil_Structure where FINAL_Status='Completed'
 | 
						|
group by ProjectId,Test_Package)
 | 
						|
tcs1 on f.ProjectId=tcs1.ProjectId and f.SubSysNo=tcs1.Test_Package
 | 
						|
 | 
						|
--Transfer_Telecom
 | 
						|
left join (select count(*)as TtCount,ProjectId,Test_Package from Transfer_Telecom
 | 
						|
group by ProjectId,Test_Package)
 | 
						|
Tt on f.ProjectId=Tt.ProjectId and f.SubSysNo=Tt.Test_Package
 | 
						|
 | 
						|
left join (select count(*)as TtScount,ProjectId,Test_Package from Transfer_Telecom where FINAL_Status='Completed'
 | 
						|
group by ProjectId,Test_Package)
 | 
						|
Tt1 on f.ProjectId=Tt1.ProjectId and f.SubSysNo=Tt1.Test_Package 
 | 
						|
 | 
						|
where f.ProjectId = @ProjectId ";
 | 
						|
 | 
						|
            List<SqlParameter> listStr = new List<SqlParameter>();
 | 
						|
            listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
 | 
						|
 | 
						|
            if (!string.IsNullOrEmpty(ddlSubSysNo.SelectedValue))
 | 
						|
            {
 | 
						|
                strSql += " AND f.SubSysNo='" + ddlSubSysNo.SelectedValue + "' ";
 | 
						|
            }
 | 
						|
            if (!string.IsNullOrEmpty(drpType.SelectedValue))
 | 
						|
            {
 | 
						|
                strSql += " AND lhcs.Type='" + drpType.SelectedValue + "' ";
 | 
						|
            }
 | 
						|
 | 
						|
            //strSql += " order by f.Type ";
 | 
						|
            //strSql += " order by f.SubSysNo ";
 | 
						|
            strSql += " order by lhcs.Type,lhcs.SN ";
 | 
						|
            SqlParameter[] parameter = listStr.ToArray();
 | 
						|
            return SQLHelper.GetDataTableRunText(strSql, parameter);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 数据绑定
 | 
						|
        /// </summary>
 | 
						|
        public void BindGrid()
 | 
						|
        {
 | 
						|
            DataTable tb = DataSql();
 | 
						|
            Grid1.RecordCount = tb.Rows.Count;
 | 
						|
            var table = this.GetPagedDataTable(Grid1, tb);
 | 
						|
            // 添加管道焊接信息
 | 
						|
            DataColumn StrTotalFactor = new DataColumn("StrTotalFactor", typeof(string));
 | 
						|
            DataColumn StrCompleteFactor = new DataColumn("StrCompleteFactor", typeof(string));
 | 
						|
            DataColumn StrCompleteProportion = new DataColumn("StrCompleteProportion", typeof(string));
 | 
						|
            table.Columns.Add(StrTotalFactor);
 | 
						|
            table.Columns.Add(StrCompleteFactor);
 | 
						|
            table.Columns.Add(StrCompleteProportion);
 | 
						|
            // 添加管道试压包
 | 
						|
            DataColumn StrPipingCount = new DataColumn("StrPipingCount", typeof(string));
 | 
						|
            DataColumn StrPipingScount = new DataColumn("StrPipingScount", typeof(string));
 | 
						|
            DataColumn StrPipingPercent = new DataColumn("StrPipingPercent", typeof(string));
 | 
						|
            table.Columns.Add(StrPipingCount);
 | 
						|
            table.Columns.Add(StrPipingScount);
 | 
						|
            table.Columns.Add(StrPipingPercent);
 | 
						|
            // 管道冲洗吹扫&复位信息
 | 
						|
            DataColumn StrReinstateCount = new DataColumn("StrReinstateCount", typeof(string));
 | 
						|
            DataColumn StrReinstateScount = new DataColumn("StrReinstateScount", typeof(string));
 | 
						|
            DataColumn StrReinstatePercent = new DataColumn("StrReinstatePercent", typeof(string));
 | 
						|
            table.Columns.Add(StrReinstateCount);
 | 
						|
            table.Columns.Add(StrReinstateScount);
 | 
						|
            table.Columns.Add(StrReinstatePercent);
 | 
						|
            // 设备测试包
 | 
						|
            DataColumn StrEqCount = new DataColumn("StrEqCount", typeof(string));
 | 
						|
            DataColumn StrEqSCount = new DataColumn("StrEqSCount", typeof(string));
 | 
						|
            DataColumn StrEqPercent = new DataColumn("StrEqPercent", typeof(string));
 | 
						|
            table.Columns.Add(StrEqCount);
 | 
						|
            table.Columns.Add(StrEqSCount);
 | 
						|
            table.Columns.Add(StrEqPercent);
 | 
						|
            // 电气测试包
 | 
						|
            DataColumn StrTeCount = new DataColumn("StrTeCount", typeof(string));
 | 
						|
            DataColumn StrTeScount = new DataColumn("StrTeScount", typeof(string));
 | 
						|
            DataColumn StrTePercent = new DataColumn("StrTePercent", typeof(string));
 | 
						|
            table.Columns.Add(StrTeCount);
 | 
						|
            table.Columns.Add(StrTeScount);
 | 
						|
            table.Columns.Add(StrTePercent);
 | 
						|
            // 仪表测试包
 | 
						|
            DataColumn StrTiCount = new DataColumn("StrTiCount", typeof(string));
 | 
						|
            DataColumn StrTiScount = new DataColumn("StrTiScount", typeof(string));
 | 
						|
            DataColumn StrTiPercent = new DataColumn("StrTiPercent", typeof(string));
 | 
						|
            table.Columns.Add(StrTiCount);
 | 
						|
            table.Columns.Add(StrTiScount);
 | 
						|
            table.Columns.Add(StrTiPercent);
 | 
						|
            // 土建/建筑/结构测试包
 | 
						|
            DataColumn StrTcsCount = new DataColumn("StrTcsCount", typeof(string));
 | 
						|
            DataColumn StrTcsScount = new DataColumn("StrTcsScount", typeof(string));
 | 
						|
            DataColumn StrTcsPercent = new DataColumn("StrTcsPercent", typeof(string));
 | 
						|
            table.Columns.Add(StrTcsCount);
 | 
						|
            table.Columns.Add(StrTcsScount);
 | 
						|
            table.Columns.Add(StrTcsPercent);
 | 
						|
            // 电信测试包
 | 
						|
            DataColumn StrTtCount = new DataColumn("StrTtCount", typeof(string));
 | 
						|
            DataColumn StrTtScount = new DataColumn("StrTtScount", typeof(string));
 | 
						|
            DataColumn StrTtPercent = new DataColumn("StrTtPercent", typeof(string));
 | 
						|
            table.Columns.Add(StrTtCount);
 | 
						|
            table.Columns.Add(StrTtScount);
 | 
						|
            table.Columns.Add(StrTtPercent);
 | 
						|
 | 
						|
            // 遍历所有行
 | 
						|
            foreach (DataRow row in table.Rows)
 | 
						|
            {
 | 
						|
                //管道焊接信息-总达因数
 | 
						|
                //string TotalFactor = row["TotalFactor"].ToString();
 | 
						|
                //if (string.IsNullOrWhiteSpace(TotalFactor) || TotalFactor == "0.0" || TotalFactor == "0")
 | 
						|
                if (string.IsNullOrWhiteSpace(row["TotalFactor"].ToString()) || (decimal)row["TotalFactor"] == 0)
 | 
						|
                {
 | 
						|
                    row["StrTotalFactor"] = "NA";
 | 
						|
                    row["StrCompleteFactor"] = "NA";
 | 
						|
                    row["StrCompleteProportion"] = "NA";
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    row["StrTotalFactor"] = row["TotalFactor"].ToString();
 | 
						|
                    row["StrCompleteFactor"] = row["CompleteFactor"].ToString();
 | 
						|
                    row["StrCompleteProportion"] = row["CompleteProportion"].ToString();
 | 
						|
                }
 | 
						|
                //管道试压包
 | 
						|
                //string PipingCount = row["PipingCount"].ToString();
 | 
						|
                //if (string.IsNullOrWhiteSpace(PipingCount) || PipingCount == "0.0" || PipingCount == "0")
 | 
						|
                if (string.IsNullOrWhiteSpace(row["PipingCount"].ToString()) || (int)row["PipingCount"] == 0)
 | 
						|
                {
 | 
						|
                    row["StrPipingCount"] = "NA";
 | 
						|
                    row["StrPipingScount"] = "NA";
 | 
						|
                    row["StrPipingPercent"] = "NA";
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    row["StrPipingCount"] = row["PipingCount"].ToString();
 | 
						|
                    row["StrPipingScount"] = row["PipingScount"].ToString();
 | 
						|
                    row["StrPipingPercent"] = row["PipingPercent"].ToString();
 | 
						|
                }
 | 
						|
                //管道冲洗吹扫&复位信息
 | 
						|
                //string ReinstateCount = row["ReinstateCount"].ToString();
 | 
						|
                //if (string.IsNullOrWhiteSpace(ReinstateCount) || ReinstateCount == "0.0" || ReinstateCount == "0")
 | 
						|
                if (string.IsNullOrWhiteSpace(row["ReinstateCount"].ToString()) || (int)row["ReinstateCount"] == 0)
 | 
						|
                {
 | 
						|
                    row["StrReinstateCount"] = "NA";
 | 
						|
                    row["StrReinstateScount"] = "NA";
 | 
						|
                    row["StrReinstatePercent"] = "NA";
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    row["StrReinstateCount"] = row["ReinstateCount"].ToString();
 | 
						|
                    row["StrReinstateScount"] = row["ReinstateScount"].ToString();
 | 
						|
                    row["StrReinstatePercent"] = row["ReinstatePercent"].ToString();
 | 
						|
                }
 | 
						|
                //设备测试包
 | 
						|
                //string EqCount = row["EqCount"].ToString();
 | 
						|
                //if (string.IsNullOrWhiteSpace(EqCount) || EqCount == "0.0" || EqCount == "0")
 | 
						|
                if (string.IsNullOrWhiteSpace(row["EqCount"].ToString()) || (int)row["EqCount"] == 0)
 | 
						|
                {
 | 
						|
                    row["StrEqCount"] = "NA";
 | 
						|
                    row["StrEqSCount"] = "NA";
 | 
						|
                    row["StrEqPercent"] = "NA";
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    row["StrEqCount"] = row["EqCount"].ToString();
 | 
						|
                    row["StrEqSCount"] = row["EqSCount"].ToString();
 | 
						|
                    row["StrEqPercent"] = row["EqPercent"].ToString();
 | 
						|
                }
 | 
						|
                //电气测试包
 | 
						|
                //string TeCount = row["TeCount"].ToString();
 | 
						|
                //if (string.IsNullOrWhiteSpace(TeCount) || TeCount == "0.0" || TeCount == "0")
 | 
						|
                if (string.IsNullOrWhiteSpace(row["TeCount"].ToString()) || (int)row["TeCount"] == 0)
 | 
						|
                {
 | 
						|
                    row["StrTeCount"] = "NA";
 | 
						|
                    row["StrTeScount"] = "NA";
 | 
						|
                    row["StrTePercent"] = "NA";
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    row["StrTeCount"] = row["TeCount"].ToString();
 | 
						|
                    row["StrTeScount"] = row["TeScount"].ToString();
 | 
						|
                    row["StrTePercent"] = row["TePercent"].ToString();
 | 
						|
                }
 | 
						|
                //仪表测试包
 | 
						|
                //string TiCount = row["TiCount"].ToString();
 | 
						|
                //if (string.IsNullOrWhiteSpace(TiCount) || TiCount == "0.0" || TiCount == "0")
 | 
						|
                if (string.IsNullOrWhiteSpace(row["TiCount"].ToString()) || (int)row["TiCount"] == 0)
 | 
						|
                {
 | 
						|
                    row["StrTiCount"] = "NA";
 | 
						|
                    row["StrTiScount"] = "NA";
 | 
						|
                    row["StrTiPercent"] = "NA";
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    row["StrTiCount"] = row["TiCount"].ToString();
 | 
						|
                    row["StrTiScount"] = row["TiScount"].ToString();
 | 
						|
                    row["StrTiPercent"] = row["TiPercent"].ToString();
 | 
						|
                }
 | 
						|
                //土建/建筑/结构测试包
 | 
						|
                //string TcsCount = row["TcsCount"].ToString();
 | 
						|
                //if (string.IsNullOrWhiteSpace(TcsCount) || TcsCount == "0.0" || TcsCount == "0")
 | 
						|
                if (string.IsNullOrWhiteSpace(row["TcsCount"].ToString()) || (int)row["TcsCount"] == 0)
 | 
						|
                {
 | 
						|
                    row["StrTcsCount"] = "NA";
 | 
						|
                    row["StrTcsScount"] = "NA";
 | 
						|
                    row["StrTcsPercent"] = "NA";
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    row["StrTcsCount"] = row["TcsCount"].ToString();
 | 
						|
                    row["StrTcsScount"] = row["TcsScount"].ToString();
 | 
						|
                    row["StrTcsPercent"] = row["TcsPercent"].ToString();
 | 
						|
                }
 | 
						|
                //电信测试包
 | 
						|
                //string TtCount = row["TtCount"].ToString();
 | 
						|
                //if (string.IsNullOrWhiteSpace(TtCount) || TtCount == "0.0" || TtCount == "0")
 | 
						|
                if (string.IsNullOrWhiteSpace(row["TtCount"].ToString()) || (int)row["TtCount"] == 0)
 | 
						|
                {
 | 
						|
                    row["StrTtCount"] = "NA";
 | 
						|
                    row["StrTtScount"] = "NA";
 | 
						|
                    row["StrTtPercent"] = "NA";
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    row["StrTtCount"] = row["TtCount"].ToString();
 | 
						|
                    row["StrTtScount"] = row["TtScount"].ToString();
 | 
						|
                    row["StrTtPercent"] = row["TtPercent"].ToString();
 | 
						|
                }
 | 
						|
            }
 | 
						|
            Grid1.DataSource = table;
 | 
						|
            Grid1.DataBind();
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 分页、排序
 | 
						|
        /// <summary>
 | 
						|
        /// 分页下拉
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 分页索引事件
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
 | 
						|
        {
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 排序
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
 | 
						|
        {
 | 
						|
            Grid1.SortDirection = e.SortDirection;
 | 
						|
            Grid1.SortField = e.SortField;
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 查询
 | 
						|
        /// <summary>
 | 
						|
        /// 查询
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnSearch_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 关闭弹出窗口
 | 
						|
        /// <summary>
 | 
						|
        /// 关闭弹出窗口
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | 
						|
        {
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 编辑
 | 
						|
        /// <summary>
 | 
						|
        /// 右键编辑事件
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnMenuModify_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (Grid1.SelectedRowIndexArray.Length == 0)
 | 
						|
            {
 | 
						|
                Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
 | 
						|
                return;
 | 
						|
            }
 | 
						|
 | 
						|
            string SystemNo = Grid1.SelectedRowID;
 | 
						|
            PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SystemstatusEdit.aspx?SystemNo={0}", SystemNo, "编辑 - ")));
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        protected void ddlSubSysNo_SelectedIndexChanged(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
        /// <summary>
 | 
						|
        /// 获取总完成率
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="systemNo"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        protected string totalper(object systemNo)
 | 
						|
        {
 | 
						|
            string rate = string.Empty;
 | 
						|
            if (systemNo != null)
 | 
						|
            {
 | 
						|
                var pid = CurrUser.LoginProjectId;
 | 
						|
                var scode = systemNo.ToString();
 | 
						|
                //根据systemNo和projectid获取所有数据 和完成的数据
 | 
						|
                #region 九个表的数据
 | 
						|
                var list1 = Funs.DB.Transfer_Piping.Where(x => x.ProjectId == pid && x.TestPackage == scode).ToList();
 | 
						|
                var list2 = Funs.DB.Transfer_StaticEquipment.Where(x => x.ProjectId == pid && x.TestPackage == scode).ToList();
 | 
						|
                var list3 = Funs.DB.Transfer_RotatingEquipment.Where(x => x.ProjectId == pid && x.TestPackage == scode).ToList();
 | 
						|
                var list4 = Funs.DB.Transfer_Instrumentation.Where(x => x.ProjectId == pid && x.Test_Package == scode).ToList();
 | 
						|
                var list5 = Funs.DB.Transfer_Electrical.Where(x => x.ProjectId == pid && x.Test_Package == scode).ToList();
 | 
						|
                var list6 = Funs.DB.Transfer_Civil_Structure.Where(x => x.ProjectId == pid && x.Test_Package == scode).ToList();
 | 
						|
                //var list7 = Funs.DB.Transfer_Firefighting.Where(x => x.ProjectId == pid && x.Test_Package == scode).ToList();
 | 
						|
                var list8 = Funs.DB.Transfer_Telecom.Where(x => x.ProjectId == pid && x.Test_Package == scode).ToList();
 | 
						|
                #endregion
 | 
						|
 | 
						|
                //float allcount = (list1.Count + list2.Count + list3.Count + list4.Count +
 | 
						|
                //    list5.Count + list6.Count + list8.Count);//list7.Count +
 | 
						|
 | 
						|
                //float allScount = (list1.Where(x => x.FINALStatus == "Completed").ToList().Count + list2.Where(x => x.MechanicalFINALStatus == "Completed").ToList().Count
 | 
						|
                //    + list3.Where(x => x.MechanicalFINALStatus == "Completed").ToList().Count + list4.Where(x => x.FINAL_Status == "Completed").ToList().Count +
 | 
						|
                //    list5.Where(x => x.FINAL_Status == "Completed").ToList().Count + list6.Where(x => x.FINAL_Status == "Completed").ToList().Count
 | 
						|
                //    //+ list7.Where(x => x.FINAL_Status == "Completed").ToList().Count 
 | 
						|
                //    + list8.Where(x => x.FINAL_Status == "Completed").ToList().Count
 | 
						|
                //    );
 | 
						|
 | 
						|
                //Piping管道试压包和复位都要统计
 | 
						|
                float allcount = (list1.Count + list1.Count + list2.Count + list3.Count + list4.Count +
 | 
						|
                    list5.Count + list6.Count + list8.Count);//list7.Count +
 | 
						|
 | 
						|
                float allScount = (list1.Where(x => x.PressureTestCompleted == "Completed").ToList().Count
 | 
						|
                    + list1.Where(x => x.Reduction == "Completed").ToList().Count
 | 
						|
                    + list2.Where(x => x.MechanicalFINALStatus == "Completed").ToList().Count
 | 
						|
                    + list3.Where(x => x.MechanicalFINALStatus == "Completed").ToList().Count
 | 
						|
                    + list4.Where(x => x.FINAL_Status == "Completed").ToList().Count +
 | 
						|
                    list5.Where(x => x.FINAL_Status == "Completed").ToList().Count
 | 
						|
                    + list6.Where(x => x.FINAL_Status == "Completed").ToList().Count
 | 
						|
                    //+ list7.Where(x => x.FINAL_Status == "Completed").ToList().Count 
 | 
						|
                    + list8.Where(x => x.FINAL_Status == "Completed").ToList().Count
 | 
						|
                    );
 | 
						|
 | 
						|
                if (Convert.ToInt32(allcount) == 0)
 | 
						|
                {
 | 
						|
                    return "0";
 | 
						|
                }
 | 
						|
                var rateF = 100 * (allScount / allcount);
 | 
						|
                rate = rateF.ToString("F2");
 | 
						|
            }
 | 
						|
            return rate;
 | 
						|
        }
 | 
						|
 | 
						|
        #region 导出按钮
 | 
						|
        /// 导出按钮
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnOut_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            Response.ClearContent();
 | 
						|
            string filename = Funs.GetNewFileName();
 | 
						|
            Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("项目月报" + filename, System.Text.Encoding.UTF8) + ".xls");
 | 
						|
            Response.ContentType = "application/excel";
 | 
						|
            Response.ContentEncoding = System.Text.Encoding.UTF8;
 | 
						|
            this.Grid1.PageSize = 100000;
 | 
						|
            this.BindGrid();
 | 
						|
            Response.Write(GetGridMultiHeaderTableHtml(Grid1));
 | 
						|
            //Response.Write(GetGridTableHtml(Grid1));
 | 
						|
            Response.End();
 | 
						|
        }
 | 
						|
 | 
						|
        ///// <summary>
 | 
						|
        ///// 导出方法
 | 
						|
        ///// </summary>
 | 
						|
        ///// <param name="grid"></param>
 | 
						|
        ///// <returns></returns>
 | 
						|
        //private string GetGridTableHtml(Grid grid)
 | 
						|
        //{
 | 
						|
        //    StringBuilder sb = new StringBuilder();
 | 
						|
        //    sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
 | 
						|
        //    sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
 | 
						|
        //    //sb.Append("<tr>");
 | 
						|
        //    //foreach (GridColumn column in grid.Columns)
 | 
						|
        //    //{
 | 
						|
        //    //    if (column.ColumnID != "ckbIsSelected" && column.ColumnID != "Punish" && column.ColumnID != "Del")
 | 
						|
        //    //    {
 | 
						|
        //    //        sb.AppendFormat("<td>{0}</td>", column.HeaderText);
 | 
						|
        //    //    }
 | 
						|
        //    //}
 | 
						|
        //    //sb.Append("</tr>");
 | 
						|
        //    MultiHeaderTable mht = new MultiHeaderTable();
 | 
						|
        //    mht.ResolveMultiHeaderTable(Grid1.Columns);
 | 
						|
 | 
						|
        //    foreach (List<object[]> rows in mht.MultiTable)
 | 
						|
        //    {
 | 
						|
        //        sb.Append("<tr>");
 | 
						|
        //        foreach (object[] cell in rows)
 | 
						|
        //        {
 | 
						|
        //            int rowspan = Convert.ToInt32(cell[0]);
 | 
						|
        //            int colspan = Convert.ToInt32(cell[1]);
 | 
						|
        //            GridColumn column = cell[2] as GridColumn;
 | 
						|
        //            if (column.Hidden == false)
 | 
						|
        //            {
 | 
						|
        //                sb.AppendFormat("<th{0}{1}{2}>{3}</th>",
 | 
						|
        //                rowspan != 1 ? " rowspan=\"" + rowspan + "\"" : "",
 | 
						|
        //                colspan != 1 ? " colspan=\"" + colspan + "\"" : "",
 | 
						|
        //                colspan != 1 ? " style=\"text-align:center;\"" : "",
 | 
						|
        //                column.HeaderText);
 | 
						|
        //            }
 | 
						|
        //        }
 | 
						|
        //        sb.Append("</tr>");
 | 
						|
        //    }
 | 
						|
        //    foreach (GridRow row in grid.Rows)
 | 
						|
        //    {
 | 
						|
        //        sb.Append("<tr>");
 | 
						|
        //        //if (row.Grid.gr.Hidden == false) { 
 | 
						|
        //        foreach (GridColumn column in mht.Columns)
 | 
						|
        //        {
 | 
						|
        //            if (column.ColumnID != "ckbIsSelected" && column.ColumnID != "Punish" && column.ColumnID != "Del")
 | 
						|
        //            {
 | 
						|
        //                string html = row.Values[column.ColumnIndex].ToString();
 | 
						|
 | 
						|
        //                if (column.ColumnID == "tfPageIndex")
 | 
						|
        //                {
 | 
						|
        //                    html = (row.FindControl("lblPageIndex") as AspNet.Label).Text;
 | 
						|
        //                }
 | 
						|
 | 
						|
        //                else if (column.ColumnID == "Count4")
 | 
						|
        //                {
 | 
						|
        //                    html = (row.FindControl("Label5") as AspNet.Label).Text;
 | 
						|
        //                }
 | 
						|
 | 
						|
        //                sb.AppendFormat("<td>{0}</td>", html);
 | 
						|
        //            }
 | 
						|
        //        }
 | 
						|
        //        //}
 | 
						|
        //        sb.Append("</tr>");
 | 
						|
        //    }
 | 
						|
 | 
						|
        //    sb.Append("</table>");
 | 
						|
 | 
						|
        //    return sb.ToString();
 | 
						|
        //}
 | 
						|
        #endregion
 | 
						|
 | 
						|
    }
 | 
						|
} |