增加公司级五张报表功能
This commit is contained in:
@@ -0,0 +1,259 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 人员下拉框绑定数据
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string unitId = Const.UnitId_SEDIN;
|
||||
|
||||
string strSql = @"SELECT PersonId,PersonName,JobNum"
|
||||
+ @" FROM Person_Persons AS users"
|
||||
//+ @" LEFT JOIN Sys_Role AS role ON users.RoleId= role.RoleId"
|
||||
+ @" WHERE users.IsPost=1 AND users.RoleIds is not null AND UnitId ='" + unitId + "'";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
if (!string.IsNullOrEmpty(this.txtPersonName.Text.Trim()))
|
||||
{
|
||||
strSql += " AND (PersonName LIKE @Name OR JobNum LIKE @Name)";
|
||||
listStr.Add(new SqlParameter("@Name", "%" + this.txtPersonName.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)
|
||||
{
|
||||
|
||||
#region 百万工时安全统计月报
|
||||
if (Type == "MillionsMonthlyReport")//百万工时安全统计月报
|
||||
{
|
||||
var report = BLL.MillionsMonthlyReportService.GetMillionsMonthlyReportByMillionsMonthlyReportId(Id);
|
||||
if (report != null)
|
||||
{
|
||||
SetFlowData(Const.MillionsMonthlyReportMenuId, this.Id, handleMan);
|
||||
report.HandleState = handleStates;
|
||||
report.HandleMan = handleMan;
|
||||
BLL.MillionsMonthlyReportService.UpdateMillionsMonthlyReport(report);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 职工伤亡事故原因分析
|
||||
if (Type == "AccidentCauseReport")//职工伤亡事故原因分析
|
||||
{
|
||||
var report = BLL.AccidentCauseReportService.GetAccidentCauseReportByAccidentCauseReportId(Id);
|
||||
if (report != null)
|
||||
{
|
||||
SetFlowData(Const.AccidentCauseReportMenuId, this.Id, handleMan);
|
||||
report.HandleState = handleStates;
|
||||
report.HandleMan = handleMan;
|
||||
BLL.AccidentCauseReportService.UpdateAccidentCauseReport(report);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 安全生产数据季报
|
||||
if (Type == "SafetyQuarterlyReport")//安全生产数据季报
|
||||
{
|
||||
var report = BLL.SafetyQuarterlyReportService.GetSafetyQuarterlyReportById(Id);
|
||||
if (report != null)
|
||||
{
|
||||
SetFlowData(Const.SafetyQuarterlyReportMenuId, this.Id, handleMan);
|
||||
report.HandleState = handleStates;
|
||||
report.HandleMan = handleMan;
|
||||
BLL.SafetyQuarterlyReportService.UpdateSafetyQuarterlyReport(report);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 应急演练开展情况季报表
|
||||
if (Type == "DrillConductedQuarterlyReport")//应急演练开展情况季报表
|
||||
{
|
||||
var report = BLL.DrillConductedQuarterlyReportService.GetDrillConductedQuarterlyReportById(Id);
|
||||
if (report != null)
|
||||
{
|
||||
SetFlowData(Const.DrillConductedQuarterlyReportMenuId, this.Id, handleMan);
|
||||
report.HandleState = handleStates;
|
||||
report.HandleMan = handleMan;
|
||||
BLL.DrillConductedQuarterlyReportService.UpdateDrillConductedQuarterlyReport(report);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 应急演练工作计划半年报
|
||||
if (Type == "DrillPlanHalfYearReport")//应急演练工作计划半年报
|
||||
{
|
||||
var report = BLL.DrillPlanHalfYearReportService.GetDrillPlanHalfYearReportById(this.Id);
|
||||
if (report != null)
|
||||
{
|
||||
SetFlowData(Const.DrillPlanHalfYearReportMenuId, this.Id, handleMan);
|
||||
report.HandleState = handleStates;
|
||||
report.HandleMan = handleMan;
|
||||
BLL.DrillPlanHalfYearReportService.UpdateDrillPlanHalfYearReport(report);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInParent("请选择办理人!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="MenuId"></param>
|
||||
/// <param name="dataId"></param>
|
||||
private void SetFlowData(string menuId, string dataId,string handleMan)
|
||||
{
|
||||
var getIsExitOperate = Funs.DB.ProjectData_FlowOperate.FirstOrDefault(x => x.DataId == this.Id);
|
||||
if (getIsExitOperate == null) //首次生成审批记录
|
||||
{
|
||||
////编制人添加记录信息
|
||||
Model.ProjectData_FlowOperate newFlow = new Model.ProjectData_FlowOperate
|
||||
{
|
||||
MenuId = menuId,
|
||||
DataId = this.Id,
|
||||
OperaterId = this.CurrUser.PersonId,
|
||||
OperaterTime = DateTime.Now,
|
||||
IsClosed = true,
|
||||
State = BLL.Const.State_1,
|
||||
Opinion = this.txtOpinion.Text
|
||||
};
|
||||
BLL.ProjectDataFlowSetService.AddProjectData_FlowOperate(newFlow);
|
||||
}
|
||||
////更新 当前人要处理的意见
|
||||
var updateUnFlowOperate = Funs.DB.ProjectData_FlowOperate.FirstOrDefault(x => x.MenuId == menuId && x.DataId == dataId && (x.IsClosed == false || !x.IsClosed.HasValue));
|
||||
if (updateUnFlowOperate != null)
|
||||
{
|
||||
updateUnFlowOperate.OperaterTime = DateTime.Now;
|
||||
updateUnFlowOperate.Opinion = this.txtOpinion.Text;
|
||||
updateUnFlowOperate.IsClosed = true;
|
||||
BLL.ProjectDataFlowSetService.UpdateFlowOperateOpinion(updateUnFlowOperate);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (this.cbNext.SelectedValue == "0")
|
||||
{
|
||||
this.drpHandleMan.Label = "上报人";
|
||||
var getFData = Funs.DB.ProjectData_FlowOperate.FirstOrDefault(x => x.DataId == Id && x.SortIndex == 1);
|
||||
if (getFData != null)
|
||||
{
|
||||
this.drpHandleMan.Value = getFData.OperaterId;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drpHandleMan.Label = "办理人";
|
||||
this.drpHandleMan.Value = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user