shgx_tz_mom/ZR.Admin.WebApi/Controllers/mes/andon/AndonAlarmAreaController.cs
2025-12-21 15:02:05 +08:00

123 lines
4.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 ZR.Admin.WebApi.Extensions;
using ZR.Admin.WebApi.Filters;
using ZR.Model.MES.andon;
using ZR.Model.MES.andon.Dto;
using ZR.Service.mes.andon.Iservice;
//创建时间2025-12-20
namespace ZR.Admin.WebApi.Controllers.andon
{
/// <summary>
/// 报警区域表
/// </summary>
[AllowAnonymous]
[Route("mes/AndonAlarmArea")]
public class AndonAlarmAreaController : BaseController
{
/// <summary>
/// 报警区域表接口
/// </summary>
private readonly IAndonAlarmAreaService _AndonAlarmAreaService;
public AndonAlarmAreaController(IAndonAlarmAreaService AndonAlarmAreaService)
{
_AndonAlarmAreaService = AndonAlarmAreaService;
}
/// <summary>
/// 查询报警区域表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "business:andonalarmarea:list")]
public IActionResult QueryAndonAlarmArea([FromQuery] AndonAlarmAreaQueryDto parm)
{
var response = _AndonAlarmAreaService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询报警区域表详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "business:andonalarmarea:query")]
public IActionResult GetAndonAlarmArea(int Id)
{
var response = _AndonAlarmAreaService.GetInfo(Id);
var info = response.Adapt<AndonAlarmArea>();
return SUCCESS(info);
}
/// <summary>
/// 添加报警区域表
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "business:andonalarmarea:add")]
[Log(Title = "报警区域表", BusinessType = BusinessType.INSERT)]
public IActionResult AddAndonAlarmArea([FromBody] AndonAlarmAreaDto parm)
{
var modal = parm.Adapt<AndonAlarmArea>().ToCreate(HttpContext);
var response = _AndonAlarmAreaService.AddAndonAlarmArea(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新报警区域表
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "business:andonalarmarea:edit")]
[Log(Title = "报警区域表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateAndonAlarmArea([FromBody] AndonAlarmAreaDto parm)
{
var modal = parm.Adapt<AndonAlarmArea>().ToUpdate(HttpContext);
var response = _AndonAlarmAreaService.UpdateAndonAlarmArea(modal);
return ToResponse(response);
}
/// <summary>
/// 删除报警区域表
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "business:andonalarmarea:delete")]
[Log(Title = "报警区域表", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteAndonAlarmArea(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _AndonAlarmAreaService.Delete(idsArr);
return ToResponse(response);
}
[HttpGet("getPullDownP")]
[ActionPermissionFilter(Permission = "business:andonalarmarea:list")]
public ApiResult GetPullDownP()
{
var response = _AndonAlarmAreaService.GetPullDownP();
return response;
}
[HttpPost("getPullDownByPID")]
[ActionPermissionFilter(Permission = "business:andonalarmarea:list")]
public ApiResult GetPullDownByPID([FromBody] AlarmAreaPullDownDto parm)
{
var response = _AndonAlarmAreaService.GetPullDownByPID(parm);
return response;
}
}
}