提交代码

This commit is contained in:
2024-09-24 11:28:27 +08:00
parent 24de50cd30
commit 0865c7e41e
54 changed files with 5535 additions and 784 deletions
@@ -8,7 +8,7 @@ using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.HSSE.Hazard
{
public partial class ConstructionRisk : PageBase
@@ -18,7 +18,7 @@ namespace FineUIPro.Web.HSSE.Hazard
if (!IsPostBack)
{
GetButtonPower();//权限设置
this.InitTreeMenu();//加载树
}
}
@@ -30,9 +30,9 @@ namespace FineUIPro.Web.HSSE.Hazard
private void InitTreeMenu()
{
this.tvControlItem.Nodes.Clear();
List<Base_Unit> units = null;
var user = Person_PersonsService.GetPerson_PersonsById(this.CurrUser.PersonId);
if (!string.IsNullOrEmpty(user.UnitId))
{
@@ -41,7 +41,7 @@ namespace FineUIPro.Web.HSSE.Hazard
{
if (projectUnit.UnitType == BLL.Const.ProjectUnitType_1 || projectUnit.UnitType == BLL.Const.ProjectUnitType_3 || projectUnit.UnitType == BLL.Const.ProjectUnitType_4)
{
var ids = Funs.DB.HSSE_ConstructionRisk.Select(x=>x.UnitId).Distinct().ToList();
var ids = Funs.DB.HSSE_ConstructionRisk.Select(x => x.UnitId).Distinct().ToList();
units = (from x in Funs.DB.Base_Unit
where ids.Contains(x.UnitId)
select x).OrderBy(x => x.UnitCode).ToList();
@@ -49,7 +49,8 @@ namespace FineUIPro.Web.HSSE.Hazard
else
{
units = (from x in Funs.DB.Base_Unit
where x.UnitId == this.CurrUser.UnitId select x).ToList();
where x.UnitId == this.CurrUser.UnitId
select x).ToList();
}
}
}
@@ -66,15 +67,15 @@ namespace FineUIPro.Web.HSSE.Hazard
{
foreach (var unit in units)
{
TreeNode rootNode = new TreeNode();
rootNode.Text = unit.UnitName;
rootNode.NodeID = unit.UnitId;
rootNode.ToolTip = "单位";
rootNode.Expanded = false;
this.tvControlItem.Nodes.Add(rootNode);
this.BindNodes(rootNode);
TreeNode rootNode = new TreeNode();
rootNode.Text = unit.UnitName;
rootNode.NodeID = unit.UnitId;
rootNode.ToolTip = "单位";
rootNode.Expanded = false;
this.tvControlItem.Nodes.Add(rootNode);
this.BindNodes(rootNode);
}
}
@@ -94,27 +95,29 @@ namespace FineUIPro.Web.HSSE.Hazard
}
protected void Window2_Close(object sender, WindowCloseEventArgs e)
{
if (hdState.Text == "A")
if (!string.IsNullOrEmpty(hdState.Text))
{
var ids = Grid1.SelectedRowID.Split('|');
if (ids.Length > 1)
string[] strs = hdState.Text.Split('|');
if (strs[0] == "A")
{
hdState.Text = "";
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../Check/RectifyNoticesAdd.aspx?ControlId={0}", ids[1], "编辑 - ")));
}
var ids = Grid1.SelectedRowID.Split('|');
if (ids.Length > 1)
{
hdState.Text = "";
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../Check/RectifyNoticesAdd.aspx?ControlId={0}", strs[1], "编辑 - ")));
}
}
else if (strs[0] == "B")
{
var ids = Grid1.SelectedRowID.Split('|');
if (ids.Length > 1)
{
hdState.Text = "";
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../HiddenInspection/HiddenRectificationAdd.aspx?ControlId={0}", strs[1], "编辑 - ")));
}
}
}
else if (hdState.Text == "B")
{
var ids = Grid1.SelectedRowID.Split('|');
if (ids.Length > 1)
{
hdState.Text = "";
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../HiddenInspection/HiddenRectificationAdd.aspx?ControlId={0}", ids[1], "编辑 - ")));
}
}
this.InitTreeMenu();
this.BindGrid();
}
@@ -139,7 +142,7 @@ namespace FineUIPro.Web.HSSE.Hazard
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <summary>
/// 右键删除明细
@@ -156,11 +159,13 @@ namespace FineUIPro.Web.HSSE.Hazard
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var ids =rowID.Split('|');
var ids = rowID.Split('|');
if (ids.Length >= 1)
{
var list = Funs.DB.HSSE_ConstructionRiskControl.Where(x => x.ConstructionRiskId == ids[0]).ToList();
Funs.DB.HSSE_ConstructionRiskControl.DeleteAllOnSubmit(list);
var approves = Funs.DB.HSSE_ConstructionRiskApprove.Where(x => x.ConstructionRiskId == ids[0]).ToList();
Funs.DB.HSSE_ConstructionRiskApprove.DeleteAllOnSubmit(approves);
var constructionRisk = Funs.DB.HSSE_ConstructionRisk.Where(x => x.ConstructionRiskId == ids[0]).FirstOrDefault();
Funs.DB.HSSE_ConstructionRisk.DeleteOnSubmit(constructionRisk);
Funs.DB.SubmitChanges();
@@ -173,9 +178,9 @@ namespace FineUIPro.Web.HSSE.Hazard
#endregion
/// <summary>
/// 数据绑定
/// </summary>
@@ -184,12 +189,10 @@ namespace FineUIPro.Web.HSSE.Hazard
if (this.tvControlItem.SelectedNode != null && this.tvControlItem.SelectedNode.NodeID.Contains("|"))
{
var ids = this.tvControlItem.SelectedNode.NodeID.Split('|');
string strSql = @"select c.UnitWorkName, '' Id,*
,b.CheckResult,(CASE WHEN a.States = " + BLL.Const.State_3 + " THEN '审核/审批完成' when a.States = " + BLL.Const.State_0 + " OR a.States IS NULL THEN '待提交' WHEN a.States = " + BLL.Const.State_2 + " THEN '待总包安全经理审核' ELSE '待['+OperateUser.PersonName+']办理' END) AS FlowOperateName"
string strSql = @"select c.MainItemName, '' Id,*
,b.CheckResult"
+ @" from [dbo].[HSSE_ConstructionRisk] a left join [dbo].[HSSE_ConstructionRiskControl] b
on a.ConstructionRiskId =b.ConstructionRiskId left join WBS_UnitWork c on a.WorkAreaId = c.UnitWorkId
LEFT JOIN Sys_FlowOperate AS FlowOperate ON a.ConstructionRiskId=FlowOperate.DataId AND FlowOperate.IsClosed <> 1
LEFT JOIN Person_Persons AS OperateUser ON FlowOperate.OperaterId=OperateUser.PersonId
on a.ConstructionRiskId =b.ConstructionRiskId left join ProjectData_MainItem c on a.WorkAreaId = c.MainItemId
where a.UnitId=@UnitId and a.DateWeek=@DateWeek order by a.[ConstructionContent],b.[ShowIndex]";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@UnitId", ids[0]));
@@ -218,17 +221,17 @@ namespace FineUIPro.Web.HSSE.Hazard
/// <param name="node"></param>
private void BindNodes(TreeNode node)
{
var DateWeek = (from x in Funs.DB.HSSE_ConstructionRisk
where x.ProjectId == this.CurrUser.LoginProjectId
&& x.UnitId == node.NodeID
select x.DateWeek).Distinct().ToList().OrderByDescending(x => x);
where x.ProjectId == this.CurrUser.LoginProjectId
&& x.UnitId == node.NodeID
select x.DateWeek).Distinct().ToList().OrderByDescending(x => x);
foreach (var d in DateWeek)
{
TreeNode newNode = new TreeNode();
newNode.Text = d; //string.Format("{0:yyyy-MM-dd}", d.AssessmentDate);
newNode.NodeID = node.NodeID + "|" + d;
newNode.EnableClickEvent = true;
newNode.NodeID = node.NodeID + "|" + d;
newNode.EnableClickEvent = true;
newNode.ToolTip = "标签";
node.Nodes.Add(newNode);
@@ -244,23 +247,28 @@ namespace FineUIPro.Web.HSSE.Hazard
{
return;
}
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.ConstructionRiskMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnIn))
if (buttonList.Contains(BLL.Const.BtnAdd))
{
this.btnImport.Hidden = false;
//this.btnImport.Hidden = false;
this.btnNew.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDelete.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
this.btnMenuModify.Hidden = false;
this.btnMenuCheck.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnAuditing))
{
this.btnMenuDelete.Hidden = false;
this.btnMenuComplete.Hidden = false;
}
}
}
@@ -309,7 +317,7 @@ namespace FineUIPro.Web.HSSE.Hazard
// }
// }
//}
var r = Funs.DB.HSSE_ConstructionRisk.Where(x => x.ProjectId==this.CurrUser.LoginProjectId && x.States == "2");
var r = Funs.DB.HSSE_ConstructionRisk.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.States == "2");
foreach (var item in r)
{
item.States = "3";
@@ -317,7 +325,7 @@ namespace FineUIPro.Web.HSSE.Hazard
Funs.DB.SubmitChanges();
BindGrid();
}
#region TreeView
/// <summary>
/// 点击TreeView
@@ -326,26 +334,195 @@ namespace FineUIPro.Web.HSSE.Hazard
/// <param name="e"></param>
protected void tvControlItem_NodeCommand111(object sender, TreeCommandEventArgs e)
{
BindGrid();
BindGrid();
}
#endregion
protected void btnMenuCheck_Click(object sender, EventArgs e)
protected void btnMenuCheck_Click(object sender, EventArgs e)
{
var ids = Grid1.SelectedRowID.Split('|');
if (ids.Length > 1)
{
hdState.Text = "";
string id = ids[0];
var ins = BLL.ConstructionRiskListService.GetConstructionRisk(id);
if (ins != null)
{
if (ins.States.Equals(Const.ConstructionRisk_Complete))
{
Alert.ShowInTop("施工已完成,无需巡检!", MessageBoxIcon.Warning);
return;
}
else if (ins.States != BLL.Const.ConstructionRisk_Audit3)
{
Alert.ShowInTop("尚未实施,无法巡检!", MessageBoxIcon.Warning);
return;
}
}
PageContext.RegisterStartupScript(Window2.GetSaveStateReference(hdState.ClientID)
+ Window2.GetShowReference(String.Format("ConstructionRiskControlCheck.aspx?ControlId={0}", ids[1], "编辑 - ")));
+ Window2.GetShowReference(String.Format("ConstructionRiskControlCheck.aspx?ConstructionRiskId={0}", id, "编辑 - ")));
}
}
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
var ids = Grid1.SelectedRowID.Split('|');
btnMenuModify_Click(null, null);
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionRiskEdit.aspx?ConstructionRiskId={0}", ids[0], "编辑 - ")));
#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;
}
var ids = Grid1.SelectedRowID.Split('|');
string id = ids[0];
var ins = BLL.ConstructionRiskListService.GetConstructionRisk(id);
if (ins != null)
{
if (ins.States.Equals(Const.ConstructionRisk_Audit3))
{
Alert.ShowInTop("实施中,无法编辑,请右键查看!", MessageBoxIcon.Warning);
return;
}
if (ins.States.Equals(Const.ConstructionRisk_Complete))
{
Alert.ShowInTop("施工已完成,无法编辑,请右键查看!", MessageBoxIcon.Warning);
return;
}
Model.HSSE_ConstructionRiskApprove approve = BLL.ConstructionRiskApproveService.GetConstructionRiskApproveByConstructionRiskId(id);
if (approve != null)
{
if (!string.IsNullOrEmpty(approve.ApproveMan))
{
if (this.CurrUser.PersonId == approve.ApproveMan || CurrUser.PersonId == Const.sysglyId)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionRiskEdit.aspx?ConstructionRiskId={0}", id, "编辑 - ")));
return;
}
else
{
Alert.ShowInTop("您不是当前办理人,无法编辑,请右键查看!", MessageBoxIcon.Warning);
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 btnMenuComplete_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
var ids = Grid1.SelectedRowID.Split('|');
string id = ids[0];
var ins = BLL.ConstructionRiskListService.GetConstructionRisk(id);
if (ins != null)
{
if (ins.States == Const.ConstructionRisk_Audit3)
{
ins.States = Const.ConstructionRisk_Complete;
BLL.ConstructionRiskListService.UpdateConstructionRisk(ins);
BindGrid();
Alert.ShowInTop("操作成功!", MessageBoxIcon.Success);
return;
}
else if (ins.States == Const.ConstructionRisk_Complete)
{
Alert.ShowInTop("该记录已完成!", MessageBoxIcon.Warning);
return;
}
else
{
Alert.ShowInTop("该记录尚未实施,无法操作完成!", MessageBoxIcon.Warning);
return;
}
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
#endregion
protected void btnMenuView_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
var ids = Grid1.SelectedRowID.Split('|');
string id = ids[0];
var ins = BLL.ConstructionRiskListService.GetConstructionRisk(id);
if (ins != null)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionRiskView.aspx?ConstructionRiskId={0}", id, "查看 - ")));
}
}
//<summary>
//获取办理人姓名
//</summary>
//<param name="state"></param>
//<returns></returns>
protected string ConvertMan(object Id)
{
if (Id != null)
{
var ids = Id.ToString().Split('|');
Model.HSSE_ConstructionRiskApprove a = BLL.ConstructionRiskApproveService.GetConstructionRiskApproveByConstructionRiskId(ids[0]);
if (a != null)
{
if (a.ApproveMan != null)
{
return BLL.Person_PersonsService.GetPersonsNameById(a.ApproveMan);
}
}
else
{
return "";
}
}
return "";
}
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
{
var ids = e.RowID.Split('|');
if (e.CommandName.Equals("CheckSee"))
{
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("ConstructionRiskCheckSee.aspx?ConstructionRiskId={0}", ids[0])));
}
}
}
}