238 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			238 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								namespace FineUIPro.Web.HSSE.License
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    using BLL;
							 | 
						|||
| 
								 | 
							
								    using System;
							 | 
						|||
| 
								 | 
							
								    using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								    using System.Data;
							 | 
						|||
| 
								 | 
							
								    using System.Data.SqlClient;
							 | 
						|||
| 
								 | 
							
								    using System.Linq;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    public partial class PressureTestView : PageBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        #region 定义项
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 主键
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private string PressureTestId
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return (string)ViewState["PressureTestId"];
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            set
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ViewState["PressureTestId"] = value;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 加载
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 加载页面
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Page_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (!IsPostBack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                this.SimpleForm1.Title = UnitService.GetUnitNameByUnitId(Const.UnitId_CD) + this.Title;
							 | 
						|||
| 
								 | 
							
								                this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
							 | 
						|||
| 
								 | 
							
								                this.PressureTestId = Request.Params["PressureTestId"];
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.PressureTestId))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    var getPressureTest = LicensePublicService.GetPressureTestById(this.PressureTestId);
							 | 
						|||
| 
								 | 
							
								                    if (getPressureTest != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.lbLicenseCode.Text = getPressureTest.LicenseCode;
							 | 
						|||
| 
								 | 
							
								                        this.txtApplyUnit.Text = UnitService.GetUnitNameByUnitId(getPressureTest.ApplyUnitId);
							 | 
						|||
| 
								 | 
							
								                        this.txtApplyManName.Text = UserService.GetUserNameByUserId(getPressureTest.ApplyManId);
							 | 
						|||
| 
								 | 
							
								                        this.txtWorkPalce.Text = getPressureTest.WorkPalce;
							 | 
						|||
| 
								 | 
							
								                        string name = getPressureTest.WatchManName;
							 | 
						|||
| 
								 | 
							
								                        if (string.IsNullOrEmpty(getPressureTest.WatchManName))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            name = UserService.GetUserNameByUserId(getPressureTest.WatchManId);
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        this.txtFireWatchManName.Text = name;
							 | 
						|||
| 
								 | 
							
								                        if (getPressureTest.ValidityStartTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtWorkDate.Text = getPressureTest.ValidityStartTime.Value.ToString("f") + " 至 ";
							 | 
						|||
| 
								 | 
							
								                            if (getPressureTest.ValidityEndTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                this.txtWorkDate.Text += getPressureTest.ValidityEndTime.Value.ToString("f");
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        this.txtWorkMeasures.Text = getPressureTest.WorkContent;
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(getPressureTest.SignatureUrl))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtTime0.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getPressureTest.ApplyDate);
							 | 
						|||
| 
								 | 
							
								                            this.txtOpinion0.Text = "同意。";
							 | 
						|||
| 
								 | 
							
								                            this.txtName0.Text = this.txtApplyManName.Text;
							 | 
						|||
| 
								 | 
							
								                            this.Image0.ImageUrl = "~/" + getPressureTest.SignatureUrl;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(getPressureTest.CancelManId))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtCance.Text = UserService.GetUserNameByUserId(getPressureTest.CancelManId) + ";取消时间:"
							 | 
						|||
| 
								 | 
							
								                                + string.Format("{0:yyyy-MM-dd HH:mm}", getPressureTest.CancelTime) + ";原因:" + getPressureTest.CancelReasons + "。";
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(getPressureTest.CloseManId))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            if (!string.IsNullOrEmpty(getPressureTest.CloseReasons))
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                this.txtClose.Text = getPressureTest.CloseReasons + " 关闭时间:"
							 | 
						|||
| 
								 | 
							
								                                 + string.Format("{0:yyyy-MM-dd HH:mm}", getPressureTest.CloseTime) + "。";
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                            else
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                this.txtClose.Text = UserService.GetUserNameByUserId(getPressureTest.CloseManId) + "关闭;关闭时间:"
							 | 
						|||
| 
								 | 
							
								                                + string.Format("{0:yyyy-MM-dd HH:mm}", getPressureTest.CloseTime) + "。";
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                // 绑定表格
							 | 
						|||
| 
								 | 
							
								                this.BindGrid();
							 | 
						|||
| 
								 | 
							
								                this.SetFlow();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 获取审核记录信息
							 | 
						|||
| 
								 | 
							
								        public string FlowOperateId1;
							 | 
						|||
| 
								 | 
							
								        public string FlowOperateId2;
							 | 
						|||
| 
								 | 
							
								        public string FlowOperateId3;
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private void SetFlow()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            var getFlows = LicensePublicService.GetFlowOperateListByDataId(this.PressureTestId);
							 | 
						|||
