shgx_tz_mom/ZR.Admin.WebApi/Controllers/mes/andon/AndonWorkTimeController.cs

107 lines
3.6 KiB
C#
Raw Normal View History

2026-03-03 19:46:07 +08:00
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;
2026-03-04 08:45:29 +08:00
using ZR.Service.mes.andon;
2026-03-03 19:46:07 +08:00
using ZR.Service.mes.andon.Iservice;
//创建时间2025-12-10
namespace ZR.Admin.WebApi.Controllers.andon
{
/// <summary>
/// 安灯区域工作时间表
/// </summary>
[Route("mes/AndonWorkTime")]
[AllowAnonymous]
public class AndonWorkTimeController : BaseController
{
/// <summary>
/// 安灯区域工作时间表接口
/// </summary>
private readonly IAndonWorkTimeService _AndonWorkTimeService;
public AndonWorkTimeController(IAndonWorkTimeService AndonWorkTimeService)
{
_AndonWorkTimeService = AndonWorkTimeService;
}
/// <summary>
/// 查询安灯区域工作时间表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "andonworktime:list")]
public IActionResult QueryAndonWorkTime([FromQuery] AndonWorkTimeQueryDto parm)
{
var response = _AndonWorkTimeService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询安灯区域工作时间表详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "andonworktime:query")]
public IActionResult GetAndonWorkTime(int Id)
{
var response = _AndonWorkTimeService.GetInfo(Id);
var info = response.Adapt<AndonWorkTimeDto>();
return SUCCESS(info);
}
/// <summary>
/// 添加安灯区域工作时间表
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "andonworktime:add")]
[Log(Title = "安灯区域工作时间表", BusinessType = BusinessType.INSERT)]
public IActionResult AddAndonWorkTime([FromBody] AndonWorkTimeDto parm)
{
var modal = parm.Adapt<AndonWorkTime>().ToCreate(HttpContext);
var response = _AndonWorkTimeService.AddAndonWorkTime(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新安灯区域工作时间表
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "andonworktime:edit")]
[Log(Title = "安灯区域工作时间表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateAndonWorkTime([FromBody] AndonWorkTimeDto parm)
{
var modal = parm.Adapt<AndonWorkTime>().ToUpdate(HttpContext);
var response = _AndonWorkTimeService.UpdateAndonWorkTime(modal);
return ToResponse(response);
}
/// <summary>
/// 删除安灯区域工作时间表
/// </summary>
/// <returns></returns>
[HttpPost("delete/{ids}")]
[ActionPermissionFilter(Permission = "andonworktime:delete")]
[Log(Title = "安灯区域工作时间表", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteAndonWorkTime([FromRoute]string ids)
{
2026-03-04 08:45:29 +08:00
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
2026-03-03 19:46:07 +08:00
2026-03-04 08:45:29 +08:00
var response = _AndonWorkTimeService.Delete(idsArr);
return ToResponse(response);
2026-03-03 19:46:07 +08:00
}
}
}