安全巡检接入真实数据库:编码字段自动生成、公示牌二维码修复、安全问题统计排除作废

- 安全巡检表新增编码字段(Code,全局唯一 XJ-序号),WebAPI/桌面端新增时自动生成,不可重复
- 修复危大超危工程公示牌二维码不显示:urlName 含非法字符?导致 image.Save 抛异常,改用主键+内容哈希安全文件名
- 安全问题统计(mainProject/main3)排除作废数据(States=4),图表口径与顶部计数一致
- Word 导出文件名改为 监督巡视部位+编号
- Model.cs 由 SqlMetal 重新生成,补齐巡检人ID/签收人ID/发现问题/处理要求等字段;新增 HSSE_SafetyPatrol.Code.cs 补充 Code 列
- 新增安全巡检完整建表脚本(SGGLDB_V2026-08-25-001);删除已过时的接口文档 SafetyPatrol_API.md
This commit is contained in:
2026-08-26 19:13:11 +08:00
parent 55944d732a
commit 192824ea90
27 changed files with 1601 additions and 309 deletions
+1 -1
View File
@@ -547,7 +547,7 @@ namespace Resources {
}
/// <summary>
/// 查找类似 质量管理 的本地化字符串。
/// 查找类似 技术质量管理 的本地化字符串。
/// </summary>
internal static string QualityManage {
get {
@@ -151,7 +151,7 @@
<value>在新标签页中打开</value>
</data>
<data name="QualityManage" xml:space="preserve">
<value>质量管理</value>
<value>技术质量管理</value>
</data>
<data name="quit" xml:space="preserve">
<value>退出</value>
@@ -151,7 +151,7 @@
<value>在新标签页中打开</value>
</data>
<data name="QualityManage" xml:space="preserve">
<value>质量管理</value>
<value>技术质量管理</value>
</data>
<data name="quit" xml:space="preserve">
<value>退出</value>
@@ -201,6 +201,9 @@
<data name="IntegratedManage" xml:space="preserve">
<value>综合管理</value>
</data>
<data name="NoPermission" xml:space="preserve">
<value>您没有权限进入项目管理模块!</value>
</data>
<data name="NoticeManage" xml:space="preserve">
<value>通知管理</value>
</data>
@@ -213,9 +216,6 @@
<data name="SwitchHomePage" xml:space="preserve">
<value>切换首页</value>
</data>
<data name="NoPermission" xml:space="preserve">
<value>您没有权限进入项目管理模块!</value>
</data>
<data name="CertificateWarning" xml:space="preserve">
<value>证书预警</value>
</data>
@@ -196,10 +196,11 @@ namespace FineUIPro.Web.Controls
try
{
string imageUrl = string.Empty;
////QRCodeScale 为每个二维码模块的像素倍数,固定值 5(原为 nr.Length,会随内容长度放大成超大图)
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder
{
QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE,
QRCodeScale = nr.Length,
QRCodeScale = 5,
QRCodeVersion = 0,
QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M
};
@@ -51,10 +51,11 @@ namespace FineUIPro.Web.Controls
private void CreateCode_Simple(string nr, string urlName)
{
string imageUrl = string.Empty;
////QRCodeScale 为每个二维码模块的像素倍数,固定值 5(原为 nr.Length,会随内容长度放大成超大图)
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder
{
QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE,
QRCodeScale = nr.Length,
QRCodeScale = 5,
QRCodeVersion = 0,
QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M
};
+1
View File
@@ -19843,6 +19843,7 @@
<Content Include="App_GlobalResources\Lan.resx">
<Generator>GlobalResourceProxyGenerator</Generator>
<LastGenOutput>Lan.designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
@@ -330,10 +330,14 @@ namespace FineUIPro.Web.HSSE.HazardousMG
if (info != null)
{
////二维码内容:危大工程标识(编号),接入数据库后替换为巡检页面URL
string strValue = "hazard$hid=" + info.HazardProjectId;
string urlName = "hazard$hid=" + info.HazardProjectId;
string strValue = "hazard$hid=" + info.HazardProjectId + "&hname=" + info.ProjectName + "&projectId=" + info.ProjectId;
////urlName 仅作生成的二维码图片文件名,用「主键+内容哈希」保证文件名安全(不含 ? / = 等非法字符)且内容变化时不复用旧图
string urlName = info.HazardProjectId + "_" + ((uint)strValue.GetHashCode()).ToString("X");
string title = "危大工程公示牌:" + info.ProjectName;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/Controls/ShowQRImage.aspx?strValue={0}&urlName={1}&title={2}", strValue, urlName, System.Web.HttpUtility.UrlEncode(title)), "公示牌二维码", 340, 400));
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/Controls/ShowQRImage.aspx?strValue={0}&urlName={1}&title={2}",
System.Web.HttpUtility.UrlEncode(strValue),
System.Web.HttpUtility.UrlEncode(urlName),
System.Web.HttpUtility.UrlEncode(title)), "公示牌二维码", 340, 400));
}
}
#endregion
@@ -20,12 +20,12 @@
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="危大、超危工程每日巡检记录" EnableCollapse="true"
runat="server" BoxFlex="1" EnableColumnLines="true" DataKeyNames="PatrolId"
EnableAjax="false" runat="server" BoxFlex="1" EnableColumnLines="true" DataKeyNames="PatrolId"
DataIDField="PatrolId" AllowSorting="true"
SortField="PatrolDate" SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true"
IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick"
OnRowCommand="Grid1_RowCommand" EnableTextSelection="True">
OnRowCommand="Grid1_RowCommand" EnableTextSelection="True" EnableCheckBoxSelect="true" KeepCurrentSelection="true">
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
@@ -46,6 +46,9 @@
</f:Button>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出Word" Text="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
<f:Button ID="btnNew" ToolTip="扫码巡检" Icon="Add" runat="server" OnClick="btnNew_Click">
</f:Button>
</Items>
@@ -58,22 +61,18 @@
<asp:Label ID="lblNumber" runat="server" Text='<%# Grid1.PageIndex * Grid1.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="180px" ColumnID="HazardProjectName" DataField="HazardProjectName"
SortField="HazardProjectName" FieldType="String" HeaderText="工程名称" HeaderTextAlign="Center"
<f:RenderField Width="90px" ColumnID="Code" DataField="Code"
SortField="Code" FieldType="String" HeaderText="编码" HeaderTextAlign="Center"
TextAlign="Center">
</f:RenderField>
<f:RenderField Width="200px" ColumnID="HazardProjectName" DataField="HazardProjectName"
SortField="HazardProjectName" FieldType="String" HeaderText="监督巡视部位" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="120px" ColumnID="PatrolDate" DataField="PatrolDate"
SortField="PatrolDate" FieldType="Date" Renderer="Date" HeaderText="巡检日期" HeaderTextAlign="Center"
TextAlign="Center">
</f:RenderField>
<f:RenderField Width="80px" ColumnID="PatrolMan" DataField="PatrolMan"
SortField="PatrolMan" FieldType="String" HeaderText="巡检人" HeaderTextAlign="Center"
TextAlign="Center">
</f:RenderField>
<f:RenderField Width="200px" ColumnID="Content" DataField="Content"
SortField="Content" FieldType="String" HeaderText="巡检内容" HeaderTextAlign="Center" ExpandUnusedSpace="true"
TextAlign="Left">
</f:RenderField>
<f:TemplateField ColumnID="tfPatrolStatus" Width="120px" HeaderText="巡检状态" HeaderTextAlign="Center"
TextAlign="Center">
<ItemTemplate>
@@ -81,8 +80,19 @@
ForeColor='<%# GetPatrolStatusColor(Eval("PatrolStatus")) %>' Font-Bold="true"></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="200px" ColumnID="Problems" DataField="Problems"
SortField="Problems" FieldType="String" HeaderText="发现问题" HeaderTextAlign="Center" ExpandUnusedSpace="true"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="180px" ColumnID="HandleRequire" DataField="HandleRequire"
SortField="HandleRequire" FieldType="String" HeaderText="处理要求" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:LinkButtonField Width="80px" ColumnID="Attach" CommandName="attchUrl"
HeaderText="巡检图片" HeaderTextAlign="Center" TextAlign="Center" Text="查看">
HeaderText="巡检附件" HeaderTextAlign="Center" TextAlign="Center" Text="查看">
</f:LinkButtonField>
<f:LinkButtonField Width="80px" ColumnID="AttachRectify" CommandName="attchUrlRectify"
HeaderText="整改附件" HeaderTextAlign="Center" TextAlign="Center" Text="查看">
</f:LinkButtonField>
</Columns>
<Listeners>
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.IO.Compression;
using System.Linq;
namespace FineUIPro.Web.HSSE.HazardousMG
@@ -35,6 +37,117 @@ namespace FineUIPro.Web.HSSE.HazardousMG
}
}
/// <summary>
/// 导出Word:每条记录生成独立文档(文档名使用监督巡视部位)。
/// 单条直接下载 .docx;多条打包为 .zip,压缩包内每个 .docx 以监督巡视部位命名。
/// </summary>
protected void btnOut_Click(object sender, EventArgs e)
{
string[] ids = Grid1.SelectedRowIDArray;
if (ids == null || ids.Length == 0)
{
Alert.ShowInTop("请先勾选要导出的巡检记录!", MessageBoxIcon.Warning);
return;
}
List<KeyValuePair<string, byte[]>> files = new List<KeyValuePair<string, byte[]>>();
int dupIndex = 0;
foreach (string id in ids)
{
if (string.IsNullOrEmpty(id))
{
continue;
}
Model.HSSE_SafetyPatrol info = BLL.SafetyPatrolService.GetById(id);
if (info == null)
{
continue;
}
byte[] bytes = BLL.SafetyPatrolWordService.Generate(id);
if (bytes == null)
{
continue;
}
////文件名 = 监督巡视部位 + 编号(编码唯一,规避同名覆盖)
string baseName = SanitizeFileName(info.HazardProjectName);
string codeSuffix = string.IsNullOrEmpty(info.Code) ? string.Empty : "_" + info.Code;
string fileName = baseName + codeSuffix + ".docx";
// 同名记录去重,避免覆盖
while (files.Any(f => f.Key == fileName))
{
dupIndex++;
fileName = baseName + "(" + dupIndex + ").docx";
}
files.Add(new KeyValuePair<string, byte[]>(fileName, bytes));
}
if (files.Count == 0)
{
Alert.ShowInTop("未找到有效巡检记录!", MessageBoxIcon.Warning);
return;
}
Response.Clear();
if (files.Count == 1)
{
// 单条:直接下发 .docx
Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(files[0].Key, System.Text.Encoding.UTF8));
Response.BinaryWrite(files[0].Value);
}
else
{
// 多条:打包为 .zip
Response.ContentType = "application/zip";
Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("安全巡检记录_" + BLL.Funs.GetNewFileName() + ".zip", System.Text.Encoding.UTF8));
using (MemoryStream ms = new MemoryStream())
{
using (ZipArchive zip = new ZipArchive(ms, ZipArchiveMode.Create, true))
{
foreach (KeyValuePair<string, byte[]> f in files)
{
ZipArchiveEntry entry = zip.CreateEntry(f.Key, CompressionLevel.Optimal);
using (Stream es = entry.Open())
{
es.Write(f.Value, 0, f.Value.Length);
}
}
}
Response.BinaryWrite(ms.ToArray());
}
}
Response.Flush();
Response.End();
}
/// <summary>
/// 清洗文件名(去非法字符),保证文件名合法可下载。
/// </summary>
/// <param name="name">监督巡视部位名称</param>
/// <returns>合法文件名(不含扩展名)</returns>
private static string SanitizeFileName(string name)
{
if (string.IsNullOrEmpty(name))
{
return "监督记录表";
}
string fileName = name;
foreach (char c in Path.GetInvalidFileNameChars())
{
fileName = fileName.Replace(c, '_');
}
fileName = fileName.Trim();
if (fileName.Length == 0)
{
return "监督记录表";
}
if (fileName.Length > 80)
{
fileName = fileName.Substring(0, 80);
}
return fileName;
}
/// <summary>
/// 扫码巡检按钮事件
/// </summary>
@@ -51,12 +164,20 @@ namespace FineUIPro.Web.HSSE.HazardousMG
#region
/// <summary>
/// 巡检状态颜色(待整改标红)
/// 巡检状态颜色(待整改标红、整改待复查标橙、正常标绿
/// </summary>
public Color GetPatrolStatusColor(object value)
{
string state = value == null ? "" : value.ToString();
return state == "待整改" ? Color.Red : Color.Green;
switch (state)
{
case "待整改":
return Color.Red;
case "整改待复查":
return Color.Orange;
default:
return Color.Green;
}
}
#endregion
@@ -217,6 +338,11 @@ namespace FineUIPro.Web.HSSE.HazardousMG
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/SafetyPatrol&menuId={2}",
-1, e.RowID, BLL.Const.SafetyPatrolMenuId)));
}
else if (e.CommandName == "attchUrlRectify")
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/SafetyPatrolCorrect&menuId={2}",
-1, e.RowID, BLL.Const.SafetyPatrolRectifyMenuId)));
}
}
#endregion
}
@@ -7,70 +7,160 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>编辑安全巡检记录</title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.patrol-table {
width: 100%;
border-collapse: collapse;
border: 1px solid #000;
}
.patrol-table td {
border: 1px solid #000;
padding: 6px 8px;
vertical-align: middle;
}
.ptitle {
text-align: center;
font-size: 16px;
font-weight: bold;
padding: 10px;
}
.phead {
background-color: #f2f2f2;
text-align: center;
font-weight: bold;
}
.plabel {
white-space: nowrap;
}
.pcell {
vertical-align: top;
}
.cfooter {
text-align: center;
}
/* 让 TextArea 撑满所在单元格(FineUIPro 核心类为 .f-textbox,无 .f-textarea */
.patrol-table td.fillcell,
.patrol-table td.fillcell > * {
width: 100% !important;
box-sizing: border-box;
}
.patrol-table td.fillcell textarea {
width: 100% !important;
box-sizing: border-box;
}
/* 标签与输入框整组水平、垂直居中(其它、签收人、监督巡视人员) */
.pair-center {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: nowrap;
white-space: nowrap;
}
/* 保证组内输入框不被压缩到下一行 */
.pair-center > * {
flex-shrink: 0;
}
#ContentPanel1_txtProblems,#ContentPanel1_txtHandleRequire,#ContentPanel1_txtRectifyReview,#ContentPanel1_txtRemarks{
height: 100%;
width: 100%;
}
.textareaClass {
height: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="SimpleForm1"/>
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" Title="危大、超危工程每日巡检记录" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:DropDownList ID="ddlHazardProject" runat="server" Label="扫码工程" LabelAlign="Right"
LabelWidth="100px" Required="true" ShowRedStar="true">
</f:DropDownList>
<f:DatePicker ID="dpPatrolDate" runat="server" Label="巡检日期" LabelAlign="Right"
LabelWidth="90px" DateFormatString="yyyy-MM-dd">
</f:DatePicker>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="ddlPatrolStatus" runat="server" Label="巡检状态" LabelAlign="Right"
LabelWidth="100px">
<f:ListItem Text="正常" Value="正常" />
<f:ListItem Text="待整改" Value="待整改" />
</f:DropDownList>
<f:Label ID="lblPatrolMan" runat="server" Label="巡检人" LabelAlign="Right"
LabelWidth="90px">
</f:Label>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextArea ID="txtContent" runat="server" Label="巡检内容" LabelAlign="Right" Height="100px"
MaxLength="1000" LabelWidth="100px">
</f:TextArea>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Panel ID="Panel2" ShowHeader="false" ShowBorder="false" Layout="Column" CssClass="" runat="server">
<Items>
<f:Label ID="Label1" runat="server" ShowRedStar="true" Label="巡检图片"
LabelWidth="100px" LabelAlign="Right">
</f:Label>
<f:Button ID="btnAttach" Icon="TableCell" EnablePostBack="true" Text="上传" runat="server" OnClick="btnAttach_Click">
</f:Button>
</Items>
</f:Panel>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" ValidateForms="SimpleForm1"
OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
<f:PageManager ID="PageManager1" AutoSizePanelID="ContentPanel1" runat="server" />
<f:ContentPanel ID="ContentPanel1" ShowBorder="false" ShowHeader="false" BodyPadding="10px"
AutoScroll="true" runat="server">
<div id="patrolContent">
<table class="patrol-table">
<tr>
<td colspan="2" class="ptitle">附件9 &nbsp;&nbsp;(危大工程类别)监督记录表</td>
</tr>
<tr>
<td>
<f:Form ID="FormHazard" ShowBorder="false" ShowHeader="false" BodyPadding="0" LabelAlign="Right" runat="server">
<Rows>
<f:FormRow>
<Items>
<f:DropDownList ID="ddlHazardProject" runat="server" Label="监督巡视部位" LabelWidth="110px" LabelAlign="Right" Required="true" Width="220px"></f:DropDownList>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</td>
<td>
<f:Form ID="FormDate" ShowBorder="false" ShowHeader="false" BodyPadding="0" LabelAlign="Right" runat="server">
<Rows>
<f:FormRow>
<Items>
<f:DatePicker ID="dpPatrolDate" runat="server" Label="巡检日期" LabelWidth="80px" LabelAlign="Right" Width="140px" DateFormatString="yyyy-MM-dd"></f:DatePicker>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtCode" runat="server" Label="编码" LabelWidth="80px" LabelAlign="Right" Width="140px" Readonly="true"></f:TextBox>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</td>
</tr>
<tr>
<td class="phead">监督巡视内容</td>
<td class="phead">发现问题</td>
</tr>
<tr>
<td class="pcell" style="height: 150px;">
<div>1、施工条件保持情况</div>
<div>2、按方案施工情况,实体与方案参数的对比</div>
<div>3、现场安全防护状况</div>
<div>4、作业人员持证上岗情况</div>
<div class="pair-center">其它:<f:TextBox ID="txtContentOther" runat="server" Width="195px"></f:TextBox></div>
</td>
<td class="pcell fillcell">
<f:TextArea ID="txtProblems" runat="server" CssStyle="height:100%;" ></f:TextArea>
</td>
</tr>
<tr>
<td class="plabel">处理要求:</td>
<td class="plabel"><div class="pair-center">签收人:<f:DropDownList ID="ddlReceiver" runat="server" Width="180px"></f:DropDownList></div></td>
</tr>
<tr>
<td colspan="2" class="pcell fillcell">
<f:TextArea ID="txtHandleRequire" runat="server" Height="90px"></f:TextArea>
</td>
</tr>
<tr>
<td colspan="2" class="plabel">整改后复查情况:</td>
</tr>
<tr>
<td colspan="2" class="pcell fillcell">
<f:TextArea ID="txtRectifyReview" runat="server" Height="90px"></f:TextArea>
</td>
</tr>
<tr>
<td colspan="2" class="plabel">备注:</td>
</tr>
<tr>
<td colspan="2" class="pcell fillcell">
<f:TextArea ID="txtRemarks" runat="server" Height="70px"></f:TextArea>
</td>
</tr>
<tr>
<td colspan="2" class="cfooter"><div class="pair-center">监督巡视人员:<f:DropDownList ID="ddlPatrolMan" runat="server" Width="200px"></f:DropDownList></div></td>
</tr>
</table>
</div>
<div style="text-align:center; margin-top:10px;">
<f:Button ID="btnAttach" Icon="TableCell" EnablePostBack="true" Text="上传巡视图片" runat="server" OnClick="btnAttach_Click"></f:Button>
<f:Button ID="btnAttachRectify" Icon="TableCell" EnablePostBack="true" Text="上传整改图片" runat="server" OnClick="btnAttachRectify_Click"></f:Button>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" OnClick="btnSave_Click"></f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose" OnClientClick="F.activeWindow.hide();"></f:Button>
</div>
</f:ContentPanel>
<f:Window ID="WindowAtt" Title="附件" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace FineUIPro.Web.HSSE.HazardousMG
{
@@ -24,6 +25,21 @@ namespace FineUIPro.Web.HSSE.HazardousMG
ViewState["PatrolId"] = value;
}
}
/// <summary>
/// 巡检状态(编辑页已不提供选择,加载时保留原值,新增默认正常)
/// </summary>
private string PatrolStatus
{
get
{
return (string)ViewState["PatrolStatus"];
}
set
{
ViewState["PatrolStatus"] = value;
}
}
#endregion
#region
@@ -36,11 +52,6 @@ namespace FineUIPro.Web.HSSE.HazardousMG
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.InitDropDownList();
////巡检人关联当前登录账号
if (this.CurrUser != null)
{
this.lblPatrolMan.Text = this.CurrUser.UserName;
}
this.PatrolId = Request.Params["PatrolId"];
if (!string.IsNullOrEmpty(this.PatrolId))
{
@@ -56,19 +67,26 @@ namespace FineUIPro.Web.HSSE.HazardousMG
{
this.dpPatrolDate.SelectedDate = info.PatrolDate.Value;
}
if (!string.IsNullOrEmpty(info.PatrolStatus))
{
this.ddlPatrolStatus.SelectedValue = info.PatrolStatus;
}
this.txtContent.Text = info.Content;
this.txtCode.Text = info.Code;
this.PatrolStatus = string.IsNullOrEmpty(info.PatrolStatus) ? "正常" : info.PatrolStatus;
this.InitUserDropDownList(info.PatrolMan, info.PatrolManId, info.Receiver, info.ReceiverId);
this.RenderContent(info.Content);
this.txtProblems.Text = info.Problems;
this.txtHandleRequire.Text = info.HandleRequire;
this.txtRectifyReview.Text = info.RectifyReview;
this.txtRemarks.Text = info.Remarks;
}
}
else
{
////新增(扫码巡检):默认巡检日期为当天、巡检状态为正常
////新增(扫码巡检):默认巡检日期为当天、巡检状态为正常;巡检人默认当前登录账号
this.dpPatrolDate.SelectedDate = DateTime.Now;
this.ddlPatrolStatus.SelectedValue = "正常";
this.PatrolStatus = "正常";
this.InitUserDropDownList(null, null, null, null);
}
////让父级编辑窗口高度自适应内容,避免固定高度留下大空白;超过 720px 时内部滚动
string fitJs = "setTimeout(function(){try{var w=F.activeWindow;if(w){var el=document.getElementById('patrolContent');var h=el?el.offsetHeight:0;h+=40;if(h>720){h=720;}w.setSize(780,h);}}catch(e){}},200);";
PageContext.RegisterStartupScript(fitJs);
}
}
@@ -87,6 +105,123 @@ namespace FineUIPro.Web.HSSE.HazardousMG
this.ddlHazardProject.Items.Add(new FineUIPro.ListItem(p.ProjectName + "" + p.ProjectCode + "", p.HazardProjectId));
}
}
/// <summary>
/// 绑定巡检人、签收人下拉(来自项目用户)
/// </summary>
/// <param name="patrolMan">巡检人名称(回显用)</param>
/// <param name="patrolManId">巡检人ID(回显用)</param>
/// <param name="receiver">签收人名称(回显用)</param>
/// <param name="receiverId">签收人ID(回显用)</param>
private void InitUserDropDownList(string patrolMan, string patrolManId, string receiver, string receiverId)
{
if (this.CurrUser == null || string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
{
return;
}
List<Model.Sys_User> users = BLL.UserService.GetProjectUserListByProjectId(this.CurrUser.LoginProjectId);
////巡检人(默认当前登录账号);签收人允许留空
this.BindPatrolUser(this.ddlPatrolMan, users, patrolMan, patrolManId, this.CurrUser.UserId);
this.BindPatrolUser(this.ddlReceiver, users, receiver, receiverId, null);
}
/// <summary>
/// 绑定单个用户下拉:优先按ID回显,其次按名称回显;均不匹配且名称有值时保留原名称
/// </summary>
/// <param name="ddl">目标下拉</param>
/// <param name="users">项目用户列表</param>
/// <param name="selectName">回显名称</param>
/// <param name="selectId">回显ID</param>
/// <param name="defaultUserId">默认选中用户ID(可空)</param>
private void BindPatrolUser(FineUIPro.DropDownList ddl, List<Model.Sys_User> users, string selectName, string selectId, string defaultUserId)
{
ddl.Items.Clear();
////签收人允许留空(首项为占位)
if (ddl.ID == "ddlReceiver")
{
ddl.Items.Add(new FineUIPro.ListItem("请选择", ""));
}
string selectValue = string.IsNullOrEmpty(selectId) ? string.Empty : selectId;
foreach (Model.Sys_User u in users)
{
////默认选中项(巡检人默认当前登录账号)
if (string.IsNullOrEmpty(selectValue) && !string.IsNullOrEmpty(defaultUserId) && u.UserId == defaultUserId)
{
selectValue = u.UserId;
}
////名称回显(老数据无ID
if (string.IsNullOrEmpty(selectValue) && !string.IsNullOrEmpty(selectName) && u.UserName == selectName)
{
selectValue = u.UserId;
}
ddl.Items.Add(new FineUIPro.ListItem(u.UserName, u.UserId));
}
////名称在项目用户中找不到(如外部人员):追加原名称选项,保留旧数据
if (string.IsNullOrEmpty(selectValue) && !string.IsNullOrEmpty(selectName))
{
ddl.Items.Insert(0, new FineUIPro.ListItem(selectName, ""));
}
if (!string.IsNullOrEmpty(selectValue))
{
ddl.SelectedValue = selectValue;
}
else if (ddl.Items.Count > 0)
{
ddl.SelectedIndex = 0;
}
}
/// <summary>
/// 根据巡视内容渲染"其它"输入框。1-4 项为固定默认值(写死、始终显示),不再从 Content 解析勾选。
/// Content 以后只存「其它」内容:兼容旧格式「…;其它:xxx」,也兼容直接为其它文本的新格式。
/// </summary>
/// <param name="content">Content 字段(以后仅其它内容;旧数据可能形如:1、…;4、…;其它:xxx</param>
private void RenderContent(string content)
{
if (string.IsNullOrEmpty(content))
{
return;
}
string other = null;
foreach (string seg in content.Split(''))
{
string s = seg.Trim();
if (s.Length == 0)
{
continue;
}
if (s.StartsWith("其它") || s.StartsWith("其他"))
{
int idx = s.IndexOf('');
other = idx >= 0 ? s.Substring(idx + 1).Trim() : string.Empty;
break;
}
}
// 新格式:Content 无「其它:」前缀、且不以项号前缀(1、…)开头,则整段即为其它内容
if (other == null)
{
other = Regex.IsMatch(content, @"^\s*\d+、") ? string.Empty : content.Trim();
}
if (other.Length > 0)
{
this.txtContentOther.Text = other;
}
}
/// <summary>
/// 构造 Content 文本。1-4 项固定写死(始终显示,不参与存储),Content 仅存「其它」内容。
/// 「其它」无多选:输入框有内容即表示选中。
/// </summary>
/// <returns>如:其它:基坑围挡损坏;无其它内容返回空串</returns>
private string BuildContent()
{
string other = this.txtContentOther.Text.Trim();
if (other.Length > 0)
{
return "其它:" + other;
}
return string.Empty;
}
#endregion
#region
@@ -100,16 +235,14 @@ namespace FineUIPro.Web.HSSE.HazardousMG
Alert.ShowInTop("请先选择项目!", MessageBoxIcon.Warning);
return;
}
////新增时先生成主键,保证附件能挂到同一记录
////新增时先生成主键
if (string.IsNullOrEmpty(this.PatrolId))
{
this.PatrolId = Guid.NewGuid().ToString();
}
////校验附件是否已上传
Model.AttachFile attach = BLL.Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.PatrolId);
if (attach == null || string.IsNullOrEmpty(attach.AttachUrl))
if (string.IsNullOrEmpty(this.ddlHazardProject.SelectedValue))
{
Alert.ShowInTop("请上传巡检图片", MessageBoxIcon.Warning);
Alert.ShowInTop("请选择危大工程类别", MessageBoxIcon.Warning);
return;
}
////根据所选清单回填工程名称
@@ -119,6 +252,19 @@ namespace FineUIPro.Web.HSSE.HazardousMG
{
hazardProjectName = project.ProjectName;
}
////巡检人、签收人(下拉选中项:ID + 名称;外部人员无ID时仅保留名称)
string patrolManId = this.ddlPatrolMan.SelectedValue;
string patrolManName = this.ddlPatrolMan.SelectedItem == null ? string.Empty : this.ddlPatrolMan.SelectedItem.Text.Trim();
if (patrolManName == "请选择")
{
patrolManName = string.Empty;
}
string receiverId = this.ddlReceiver.SelectedValue;
string receiverName = this.ddlReceiver.SelectedItem == null ? string.Empty : this.ddlReceiver.SelectedItem.Text.Trim();
if (receiverName == "请选择")
{
receiverName = string.Empty;
}
Model.HSSE_SafetyPatrol info = new Model.HSSE_SafetyPatrol
{
PatrolId = this.PatrolId,
@@ -126,9 +272,16 @@ namespace FineUIPro.Web.HSSE.HazardousMG
HazardProjectId = this.ddlHazardProject.SelectedValue,
HazardProjectName = hazardProjectName,
PatrolDate = this.dpPatrolDate.SelectedDate,
PatrolMan = this.CurrUser.UserName,
PatrolStatus = this.ddlPatrolStatus.SelectedValue,
Content = this.txtContent.Text.Trim()
PatrolMan = patrolManName,
PatrolManId = patrolManId,
PatrolStatus = this.PatrolStatus,
Content = this.BuildContent(),
Problems = this.txtProblems.Text.Trim(),
Receiver = receiverName,
ReceiverId = receiverId,
HandleRequire = this.txtHandleRequire.Text.Trim(),
RectifyReview = this.txtRectifyReview.Text.Trim(),
Remarks = this.txtRemarks.Text.Trim()
};
////存在则更新,不存在则新增(服务层已处理)
BLL.SafetyPatrolService.Update(info);
@@ -146,6 +299,18 @@ namespace FineUIPro.Web.HSSE.HazardousMG
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/SafetyPatrol&menuId={1}", this.PatrolId, BLL.Const.SafetyPatrolMenuId)));
}
/// <summary>
/// 上传整改图片
/// </summary>
protected void btnAttachRectify_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.PatrolId))
{
this.PatrolId = Guid.NewGuid().ToString();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/SafetyPatrolCorrect&menuId={1}", this.PatrolId, BLL.Const.SafetyPatrolRectifyMenuId)));
}
#endregion
}
}
@@ -33,13 +33,22 @@ namespace FineUIPro.Web.HSSE.HazardousMG
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// ContentPanel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
protected global::FineUIPro.ContentPanel ContentPanel1;
/// <summary>
/// FormHazard 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form FormHazard;
/// <summary>
/// ddlHazardProject 控件。
@@ -50,6 +59,15 @@ namespace FineUIPro.Web.HSSE.HazardousMG
/// </remarks>
protected global::FineUIPro.DropDownList ddlHazardProject;
/// <summary>
/// FormDate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form FormDate;
/// <summary>
/// dpPatrolDate 控件。
/// </summary>
@@ -60,49 +78,76 @@ namespace FineUIPro.Web.HSSE.HazardousMG
protected global::FineUIPro.DatePicker dpPatrolDate;
/// <summary>
/// ddlPatrolStatus 控件。
/// txtContentOther 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPatrolStatus;
protected global::FineUIPro.TextBox txtContentOther;
/// <summary>
/// lblPatrolMan 控件。
/// txtCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label lblPatrolMan;
protected global::FineUIPro.TextBox txtCode;
/// <summary>
/// txtContent 控件。
/// txtProblems 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextArea txtContent;
protected global::FineUIPro.TextArea txtProblems;
/// <summary>
/// Panel2 控件。
/// ddlReceiver 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel2;
protected global::FineUIPro.DropDownList ddlReceiver;
/// <summary>
/// Label1 控件。
/// txtHandleRequire 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label Label1;
protected global::FineUIPro.TextArea txtHandleRequire;
/// <summary>
/// txtRectifyReview 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextArea txtRectifyReview;
/// <summary>
/// txtRemarks 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextArea txtRemarks;
/// <summary>
/// ddlPatrolMan 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPatrolMan;
/// <summary>
/// btnAttach 控件。
@@ -114,22 +159,13 @@ namespace FineUIPro.Web.HSSE.HazardousMG
protected global::FineUIPro.Button btnAttach;
/// <summary>
/// Toolbar1 控件。
/// btnAttachRectify 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
protected global::FineUIPro.Button btnAttachRectify;
/// <summary>
/// btnSave 控件。
-1
View File
@@ -13,7 +13,6 @@
<TreeNode id="E85CB915-FAC3-4E59-82E7-28DD5525CCB0" Text="危大工程管控" EnText="危大工程管控" NavigateUrl=""><TreeNode id="0F166DE2-6DF7-49A9-8E4A-93F5AE476F28" Text="专项施工方案" EnText="专项施工方案" NavigateUrl="HSSE/HazardousMG/SpecialPlan.aspx"></TreeNode>
<TreeNode id="1C0D9228-1548-47A8-9BC2-801CFED45915" Text="安全技术交底" EnText="安全技术交底" NavigateUrl="HSSE/HazardousMG/SafetyDisclosure.aspx"></TreeNode>
<TreeNode id="44A8CF73-7F23-40CB-9D64-FD05AB48522D" Text="危大、超危清单" EnText="危大、超危清单" NavigateUrl="HSSE/HazardousMG/HazardProject.aspx"></TreeNode>
<TreeNode id="39C36EF6-A11E-4EA1-B78C-E0F59AAA6EB7" Text="风险分级管控清单" EnText="风险分级管控清单" NavigateUrl="HSSE/HazardousMG/RiskControlList.aspx"></TreeNode>
</TreeNode>
<TreeNode id="3B322232-38A1-4291-9832-CD4A01C2A975" Text="WBS数据" EnText="WBS数据" NavigateUrl=""><TreeNode id="5AA08233-9E04-4808-AC43-DD411C5F9D31" Text="现场控制点裁剪" EnText="现场控制点裁剪" NavigateUrl="CQMS/WBS/ProjectControlPoint.aspx"></TreeNode>
</TreeNode>
+1 -1
View File
@@ -146,7 +146,7 @@ namespace FineUIPro.Web.common
// 检查列表
var query = (
from hsse in Funs.DB.HSSE_Hazard_HazardRegister
where hsse.RectifyName != null && hsse.RegisterDate > startd && hsse.RegisterDate < endd
where hsse.RectifyName != null && hsse.States != "4" && hsse.RegisterDate > startd && hsse.RegisterDate < endd
group hsse by hsse.RectifyName into g1
select new { type = g1.Key, count = g1.Count() }
@@ -129,7 +129,7 @@ namespace FineUIPro.Web.common
// 检查列表
var query =
(from hsse in Funs.DB.HSSE_Hazard_HazardRegister
where hsse.RectifyName != null && hsse.ProjectId == ProjectId && hsse.RegisterDate> startd && hsse.RegisterDate < endd
where hsse.RectifyName != null && hsse.States != "4" && hsse.ProjectId == ProjectId && hsse.RegisterDate> startd && hsse.RegisterDate < endd
group hsse by hsse.RectifyName into g1
select new { type = g1.Key, count = g1.Count() }).Union((from i in Funs.DB.Inspect_Inspection
join itm in Funs.DB.Inspect_InspectionItem on i.InspectionId equals itm.InspectionId