| 
								 | 
							
								            if (getFlows.Count() > 0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                var getF1 = getFlows.FirstOrDefault(x => x.SortIndex == 1);
							 | 
						|||
| 
								 | 
							
								                if (getF1 != null)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    FlowOperateId1 = getF1.FlowOperateId;
							 | 
						|||
| 
								 | 
							
								                    this.txtForm1.Title = getF1.AuditFlowName + ":";
							 | 
						|||
| 
								 | 
							
								                    if (getF1.OperaterTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        if (getF1.IsAgree == true)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtOpinion1.Text = "同意。";
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        else
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtOpinion1.Text = getF1.Opinion;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(getF1.SignatureUrl))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.Image1.ImageUrl = "~/" + getF1.SignatureUrl;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        var signUser1 = UserService.GetUserByUserId(getF1.OperaterId);
							 | 
						|||
| 
								 | 
							
								                        if (signUser1 != null)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtName1.Text = signUser1.UserName;                            
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        this.txtTime1.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF1.OperaterTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                var getF2 = getFlows.FirstOrDefault(x => x.SortIndex == 2);
							 | 
						|||
| 
								 | 
							
								                if (getF2 != null)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    FlowOperateId2 = getF2.FlowOperateId;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    this.txtForm2.Title = getF2.AuditFlowName + ":";
							 | 
						|||
| 
								 | 
							
								                    if (getF2.OperaterTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        if (getF2.IsAgree == true)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtOpinion2.Text = "同意。";
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        else
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtOpinion2.Text = getF2.Opinion;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(getF2.SignatureUrl))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.Image2.ImageUrl = "~/" + getF2.SignatureUrl;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        var signUser2 = UserService.GetUserByUserId(getF2.OperaterId);
							 | 
						|||
| 
								 | 
							
								                        if (signUser2 != null)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtName2.Text = signUser2.UserName;
							 | 
						|||
| 
								 | 
							
								                           
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        this.txtTime2.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF2.OperaterTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                var getF3 = getFlows.FirstOrDefault(x => x.SortIndex == 3);
							 | 
						|||
| 
								 | 
							
								                if (getF3 != null)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    FlowOperateId3 = getF3.FlowOperateId;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    this.txtForm3.Title = getF3.AuditFlowName + ":";
							 | 
						|||
| 
								 | 
							
								                    if (getF3.OperaterTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        if (getF3.IsAgree == true)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtOpinion3.Text = "同意。";
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        else
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtOpinion3.Text = getF3.Opinion;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(getF3.SignatureUrl))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.Image3.ImageUrl = "~/" + getF3.SignatureUrl;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        var signUser3 = UserService.GetUserByUserId(getF3.OperaterId);
							 | 
						|||
| 
								 | 
							
								                        if (signUser3 != null)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtName3.Text = signUser3.UserName;                           
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        this.txtTime3.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF3.OperaterTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                var getF4 = getFlows.FirstOrDefault(x => x.SortIndex == 4);
							 | 
						|||
| 
								 | 
							
								                if (getF4 != null)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.txtForm4.Title = getF4.AuditFlowName + ":";
							 | 
						|||
| 
								 | 
							
								                    if (getF4.OperaterTime.HasValue)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        if (getF4.IsAgree == true)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                           // this.txtOpinion4.Text = "同意。";
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        else
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.txtOpinion4.Text = getF4.Opinion;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        this.txtName4.Text = UserService.GetUserNameByUserId(getF4.OperaterId);
							 | 
						|||
| 
								 | 
							
								                        this.txtTime4.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF4.OperaterTime);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                       }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 绑定数据
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private void BindGrid()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string strSql = @"SELECT LicenseItemId,DataId,SortIndex,SafetyMeasures,(CASE WHEN IsUsed = 1 THEN '合格' ELSE '不合格' END) AS NoUsedName,ConfirmManId,U.UserName AS ConfirmManName"
							 | 
						|||
| 
								 | 
							
								                         + @" FROM License_LicenseItem AS L "
							 | 
						|||
| 
								 | 
							
								                         + @" LEFT JOIN Sys_User AS U ON L.ConfirmManId =U.UserId"
							 | 
						|||
| 
								 | 
							
								                         + @" WHERE L.DataId ='" + this.PressureTestId + "'";
							 | 
						|||
| 
								 | 
							
								            List<SqlParameter> listStr = new List<SqlParameter>();            
							 | 
						|||
| 
								 | 
							
								            SqlParameter[] parameter = listStr.ToArray();
							 | 
						|||
| 
								 | 
							
								            DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
							 | 
						|||
| 
								 | 
							
								            Grid1.RecordCount = tb.Rows.Count;            
							 | 
						|||
| 
								 | 
							
								            var table = this.GetPagedDataTable(Grid1, tb);
							 | 
						|||
| 
								 | 
							
								            Grid1.DataSource = table;
							 | 
						|||
| 
								 | 
							
								            Grid1.DataBind();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |