diff --git a/Entity/Api/Req/EquipAlarmDefineReq.cs b/Entity/Api/Req/EquipAlarmDefineReq.cs
new file mode 100644
index 0000000..140f5c6
--- /dev/null
+++ b/Entity/Api/Req/EquipAlarmDefineReq.cs
@@ -0,0 +1,55 @@
+using HybirdFrameworkCore.Entity;
+
+namespace Entity.Api.Req;
+
+public class EquipAlarmDefineReq: QueryPageModel
+{
+ ///
+ /// Desc:id
+ /// Default:
+ /// Nullable:False
+ ///
+ public int? Id { get; set; }
+
+ ///
+ /// Desc:设备类型编码
+ /// Default:
+ /// Nullable:True
+ ///
+ public int EquipTypeCode { get; set; }
+
+ ///
+ /// Desc:设备编码
+ /// Default:
+ /// Nullable:True
+ ///
+ public string? EquipCode { get; set; }
+
+ ///
+ /// Desc:报警编码
+ /// Default:
+ /// Nullable:True
+ ///
+ public string? ErrorCode { get; set; }
+
+ ///
+ /// Desc:报警等级
+ /// Default:
+ /// Nullable:True
+ ///
+ public string? ErrorLevel { get; set; }
+
+ ///
+ /// Desc:报警描述
+ /// Default:
+ /// Nullable:True
+ ///
+ public string? ErrorMsg { get; set; }
+
+ ///
+ /// Desc:处理方法
+ /// Default:
+ /// Nullable:True
+ ///
+ public string? ProcessMethod { get; set; }
+}
\ No newline at end of file
diff --git a/Entity/Dto/EquipAlarmDefineDto.cs b/Entity/Dto/EquipAlarmDefineDto.cs
new file mode 100644
index 0000000..09eeca6
--- /dev/null
+++ b/Entity/Dto/EquipAlarmDefineDto.cs
@@ -0,0 +1,56 @@
+using Magicodes.ExporterAndImporter.Core;
+using Magicodes.ExporterAndImporter.Excel;
+
+namespace Entity.Dto;
+
+[ExcelExporter(Name = "设备报警基础信息", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)]
+public class EquipAlarmDefineDto
+{
+ ///
+ /// Desc:设备类型编码
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "设备类型编码", IsBold = true)]
+ public int EquipTypeCode { get; set; }
+
+ ///
+ /// Desc:设备编码
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "设备编码", IsBold = true)]
+ public string EquipCode { get; set; }
+
+ ///
+ /// Desc:报警编码
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "报警编码", IsBold = true)]
+ public string ErrorCode { get; set; }
+
+ ///
+ /// Desc:报警等级
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "报警等级", IsBold = true)]
+ public string ErrorLevel { get; set; }
+
+ ///
+ /// Desc:报警描述
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "报警描述", IsBold = true)]
+ public string ErrorMsg { get; set; }
+
+ ///
+ /// Desc:处理方法
+ /// Default:
+ /// Nullable:True
+ ///
+ [ExporterHeader(DisplayName = "处理方法", IsBold = true)]
+ public string ProcessMethod { get; set; }
+}
\ No newline at end of file
diff --git a/Service/Station/EquipAlarmDefineService.cs b/Service/Station/EquipAlarmDefineService.cs
new file mode 100644
index 0000000..0a1cf81
--- /dev/null
+++ b/Service/Station/EquipAlarmDefineService.cs
@@ -0,0 +1,220 @@
+using AutoMapper;
+using Entity.Api.Req;
+using Entity.DbModel.Station;
+using Entity.Dto;
+using HybirdFrameworkCore.Autofac.Attribute;
+using HybirdFrameworkCore.Entity;
+using HybirdFrameworkCore.Utils;
+using Magicodes.ExporterAndImporter.Excel;
+using Mapster;
+using Microsoft.AspNetCore.Mvc;
+using Repository.Station;
+using SqlSugar;
+
+namespace Service.Station;
+
+[Scope("SingleInstance")]
+public class EquipAlarmDefineService: BaseServices
+{
+ EquipAlarmDefineRepository _elecPriceModelVersionRepository;
+ public EquipAlarmDefineService(EquipAlarmDefineRepository dal)
+ {
+ _elecPriceModelVersionRepository = dal;
+ BaseDal = dal;
+ }
+
+ ///
+ /// 查询未处理报警列表
+ ///
+ /// 设备类型:-1-查询全部;0-充电机;1-电表;2-水冷机;3-plc<
+ /// 设备编码
+ ///
+ public Result> QueryEquipAlarmPage(EquipAlarmDefineReq req)
+ {
+ int totalCount = 0;
+ int EquipTypeCode = req.EquipTypeCode;
+ string EquipCode = req.EquipCode;
+ string ErrorCode = req.ErrorCode;
+ string ErrorLevel = req.ErrorLevel;
+ string ErrorMsg = req.ErrorMsg;
+ string ProcessMethod = req.ProcessMethod;
+ List list = BaseDal.Queryable()
+ .WhereIF(EquipTypeCode != -1, it => it.EquipTypeCode == EquipTypeCode)
+ .WhereIF(ObjUtils.IsNotNullOrWhiteSpace(EquipCode), it => it.EquipCode == EquipCode)
+ .WhereIF(ObjUtils.IsNotNullOrWhiteSpace(ErrorLevel), it => it.ErrorLevel == ErrorLevel)
+ .WhereIF(ObjUtils.IsNotNullOrWhiteSpace(ErrorMsg), it => it.ErrorMsg.Contains(ErrorMsg))
+ .WhereIF(ObjUtils.IsNotNullOrWhiteSpace(ProcessMethod), it => it.ProcessMethod.Contains(ProcessMethod))
+ .ToList(); // 注意:这里添加了 ToList() 来确保执行查询
+
+ PageResult result = new PageResult()
+ {
+ PageNum = req.PageNum,
+ PageSize = req.PageSize,
+ ToTal = totalCount,
+ Rows = list
+ };
+ return Result>.Success(result);
+ }
+
+ ///
+ /// 导出
+ ///
+ ///
+ public async Task ExportEquipAlarmRecord()
+ {
+ List equipAlarmRecords = await BaseDal.QueryAsync();
+
+ var config = new MapperConfiguration(cfg =>
+ {
+ cfg.CreateMap().ReverseMap();
+ });
+
+ IMapper mapper = config.CreateMapper();
+
+ List logExList = mapper.Map>(equipAlarmRecords);
+
+ IExcelExporter excelExporter = new ExcelExporter();
+
+ var res = await excelExporter.ExportAsByteArray(logExList);
+
+ return new FileStreamResult(new MemoryStream(res), "application/octet-stream")
+ { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "设备报警基础信息.xlsx" };
+ }
+
+ ///
+ /// 新增
+ ///
+ ///
+ ///
+ public async Task> Add([FromBody] EquipAlarmDefineReq req)
+ {
+ if (req.EquipCode == null)
+ {
+ return Result.Fail("设备类型编码不能为空");
+ }
+ if (req.ErrorCode == null)
+ {
+ return Result.Fail("报警编码不能为空");
+ }
+ if (req.ErrorLevel == null)
+ {
+ return Result.Fail("报警等级不能为空");
+ }
+ if (req.ErrorMsg == null)
+ {
+ return Result.Fail("报警描述不能为空");
+ }
+
+ var equipAlarmDefineTask =
+ BaseDal.QueryByClauseAsync(u =>
+ u.EquipTypeCode == req.EquipTypeCode && u.EquipCode == req.EquipCode && u.ErrorCode == req.ErrorCode &&
+ u.ErrorLevel == req.ErrorLevel);
+
+ await Task.WhenAll(equipAlarmDefineTask);
+
+ var isExist = equipAlarmDefineTask.Result;
+ if (isExist != null)
+ {
+ return Result.Fail("已存在同名或同编码设备信息");
+ }
+
+ var equipInfo = req.Adapt();
+
+ var insertEquipInfoTask = BaseDal.InsertAsync(equipInfo);
+
+ await Task.WhenAll(insertEquipInfoTask);
+
+ var insertAsync = insertEquipInfoTask.Result;
+
+ if (insertAsync.Id > 0)
+ {
+ return Result.Success("新增id:" + insertAsync.Id);
+ }
+
+ return Result.Fail("新增失败");
+ }
+
+ ///
+ /// 修改报警数据编码
+ ///
+ ///
+ ///
+ public async Task> Modify([FromBody] EquipAlarmDefineReq req)
+ {
+ // 查询 EquipInfo
+ var equipInfo = await BaseDal.QueryByClauseAsync(u => u.Id == req.Id);
+ if (equipInfo == null)
+ {
+ return Result.Fail("id不存在");
+ }
+
+ if (req.EquipCode == null)
+ {
+ return Result.Fail("设备类型编码不能为空");
+ }
+ if (req.ErrorCode == null)
+ {
+ return Result.Fail("报警编码不能为空");
+ }
+ if (req.ErrorLevel == null)
+ {
+ return Result.Fail("报警等级不能为空");
+ }
+ if (req.ErrorMsg == null)
+ {
+ return Result.Fail("报警描述不能为空");
+ }
+ //判断是否重复
+ var equipAlarmDefineTask =
+ BaseDal.QueryByClauseAsync(u =>
+ u.EquipTypeCode == req.EquipTypeCode && u.EquipCode == req.EquipCode && u.ErrorCode == req.ErrorCode &&
+ u.ErrorLevel == req.ErrorLevel);
+
+ await Task.WhenAll(equipAlarmDefineTask);
+
+ var insertAsync = equipAlarmDefineTask.Result;
+
+ if (insertAsync.Id > 0)
+ {
+ return Result.Success("新增id:" + insertAsync.Id);
+ }
+
+ return Result.Fail("修改失败");
+ }
+
+ ///
+ /// 删除
+ ///
+ /// ids id列表
+ ///
+ [HttpPost("DeleteByIds")]
+ public async Task> DeleteByIds([FromBody] EquipAlarmDefineReq req)
+ {
+ // 查询 EquipInfo
+ var equipInfo = await BaseDal.QueryByClauseAsync(u => u.Id == req.Id);
+ if (equipInfo == null)
+ {
+ return Result.Fail("id不存在");
+ }
+
+ // 查询 EquipNetInfo
+ var equipNetInfo = await BaseDal.QueryByClauseAsync(u => u.EquipCode == equipInfo.EquipCode);
+ if (equipNetInfo == null)
+ {
+ return Result.Fail("不存在此编码");
+ }
+
+ var deleteEquipInfoTask = BaseDal.DeleteAsync(equipInfo);
+
+ await Task.WhenAll(deleteEquipInfoTask);
+
+ var deleteResult = deleteEquipInfoTask.Result;
+
+ if (deleteResult)
+ {
+ return Result.Success("删除成功");
+ }
+
+ return Result.Fail("删除失败");
+ }
+}
\ No newline at end of file
diff --git a/WebStarter/Controllers/BatteryController.cs b/WebStarter/Controllers/BatteryController.cs
new file mode 100644
index 0000000..a84000b
--- /dev/null
+++ b/WebStarter/Controllers/BatteryController.cs
@@ -0,0 +1,13 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace WebStarter.Controllers;
+
+///
+/// 电池数据显示
+///
+[ApiController]
+[Route("api/[controller]")]
+public class BatteryController: ControllerBase
+{
+
+}
\ No newline at end of file
diff --git a/WebStarter/Controllers/EquipAlarmDefineController.cs b/WebStarter/Controllers/EquipAlarmDefineController.cs
new file mode 100644
index 0000000..df245a4
--- /dev/null
+++ b/WebStarter/Controllers/EquipAlarmDefineController.cs
@@ -0,0 +1,82 @@
+using Entity.Api.Req;
+using Entity.Api.Resp;
+using Entity.DbModel.Station;
+using HybirdFrameworkCore.Entity;
+using log4net;
+using Microsoft.AspNetCore.Mvc;
+using Repository.Station;
+using Service.Station;
+
+namespace WebStarter.Controllers;
+
+///
+/// 报警数据编码
+///
+[ApiController]
+[Route("api/[controller]")]
+public class EquipAlarmDefineController: ControllerBase
+{
+ private static readonly ILog Log = LogManager.GetLogger(typeof(EquipAlarmDefineController));
+ private readonly EquipAlarmDefineService equipAlarmDefineRepository;
+
+ public EquipAlarmDefineController(EquipAlarmDefineService equipAlarmDefineRepository)
+ {
+ this.equipAlarmDefineRepository = equipAlarmDefineRepository;
+ }
+
+ ///
+ /// 查询分页数据
+ ///
+ ///
+ [HttpPost("QueryPage")]
+ public Result> QueryPage([FromBody] EquipAlarmDefineReq req)
+ {
+ return equipAlarmDefineRepository.QueryEquipAlarmPage(req);
+ }
+ ///
+ /// 导出未处理报警
+ ///
+ ///
+ [HttpPost]
+ [Route("ExportEquipAlarmRecord")]
+ public async Task ExportEquipAlarmRecord()
+ {
+ return await equipAlarmDefineRepository.ExportEquipAlarmRecord();
+ }
+
+
+
+ ///
+ /// 新增
+ ///
+ ///
+ [HttpPost("Add")]
+ public async Task> Add([FromBody] EquipAlarmDefineReq req)
+ {
+ return await equipAlarmDefineRepository.Add(req);
+ }
+
+ ///
+ /// 修改报警数据编码
+ ///
+ ///
+ ///
+ [HttpPost("Modify")]
+ public async Task> Modify([FromBody] EquipAlarmDefineReq req)
+ {
+ return await equipAlarmDefineRepository.Modify(req);
+ }
+
+ ///
+ /// 删除
+ ///
+ /// ids id列表
+ ///
+ [HttpPost("DeleteByIds")]
+ public async Task> DeleteByIds([FromBody] EquipAlarmDefineReq req)
+ {
+ return await equipAlarmDefineRepository.DeleteByIds(req);
+ }
+
+
+}
\ No newline at end of file