118 lines
3.8 KiB
C#
118 lines
3.8 KiB
C#
using DOAN.Admin.WebApi.Filters;
|
||
using DOAN.Model.MES.quality.IQC;
|
||
using DOAN.Model.MES.quality.IQC.Dto;
|
||
using DOAN.Service.MES.quality.FQC.IService;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
|
||
//创建时间:2024-10-10
|
||
namespace DOAN.WebApi.Controllers.MES.quality.FQC
|
||
{
|
||
/// <summary>
|
||
/// 缺陷类别
|
||
/// </summary>
|
||
//[Verify]
|
||
[Route("mes/qualityManagement/FQC/QcDefectConfig")]
|
||
public class QcDefectConfigController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 缺陷类别接口
|
||
/// </summary>
|
||
private readonly IQcDefectConfigService _QcDefectConfigService;
|
||
|
||
public QcDefectConfigController(IQcDefectConfigService QcDefectConfigService)
|
||
{
|
||
_QcDefectConfigService = QcDefectConfigService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询缺陷类别列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "qualityManagement:qcdefectconfig:list")]
|
||
public IActionResult QueryQcDefectConfig([FromQuery] QcDefectConfigQueryDto parm)
|
||
{
|
||
var response = _QcDefectConfigService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
//TODO 查询缺陷项 不分页
|
||
[HttpGet("list_no_page")]
|
||
[AllowAnonymous]
|
||
public IActionResult QueryQcDefectConfigNoPage([FromQuery] QcDefectConfigQueryDto parm)
|
||
{
|
||
var response = _QcDefectConfigService.GetListNoPage(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 查询缺陷类别详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "qualityManagement:qcdefectconfig:query")]
|
||
public IActionResult GetQcDefectConfig(int Id)
|
||
{
|
||
var response = _QcDefectConfigService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<QcDefectConfig>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加缺陷类别
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "qualityManagement:qcdefectconfig:add")]
|
||
[Log(Title = "缺陷类别", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddQcDefectConfig([FromBody] QcDefectConfigDto parm)
|
||
{
|
||
var modal = parm.Adapt<QcDefectConfig>().ToCreate(HttpContext);
|
||
|
||
var response = _QcDefectConfigService.AddQcDefectConfig(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新缺陷类别
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "qualityManagement:qcdefectconfig:edit")]
|
||
[Log(Title = "缺陷类别", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateQcDefectConfig([FromBody] QcDefectConfigDto parm)
|
||
{
|
||
var modal = parm.Adapt<QcDefectConfig>().ToUpdate(HttpContext);
|
||
var response = _QcDefectConfigService.UpdateQcDefectConfig(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除缺陷类别
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpDelete("{ids}")]
|
||
[ActionPermissionFilter(Permission = "qualityManagement:qcdefectconfig:delete")]
|
||
[Log(Title = "缺陷类别", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteQcDefectConfig(string ids)
|
||
{
|
||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||
|
||
var response = _QcDefectConfigService.Delete(idsArr);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
} |