2026-01-20 09:23:56 +08:00

101 lines
3.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Microsoft.AspNetCore.Mvc;
using RIZO.Model.MES.alarm;
using RIZO.Model.MES.alarm.Dto;
using RIZO.Service.MES.alarm.IService;
//创建时间2026-01-19
namespace RIZO.Admin.WebApi.Controllers.Mes.alerm
{
/// <summary>
/// PLC报警信息
/// </summary>
[Route("mes/AlarmInfo")]
[AllowAnonymous]
public class AlarmInfoController : BaseController
{
/// <summary>
/// PLC报警信息接口
/// </summary>
private readonly IAlarmInfoService _AlarmInfoService;
public AlarmInfoController(IAlarmInfoService AlarmInfoService)
{
_AlarmInfoService = AlarmInfoService;
}
/// <summary>
/// 查询PLC报警信息列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "alarminfo:list")]
public IActionResult QueryAlarmInfo([FromQuery] AlarmInfoQueryDto parm)
{
var response = _AlarmInfoService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询PLC报警信息详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "alarminfo:query")]
public IActionResult GetAlarmInfo(int Id)
{
var response = _AlarmInfoService.GetInfo(Id);
var info = response.Adapt<AlarmInfoDto>();
return SUCCESS(info);
}
/// <summary>
/// 添加PLC报警信息
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "alarminfo:add")]
[Log(Title = "PLC报警信息", BusinessType = BusinessType.INSERT)]
public IActionResult AddAlarmInfo([FromBody] AlarmInfoDto parm)
{
var modal = parm.Adapt<AlarmInfo>().ToCreate(HttpContext);
var response = _AlarmInfoService.AddAlarmInfo(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新PLC报警信息
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "alarminfo:edit")]
[Log(Title = "PLC报警信息", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateAlarmInfo([FromBody] AlarmInfoDto parm)
{
var modal = parm.Adapt<AlarmInfo>().ToUpdate(HttpContext);
var response = _AlarmInfoService.UpdateAlarmInfo(modal);
return ToResponse(response);
}
/// <summary>
/// 删除PLC报警信息
/// </summary>
/// <returns></returns>
[HttpPost("delete/{ids}")]
[ActionPermissionFilter(Permission = "alarminfo:delete")]
[Log(Title = "PLC报警信息", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteAlarmInfo([FromRoute]string ids)
{
var idArr = Tools.SplitAndConvert<int>(ids);
return ToResponse(_AlarmInfoService.Delete(idArr));
}
}
}