using Microsoft.AspNetCore.Mvc;
using DOAN.Model.Dto;
using DOAN.Admin.WebApi.Filters;
using DOAN.Model.MES.exception;
using DOAN.Model.MES.exception.Dto;
using DOAN.Service.exception.IService;
using Infrastructure.Converter;
//创建时间:2024-11-19
namespace DOAN.Admin.WebApi.Controllers
{
///
/// 工单修改日志表
///
[Verify]
[Route("mes/exception/ProWorkorderUpdateLog")]
public class ProWorkorderUpdateLogController : BaseController
{
///
/// 工单修改日志表接口
///
private readonly IProWorkorderUpdateLogService _ProWorkorderUpdateLogService;
public ProWorkorderUpdateLogController(IProWorkorderUpdateLogService ProWorkorderUpdateLogService)
{
_ProWorkorderUpdateLogService = ProWorkorderUpdateLogService;
}
///
/// 查询工单修改日志表列表
///
///
///
[HttpPost("list")]
[ActionPermissionFilter(Permission = "exceptionManagement:proworkorderupdatelog:list")]
public IActionResult QueryProWorkorderUpdateLog([FromBody] ProWorkorderUpdateLogQueryDto parm)
{
parm.SearchDateTimeArray[0]= DOANConvertDateTime.ConvertLocalDate(parm.SearchDateTimeArray[0]);
parm.SearchDateTimeArray[1]= DOANConvertDateTime.ConvertLocalDate(parm.SearchDateTimeArray[1]);
var response = _ProWorkorderUpdateLogService.GetList(parm);
return SUCCESS(response);
}
///
/// 查询工单修改日志表详情
///
///
///
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "exceptionManagement:proworkorderupdatelog:query")]
public IActionResult GetProWorkorderUpdateLog(string Id)
{
var response = _ProWorkorderUpdateLogService.GetInfo(Id);
var info = response.Adapt();
return SUCCESS(info);
}
///
/// 添加工单修改日志表
///
///
[HttpPost]
[ActionPermissionFilter(Permission = "exceptionManagement:proworkorderupdatelog:add")]
[Log(Title = "工单修改日志表", BusinessType = BusinessType.INSERT)]
public IActionResult AddProWorkorderUpdateLog([FromBody] ProWorkorderUpdateLogDto parm)
{
var modal = parm.Adapt().ToCreate(HttpContext);
var response = _ProWorkorderUpdateLogService.AddProWorkorderUpdateLog(modal);
return SUCCESS(response);
}
///
/// 更新工单修改日志表
///
///
[HttpPut]
[ActionPermissionFilter(Permission = "exceptionManagement:proworkorderupdatelog:edit")]
[Log(Title = "工单修改日志表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateProWorkorderUpdateLog([FromBody] ProWorkorderUpdateLogDto parm)
{
var modal = parm.Adapt().ToUpdate(HttpContext);
var response = _ProWorkorderUpdateLogService.UpdateProWorkorderUpdateLog(modal);
return ToResponse(response);
}
///
/// 删除工单修改日志表
///
///
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "exceptionManagement:proworkorderupdatelog:delete")]
[Log(Title = "工单修改日志表", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteProWorkorderUpdateLog(string ids)
{
string[] idsArr = Tools.SpitStrArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _ProWorkorderUpdateLogService.Delete(idsArr);
return ToResponse(response);
}
}
}