From afa49768280092e67aeedb7defb41566b28d5bf3 Mon Sep 17 00:00:00 2001
From: 10191 <506754232@qq.com>
Date: Sat, 9 Aug 2025 12:27:29 +0800
Subject: [PATCH] =?UTF-8?q?AI=E8=AF=86=E5=88=AB=E6=8E=A5=E6=94=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../版本日志/SGGLDB_V2025-08-09-001_lc.sql | 24 ++
SGGL/BLL/Common/Const.cs | 8 +
SGGL/BLL/Common/UploadFileService.cs | 50 ++++
SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 8 +
.../HSSE/AlarmEvent/AIAlarmEvent.aspx | 127 +++++++++
.../HSSE/AlarmEvent/AIAlarmEvent.aspx.cs | 264 ++++++++++++++++++
.../AlarmEvent/AIAlarmEvent.aspx.designer.cs | 170 +++++++++++
SGGL/Model/APIItem/AIAlarmEventItem.cs | 23 ++
SGGL/Model/Model.csproj | 1 +
.../Controllers/AIAlarmEventController.cs | 63 +++++
SGGL/WebAPI/Filter/TestPermissionAttribute.cs | 3 +-
SGGL/WebAPI/WebAPI.csproj | 1 +
12 files changed, 741 insertions(+), 1 deletion(-)
create mode 100644 DataBase/版本日志/SGGLDB_V2025-08-09-001_lc.sql
create mode 100644 SGGL/FineUIPro.Web/HSSE/AlarmEvent/AIAlarmEvent.aspx
create mode 100644 SGGL/FineUIPro.Web/HSSE/AlarmEvent/AIAlarmEvent.aspx.cs
create mode 100644 SGGL/FineUIPro.Web/HSSE/AlarmEvent/AIAlarmEvent.aspx.designer.cs
create mode 100644 SGGL/Model/APIItem/AIAlarmEventItem.cs
create mode 100644 SGGL/WebAPI/Controllers/AIAlarmEventController.cs
diff --git a/DataBase/版本日志/SGGLDB_V2025-08-09-001_lc.sql b/DataBase/版本日志/SGGLDB_V2025-08-09-001_lc.sql
new file mode 100644
index 00000000..91d720cf
--- /dev/null
+++ b/DataBase/版本日志/SGGLDB_V2025-08-09-001_lc.sql
@@ -0,0 +1,24 @@
+
+
+CREATE TABLE [dbo].[HSSE_AIAlarmEvent](
+ [AIAlarmEventId] [nvarchar](50) NOT NULL,
+ [DeviceId] [nvarchar](50) NULL,
+ [DeviceVersion] [varchar](50) NULL,
+ [Date] [datetime] NULL,
+ [TimeStamp] [timestamp] NULL,
+ [Label] [nvarchar](50) NULL,
+ [Alias] [nvarchar](50) NULL,
+ [Count] [int] NULL,
+ [Extend] [nvarchar](max) NULL,
+ CONSTRAINT [PK_HSSE_AIAlarmEvent] PRIMARY KEY CLUSTERED
+(
+ [AIAlarmEventId] ASC
+)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
+) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
+
+GO
+
+
+
+
+ INSERT INTO [dbo].[Sys_Menu] ([MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed]) VALUES (N'3D3AB427-FA89-4863-9E66-402FE3D46095', N'AIͷ', NULL, N'HSSE/AlarmEvent/AIAlarmEvent.aspx', '10', N'8F0FB635-75C7-472D-B423-B7B886E632FF', N'Menu_HSSE', '0', '1', '1');
diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs
index 06a3ca78..d01a3042 100644
--- a/SGGL/BLL/Common/Const.cs
+++ b/SGGL/BLL/Common/Const.cs
@@ -11,6 +11,12 @@ namespace BLL
///
public static DateTime DtmarkTime = DateTime.Parse("2020-01-01");
public static int CacheMinutes = 10;
+
+ ///
+ /// AI摄像头报警
+ ///
+ public const string AIAlarmEventMenuId = "3D3AB427-FA89-4863-9E66-402FE3D46095";
+
#region 查询字段:系统设置
///
/// 系统管理员ID
@@ -6246,5 +6252,7 @@ namespace BLL
/// 施工工程师(总包)
///
public const string SGEngineer = "F7302DA3-B522-43F9-98CC-6317622A884E";
+
+
}
}
\ No newline at end of file
diff --git a/SGGL/BLL/Common/UploadFileService.cs b/SGGL/BLL/Common/UploadFileService.cs
index 0e5c2464..642c6388 100644
--- a/SGGL/BLL/Common/UploadFileService.cs
+++ b/SGGL/BLL/Common/UploadFileService.cs
@@ -295,7 +295,57 @@ namespace BLL
public const string HSEAgreementUrlFilePath = "FileUpload\\HSEAgreementUrl\\";
#endregion
#endregion
+ public static void SaveAttachUrlForApi(string source, string attachUrl, string menuId, string toKeyId)
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ string rootUrl = ConfigurationManager.AppSettings["localRoot"];
+ if (string.IsNullOrEmpty(rootUrl))
+ {
+ rootUrl = Funs.RootPath;
+ }
+
+ List sour = (from x in db.AttachFile
+ where x.MenuId == menuId && x.ToKeyId == toKeyId
+ select x).ToList();
+ if (sour.Count() == 0)
+ {
+ Model.AttachFile att = new Model.AttachFile
+ {
+ AttachFileId = SQLHelper.GetNewID(),
+ ToKeyId = toKeyId,
+ AttachSource = source.ToString(),
+ AttachUrl = attachUrl,
+ MenuId = menuId,
+ // ImageByte= imageByte,
+ //AttachPath= attachPath,
+ };
+ if (menuId == BLL.Const.PersonListMenuId)
+ {
+ att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]);
+ }
+ db.AttachFile.InsertOnSubmit(att);
+ db.SubmitChanges();
+ }
+ else
+ {
+ Model.AttachFile att = db.AttachFile.FirstOrDefault(x => x.MenuId == menuId && x.AttachFileId == sour.First().AttachFileId);
+ if (att != null)
+ {
+ att.ToKeyId = toKeyId;
+ att.AttachSource = source.ToString();
+ att.AttachUrl = attachUrl;
+ att.MenuId = menuId;
+ if (menuId == BLL.Const.PersonListMenuId)
+ {
+ att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]);
+ }
+ db.SubmitChanges();
+ }
+ }
+ }
+ }
///
/// 保存附件
///
diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
index 9e63843c..92f2cd6a 100644
--- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
+++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
@@ -954,6 +954,7 @@
+
@@ -11124,6 +11125,13 @@
DriverManagerView.aspx
+
+ AIAlarmEvent.aspx
+ ASPXCodeBehind
+
+
+ AIAlarmEvent.aspx
+
CheckColligation.aspx
ASPXCodeBehind
diff --git a/SGGL/FineUIPro.Web/HSSE/AlarmEvent/AIAlarmEvent.aspx b/SGGL/FineUIPro.Web/HSSE/AlarmEvent/AIAlarmEvent.aspx
new file mode 100644
index 00000000..5386e067
--- /dev/null
+++ b/SGGL/FineUIPro.Web/HSSE/AlarmEvent/AIAlarmEvent.aspx
@@ -0,0 +1,127 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AIAlarmEvent.aspx.cs" Inherits="FineUIPro.Web.HSSE.AlarmEvent.AIAlarmEvent" %>
+
+<%@ Register Src="~/Controls/UnitProjectTControl.ascx" TagName="UnitProjectTControl" TagPrefix="uc1" %>
+
+
+
+
+
+
+ AI摄像头报警
+
+
+
+
+
+
+
diff --git a/SGGL/FineUIPro.Web/HSSE/AlarmEvent/AIAlarmEvent.aspx.cs b/SGGL/FineUIPro.Web/HSSE/AlarmEvent/AIAlarmEvent.aspx.cs
new file mode 100644
index 00000000..7ab126d8
--- /dev/null
+++ b/SGGL/FineUIPro.Web/HSSE/AlarmEvent/AIAlarmEvent.aspx.cs
@@ -0,0 +1,264 @@
+using BLL;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using AspNet = System.Web.UI.WebControls;
+
+namespace FineUIPro.Web.HSSE.AlarmEvent
+{
+ public partial class AIAlarmEvent : PageBase
+ {
+ #region 项目主键
+ ///
+ /// 项目主键
+ ///
+ public string ProjectId
+ {
+ get
+ {
+ return (string)ViewState["ProjectId"];
+ }
+ set
+ {
+ ViewState["ProjectId"] = value;
+ }
+ }
+ #endregion
+ #region 加载
+ ///
+ /// 加载页面
+ ///
+ ///
+ ///
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!IsPostBack)
+ {
+ Funs.DropDownPageSize(this.ddlPageSize);
+ this.ProjectId = this.CurrUser.LoginProjectId;
+ if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
+ {
+ this.ProjectId = Request.Params["projectId"];
+ }
+ this.GetButtonPower();
+ // 绑定表格
+ this.BindGrid();
+ }
+ }
+
+ ///
+ /// 绑定数据
+ ///
+ private void BindGrid()
+ {
+ if (!string.IsNullOrEmpty(this.ProjectId))
+ {
+ string strSql = "SELECT * FROM HSSE_AIAlarmEvent ";
+ List listStr = new List();
+
+ if (!string.IsNullOrEmpty(this.txtCarManagerCode.Text.Trim()))
+ {
+ strSql += " WHERE Alias LIKE @Alias ";
+ listStr.Add(new SqlParameter("@Alias", "%" + this.txtCarManagerCode.Text.Trim() + "%"));
+ }
+ SqlParameter[] parameter = listStr.ToArray();
+ DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
+
+ Grid1.RecordCount = tb.Rows.Count;
+ //tb = GetFilteredTable(Grid1.FilteredData, tb);
+ var table = this.GetPagedDataTable(Grid1, tb);
+ Grid1.DataSource = table;
+ Grid1.DataBind();
+ }
+
+ }
+
+ ///
+ /// 查询
+ ///
+ ///
+ ///
+ protected void TextBox_TextChanged(object sender, EventArgs e)
+ {
+ this.BindGrid();
+ }
+
+ ///
+ /// 改变索引事件
+ ///
+ ///
+ ///
+ protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
+ {
+ Grid1.PageIndex = e.NewPageIndex;
+ BindGrid();
+ }
+
+ ///
+ /// 分页下拉选择事件
+ ///
+ ///
+ ///
+ protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
+ BindGrid();
+ }
+
+ ///
+ /// 排序
+ ///
+ ///
+ ///
+ protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
+ {
+ Grid1.SortDirection = e.SortDirection;
+ Grid1.SortField = e.SortField;
+ BindGrid();
+ }
+
+ ///
+ /// 关闭弹出窗口
+ ///
+ ///
+ ///
+ protected void Window1_Close(object sender, EventArgs e)
+ {
+ BindGrid();
+ }
+ #endregion
+ protected string ConvertImageUrlByImage(object registrationId)
+ {
+ string url = string.Empty;
+ string httpUrl = "../../";
+
+ if (registrationId != null)
+ {
+ IList sourlist = AttachFileService.GetBeforeFileList(registrationId.ToString(), BLL.Const.AIAlarmEventMenuId);
+
+ if (sourlist != null && sourlist.Count > 0)
+ {
+ string AttachUrl = "";
+ foreach (var item in sourlist)
+ {
+ if (!string.IsNullOrEmpty(item.AttachUrl) && item.AttachUrl.ToLower().EndsWith(".jpg") || item.AttachUrl.ToLower().EndsWith(".jpeg") || item.AttachUrl.ToLower().EndsWith(".png"))
+ AttachUrl += item.AttachUrl.TrimEnd(',') + ",";
+ }
+ url = BLL.UploadAttachmentService.ShowImage(httpUrl, AttachUrl.TrimEnd(','));
+ }
+ }
+ return url;
+ }
+
+
+ #region 删除
+ ///
+ /// 右键删除事件
+ ///
+ ///
+ ///
+ protected void btnMenuDelete_Click(object sender, EventArgs e)
+ {
+ if (Grid1.SelectedRowIndexArray.Length > 0)
+ {
+ foreach (int rowIndex in Grid1.SelectedRowIndexArray)
+ {
+ string rowID = Grid1.DataKeys[rowIndex][0].ToString();
+ var getV = BLL.CarManagerService.GetCarManagerById(rowID);
+ if (getV != null)
+ {
+ BLL.LogService.AddSys_Log(this.CurrUser, getV.CarManagerCode, getV.CarManagerId, BLL.Const.AIAlarmEventMenuId, BLL.Const.BtnDelete);
+ BLL.CarManagerService.DeleteCarManagerById(rowID);
+ }
+ }
+ this.BindGrid();
+ ShowNotify("删除数据成功!", MessageBoxIcon.Success);
+ }
+ }
+ #endregion
+
+ #region 获取按钮权限
+ ///
+ /// 获取按钮权限
+ ///
+ ///
+ ///
+ private void GetButtonPower()
+ {
+ if (Request.Params["value"] == "0")
+ {
+ return;
+ }
+ var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.UserId, BLL.Const.AIAlarmEventMenuId);
+ if (buttonList.Count() > 0)
+ {
+
+
+ if (buttonList.Contains(BLL.Const.BtnDelete))
+ {
+ this.btnMenuDelete.Hidden = false;
+ }
+ }
+ }
+ #endregion
+
+ #region 导出按钮
+ /// 导出按钮
+ ///
+ ///
+ ///
+ protected void btnOut_Click(object sender, EventArgs e)
+ {
+ Response.ClearContent();
+ string filename = Funs.GetNewFileName();
+ Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("现场车辆管理" + filename, System.Text.Encoding.UTF8) + ".xls");
+ Response.ContentType = "application/excel";
+ Response.ContentEncoding = System.Text.Encoding.UTF8;
+ this.Grid1.PageSize = 500;
+ this.BindGrid();
+ Response.Write(GetGridTableHtml(Grid1));
+ Response.End();
+ }
+
+ ///
+ /// 导出方法
+ ///
+ ///
+ ///
+ private string GetGridTableHtml(Grid grid)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("");
+ sb.Append("");
+ sb.Append("");
+ foreach (GridColumn column in grid.Columns)
+ {
+ sb.AppendFormat("{0} | ", column.HeaderText);
+ }
+ sb.Append("
");
+ foreach (GridRow row in grid.Rows)
+ {
+ sb.Append("");
+ foreach (GridColumn column in grid.Columns)
+ {
+ string html = row.Values[column.ColumnIndex].ToString();
+ if (column.ColumnID == "tfNumber")
+ {
+ html = (row.FindControl("lblNumber") as AspNet.Label).Text;
+ }
+ sb.AppendFormat("{0} | ", html);
+ }
+
+ sb.Append("
");
+ }
+
+ sb.Append("
");
+
+ return sb.ToString();
+ }
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/HSSE/AlarmEvent/AIAlarmEvent.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/AlarmEvent/AIAlarmEvent.aspx.designer.cs
new file mode 100644
index 00000000..772c53b3
--- /dev/null
+++ b/SGGL/FineUIPro.Web/HSSE/AlarmEvent/AIAlarmEvent.aspx.designer.cs
@@ -0,0 +1,170 @@
+//------------------------------------------------------------------------------
+// <自动生成>
+// 此代码由工具生成。
+//
+// 对此文件的更改可能导致不正确的行为,如果
+// 重新生成代码,则所做更改将丢失。
+// 自动生成>
+//------------------------------------------------------------------------------
+
+namespace FineUIPro.Web.HSSE.AlarmEvent
+{
+
+
+ public partial class AIAlarmEvent
+ {
+
+ ///
+ /// form1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ ///
+ /// PageManager1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.PageManager PageManager1;
+
+ ///
+ /// Panel1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Panel Panel1;
+
+ ///
+ /// panelCenterRegion 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Panel panelCenterRegion;
+
+ ///
+ /// Grid1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Grid Grid1;
+
+ ///
+ /// Toolbar2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Toolbar Toolbar2;
+
+ ///
+ /// txtCarManagerCode 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtCarManagerCode;
+
+ ///
+ /// ToolbarFill1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.ToolbarFill ToolbarFill1;
+
+ ///
+ /// btnOut 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnOut;
+
+ ///
+ /// lblNumber 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.Label lblNumber;
+
+ ///
+ /// lbImageUrl 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.Label lbImageUrl;
+
+ ///
+ /// ToolbarSeparator1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
+
+ ///
+ /// ToolbarText1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.ToolbarText ToolbarText1;
+
+ ///
+ /// ddlPageSize 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.DropDownList ddlPageSize;
+
+ ///
+ /// Window1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Window Window1;
+
+ ///
+ /// Menu1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Menu Menu1;
+
+ ///
+ /// btnMenuDelete 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.MenuButton btnMenuDelete;
+ }
+}
diff --git a/SGGL/Model/APIItem/AIAlarmEventItem.cs b/SGGL/Model/APIItem/AIAlarmEventItem.cs
new file mode 100644
index 00000000..a295feb1
--- /dev/null
+++ b/SGGL/Model/APIItem/AIAlarmEventItem.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Model.APIItem
+{
+ public class AIAlarmEventItem
+ {
+ public string device_id { get; set; }
+ public string device_version { get; set; }
+ public DateTime? date { get; set; }
+ public string timestamp { get; set; }
+ public string label { get; set; }
+ public string alias { get; set; }
+ public int? count { get; set; }
+ public object extend { get; set; }
+ public string img_base64 { get; set; }
+
+
+ }
+}
diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj
index 80ef2051..3de3eea2 100644
--- a/SGGL/Model/Model.csproj
+++ b/SGGL/Model/Model.csproj
@@ -71,6 +71,7 @@
+
diff --git a/SGGL/WebAPI/Controllers/AIAlarmEventController.cs b/SGGL/WebAPI/Controllers/AIAlarmEventController.cs
new file mode 100644
index 00000000..32e0a7ab
--- /dev/null
+++ b/SGGL/WebAPI/Controllers/AIAlarmEventController.cs
@@ -0,0 +1,63 @@
+using BLL;
+using Model.APIItem;
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.IO;
+using System.Linq;
+using System.Web;
+using System.Web.Http;
+
+namespace WebAPI.Controllers
+{
+
+ public class AIAlarmEventController : ApiController
+ {
+ [HttpPost]
+ public Model.ResponeData alarmEvent([FromBody] AIAlarmEventItem item)
+ {
+ var responeData = new Model.ResponeData();
+ try
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ Model.HSSE_AIAlarmEvent newInOut = new Model.HSSE_AIAlarmEvent
+ {
+ AIAlarmEventId = Guid.NewGuid().ToString(),
+ DeviceId = item.device_id,
+ DeviceVersion = item.device_version,
+ Date = item.date,
+ Label = item.label,
+ Alias = item.alias,
+ Count = item.count,
+ Extend = item.extend.ToString(),
+ };
+ db.HSSE_AIAlarmEvent.InsertOnSubmit(newInOut);
+ db.SubmitChanges();
+ if (!string.IsNullOrEmpty(item.img_base64))
+ {
+ var image = Convert.FromBase64String(item.img_base64);
+ string rootPath = ConfigurationManager.AppSettings["localRoot"];
+ string path = "FileUpLoad/HSSE/AIAlarmEvent/" + DateTime.Now.ToString("yyyy-MM") + "/";
+ string fileUrl = (rootPath + path).Replace('/', '\\');
+ string flieName = Funs.GetNewFileName() + ".jpg";
+ if (!Directory.Exists(fileUrl))
+ {
+ Directory.CreateDirectory(fileUrl);
+ }
+ System.IO.File.WriteAllBytes((fileUrl + flieName), image);
+ UploadFileService.SaveAttachUrlForApi(UploadFileService.GetSourceByAttachUrl(path + flieName, 10, null), path + flieName, BLL.Const.AIAlarmEventMenuId, newInOut.AIAlarmEventId);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = ex.Message;
+ ErrLogInfo.WriteLog(ex, "接口-插入智能识别记录", "AIAlarmEventController.alarmEvent");
+ }
+ return responeData;
+ }
+ }
+}
+
\ No newline at end of file
diff --git a/SGGL/WebAPI/Filter/TestPermissionAttribute.cs b/SGGL/WebAPI/Filter/TestPermissionAttribute.cs
index 17c66638..248be49f 100644
--- a/SGGL/WebAPI/Filter/TestPermissionAttribute.cs
+++ b/SGGL/WebAPI/Filter/TestPermissionAttribute.cs
@@ -101,7 +101,8 @@ namespace WebAPI.Filter
"upload*attendance" ,
"CNCECServer*PostGetHSSEData",
"CNCECServer*PostGetCQMSData",
- "CNCECServer*PostGetHJGLData"
+ "CNCECServer*PostGetHJGLData",
+ "AIAlarmEvent*alarmEvent"
};
///
diff --git a/SGGL/WebAPI/WebAPI.csproj b/SGGL/WebAPI/WebAPI.csproj
index 92b235f5..86c64294 100644
--- a/SGGL/WebAPI/WebAPI.csproj
+++ b/SGGL/WebAPI/WebAPI.csproj
@@ -148,6 +148,7 @@
+