2021-04-30 10:28:37 +08:00
|
|
|
|
using BLL;
|
2023-10-12 19:33:22 +08:00
|
|
|
|
using FineUIPro.Web.DataShow;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
2024-05-05 17:08:38 +08:00
|
|
|
|
using System.IO;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
using System.Linq;
|
2022-06-06 11:23:24 +08:00
|
|
|
|
using System.Text;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.CQMS.Check
|
|
|
|
|
{
|
|
|
|
|
public partial class CheckList : PageBase
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 项目id
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string ProjectId
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)ViewState["ProjectId"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["ProjectId"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#region 加载页面
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载页面
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// 表头过滤
|
|
|
|
|
//FilterDataRowItem = FilterDataRowItemImplement;
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
GetButtonPower();
|
|
|
|
|
//if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.ProjectId)
|
|
|
|
|
//{
|
|
|
|
|
// this.ProjectId = Request.Params["projectId"];
|
|
|
|
|
//}
|
|
|
|
|
//权限按钮方法
|
|
|
|
|
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);
|
|
|
|
|
btnNew.OnClientClick = Window1.GetShowReference("ChecklistEdit.aspx") + "return false;";
|
|
|
|
|
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
2023-10-12 19:33:22 +08:00
|
|
|
|
if (ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.CurrUser.LoginProjectId, CurrUser.UnitId))
|
|
|
|
|
{
|
|
|
|
|
drpSponsorUnit.SelectedValue = CurrUser.UnitId;
|
|
|
|
|
drpSponsorUnit.Readonly = true;
|
|
|
|
|
}
|
2021-04-30 10:28:37 +08:00
|
|
|
|
// 绑定表格
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
//public System.Web.UI.WebControls.ListItem[] GetHandelStatus()
|
|
|
|
|
//{
|
|
|
|
|
// var list = Handelstatus();
|
|
|
|
|
// System.Web.UI.WebControls.ListItem[] litem = new System.Web.UI.WebControls.ListItem[list.Count];
|
|
|
|
|
|
|
|
|
|
// for (int i = 0; i < list.Count; i++)
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
// litem[i]= new System.Web.UI.WebControls.ListItem(list.Keys.ToString(),list.Values.ToString());
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// return litem;
|
|
|
|
|
//}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 整改状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
protected IDictionary<int, string> Handelstatus()
|
|
|
|
|
{
|
|
|
|
|
Dictionary<int, string> dic = new Dictionary<int, string>();
|
|
|
|
|
dic.Add(1, "未确认");
|
|
|
|
|
dic.Add(2, "已闭环");
|
|
|
|
|
dic.Add(3, "超期未整改");
|
|
|
|
|
dic.Add(4, "未整改");
|
|
|
|
|
return dic;
|
|
|
|
|
}
|
|
|
|
|
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.LimitDate,"
|
|
|
|
|
+ @" chec.checkman,chec.CheckDate,chec.DocCode,chec.submitman,chec.state,chec.CNProfessionalCode,"
|
2024-08-19 16:32:39 +08:00
|
|
|
|
+ @" unit.UnitName,unitWork.UnitWorkName,u.userName "
|
2021-04-30 10:28:37 +08:00
|
|
|
|
+ @" 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 chec.ProjectId=@ProjectId";
|
|
|
|
|
|
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
|
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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>
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
#region 过滤表头、排序、分页、关闭窗口
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 过滤表头
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_FilterChange(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <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 Grid1_Sort(object sender, GridSortEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//Grid1.SortDirection = e.SortDirection;
|
|
|
|
|
//Grid1.SortField = e.SortField;
|
|
|
|
|
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 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)
|
|
|
|
|
{
|
|
|
|
|
btnMenuModify_Click(null, null);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 编辑
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 编辑按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuModify_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string codes = Grid1.SelectedRowID.Split(',')[0];
|
|
|
|
|
var checks = BLL.CheckControlService.GetCheckControl(codes);
|
|
|
|
|
|
|
|
|
|
if (checks != null)
|
|
|
|
|
{
|
|
|
|
|
if (checks.State.Equals(Const.CheckControl_Complete))
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("您不是当前办理人,无法编辑,请右键查看!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Model.Check_CheckControlApprove approve = BLL.CheckControlApproveService.GetCheckControlApproveByCheckControlId(codes);
|
|
|
|
|
if (approve != null)
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(approve.ApproveMan))
|
|
|
|
|
{
|
|
|
|
|
if (this.CurrUser.UserId == approve.ApproveMan || CurrUser.UserId == Const.sysglyId)
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListEdit.aspx?CheckControlCode={0}", codes, "编辑 - ")));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (checks.State == BLL.Const.CheckControl_Complete)
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListView.aspx?CheckControlCode={0}", codes, "查看 - ")));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("您不是当前办理人,无法编辑,请右键查看!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (this.btnMenuModify.Hidden || checks.State == BLL.Const.State_2) ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListView.aspx?CheckControlCode={0}", codes, "查看 - ")));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListEdit.aspx?CheckControlCode={0}", codes, "编辑 - ")));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("您不是当前办理人,无法编辑,请右键查看!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 删除
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 批量删除
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuDel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string codes = Grid1.SelectedRowID.Split(',')[0];
|
|
|
|
|
var checks = BLL.CheckControlService.GetCheckControl(codes);
|
|
|
|
|
|
|
|
|
|
BLL.CheckControlApproveService.DeleteCheckControlApprovesByCheckControlCode(codes);
|
|
|
|
|
BLL.CheckControlService.DeleteCheckControl(codes);
|
|
|
|
|
BLL.LogService.AddSys_Log(this.CurrUser, checks.DocCode, codes, BLL.Const.CheckListMenuId, "删除质量巡检记录");
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
BindGrid();
|
|
|
|
|
Alert.ShowInTop("删除数据成功!", MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 获取按钮权限
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取按钮权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="button"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private void GetButtonPower()
|
|
|
|
|
{
|
|
|
|
|
if (Request.Params["value"] == "0")
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.UserId, BLL.Const.CheckListMenuId);
|
|
|
|
|
if (buttonList.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnAdd))
|
|
|
|
|
{
|
|
|
|
|
this.btnNew.Hidden = false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnModify))
|
|
|
|
|
{
|
|
|
|
|
this.btnMenuModify.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnDelete))
|
|
|
|
|
{
|
|
|
|
|
this.btnMenuDel.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
/// <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 "";
|
|
|
|
|
}
|
|
|
|
|
//<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 void Grid1_RowDataBound(object sender, GridRowEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//if (checkControl.State.Equals("5") || checkControl.State.Equals("6"))
|
|
|
|
|
//{
|
|
|
|
|
// Grid1.Rows[i].RowCssClass = "lightgreen";//未确认
|
|
|
|
|
//}
|
|
|
|
|
//else if (checkControl.State == Const.CheckControl_Complete)
|
|
|
|
|
//{ //闭环
|
|
|
|
|
// Grid1.Rows[i].RowCssClass = "green";
|
|
|
|
|
//}
|
|
|
|
|
////else if( checkControl.LimitDate> )
|
|
|
|
|
//else if (Convert.ToDateTime(checkControl.LimitDate).AddDays(1).Date < DateTime.Now && checkControl.State != BLL.Const.CheckControl_Complete) //延期未整改
|
|
|
|
|
//{
|
|
|
|
|
// Grid1.Rows[i].RowCssClass = "orange";
|
|
|
|
|
//}
|
|
|
|
|
//else //期内未整改
|
|
|
|
|
//{
|
|
|
|
|
// Grid1.Rows[i].RowCssClass = "red";
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnMenuView_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string codes = Grid1.SelectedRowID.Split(',')[0];
|
|
|
|
|
var checks = BLL.CheckControlService.GetCheckControl(codes);
|
|
|
|
|
|
|
|
|
|
if (checks != null)
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListView.aspx?CheckControlCode={0}", codes, "查看 - ")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnQuery_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
protected void btnRset_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
drpSponsorUnit.SelectedIndex = 0;
|
|
|
|
|
drpCNProfessional.SelectedIndex = 0;
|
|
|
|
|
dpHandelStatus.SelectedIndex = 0;
|
|
|
|
|
drpQuestionType.SelectedIndex = 0;
|
|
|
|
|
drpUnitWork.SelectedIndex = 0;
|
|
|
|
|
txtStartTime.Text = "";
|
|
|
|
|
txtEndTime.Text = "";
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
2022-05-22 10:13:35 +08:00
|
|
|
|
|
|
|
|
|
#region 导出按钮
|
|
|
|
|
/// 导出按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnOut_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2024-05-05 17:08:38 +08:00
|
|
|
|
string rootPath = Server.MapPath("~/");
|
|
|
|
|
string initTemplatePath = Const.CheckListTemlUrl;
|
|
|
|
|
string uploadfilepath = string.Empty;
|
|
|
|
|
string newUrl = string.Empty;
|
|
|
|
|
uploadfilepath = rootPath + initTemplatePath;
|
|
|
|
|
|
|
|
|
|
var lists = (from x in Funs.DB.Check_CheckControl
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId
|
|
|
|
|
select x);
|
|
|
|
|
if (!string.IsNullOrEmpty(txtStartTime.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
lists = lists.Where(x => x.CheckDate >= Funs.GetNewDateTime(txtStartTime.Text.Trim() + " 00:00:00"));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(txtEndTime.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
lists = lists.Where(x => x.CheckDate <= Funs.GetNewDateTime(txtEndTime.Text.Trim() + " 23:59:59"));
|
|
|
|
|
}
|
|
|
|
|
if (drpSponsorUnit.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
lists = lists.Where(x => x.UnitId == drpSponsorUnit.SelectedValue);
|
|
|
|
|
}
|
|
|
|
|
if (drpUnitWork.SelectedValue != Const._Null)
|
|
|
|
|
{
|
|
|
|
|
lists = lists.Where(x => x.UnitWorkId == drpUnitWork.SelectedValue);
|
|
|
|
|
}
|
|
|
|
|
if (drpCNProfessional.SelectedValue != Const._Null)
|
|
|
|
|
{
|
|
|
|
|
lists = lists.Where(x => x.CNProfessionalCode == drpCNProfessional.SelectedValue);
|
|
|
|
|
}
|
|
|
|
|
if (drpQuestionType.SelectedValue != Const._Null)
|
|
|
|
|
{
|
|
|
|
|
lists = lists.Where(x => x.QuestionType == drpQuestionType.SelectedValue);
|
|
|
|
|
}
|
|
|
|
|
if (dpHandelStatus.SelectedValue != Const._Null)
|
|
|
|
|
{
|
|
|
|
|
if (dpHandelStatus.SelectedValue.Equals("1"))
|
|
|
|
|
{
|
|
|
|
|
lists = lists.Where(x => x.State == "5" || x.State == "6");
|
|
|
|
|
}
|
|
|
|
|
else if (dpHandelStatus.SelectedValue.Equals("2"))
|
|
|
|
|
{
|
|
|
|
|
lists = lists.Where(x => x.State == "7");
|
|
|
|
|
}
|
|
|
|
|
else if (dpHandelStatus.SelectedValue.Equals("3"))
|
|
|
|
|
{
|
|
|
|
|
lists = lists.Where(x => x.LimitDate.Value.AddDays(1) < DateTime.Now && x.State != "5" && x.State != "6" && x.State != "7");
|
|
|
|
|
}
|
|
|
|
|
else if (dpHandelStatus.SelectedValue.Equals("4"))
|
|
|
|
|
{
|
|
|
|
|
lists = lists.Where(x => x.LimitDate.Value.AddDays(1) > DateTime.Now && x.State != "5" && x.State != "6" && x.State != "7");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (lists != null)
|
|
|
|
|
{
|
|
|
|
|
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
|
|
|
|
|
newUrl = uploadfilepath.Replace("质量巡检模板", "质量巡检(" + projectName + DateTime.Now.ToString("yyyyMMdd") + ")");
|
|
|
|
|
File.Copy(uploadfilepath, newUrl);
|
|
|
|
|
// 第一步:读取文件流
|
|
|
|
|
NPOI.SS.UserModel.IWorkbook workbook;
|
|
|
|
|
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
|
|
|
|
|
{
|
|
|
|
|
//workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
|
|
|
|
|
workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream);
|
|
|
|
|
}
|
|
|
|
|
// 创建单元格样式
|
|
|
|
|
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
|
|
|
|
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
|
|
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
|
|
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
|
|
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
|
|
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
|
|
|
|
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
2024-05-08 21:51:39 +08:00
|
|
|
|
cellStyle.WrapText = true;//自动换行
|
2024-05-05 17:08:38 +08:00
|
|
|
|
var font = workbook.CreateFont();
|
|
|
|
|
font.FontHeightInPoints = 11;
|
|
|
|
|
cellStyle.SetFont(font);
|
|
|
|
|
// 第二步:创建新数据行
|
|
|
|
|
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
|
|
|
|
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
|
|
|
|
NPOI.SS.UserModel.ICell cell;
|
|
|
|
|
int i = 2;
|
|
|
|
|
foreach (var item in lists)
|
|
|
|
|
{
|
|
|
|
|
// 第二步:创建新数据行
|
|
|
|
|
row = sheet.CreateRow(i);
|
|
|
|
|
// 添加数据
|
|
|
|
|
cell = row.CreateCell(0);
|
|
|
|
|
cell.CellStyle = cellStyle;
|
|
|
|
|
cell.SetCellValue(item.DocCode);//质量巡检编号
|
|
|
|
|
|
|
|
|
|
cell = row.CreateCell(1);
|
|
|
|
|
cell.CellStyle = cellStyle;
|
|
|
|
|
string unitWorkName = string.Empty;
|
|
|
|
|
if (!string.IsNullOrEmpty(item.UnitWorkId))
|
|
|
|
|
{
|
|
|
|
|
var unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(item.UnitWorkId);
|
|
|
|
|
if (unitWork != null)
|
|
|
|
|
{
|
|
|
|
|
if (unitWork.ProjectType == "1")
|
|
|
|
|
{
|
|
|
|
|
unitWorkName = unitWork.UnitWorkName + "(建筑)";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
unitWorkName = unitWork.UnitWorkName + "(安装)";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cell.SetCellValue(unitWorkName);//单位工程
|
|
|
|
|
|
|
|
|
|
cell = row.CreateCell(2);
|
|
|
|
|
cell.CellStyle = cellStyle;
|
|
|
|
|
string unitName = string.Empty;
|
|
|
|
|
if (!string.IsNullOrEmpty(item.UnitId))
|
|
|
|
|
{
|
|
|
|
|
unitName = BLL.UnitService.GetUnitNameByUnitId(item.UnitId);
|
|
|
|
|
}
|
|
|
|
|
cell.SetCellValue(unitName);//施工单位
|
|
|
|
|
|
|
|
|
|
cell = row.CreateCell(3);
|
|
|
|
|
cell.CellStyle = cellStyle;
|
|
|
|
|
string proName = string.Empty;
|
|
|
|
|
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalCode);
|
|
|
|
|
if (cnp != null)
|
|
|
|
|
{
|
|
|
|
|
proName = cnp.ProfessionalName;
|
|
|
|
|
}
|
|
|
|
|
cell.SetCellValue(proName);//专业
|
|
|
|
|
|
|
|
|
|
cell = row.CreateCell(4);
|
|
|
|
|
cell.CellStyle = cellStyle;
|
|
|
|
|
string t = string.Empty;
|
|
|
|
|
if (!string.IsNullOrEmpty(item.QuestionType))
|
|
|
|
|
{
|
|
|
|
|
var qt = Funs.DB.Base_QualityQuestionType.FirstOrDefault(x => x.QualityQuestionTypeId == item.QuestionType);
|
|
|
|
|
if (qt!=null)
|
|
|
|
|
{
|
|
|
|
|
t = qt.QualityQuestionType;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cell.SetCellValue(t);//问题类别
|
|
|
|
|
|
|
|
|
|
cell = row.CreateCell(5);
|
|
|
|
|
cell.CellStyle = cellStyle;
|
|
|
|
|
cell.SetCellValue(item.CheckSite);//部位
|
|
|
|
|
|
|
|
|
|
cell = row.CreateCell(6);
|
|
|
|
|
cell.CellStyle = cellStyle;
|
|
|
|
|
cell.SetCellValue(item.CheckDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.CheckDate) : "");//巡检日期
|
|
|
|
|
|
|
|
|
|
cell = row.CreateCell(7);
|
|
|
|
|
cell.CellStyle = cellStyle;
|
|
|
|
|
cell.SetCellValue(item.LimitDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.LimitDate) : "");//整改日期
|
|
|
|
|
|
|
|
|
|
cell = row.CreateCell(8);
|
|
|
|
|
cell.CellStyle = cellStyle;
|
|
|
|
|
cell.SetCellValue(BLL.UserService.GetUserNameByUserId(item.CheckMan));//检查人
|
|
|
|
|
|
|
|
|
|
cell = row.CreateCell(9);
|
|
|
|
|
cell.CellStyle = cellStyle;
|
|
|
|
|
string s = string.Empty;
|
|
|
|
|
if (!string.IsNullOrEmpty(item.State))
|
|
|
|
|
{
|
|
|
|
|
s = ConvertState(item.State);
|
|
|
|
|
}
|
|
|
|
|
cell.SetCellValue(s);//审批状态
|
|
|
|
|
|
|
|
|
|
cell = row.CreateCell(10);
|
|
|
|
|
cell.CellStyle = cellStyle;
|
|
|
|
|
string man = string.Empty;
|
|
|
|
|
if (!string.IsNullOrEmpty(item.CheckControlCode))
|
|
|
|
|
{
|
|
|
|
|
man = ConvertMan(item.CheckControlCode);
|
|
|
|
|
}
|
|
|
|
|
cell.SetCellValue(man);//办理人
|
|
|
|
|
|
|
|
|
|
cell = row.CreateCell(11);
|
|
|
|
|
cell.CellStyle = cellStyle;
|
|
|
|
|
string status = string.Empty;
|
|
|
|
|
if (!string.IsNullOrEmpty(item.CheckControlCode))
|
|
|
|
|
{
|
|
|
|
|
status = Convertstatus(item.CheckControlCode);
|
|
|
|
|
}
|
|
|
|
|
cell.SetCellValue(status);//整改状态
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
// 第三步:写入文件流
|
|
|
|
|
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
|
|
|
|
{
|
|
|
|
|
workbook.Write(stream);
|
|
|
|
|
workbook.Close();
|
|
|
|
|
}
|
|
|
|
|
string fileName = Path.GetFileName(newUrl);
|
|
|
|
|
FileInfo info = new FileInfo(newUrl);
|
|
|
|
|
long fileSize = info.Length;
|
|
|
|
|
Response.Clear();
|
|
|
|
|
Response.ContentType = "application/x-zip-compressed";
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
|
|
|
|
Response.AddHeader("Content-Length", fileSize.ToString());
|
|
|
|
|
Response.TransmitFile(newUrl, 0, fileSize);
|
|
|
|
|
Response.Flush();
|
|
|
|
|
Response.Close();
|
|
|
|
|
File.Delete(newUrl);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
2022-05-22 10:13:35 +08:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|