This commit is contained in:
2026-03-23 14:33:54 +08:00
parent 1454442fd8
commit 58f23e59d1
68 changed files with 5316 additions and 432 deletions
@@ -1,12 +1,10 @@
using BLL;
using FineUIPro.Web.BaseInfo;
using FineUIPro.Web.SysManage;
using Microsoft.Win32;
using Model;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace FineUIPro.Web.ZHGL.Supervise
{
@@ -42,13 +40,14 @@ namespace FineUIPro.Web.ZHGL.Supervise
btnClose.OnClientClick = ActiveWindow.GetHideReference();
InitDropList();
var unitModel = UnitService.GetUnitByUnitId(this.CurrUser.UnitId);
var thisUnitId = BLL.Const.UnitId_SEDIN;
this.UnitHazardRegisterId = Request.Params["UnitHazardRegisterId"];
var register = BLL.UnitHazardRegisterService.GetUnitHazardRegisterById(this.UnitHazardRegisterId);
if (register != null)
{
// 编辑模式 - 加载数据
{// 编辑模式 - 加载数据
this.txtUnitHazardRegisterCode.Text = register.UnitHazardRegisterCode;
if (register.CheckDate != null)
{
@@ -58,11 +57,23 @@ namespace FineUIPro.Web.ZHGL.Supervise
if (!string.IsNullOrWhiteSpace(register.CheckType))
{
BLL.SuperviseCheckTypeService.InitCheckTypeDropDownListByMainType(
this.drpCheckType, register.CheckMainType, false);
BLL.SuperviseCheckTypeService.InitCheckTypeDropDownListByMainType(this.drpCheckType, register.CheckMainType, false);
this.drpCheckType.SelectedValue = register.CheckType;
}
if (!string.IsNullOrWhiteSpace(register.CheckUnitId))
{
this.ddlCheckUnitId.SelectedValue = register.CheckUnitId;
}
if (!string.IsNullOrWhiteSpace(register.InspectionUnit))
{
this.ddlInspectionUnit.SelectedValue = register.InspectionUnit;
if (register.InspectionUnit != thisUnitId)
{
this.ddlCheckUnitId.Readonly = true;
}
}
if (!string.IsNullOrWhiteSpace(register.ProjectId))
{
this.ddlProjectId.SelectedValue = register.ProjectId;
@@ -73,71 +84,93 @@ namespace FineUIPro.Web.ZHGL.Supervise
this.ddlInsResponsibleUserId.SelectedValue = register.InsResponsibleUserId;
}
}
if (!string.IsNullOrWhiteSpace(register.CheckUnitId))
else
{
this.ddlCheckUnitId.SelectedValue = register.CheckUnitId;
Person_PersonsService.InitIsOfficeUserUnitIdDropDownList(this.ddlInsResponsibleUserId, this.ddlCheckUnitId.SelectedValue, true);
if (!string.IsNullOrWhiteSpace(register.InsResponsibleUserId))
{
this.ddlInsResponsibleUserId.SelectedValue = register.InsResponsibleUserId;
}
}
this.txtCheckTeam.Text = register.CheckTeam;
// 加载明细
items = BLL.UnitHazardRegisterItemService.GetItemsByRegisterId(this.UnitHazardRegisterId)
.Select(x => new View_UnitHazardRegisterItem
{
UnitHazardRegisterItemId = x.UnitHazardRegisterItemId,
ProblemDescription = x.ProblemDescription,
ProblemType = x.ProblemType,
RiskLevel = x.RiskLevel,
RectifyRequirement = x.RectifyRequirement,
CompleteStatus = x.CompleteStatus,
CompletedDate = x.CompletedDate
}).ToList();
BindDetailGrid();
if (register.States> (int)UnitHazardRegisterService.StateInt.)
if (register.States > (int)UnitHazardRegisterService.StateInt.)
{
btnImport.Hidden = true;
btnAdd.Hidden = true;
btnSave.Hidden = true;
btnSubmit.Hidden = true;
btnSubmit.Hidden = true;
}
}
else
{
// 新增模式
var unitModel = UnitService.GetUnitByUnitId(this.CurrUser.UnitId);
{// 新增模式
if (unitModel?.IsBranch == true)
{
this.ddlInspectionUnit.SelectedValue = this.CurrUser.UnitId;
this.ddlCheckUnitId.SelectedValue = this.CurrUser.UnitId;
}
else
{
var thisUnit = BLL.CommonService.GetIsThisUnit();
this.ddlCheckUnitId.SelectedValue = thisUnit.UnitId;
this.ddlCheckUnitId.SelectedValue = thisUnitId;
}
BLL.Person_PersonsService.InitUserDropDownList(this.ddlInsResponsibleUserId, null, true, this.ddlCheckUnitId.SelectedValue);
BLL.Person_PersonsService.InitIsOfficeUserUnitIdDropDownList(this.ddlInsResponsibleUserId, this.ddlCheckUnitId.SelectedValue, true);
BLL.ProjectService.InitProjectDropDownList(this.ddlProjectId, this.ddlCheckUnitId.SelectedValue, true);//检查项目
this.txtCheckTeam.Text = BLL.UnitService.GetUnitNameByUnitId(this.CurrUser.UnitId) + " " + this.CurrUser.PersonName;
this.dpkCheckDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
// 自动生成编号
int newCount= UnitHazardRegisterService.GetCount(type)+1;
this.txtUnitHazardRegisterCode.Text = newCount.ToString().PadLeft(5,'0');
int newCount = UnitHazardRegisterService.GetCount(type) + 1;
this.txtUnitHazardRegisterCode.Text = newCount.ToString().PadLeft(5, '0');
}
if (unitModel?.IsBranch == true)
{
this.ddlInspectionUnit.Readonly = true;
this.ddlCheckUnitId.Readonly = true;
}
Grid1.DataSource = items;
Grid1.DataBind();
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindDetailGrid()
{
if (string.IsNullOrEmpty(this.UnitHazardRegisterId))
{
return;
}
// 加载明细
items = BLL.UnitHazardRegisterItemService.GetItemsByRegisterId(this.UnitHazardRegisterId)
.Select(x => new View_UnitHazardRegisterItem
{
UnitHazardRegisterItemId = x.UnitHazardRegisterItemId,
ProblemDescription = x.ProblemDescription,
ProblemType = x.ProblemType,
RiskLevel = x.RiskLevel,
RectifyRequirement = x.RectifyRequirement,
CompleteStatus = x.CompleteStatus,
CompletedDate = x.CompletedDate
}).ToList();
Grid1.DataSource = items;
Grid1.DataBind();
}
protected void InitDropList()
{
drpCheckMainType.SelectedValue = type;
// 初始化下拉框
BLL.UnitService.InitBranchUnitDropDownList(this.ddlCheckUnitId, false);
BLL.ProjectService.InitProjectDropDownList(this.ddlProjectId, ddlCheckUnitId.SelectedValue, true);
BLL.Person_PersonsService.InitUserDropDownList(this.ddlInsResponsibleUserId, this.ddlProjectId.SelectedValue, true, null);
BLL.SuperviseCheckTypeService.InitCheckTypeDropDownListByMainType(
this.drpCheckType, type, false);
if (type=="0")
BLL.UnitService.InitBranchUnitDropDownList(this.ddlInspectionUnit, false);//检查单位
BLL.UnitService.InitBranchUnitDropDownList(this.ddlCheckUnitId, false);//受检单位
BLL.ProjectService.InitProjectDropDownList(this.ddlProjectId, ddlCheckUnitId.SelectedValue, true);//检查项目
//BLL.UserService.InitUserDropDownList(this.ddlInsResponsibleUserId, this.ddlProjectId.SelectedValue, true, null);
BLL.SuperviseCheckTypeService.InitCheckTypeDropDownListByMainType(this.drpCheckType, type, false);
if (type == "0")
{
this.drpProblemType.DataTextField = "RegisterTypesName";
this.drpProblemType.DataValueField = "RegisterTypesName";
@@ -148,9 +181,6 @@ namespace FineUIPro.Web.ZHGL.Supervise
{
QualityQuestionTypeService.InitQualityQuestionType(drpProblemType, false);
}
}
protected void btnAdd_Click(object sender, EventArgs e)
{
@@ -187,20 +217,25 @@ namespace FineUIPro.Web.ZHGL.Supervise
Alert.ShowInTop("请选择检查类别!", MessageBoxIcon.Warning);
return;
}
if (this.ddlProjectId.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择检查对象!", MessageBoxIcon.Warning);
return;
}
if (this.ddlCheckUnitId.SelectedValue == BLL.Const._Null)
if (this.ddlInspectionUnit.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择检查单位!", MessageBoxIcon.Warning);
return;
}
if (this.ddlCheckUnitId.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择受检单位!", MessageBoxIcon.Warning);
return;
}
//if (this.ddlProjectId.SelectedValue == BLL.Const._Null)
//{
// Alert.ShowInTop("请选择检查对象!", MessageBoxIcon.Warning);
// return;
//}
SaveNew();
SaveItem();
ShowNotify("保存成功!", MessageBoxIcon.Success);
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
protected void btnSubmit_Click(object sender, EventArgs e)
@@ -215,56 +250,96 @@ namespace FineUIPro.Web.ZHGL.Supervise
Alert.ShowInTop("请选择检查类别!", MessageBoxIcon.Warning);
return;
}
if (this.ddlProjectId.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择检查对象!", MessageBoxIcon.Warning);
return;
}
if (this.ddlCheckUnitId.SelectedValue == BLL.Const._Null)
if (this.ddlInspectionUnit.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择检查单位!", MessageBoxIcon.Warning);
return;
}
if (this.ddlCheckUnitId.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择受检单位!", MessageBoxIcon.Warning);
return;
}
//if (this.ddlProjectId.SelectedValue == BLL.Const._Null)
//{
// Alert.ShowInTop("请选择检查对象!", MessageBoxIcon.Warning);
// return;
//}
SaveNew(Const.BtnSubmit);
SaveItem();
ShowNotify("提交成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
/// <summary>
/// 检查单位下拉触发事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlInspectionUnit_SelectedIndexChanged(object sender, EventArgs e)
{
this.ddlProjectId.Items.Clear();
this.ddlInsResponsibleUserId.Items.Clear();
var inspectionUnit = this.ddlInspectionUnit.SelectedValue;
this.ddlCheckUnitId.SelectedValue = inspectionUnit;
BLL.ProjectService.InitProjectDropDownList(this.ddlProjectId, this.ddlCheckUnitId.SelectedValue, true);
Person_PersonsService.InitIsOfficeUserUnitIdDropDownList(this.ddlInsResponsibleUserId, this.ddlCheckUnitId.SelectedValue, true);
if (inspectionUnit == CommonService.GetIsThisUnit().UnitId)
{
this.ddlCheckUnitId.Readonly = false;
}
else
{
this.ddlCheckUnitId.Readonly = true;
}
}
/// <summary>
/// 受检单位下拉触发事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlCheckUnitId_SelectedIndexChanged(object sender, EventArgs e)
{
this.ddlProjectId.Items.Clear();
this.ddlInsResponsibleUserId.Items.Clear();
BLL.ProjectService.InitProjectDropDownList(this.ddlProjectId,ddlCheckUnitId.SelectedValue, true);
}
protected void ddlProjectId_SelectedIndexChanged(object sender, EventArgs e)
{
this.ddlInsResponsibleUserId.Items.Clear();
//BLL.UnitService.InitUnitNameByProjectIdUnitTypeDropDownList(this.ddlUnitId, this.ddlProjectId.SelectedValue, Const.ProjectUnitType_1, true);
BLL.Person_PersonsService.InitUserDropDownList(this.ddlInsResponsibleUserId, this.ddlProjectId.SelectedValue, true, null);
}
protected void drpCheckMainType_SelectedIndexChanged(object sender, EventArgs e)
{
BLL.SuperviseCheckTypeService.InitCheckTypeDropDownListByMainType(
this.drpCheckType, this.drpCheckMainType.SelectedValue, false);
BLL.ProjectService.InitProjectDropDownList(this.ddlProjectId, this.ddlCheckUnitId.SelectedValue, true);
Person_PersonsService.InitIsOfficeUserUnitIdDropDownList(this.ddlInsResponsibleUserId, this.ddlCheckUnitId.SelectedValue, true);
}
/// <summary>
///
/// 受检项目下拉触发事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlProjectId_SelectedIndexChanged(object sender, EventArgs e)
{
this.ddlInsResponsibleUserId.Items.Clear();
//BLL.UnitService.InitUnitNameByProjectIdUnitTypeDropDownList(this.ddlUnitId, this.ddlProjectId.SelectedValue, Const.ProjectUnitType_1, true);
BLL.Person_PersonsService.InitUserDropDownList(this.ddlInsResponsibleUserId, this.ddlProjectId.SelectedValue, true, null);
}
/// <summary>
/// 检查大类下拉触发事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpCheckMainType_SelectedIndexChanged(object sender, EventArgs e)
{
BLL.SuperviseCheckTypeService.InitCheckTypeDropDownListByMainType(this.drpCheckType, this.drpCheckMainType.SelectedValue, false);
}
/// <summary>
///设置LinkButtonField的点击客户端事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PreDataBound(object sender, EventArgs e)
{
{
// 设置LinkButtonField的点击客户端事件
LinkButtonField deleteField = Grid1.FindColumn("Delete") as LinkButtonField;
deleteField.OnClientClick = GetDeleteScript();
var register = BLL.UnitHazardRegisterService.GetUnitHazardRegisterById(this.UnitHazardRegisterId);
if (register!=null&& register.States > (int)UnitHazardRegisterService.StateInt.)
if (register != null && register.States > (int)UnitHazardRegisterService.StateInt.)
{
LinkButtonField lbUpload = Grid1.FindColumn(6) as LinkButtonField;
LinkButtonField lbDelete = Grid1.FindColumn(7) as LinkButtonField;
@@ -272,8 +347,6 @@ namespace FineUIPro.Web.ZHGL.Supervise
lbUpload.Enabled = false;
lbDelete.Enabled = false;
}
}
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
@@ -303,8 +376,8 @@ namespace FineUIPro.Web.ZHGL.Supervise
ProblemType = values.Value<string>("ProblemType"),
RiskLevel = values.Value<string>("RiskLevel"),
RectifyRequirement = values.Value<string>("RectifyRequirement"),
CompleteStatus = 0
};
CompleteStatus = 0
};
if (UnitHazardRegisterItemService.GetUnitHazardRegisterItemById(registerItem.UnitHazardRegisterItemId) != null)
{
UnitHazardRegisterItemService.UpdateUnitHazardRegisterItem(registerItem);
@@ -313,10 +386,10 @@ namespace FineUIPro.Web.ZHGL.Supervise
{
BLL.UnitHazardRegisterItemService.AddUnitHazardRegisterItem(registerItem);
}
}
}
}
protected void SaveNew(string type="")
protected void SaveNew(string type = "")
{
Supervise_UnitHazardRegister register = new Supervise_UnitHazardRegister
{
@@ -324,16 +397,20 @@ namespace FineUIPro.Web.ZHGL.Supervise
CheckDate = Funs.GetNewDateTime(this.dpkCheckDate.Text.Trim()),
CheckMainType = this.drpCheckMainType.SelectedValue,
CheckType = this.drpCheckType.SelectedValue,
ProjectId = this.ddlProjectId.SelectedValue,
InspectionUnit = this.ddlInspectionUnit.SelectedValue,
//ProjectId = this.ddlProjectId.SelectedValue,
CheckUnitId = this.ddlCheckUnitId.SelectedValue,
InsResponsibleUserId = this.ddlInsResponsibleUserId.SelectedValue,
CheckTeam = this.txtCheckTeam.Text.Trim(),
CompileMan = this.CurrUser.PersonId,
States = (int)UnitHazardRegisterService.StateInt.
};
if (!string.IsNullOrEmpty(this.ddlProjectId.SelectedValue) && this.ddlProjectId.SelectedValue != Const._Null)
{
register.ProjectId = this.ddlProjectId.SelectedValue;
}
if (!string.IsNullOrEmpty(type))
{
register.States = (int)UnitHazardRegisterService.StateInt.;
}
if (string.IsNullOrWhiteSpace(this.UnitHazardRegisterId))
@@ -363,7 +440,7 @@ namespace FineUIPro.Web.ZHGL.Supervise
.Select(x => new View_UnitHazardRegisterItem
{
UnitHazardRegisterItemId = x.UnitHazardRegisterItemId,
ProblemDescription = x.ProblemDescription,
ProblemDescription = x.ProblemDescription,
ProblemType = x.ProblemType,
RiskLevel = x.RiskLevel,
RectifyRequirement = x.RectifyRequirement,
@@ -374,7 +451,7 @@ namespace FineUIPro.Web.ZHGL.Supervise
Grid1.DataSource = items;
Grid1.DataBind();
}
protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
{
// 刷新Grid数据
@@ -402,24 +479,52 @@ namespace FineUIPro.Web.ZHGL.Supervise
#endregion Methods
#region
/// <summary>
/// 导入按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.UnitHazardRegisterId))
{
SaveNew();
}
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("UnitHazardRegisterDetailIn.aspx?Type={0}&UnitHazardRegisterId={1}", type, this.UnitHazardRegisterId, "导入 - ")));
}
/// <summary>
/// 关闭导入弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window2_Close(object sender, WindowCloseEventArgs e)
{
BindDetailGrid();
}
#endregion
}
/// <summary>
/// 企业级检查明细视图类
/// </summary>
public class View_UnitHazardRegisterItem
{
#region Properties
{
#region Properties
public DateTime? CompletedDate { get; set; }
public int? CompleteStatus { get; set; }
public string ProblemDescription { get; set; }
public string ProblemImageUrl { get; set; }
public string ProblemType { get; set; }
public string RectifyRequirement { get; set; }
public string RiskLevel { get; set; }
public string UnitHazardRegisterItemId { get; set; }
#endregion Properties
}
public DateTime? CompletedDate { get; set; }
public int? CompleteStatus { get; set; }
public string ProblemDescription { get; set; }
public string ProblemImageUrl { get; set; }
public string ProblemType { get; set; }
public string RectifyRequirement { get; set; }
public string RiskLevel { get; set; }
public string UnitHazardRegisterItemId { get; set; }
#endregion Properties
}
}