CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/ZHGL/Information/ReportSubmit.aspx.cs

287 lines
11 KiB
C#
Raw Normal View History

2021-04-30 10:28:37 +08:00
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
2021-04-30 10:28:37 +08:00
namespace FineUIPro.Web.ZHGL.Information
{
public partial class ReportSubmit : PageBase
{
#region
/// <summary>
/// 报表类别
/// </summary>
public string Type
{
get
{
return (string)ViewState["Type"];
}
set
{
ViewState["Type"] = value;
}
}
/// <summary>
/// 报表主键Id
/// </summary>
public string Id
{
get
{
return (string)ViewState["Id"];
}
set
{
ViewState["Id"] = value;
}
}
#endregion
#region
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.Type = Request.Params["Type"];
this.Id = Request.Params["Id"];
this.BindGrid();
2021-04-30 10:28:37 +08:00
}
}
#endregion
#region
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
2023-03-30 13:51:33 +08:00
string unitId = BLL.Const.UnitId_CWCEC;
2021-04-30 10:28:37 +08:00
string strSql = @"SELECT UserId,UserName,UserCode,role.RoleName"
2021-04-30 10:28:37 +08:00
+ @" FROM Sys_User AS users"
+ @" LEFT JOIN Sys_Role AS role ON users.RoleId= role.RoleId"
2023-03-30 13:51:33 +08:00
+ @" WHERE users.IsPost=1 AND role.IsAuditFlow=1 AND users.IsOffice =1 AND UnitId ='" + unitId + "'";
2021-04-30 10:28:37 +08:00
List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(this.txtUserName.Text.Trim()))
{
strSql += " AND (UserName LIKE @Name OR UserCode LIKE @Name OR role.RoleName LIKE @Name)";
2021-04-30 10:28:37 +08:00
listStr.Add(new SqlParameter("@Name", "%" + this.txtUserName.Text.Trim() + "%"));
}
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();
}
#region
/// <summary>
/// 下拉框查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
this.drpHandleMan.Values = null;
this.BindGrid();
}
#endregion
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
string handleMan = this.drpHandleMan.Value;
string handleStates = (this.cbNext.SelectedValue == "0") ? BLL.Const.HandleState_4 : BLL.Const.HandleState_3;
if (!string.IsNullOrEmpty(handleMan) && handleMan != Const._Null)
2021-04-30 10:28:37 +08:00
{
2023-03-30 13:51:33 +08:00
#region
if (Type == "MillionsMonthlyReport")//企业安全数据统计月报
2021-04-30 10:28:37 +08:00
{
var report = BLL.MillionsMonthlyReportService.GetMillionsMonthlyReportByMillionsMonthlyReportId(Id);
if (report != null)
2021-04-30 10:28:37 +08:00
{
SetFlowData(Const.MillionsMonthlyReportMenuId, this.Id, handleMan);
report.HandleState = handleStates;
2021-04-30 10:28:37 +08:00
report.HandleMan = handleMan;
BLL.MillionsMonthlyReportService.UpdateMillionsMonthlyReport(report);
}
}
#endregion
2021-04-30 10:28:37 +08:00
#region
if (Type == "AccidentCauseReport")//职工伤亡事故原因分析
2021-04-30 10:28:37 +08:00
{
var report = BLL.AccidentCauseReportService.GetAccidentCauseReportByAccidentCauseReportId(Id);
if (report != null)
2021-04-30 10:28:37 +08:00
{
SetFlowData(Const.AccidentCauseReportMenuId, this.Id, handleMan);
report.HandleState = handleStates;
2021-04-30 10:28:37 +08:00
report.HandleMan = handleMan;
BLL.AccidentCauseReportService.UpdateAccidentCauseReport(report);
}
}
#endregion
2021-04-30 10:28:37 +08:00
#region
if (Type == "SafetyQuarterlyReport")//安全生产数据季报
2021-04-30 10:28:37 +08:00
{
var report = BLL.SafetyQuarterlyReportService.GetSafetyQuarterlyReportById(Id);
if (report != null)
2021-04-30 10:28:37 +08:00
{
SetFlowData(Const.SafetyQuarterlyReportMenuId, this.Id, handleMan);
report.HandleState = handleStates;
2021-04-30 10:28:37 +08:00
report.HandleMan = handleMan;
BLL.SafetyQuarterlyReportService.UpdateSafetyQuarterlyReport(report);
}
}
#endregion
2021-04-30 10:28:37 +08:00
#region
if (Type == "DrillConductedQuarterlyReport")//应急演练开展情况季报表
2021-04-30 10:28:37 +08:00
{
var report = BLL.DrillConductedQuarterlyReportService.GetDrillConductedQuarterlyReportById(Id);
if (report != null)
2021-04-30 10:28:37 +08:00
{
SetFlowData(Const.DrillConductedQuarterlyReportMenuId, this.Id, handleMan);
report.HandleState = handleStates;
2021-04-30 10:28:37 +08:00
report.HandleMan = handleMan;
BLL.DrillConductedQuarterlyReportService.UpdateDrillConductedQuarterlyReport(report);
}
}
#endregion
2021-04-30 10:28:37 +08:00
#region
if (Type == "DrillPlanHalfYearReport")//应急演练工作计划半年报
2021-04-30 10:28:37 +08:00
{
var report = BLL.DrillPlanHalfYearReportService.GetDrillPlanHalfYearReportById(this.Id);
if (report != null)
2021-04-30 10:28:37 +08:00
{
SetFlowData(Const.DrillPlanHalfYearReportMenuId, this.Id, handleMan);
report.HandleState = handleStates;
2021-04-30 10:28:37 +08:00
report.HandleMan = handleMan;
BLL.DrillPlanHalfYearReportService.UpdateDrillPlanHalfYearReport(report);
}
}
#endregion
2021-04-30 10:28:37 +08:00
2023-03-30 13:51:33 +08:00
#region
//if (Type== "WorkSummaryReport")//安全管理工作总结报告
//{
// var report = BLL.WorkSummaryReportService.GetWorkSummaryReportById(this.Id);
// if (report != null)
// {
// SetFlowData(Const.WorkSummaryReportMenuId, this.Id, handleMan);
// report.HandleState = handleStates;
// report.HandleMan = handleMan;
// BLL.WorkSummaryReportService.UpdateWorkSummaryReport(report);
// }
//}
#endregion
#region
//if (Type == "QualityWorkSummaryReport")//质量管理工作总结报告
//{
// var report = BLL.QualityWorkSummaryReportService.GetQualityWorkSummaryReportById(this.Id);
// if (report != null)
// {
// SetFlowData(Const.QualityWorkSummaryReportMenuId, this.Id, handleMan);
// report.HandleState = handleStates;
// report.HandleMan = handleMan;
// BLL.QualityWorkSummaryReportService.UpdateQualityWorkSummaryReport(report);
// }
//}
#endregion
ShowNotify("提交成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInParent("请选择办理人!", MessageBoxIcon.Warning);
}
2021-04-30 10:28:37 +08:00
}
#endregion
/// <summary>
///
/// </summary>
/// <param name="MenuId"></param>
/// <param name="dataId"></param>
private void SetFlowData(string menuId, string dataId,string handleMan)
2021-04-30 10:28:37 +08:00
{
var getIsExitOperate = Funs.DB.ProjectData_FlowOperate.FirstOrDefault(x => x.DataId == this.Id);
if (getIsExitOperate == null) //首次生成审批记录
2021-04-30 10:28:37 +08:00
{
////编制人添加记录信息
Model.ProjectData_FlowOperate newFlow = new Model.ProjectData_FlowOperate
{
MenuId = menuId,
DataId = this.Id,
OperaterId = this.CurrUser.UserId,
OperaterTime = DateTime.Now,
IsClosed = true,
State = BLL.Const.State_1,
Opinion = this.txtOpinion.Text
};
BLL.ProjectDataFlowSetService.AddProjectData_FlowOperate(newFlow);
2021-04-30 10:28:37 +08:00
}
////更新 当前人要处理的意见
var updateUnFlowOperate = Funs.DB.ProjectData_FlowOperate.FirstOrDefault(x => x.MenuId == menuId && x.DataId == dataId && (x.IsClosed == false || !x.IsClosed.HasValue));
if (updateUnFlowOperate != null)
2021-04-30 10:28:37 +08:00
{
updateUnFlowOperate.OperaterTime = DateTime.Now;
updateUnFlowOperate.Opinion = this.txtOpinion.Text;
updateUnFlowOperate.IsClosed = true;
BLL.ProjectDataFlowSetService.UpdateFlowOperateOpinion(updateUnFlowOperate);
2021-04-30 10:28:37 +08:00
}
string states = (this.cbNext.SelectedValue == "0") ? BLL.Const.State_2: BLL.Const.State_1;
////增加 下一步办理信息
Model.ProjectData_FlowOperate newdateUnFlowOperate = new Model.ProjectData_FlowOperate
{
MenuId = menuId,
DataId = this.Id,
OperaterId = handleMan,
IsClosed = false,
State = states,
};
BLL.ProjectDataFlowSetService.AddProjectData_FlowOperate(newdateUnFlowOperate);
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void cbNext_SelectedIndexChanged(object sender, EventArgs e)
2021-04-30 10:28:37 +08:00
{
if (this.cbNext.SelectedValue == "0")
2021-04-30 10:28:37 +08:00
{
this.drpHandleMan.Label = "上报人";
var getFData = Funs.DB.ProjectData_FlowOperate.FirstOrDefault(x => x.DataId == Id && x.SortIndex == 1);
if (getFData != null)
2021-04-30 10:28:37 +08:00
{
this.drpHandleMan.Value = getFData.OperaterId;
2021-04-30 10:28:37 +08:00
}
}
else
{
this.drpHandleMan.Label = "办理人";
this.drpHandleMan.Value = string.Empty;
2021-04-30 10:28:37 +08:00
}
}
}
}