CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/HSSE/License/LiftingWorkView.aspx.cs

334 lines
15 KiB
C#
Raw Normal View History

2021-04-30 10:28:37 +08:00
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 LiftingWorkView : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
private string LiftingWorkId
{
get
{
return (string)ViewState["LiftingWorkId"];
}
set
{
ViewState["LiftingWorkId"] = 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_CWCEC) + this.Title;
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.LiftingWorkId = Request.Params["LiftingWorkId"];
if (!string.IsNullOrEmpty(this.LiftingWorkId))
{
var getLiftingWork = LicensePublicService.GetLiftingWorkById(this.LiftingWorkId);
if (getLiftingWork != null)
{
this.lbLicenseCode.Text = getLiftingWork.LicenseCode;
this.txtApplyUnit.Text = UnitService.GetUnitNameByUnitId(getLiftingWork.ApplyUnitId);
2023-09-13 08:31:05 +08:00
//this.txtApplyManName.Text = UserService.GetUserNameByUserId(getLiftingWork.ApplyManId);
//this.txtWorkPalce.Text = getLiftingWork.WorkPalce;
2021-04-30 10:28:37 +08:00
this.txtWorkLevel.Text = getLiftingWork.WorkLevel;
if (getLiftingWork.ValidityStartTime.HasValue)
{
this.txtWorkDate.Text = getLiftingWork.ValidityStartTime.Value.ToString("f") + " 至 ";
if (getLiftingWork.ValidityEndTime.HasValue)
{
this.txtWorkDate.Text += getLiftingWork.ValidityEndTime.Value.ToString("f");
}
}
this.txtWorkMeasures.Text = getLiftingWork.WorkMeasures;
this.txtCraneCapacity.Text = getLiftingWork.CraneCapacity;
if (!string.IsNullOrEmpty(getLiftingWork.CancelManId))
{
this.txtCance.Text = UserService.GetUserNameByUserId(getLiftingWork.CancelManId) + ";取消时间:"
+ string.Format("{0:yyyy-MM-dd HH:mm}", getLiftingWork.CancelTime) + ";原因:" + getLiftingWork.CancelReasons + "。";
}
if (!string.IsNullOrEmpty(getLiftingWork.CloseManId))
{
if (!string.IsNullOrEmpty(getLiftingWork.CloseReasons))
{
this.txtClose.Text = getLiftingWork.CloseReasons + " 关闭时间:"
+ string.Format("{0:yyyy-MM-dd HH:mm}", getLiftingWork.CloseTime) + "。";
}
else
{
this.txtClose.Text = UserService.GetUserNameByUserId(getLiftingWork.CloseManId) + ";关闭时间:"
+ string.Format("{0:yyyy-MM-dd HH:mm}", getLiftingWork.CloseTime) + "。";
}
}
2023-09-13 08:31:05 +08:00
txtLiftingHeight.Text = getLiftingWork.LiftingHeight;
txtFireWatchManName.Text = getLiftingWork.FireWatchManName;
txtWorkLeaderName.Text = getLiftingWork.WorkLeaderName;
txtQzgName.Text = getLiftingWork.QzgName;
txtSjName.Text = getLiftingWork.SjName;
2021-04-30 10:28:37 +08:00
}
}
// 绑定表格
this.BindGrid();
this.SetFlow();
}
}
#endregion
#region
2023-09-21 15:54:21 +08:00
public string FlowOperateId1;
public string FlowOperateId2;
public string FlowOperateId3;
public string FlowOperateId4;
2021-04-30 10:28:37 +08:00
/// <summary>
///
/// </summary>
private void SetFlow()
{
var getFlows = LicensePublicService.GetFlowOperateListByDataId(this.LiftingWorkId);
if (getFlows.Count() > 0)
{
var getF1 = getFlows.FirstOrDefault(x => x.SortIndex == 1);
if (getF1 != null)
{
2023-09-21 15:54:21 +08:00
FlowOperateId1 = getF1.FlowOperateId;
2021-04-30 10:28:37 +08:00
this.txtForm1.Title = getF1.AuditFlowName + "";
if (getF1.OperaterTime.HasValue)
{
if (getF1.IsAgree == true)
{
this.txtOpinion1.Text = "同意。";
}
else
{
this.txtOpinion1.Text = getF1.Opinion;
}
2023-09-21 15:54:21 +08:00
if (!string.IsNullOrEmpty(getF1.SignatureUrl))
{
this.Image1.ImageUrl = "~/" + getF1.SignatureUrl;
}
var signUser1 = UserService.GetUserByUserId(getF1.OperaterId);
if (signUser1 != null)
{
this.txtName1.Text = signUser1.UserName;
}
2021-04-30 10:28:37 +08:00
this.txtTime1.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF1.OperaterTime);
}
}
2023-09-21 15:54:21 +08:00
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)
{
FlowOperateId4 = getF4.FlowOperateId;
this.txtForm4.Title = getF4.AuditFlowName + "";
if (getF4.OperaterTime.HasValue)
{
if (getF4.IsAgree == true)
{
this.txtOpinion4.Text = "同意。";
}
else
{
this.txtOpinion4.Text = getF4.Opinion;
}
if (!string.IsNullOrEmpty(getF4.SignatureUrl))
{
this.Image4.ImageUrl = "~/" + getF4.SignatureUrl;
}
var signUser4 = UserService.GetUserByUserId(getF4.OperaterId);
if (signUser4 != null)
{
this.txtName4.Text = signUser4.UserName;
}
this.txtTime4.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF4.OperaterTime);
}
}
2023-09-13 08:31:05 +08:00
//var getF2 = getFlows.FirstOrDefault(x => x.SortIndex == 2);
//if (getF2 != null)
//{
// this.txtForm2.Title = getF2.AuditFlowName + "";
// if (getF2.OperaterTime.HasValue)
// {
// if (getF2.IsAgree == true)
// {
// this.txtOpinion2.Text = "同意。";
// }
// else
// {
// this.txtOpinion2.Text = getF2.Opinion;
// }
// this.txtName2.Text = UserService.GetUserNameByUserId(getF2.OperaterId);
// this.txtTime2.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF2.OperaterTime);
// }
//}
//var getF3 = getFlows.FirstOrDefault(x => x.SortIndex == 3);
//if (getF3 != null)
//{
// this.txtForm3.Title = getF3.AuditFlowName + "";
// if (getF3.OperaterTime.HasValue)
// {
// if (getF3.IsAgree == true)
// {
// this.txtOpinion3.Text = "同意。";
// }
// else
// {
// this.txtOpinion3.Text = getF3.Opinion;
// }
// this.txtName3.Text = UserService.GetUserNameByUserId(getF3.OperaterId);
// 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);
// }
//}
//var getF5 = getFlows.FirstOrDefault(x => x.SortIndex == 5);
//if (getF5 != null)
//{
// this.txtForm5.Title = getF5.AuditFlowName + "";
// if (getF5.OperaterTime.HasValue)
// {
// if (getF5.IsAgree == true)
// {
// this.txtOpinion5.Text = "同意。";
// }
// else
// {
// this.txtOpinion5.Text = getF5.Opinion;
// }
// this.txtName5.Text = UserService.GetUserNameByUserId(getF5.OperaterId);
// this.txtTime5.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF5.OperaterTime);
// }
//}
//var getF6 = getFlows.FirstOrDefault(x => x.SortIndex == 6);
//if (getF6 != null)
//{
// this.txtForm6.Title = getF6.AuditFlowName + "";
// if (getF6.OperaterTime.HasValue)
// {
// if (getF6.IsAgree == true)
// {
// this.txtOpinion6.Text = "同意。";
// }
// else
// {
// this.txtOpinion6.Text = getF6.Opinion;
// }
// this.txtName6.Text = UserService.GetUserNameByUserId(getF6.OperaterId);
// this.txtTime6.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getF6.OperaterTime);
// }
//}
2021-04-30 10:28:37 +08:00
}
}
#endregion
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
2023-09-13 08:31:05 +08:00
string strSql = @"SELECT LicenseItemId,DataId,SortIndex,SafetyMeasures,(CASE WHEN IsUsed = 1 THEN '合格' ELSE '不合格' END) AS NoUsedName,ConfirmManId,U.UserName AS ConfirmManName"
2021-04-30 10:28:37 +08:00
+ @" FROM License_LicenseItem AS L "
+ @" LEFT JOIN Sys_User AS U ON L.ConfirmManId =U.UserId"
+ @" WHERE L.DataId ='" + this.LiftingWorkId +"'";
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();
}
}
}