523 lines
		
	
	
		
			23 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			523 lines
		
	
	
		
			23 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using BLL;
							 | 
						|||
| 
								 | 
							
								using FineUIPro.Web.Controls;
							 | 
						|||
| 
								 | 
							
								using Newtonsoft.Json.Linq;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.Data;
							 | 
						|||
| 
								 | 
							
								using System.Data.SqlClient;
							 | 
						|||
| 
								 | 
							
								using System.Text;
							 | 
						|||
| 
								 | 
							
								using AspNet = System.Web.UI.WebControls;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace FineUIPro.Web.HJGL.WeldingReport
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class WelderPerformance : PageBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        #region 加载
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 加载页面
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Page_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (!IsPostBack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Funs.DropDownPageSize(this.ddlPageSize);
							 | 
						|||
| 
								 | 
							
								                this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
							 | 
						|||
| 
								 | 
							
								                this.cbSteType.DataTextField = "Text";
							 | 
						|||
| 
								 | 
							
								                this.cbSteType.DataValueField = "Value";
							 | 
						|||
| 
								 | 
							
								                this.cbSteType.DataSource = BLL.DropListService.HJGL_GetSteTypeList();
							 | 
						|||
| 
								 | 
							
								                this.cbSteType.DataBind();
							 | 
						|||
| 
								 | 
							
								                //单位
							 | 
						|||
| 
								 | 
							
								                // var unit = BLL.UnitService.GetUnitByUnitId(this.CurrUser.UnitId);
							 | 
						|||
| 
								 | 
							
								                //if (unit != null && unit.UnitTypeId == BLL.Const.ProjectUnitType_2)
							 | 
						|||
| 
								 | 
							
								                if (this.CurrUser.UnitId!=Const.UnitId_TCC&&this.CurrUser.UserId!=Const.hfnbdId)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    BLL.UnitService.InitSubUnitNameDownList(this.drpUnit, this.CurrUser.LoginProjectId, this.CurrUser.UnitId, true);
							 | 
						|||
| 
								 | 
							
								                    this.drpUnit.SelectedValue = this.CurrUser.UnitId;
							 | 
						|||
| 
								 | 
							
								                    BLL.WorkAreaService.InitWorkAreaProjectUnitDropDownList(this.drpWorkArea, this.CurrUser.LoginProjectId, this.CurrUser.UnitId, true);
							 | 
						|||
| 
								 | 
							
								                    BLL.WelderService.InitWelderListByUnit(this.ddlWloName, this.CurrUser.LoginProjectId, this.CurrUser.UnitId, true, "-请选择-");
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    var supervisonUnit = BLL.WorkAreaService.IsSupervisor(this.CurrUser.UnitId, this.CurrUser.LoginProjectId);
							 | 
						|||
| 
								 | 
							
								                    if (supervisonUnit)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        BLL.UnitService.InitSubUnitNameDownList(this.drpUnit, this.CurrUser.LoginProjectId, this.CurrUser.UnitId, true);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(this.drpUnit, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    Funs.FineUIPleaseSelect(this.drpWorkArea);
							 | 
						|||
| 
								 | 
							
								                    Funs.FineUIPleaseSelect(this.ddlWloName);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                Funs.FineUIPleaseSelect(this.drpTeamGroup);
							 | 
						|||
| 
								 | 
							
								                //BindGrid();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 绑定BindGrid
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private DataTable tb = null;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 绑定数据
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private void BindGrid()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            List<SqlParameter> listStr = new List<SqlParameter>
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                new SqlParameter("@projectId", this.CurrUser.LoginProjectId)
							 | 
						|||
| 
								 | 
							
								            };
							 | 
						|||
| 
								 | 
							
								            if (this.drpUnit.SelectedValue != BLL.Const._Null&&!string.IsNullOrEmpty(this.drpUnit.SelectedValue))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@unitcode", this.drpUnit.SelectedValue));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@unitcode", null));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (this.drpWorkArea.SelectedValue != BLL.Const._Null&&!string.IsNullOrEmpty(this.drpWorkArea.SelectedValue))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@workareacode", this.drpWorkArea.SelectedValue));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@workareacode", null));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            
							 | 
						|||
| 
								 | 
							
								            
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@steel", null));
							 | 
						|||
| 
								 | 
							
								            
							 | 
						|||
| 
								 | 
							
								            if (this.ddlWloName.SelectedValue!=BLL.Const._Null&&!string.IsNullOrEmpty(this.ddlWloName.SelectedValue))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@wloName", this.ddlWloName.SelectedValue));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@wloName", null));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(this.txtStarTime.Text))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@date1", this.txtStarTime.Text.Trim()));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@date1", null));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(this.txtEndTime.Text))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@date2", this.txtEndTime.Text.Trim()));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@date2", null));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (BLL.WorkAreaService.IsSupervisor(this.CurrUser.UnitId, this.CurrUser.LoginProjectId))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@supervisorUnitId", this.CurrUser.UnitId));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@supervisorUnitId", null));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            SqlParameter[] parameter = listStr.ToArray();
							 | 
						|||
| 
								 | 
							
								            tb = SQLHelper.GetDataTableRunProc("sp_rpt_WelderPerformance", parameter);
							 | 
						|||
| 
								 | 
							
								            if (this.drpSteType.Values!=null && this.drpSteType.Values.Length>0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								             
							 | 
						|||
| 
								 | 
							
								                if (tb != null)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    List<DataRow> needReMoveRow = new List<DataRow>();
							 | 
						|||
| 
								 | 
							
								                    foreach (DataRow row in tb.Rows)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        foreach (string stel in this.drpSteType.Values)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            if (row["Steels"] != DBNull.Value && row["Steels"].ToString() != "" && !row["Steels"].ToString().Contains(stel))
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                needReMoveRow.Add(row);
							 | 
						|||
| 
								 | 
							
								                                break;
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    foreach (DataRow row in needReMoveRow)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        tb.Rows.Remove(row);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            this.Grid1.RecordCount = tb.Rows.Count;
							 | 
						|||
| 
								 | 
							
								            var table = this.GetPagedDataTable(Grid1, tb);
							 | 
						|||
| 
								 | 
							
								            Grid1.DataSource = table;
							 | 
						|||
| 
								 | 
							
								            Grid1.DataBind();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <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 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_Sort(object sender, FineUIPro.GridSortEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 计算合计
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 计算合计
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        protected void OutputSummaryData()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (tb != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                decimal? nowtotal_din = 0;//本期总达因值          
							 | 
						|||
| 
								 | 
							
								                int nowtotal_jot = 0;//本期总焊口
							 | 
						|||
| 
								 | 
							
								                int nowtotal_repairjot = 0;//本期总返口数
							 | 
						|||
| 
								 | 
							
								                int current_count_film = 0;//本期拍片焊口数
							 | 
						|||
| 
								 | 
							
								                int current_pass_film = 0;//本期拍片焊口合格数
							 | 
						|||
| 
								 | 
							
								                int nowtotalfilm = 0;//本期拍片总数
							 | 
						|||
| 
								 | 
							
								                int nowpassfilm = 0;//本期拍片合格数
							 | 
						|||
| 
								 | 
							
								                int nownotpassfilm = 0;//本期拍片不合格数
							 | 
						|||
| 
								 | 
							
								                decimal? totaldin = 0;//总达因值
							 | 
						|||
| 
								 | 
							
								                int total_jot = 0;//总焊口
							 | 
						|||
| 
								 | 
							
								                int total_repairjot = 0;//总返修口
							 | 
						|||
| 
								 | 
							
								                int totalfilm = 0;//总片数
							 | 
						|||
| 
								 | 
							
								                int passfilm = 0;//合格片数
							 | 
						|||
| 
								 | 
							
								                int notpassfilm = 0;//不合格数
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                double tofd_total_donedin = 0;
							 | 
						|||
| 
								 | 
							
								                double tofd_pass_donedin = 0;
							 | 
						|||
| 
								 | 
							
								                double tofd_no_pass_donedin = 0;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                double tdfw_total_donedin = 0;
							 | 
						|||
| 
								 | 
							
								                double tdfw_pass_donedin = 0;
							 | 
						|||
| 
								 | 
							
								                double tdfw_no_pass_donedin = 0;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                double ut_total_donedin = 0;
							 | 
						|||
| 
								 | 
							
								                double ut_pass_donedin = 0;
							 | 
						|||
| 
								 | 
							
								                double ut_no_pass_donedin = 0;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                foreach (DataRow row in tb.Rows)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    nowtotal_din += Funs.GetNewDecimalOrZero(row["nowtotal_din"].ToString());
							 | 
						|||
| 
								 | 
							
								                    nowtotal_jot += Funs.GetNewIntOrZero(row["nowtotal_jot"].ToString());
							 | 
						|||
| 
								 | 
							
								                    nowtotal_repairjot += Funs.GetNewIntOrZero(row["nowtotal_repairjot"].ToString());
							 | 
						|||
| 
								 | 
							
								                    current_count_film += Funs.GetNewIntOrZero(row["current_count_film"].ToString());
							 | 
						|||
| 
								 | 
							
								                    current_pass_film += Funs.GetNewIntOrZero(row["current_pass_film"].ToString());
							 | 
						|||
| 
								 | 
							
								                    nowtotalfilm += Funs.GetNewIntOrZero(row["nowtotalfilm"].ToString());
							 | 
						|||
| 
								 | 
							
								                    nowpassfilm += Funs.GetNewIntOrZero(row["nowpassfilm"].ToString());
							 | 
						|||
| 
								 | 
							
								                    nownotpassfilm += Funs.GetNewIntOrZero(row["nownotpassfilm"].ToString());
							 | 
						|||
| 
								 | 
							
								                    totaldin += Funs.GetNewDecimalOrZero(row["totaldin"].ToString());
							 | 
						|||
| 
								 | 
							
								                    total_jot += Funs.GetNewIntOrZero(row["total_jot"].ToString());
							 | 
						|||
| 
								 | 
							
								                    total_repairjot += Funs.GetNewIntOrZero(row["total_repairjot"].ToString());
							 | 
						|||
| 
								 | 
							
								                    totalfilm += Funs.GetNewIntOrZero(row["totalfilm"].ToString());
							 | 
						|||
| 
								 | 
							
								                    passfilm += Funs.GetNewIntOrZero(row["passfilm"].ToString());
							 | 
						|||
| 
								 | 
							
								                    notpassfilm += Funs.GetNewIntOrZero(row["notpassfilm"].ToString());
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    tofd_total_donedin += Funs.GetNewDoubleOrZero(row["tofd_total_donedin"].ToString());
							 | 
						|||
| 
								 | 
							
								                    tofd_pass_donedin += Funs.GetNewDoubleOrZero(row["tofd_pass_donedin"].ToString());
							 | 
						|||
| 
								 | 
							
								                    tofd_no_pass_donedin += Funs.GetNewDoubleOrZero(row["tofd_no_pass_donedin"].ToString());
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    tdfw_total_donedin += Funs.GetNewDoubleOrZero(row["tdfw_total_donedin"].ToString());
							 | 
						|||
| 
								 | 
							
								                    tdfw_pass_donedin += Funs.GetNewDoubleOrZero(row["tdfw_no_pass_donedin"].ToString());
							 | 
						|||
| 
								 | 
							
								                    tdfw_no_pass_donedin += Funs.GetNewDoubleOrZero(row["tdfw_no_pass_donedin"].ToString());
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    ut_total_donedin += Funs.GetNewDoubleOrZero(row["ut_total_donedin"].ToString());
							 | 
						|||
| 
								 | 
							
								                    ut_pass_donedin += Funs.GetNewDoubleOrZero(row["ut_pass_donedin"].ToString());
							 | 
						|||
| 
								 | 
							
								                    ut_no_pass_donedin += Funs.GetNewDoubleOrZero(row["ut_no_pass_donedin"].ToString());
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                JObject summary = new JObject
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                { "tfNumber", "合计" },
							 | 
						|||
| 
								 | 
							
								                { "nowtotal_din", nowtotal_din },
							 | 
						|||
| 
								 | 
							
								                { "nowtotal_jot", nowtotal_jot },
							 | 
						|||
| 
								 | 
							
								                { "nowtotal_repairjot", nowtotal_repairjot },
							 | 
						|||
| 
								 | 
							
								                { "current_count_film", current_count_film },
							 | 
						|||
| 
								 | 
							
								                { "current_pass_film", current_pass_film },
							 | 
						|||
| 
								 | 
							
								                { "nowtotalfilm", nowtotalfilm },
							 | 
						|||
| 
								 | 
							
								                { "nowpassfilm", nowpassfilm },
							 | 
						|||
| 
								 | 
							
								                { "nownotpassfilm", nownotpassfilm },
							 | 
						|||
| 
								 | 
							
								                { "totaldin", totaldin },
							 | 
						|||
| 
								 | 
							
								                { "total_jot", total_jot },
							 | 
						|||
| 
								 | 
							
								                { "total_repairjot", total_repairjot },
							 | 
						|||
| 
								 | 
							
								                { "totalfilm", totalfilm },
							 | 
						|||
| 
								 | 
							
								                { "passfilm", passfilm },
							 | 
						|||
| 
								 | 
							
								                { "notpassfilm", notpassfilm },
							 | 
						|||
| 
								 | 
							
								                { "tofd_total_donedin", tofd_total_donedin },
							 | 
						|||
| 
								 | 
							
								                { "tofd_pass_donedin", tofd_pass_donedin },
							 | 
						|||
| 
								 | 
							
								                { "tofd_no_pass_donedin", tofd_no_pass_donedin },
							 | 
						|||
| 
								 | 
							
								                { "tofdpassrate", tofd_pass_donedin >0? (100*(tofd_pass_donedin-tofd_no_pass_donedin)/tofd_pass_donedin).ToString("0.000")+"%":""},
							 | 
						|||
| 
								 | 
							
								                { "tdfw_total_donedin", tdfw_total_donedin },
							 | 
						|||
| 
								 | 
							
								                { "tdfw_pass_donedin", tdfw_pass_donedin },
							 | 
						|||
| 
								 | 
							
								                { "tdfw_no_pass_donedin", tdfw_no_pass_donedin },
							 | 
						|||
| 
								 | 
							
								                { "tdfwpassrate", tdfw_pass_donedin >0? (100*(tdfw_pass_donedin-tdfw_no_pass_donedin)/tdfw_pass_donedin).ToString("0.000")+"%":""},
							 | 
						|||
| 
								 | 
							
								                { "ut_total_donedin", ut_total_donedin },
							 | 
						|||
| 
								 | 
							
								                { "ut_pass_donedin", ut_pass_donedin },
							 | 
						|||
| 
								 | 
							
								                { "ut_no_pass_donedin", ut_no_pass_donedin },
							 | 
						|||
| 
								 | 
							
								                { "utpassrate", ut_pass_donedin >0? (100*(ut_pass_donedin-ut_no_pass_donedin)/ut_pass_donedin).ToString("0.000")+"%":""}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            };
							 | 
						|||
| 
								 | 
							
								                Grid1.SummaryData = summary;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion        
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 统计按钮事件
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 统计
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void BtnAnalyse_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								            OutputSummaryData();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #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;
							 | 
						|||
| 
								 | 
							
								            Response.Write(GetGridTableHtml(Grid1));
							 | 
						|||
| 
								 | 
							
								            Response.End();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 导出方法
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="grid"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        private string GetGridTableHtml(Grid grid)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            StringBuilder sb = new StringBuilder();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            MultiHeaderTable mht = new MultiHeaderTable();
							 | 
						|||
| 
								 | 
							
								            mht.ResolveMultiHeaderTable(Grid1.Columns);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            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;\">");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            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)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        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>");
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            int j = 0;
							 | 
						|||
