516 lines
18 KiB
C#
516 lines
18 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using AspNet = System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.ZHGL.ManagementReport
|
|
{
|
|
public partial class CQMSCheckDaily : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
////权限按钮方法
|
|
this.GetButtonPower();
|
|
Funs.DropDownPageSize(this.ddlPageSize);
|
|
GetButtonPower();
|
|
UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpSponsorUnit, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);
|
|
UnitWorkService.InitUnitWorkDownList(drpUnitWork, this.CurrUser.LoginProjectId, true);
|
|
CNProfessionalService.InitCNProfessionalDownList(drpCNProfessional, true);
|
|
QualityQuestionTypeService.InitQualityQuestionTypeDownList(drpQuestionType, true);
|
|
Funs.FineUIPleaseSelect(this.dpHandelStatus);
|
|
// 绑定表格
|
|
//BindGrid();
|
|
InitTreeMenu();
|
|
}
|
|
}
|
|
|
|
private void InitTreeMenu()
|
|
{
|
|
this.tvControlItem.Nodes.Clear();
|
|
TreeNode rootNode = new TreeNode();
|
|
rootNode.Text = "项目";
|
|
rootNode.NodeID = "0";
|
|
rootNode.Expanded = true;
|
|
this.tvControlItem.Nodes.Add(rootNode);
|
|
|
|
var project = (from x in Funs.DB.Base_Project
|
|
select new { x.ProjectId, x.ProjectName }).Distinct();
|
|
if (project.Count() > 0)
|
|
{
|
|
foreach (var pro in project)
|
|
{
|
|
TreeNode tnProject = new TreeNode();//年节点
|
|
tnProject.Text = SubStr(pro.ProjectName);
|
|
tnProject.NodeID = pro.ProjectId;
|
|
tnProject.ToolTip = pro.ProjectName;
|
|
tnProject.EnableClickEvent = true;
|
|
rootNode.Nodes.Add(tnProject);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
|
|
|
|
public Task<DataTable> data()
|
|
{
|
|
Task<DataTable> task = new Task<DataTable>(() =>
|
|
{
|
|
return ChecklistData();
|
|
});
|
|
task.Start();
|
|
return task;
|
|
}
|
|
protected DataTable ChecklistData()
|
|
{
|
|
string strSql = @"SELECT chec.CheckControlCode,chec.CheckSite,chec.ProjectId,chec.unitId,cNProfessional.ProfessionalName,"
|
|
+ @" QualityQuestionType.QualityQuestionType as QuestionType,"
|
|
+ @" chec.checkman,chec.CheckDate,chec.DocCode,chec.submitman,chec.state,chec.CNProfessionalCode,"
|
|
+ @" unit.UnitName,unitWork.UnitWorkName+(case unitWork.ProjectType when '1' then '(建筑)' else '(安装)' end) as UnitWorkName,u.userName "
|
|
+ @" FROM Check_CheckControl chec"
|
|
+ @" left join Base_Unit unit on unit.unitId=chec.unitId"
|
|
+ @" left join Base_CNProfessional cNProfessional on cNProfessional.CNProfessionalId=chec.CNProfessionalCode"
|
|
+ @" left join WBS_UnitWork unitWork on unitWork.UnitWorkId = chec.UnitWorkId"
|
|
+ @" left join Base_QualityQuestionType QualityQuestionType on QualityQuestionType.QualityQuestionTypeId = chec.QuestionType"
|
|
+ @" left join sys_User u on u.userId = chec.CheckMan"
|
|
+ @" where 1=1 ";
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
// if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
|
{
|
|
strSql += " AND chec.ProjectId = @ProjectId";
|
|
listStr.Add(new SqlParameter("@ProjectId", tvControlItem.SelectedNodeID));
|
|
}
|
|
|
|
strSql += " AND (chec.CheckDate>=@startTime or @startTime='') and (chec.CheckDate<=@endTime or @endTime='') ";
|
|
listStr.Add(new SqlParameter("@startTime", !string.IsNullOrEmpty(txtStartTime.Text.Trim()) ? txtStartTime.Text.Trim() + " 00:00:00" : ""));
|
|
listStr.Add(new SqlParameter("@endTime", !string.IsNullOrEmpty(txtEndTime.Text.Trim()) ? txtEndTime.Text.Trim() + " 23:59:59" : ""));
|
|
if (drpSponsorUnit.SelectedValue != BLL.Const._Null)
|
|
{
|
|
strSql += " AND chec.unitId=@unitId";
|
|
listStr.Add(new SqlParameter("@unitId", drpSponsorUnit.SelectedValue));
|
|
}
|
|
if (drpUnitWork.SelectedValue != Const._Null)
|
|
{
|
|
strSql += " AND chec.unitworkId=@unitworkId";
|
|
listStr.Add(new SqlParameter("@unitworkId", drpUnitWork.SelectedValue));
|
|
}
|
|
if (drpCNProfessional.SelectedValue != Const._Null)
|
|
{
|
|
strSql += " AND chec.CNProfessionalCode=@CNProfessionalCode";
|
|
listStr.Add(new SqlParameter("@CNProfessionalCode", drpCNProfessional.SelectedValue));
|
|
}
|
|
if (drpQuestionType.SelectedValue != Const._Null)
|
|
{
|
|
strSql += " AND chec.QuestionType=@QuestionType";
|
|
listStr.Add(new SqlParameter("@QuestionType", drpQuestionType.SelectedValue));
|
|
}
|
|
if (dpHandelStatus.SelectedValue != Const._Null)
|
|
{
|
|
if (dpHandelStatus.SelectedValue.Equals("1"))
|
|
{
|
|
strSql += " AND (chec.state='5' or chec.state='6')";
|
|
}
|
|
else if (dpHandelStatus.SelectedValue.Equals("2"))
|
|
{
|
|
strSql += " AND chec.state='7'";
|
|
}
|
|
else if (dpHandelStatus.SelectedValue.Equals("3"))
|
|
{
|
|
strSql += " AND DATEADD(day,1,chec.LimitDate)< GETDATE() and chec.state<>5 and chec.state<>6 and chec.state<>7";
|
|
}
|
|
else if (dpHandelStatus.SelectedValue.Equals("4"))
|
|
{
|
|
strSql += " AND DATEADD(day,1,chec.LimitDate)> GETDATE() and chec.state<>5 and chec.state<>6 and chec.state<>7";
|
|
}
|
|
}
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
return tb;
|
|
}
|
|
/// <summary>
|
|
/// 把状态转换代号为文字形式
|
|
/// </summary>
|
|
/// <param name="state"></param>
|
|
/// <returns></returns>
|
|
protected string ConvertState(object state)
|
|
{
|
|
if (state != null)
|
|
{
|
|
if (state.ToString() == BLL.Const.CheckControl_ReCompile)
|
|
{
|
|
return "重新编制";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_Compile)
|
|
{
|
|
return "编制";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_Audit1)
|
|
{
|
|
return "总包负责人审批";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_Audit2)
|
|
{
|
|
return "分包专业工程师回复";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_Audit3)
|
|
{
|
|
return "分包负责人审批";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_Audit4)
|
|
{
|
|
return "总包专业工程师确认";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_Audit5)
|
|
{
|
|
return "总包负责人确认";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_Complete)
|
|
{
|
|
return "审批完成";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_ReCompile2)
|
|
{
|
|
return "分包专业工程师重新回复";
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
public string Convertstatus(Object code)
|
|
{
|
|
Model.Check_CheckControl checkControl = BLL.CheckControlService.GetCheckControl(code.ToString());
|
|
if (checkControl.State.Equals("5") || checkControl.State.Equals("6"))
|
|
{
|
|
return "未确认";
|
|
}
|
|
else if (checkControl.State == Const.CheckControl_Complete)
|
|
{ //闭环
|
|
return "已闭环";
|
|
}
|
|
//else if( checkControl.LimitDate> )
|
|
else if (Convert.ToDateTime(checkControl.LimitDate).AddDays(1) < DateTime.Now) //延期未整改
|
|
{
|
|
return "超期未整改";
|
|
|
|
}
|
|
else //期内未整改
|
|
{
|
|
return "未整改";
|
|
|
|
}
|
|
}
|
|
//<summary>
|
|
//获取办理人姓名
|
|
//</summary>
|
|
//<param name="state"></param>
|
|
//<returns></returns>
|
|
protected string ConvertMan(object CheckControlCode)
|
|
{
|
|
if (CheckControlCode != null)
|
|
{
|
|
Model.Check_CheckControlApprove a = BLL.CheckControlApproveService.GetCheckControlApproveByCheckControlId(CheckControlCode.ToString());
|
|
if (a != null)
|
|
{
|
|
if (a.ApproveMan != null)
|
|
{
|
|
return BLL.UserService.GetUserByUserId(a.ApproveMan).UserName;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
protected string ConvertImageUrlByImage(object registrationId)
|
|
{
|
|
string url = string.Empty;
|
|
if (registrationId != null)
|
|
{
|
|
IList<Model.AttachFile> sourlist = AttachFileService.GetBeforeFileList(registrationId.ToString(), BLL.Const.CheckListMenuId);
|
|
|
|
if (sourlist != null && sourlist.Count > 0)
|
|
{
|
|
string AttachUrl = "";
|
|
foreach (var item in sourlist)
|
|
{
|
|
if (!string.IsNullOrEmpty(item.AttachUrl) && item.AttachUrl.ToLower().EndsWith(".jpg") || item.AttachUrl.ToLower().EndsWith(".jpeg") || item.AttachUrl.ToLower().EndsWith(".png"))
|
|
AttachUrl += item.AttachUrl.TrimEnd(',') + ",";
|
|
}
|
|
url = BLL.UploadAttachmentService.ShowImage(ConfigurationManager.AppSettings["SGGLUrl"], AttachUrl.TrimEnd(','));
|
|
}
|
|
}
|
|
return url;
|
|
}
|
|
protected string ConvertImgUrlByImage(object registrationId)
|
|
{
|
|
string url = string.Empty;
|
|
if (registrationId != null)
|
|
{
|
|
IList<Model.AttachFile> sourlist = AttachFileService.Getfilelist(registrationId.ToString() + "r", BLL.Const.CheckListMenuId);
|
|
|
|
if (sourlist != null && sourlist.Count > 0)
|
|
{
|
|
string AttachUrl = "";
|
|
foreach (var item in sourlist)
|
|
{
|
|
if (!string.IsNullOrEmpty(item.AttachUrl) && item.AttachUrl.ToLower().EndsWith(".jpg") || item.AttachUrl.ToLower().EndsWith(".jpeg") || item.AttachUrl.ToLower().EndsWith(".png"))
|
|
AttachUrl += item.AttachUrl.TrimEnd(',') + ",";
|
|
}
|
|
url = BLL.UploadAttachmentService.ShowImage(ConfigurationManager.AppSettings["SGGLUrl"], AttachUrl.TrimEnd(','));
|
|
}
|
|
}
|
|
return url;
|
|
}
|
|
|
|
protected void btnQuery_Click(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
|
|
public void BindGrid()
|
|
{
|
|
DataTable tb = ChecklistData();
|
|
|
|
// 2.获取当前分页数据
|
|
//var table = this.GetPagedDataTable(Grid1, tb1);
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
|
|
for (int i = 0; i < Grid1.Rows.Count; i++)
|
|
{
|
|
string rowID = Grid1.Rows[i].DataKeys[0].ToString();
|
|
if (rowID.Count() > 0)
|
|
{
|
|
Model.Check_CheckControl checkControl = BLL.CheckControlService.GetCheckControl(rowID);
|
|
if (checkControl.State.Equals("5") || checkControl.State.Equals("6"))
|
|
{
|
|
Grid1.Rows[i].CellCssClasses[11] = "LightGreen";//未确认
|
|
}
|
|
else if (checkControl.State == Const.CheckControl_Complete)
|
|
{ //闭环
|
|
Grid1.Rows[i].CellCssClasses[11] = "Green";
|
|
|
|
}
|
|
else if (Convert.ToDateTime(checkControl.LimitDate).AddDays(1) < DateTime.Now) //延期未整改
|
|
{
|
|
Grid1.Rows[i].CellCssClasses[11] = "Red";
|
|
}
|
|
else //期内未整改
|
|
{
|
|
Grid1.Rows[i].CellCssClasses[11] = " Yellow ";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
#region 查询
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 获取按钮权限
|
|
/// <summary>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
private void GetButtonPower()
|
|
{
|
|
if (Request.Params["value"] == "0")
|
|
{
|
|
return;
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
private string SubStr(string str)
|
|
{
|
|
string reStr = str;
|
|
if (!string.IsNullOrEmpty(str) && str.Length > 16)
|
|
{
|
|
reStr = str.Substring(0, 14) + "..";
|
|
}
|
|
return reStr;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 表排序、分页、关闭窗口
|
|
/// <summary>
|
|
/// 分页
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
Grid1.PageIndex = e.NewPageIndex;
|
|
BindGrid();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 关闭弹出窗
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region Grid双击事件
|
|
/// <summary>
|
|
/// Grid行双击事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
{
|
|
btnMenuSee_Click(null, null);
|
|
}
|
|
#endregion
|
|
|
|
#region 查看
|
|
/// <summary>
|
|
/// 查看按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuSee_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string RegistrationId = Grid1.SelectedRowID;
|
|
var registration = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(RegistrationId);
|
|
if (registration != null)
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("HiddenRectificationView.aspx?HazardRegisterId={0}", RegistrationId, "查看 - ")));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 格式化字符串
|
|
/// <summary>
|
|
/// 获取整改前图片
|
|
/// </summary>
|
|
/// <param name="registrationId"></param>
|
|
/// <returns></returns>
|
|
protected string ConvertImageUrl(object registrationId)
|
|
{
|
|
string url = string.Empty;
|
|
if (registrationId != null)
|
|
{
|
|
var registration = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(registrationId.ToString());
|
|
if (registration != null)
|
|
{
|
|
url = BLL.UploadAttachmentService.ShowAttachment("../../", registration.ImageUrl);
|
|
}
|
|
}
|
|
return url;
|
|
}
|
|
protected string ConvertProblemTypes(object registrationId)
|
|
{
|
|
string url = string.Empty;
|
|
if (registrationId != null)
|
|
{
|
|
if (registrationId.ToString() == "1")
|
|
{
|
|
return "日常巡检";
|
|
}
|
|
else if (registrationId.ToString() == "2")
|
|
{
|
|
return "专项检查";
|
|
}
|
|
|
|
}
|
|
return url;
|
|
}
|
|
|
|
|
|
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
BindGrid();
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
} |