| 
								 | 
							
								            foreach (GridRow row in grid.Rows)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                sb.Append("<tr>");
							 | 
						|||
| 
								 | 
							
								                int i = 0;
							 | 
						|||
| 
								 | 
							
								                foreach (GridColumn column in mht.Columns)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    string html = row.Values[column.ColumnIndex].ToString();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    if (column.ColumnID == "tfNumber")
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        html = (row.FindControl("labNumber") as AspNet.Label).Text;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else if (column.ColumnID == "tfGender")
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        html = (row.FindControl("labGender") as AspNet.Label).Text;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    if (i <= 5 && j % 2 == 0)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        if (!column.Hidden)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                            sb.AppendFormat("<td rowspan='2'>{0}</td>", html);
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else if (i > 5)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        if (!column.Hidden)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            if ( !string.IsNullOrEmpty(html) && ("current_passrate" == column.ColumnID || "nowpassrate" == column.ColumnID || "nowunpassrate" == column.ColumnID || "repairrate" == column.ColumnID || "finishedrate" == column.ColumnID || "passrate" == column.ColumnID || "unpassrate" == column.ColumnID || "tofdpassrate" == column.ColumnID || "tdfwpassrate" == column.ColumnID || "utpassrate" == column.ColumnID || "tofdpassrate" == column.ColumnID))
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                sb.AppendFormat("<td  style=\"text-align:center;@\" >{0}%</td>", (100 * double.Parse(html)).ToString("0.###"));
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                            else
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                sb.AppendFormat("<td >{0}</td>", html);
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    i++;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                j++;
							 | 
						|||
| 
								 | 
							
								                sb.Append("</tr>");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            var sumary = grid.SummaryData;
							 | 
						|||
| 
								 | 
							
								            if (sumary != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                sb.Append("<tr>");
							 | 
						|||
| 
								 | 
							
								                foreach (GridColumn column in grid.Columns)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    try
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        if (column is GroupField)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            if (((GroupField)column).Columns != null)
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                foreach (var item in ((GroupField)column).Columns)
							 | 
						|||
| 
								 | 
							
								                                {
							 | 
						|||
| 
								 | 
							
								                                    if (!column.Hidden)
							 | 
						|||
| 
								 | 
							
								                                    {
							 | 
						|||
| 
								 | 
							
								                                        if (("current_passrate" == item.ColumnID || "nowpassrate" == item.ColumnID || "nowunpassrate" == item.ColumnID || "repairrate" == item.ColumnID || "finishedrate" == item.ColumnID || "passrate" == item.ColumnID || "unpassrate" == item.ColumnID || "tofdpassrate" == item.ColumnID || "tdfwpassrate" == item.ColumnID || "utpassrate" == item.ColumnID || "tofdpassrate" == item.ColumnID) && sumary.ContainsKey(item.ColumnID))
							 | 
						|||
| 
								 | 
							
								                                        {
							 | 
						|||
| 
								 | 
							
								                                            sb.AppendFormat("<td  style=\"text-align:center;\" >{0}</td>", sumary.GetValue(item.ColumnID).ToString());
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                                        }
							 | 
						|||
| 
								 | 
							
								                                        else if (sumary.ContainsKey(item.ColumnID))
							 | 
						|||
| 
								 | 
							
								                                        {
							 | 
						|||
| 
								 | 
							
								                                            sb.AppendFormat("<td  style=\"text-align:center;vnd.ms-excel.numberformat:@\" >{0}</td>", sumary.GetValue(item.ColumnID).ToString());
							 | 
						|||
| 
								 | 
							
								                                        }
							 | 
						|||
| 
								 | 
							
								                                        else
							 | 
						|||
| 
								 | 
							
								                                        {
							 | 
						|||
| 
								 | 
							
								                                            sb.AppendFormat("<td  style=\"text-align:center;vnd.ms-excel.numberformat:@\" >{0}</td>", "");
							 | 
						|||
| 
								 | 
							
								                                        }
							 | 
						|||
| 
								 | 
							
								                                    }
							 | 
						|||
| 
								 | 
							
								                                }
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        else if (column is RenderField)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            if (!column.Hidden)
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                if (("current_passrate" == column.ColumnID || "nowpassrate" == column.ColumnID || "nowunpassrate" == column.ColumnID || "repairrate" == column.ColumnID || "finishedrate" == column.ColumnID || "passrate" == column.ColumnID || "unpassrate" == column.ColumnID || "tofdpassrate" == column.ColumnID || "tdfwpassrate" == column.ColumnID || "utpassrate" == column.ColumnID || "tofdpassrate" == column.ColumnID) && sumary.ContainsKey(column.ColumnID))
							 | 
						|||
| 
								 | 
							
								                                {
							 | 
						|||
| 
								 | 
							
								                                    sb.AppendFormat("<td  style=\" text-align:center;\" >{0}</td>", sumary.GetValue(column.ColumnID).ToString());
							 | 
						|||
| 
								 | 
							
								                                }
							 | 
						|||
| 
								 | 
							
								                                else if (sumary.ContainsKey(column.ColumnID))
							 | 
						|||
| 
								 | 
							
								                                {
							 | 
						|||
| 
								 | 
							
								                                    sb.AppendFormat("<td  style=\"text-align:center;vnd.ms-excel.numberformat:@\" >{0}</td>", sumary.GetValue(column.ColumnID).ToString());
							 | 
						|||
| 
								 | 
							
								                                }
							 | 
						|||
| 
								 | 
							
								                                else
							 | 
						|||
| 
								 | 
							
								                                {
							 | 
						|||
| 
								 | 
							
								                                    sb.AppendFormat("<td  style=\"text-align:center;vnd.ms-excel.numberformat:@\" >{0}</td>", "");
							 | 
						|||
| 
								 | 
							
								                                }
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        else
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            if (!column.Hidden)
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                sb.AppendFormat("<td  style=\"text-align:center;vnd.ms-excel.numberformat:@\" >{0}</td>", "");
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                         
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    catch (Exception e)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        sb.AppendFormat("<td  style=\"text-align:center;vnd.ms-excel.numberformat:@\" >{0}</td>", "");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                } sb.Append("</tr>");
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								           
							 | 
						|||
| 
								 | 
							
								            sb.Append("</table>");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return sb.ToString();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								           #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region DropDownList下拉选择事件
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 单位下拉选择事件
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void drpUnit_SelectedIndexChanged(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.drpWorkArea.Items.Clear();
							 | 
						|||
| 
								 | 
							
								            this.drpTeamGroup.Items.Clear();
							 | 
						|||
| 
								 | 
							
								            if (this.drpUnit.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpUnit.SelectedValue))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                BLL.WorkAreaService.InitWorkAreaProjectUnitDropDownList(this.drpWorkArea, this.CurrUser.LoginProjectId, this.drpUnit.SelectedValue, true);
							 | 
						|||
| 
								 | 
							
								                this.drpWorkArea.SelectedIndex = 0;
							 | 
						|||
| 
								 | 
							
								                BLL.TeamGroupService.InitTeamGroupProjectUnitDropDownList(this.drpTeamGroup, this.CurrUser.LoginProjectId, this.drpUnit.SelectedValue, true);
							 | 
						|||
| 
								 | 
							
								                this.drpTeamGroup.SelectedIndex = 0;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 班组下拉选择事件
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void drpTeamGroup_SelectedIndexChanged(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.ddlWloName.Items.Clear();
							 | 
						|||
| 
								 | 
							
								            if (this.drpTeamGroup.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpTeamGroup.SelectedValue))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                BLL.WelderService.InitWelderListByTeamGroupId(this.ddlWloName, this.CurrUser.LoginProjectId, this.drpTeamGroup.SelectedValue, true, "-请选择-");
							 | 
						|||
| 
								 | 
							
								                this.ddlWloName.SelectedIndex = 0;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |