134 lines
4.5 KiB
C#
Raw Normal View History

2024-09-30 15:31:21 +08:00
using Microsoft.AspNetCore.Mvc;
using DOAN.Model.Dto;
using DOAN.Model.MES.quality;
using DOAN.Model.MES.quality.Dto;
using DOAN.Service.MES.quality;
using DOAN.Admin.WebApi.Filters;
2024-10-08 11:49:38 +08:00
using DOAN.Infrastructure;
using Aliyun.OSS;
2024-09-30 15:31:21 +08:00
//创建时间2024-09-30
namespace DOAN.Admin.WebApi.Controllers
{
/// <summary>
/// 缺陷收集
/// </summary>
[Verify]
[Route("mes/productManagement/QcDefectCollection")]
public class QcDefectCollectionController : BaseController
{
/// <summary>
/// 缺陷收集接口
/// </summary>
private readonly IQcDefectCollectionService _QcDefectCollectionService;
public QcDefectCollectionController(IQcDefectCollectionService QcDefectCollectionService)
{
_QcDefectCollectionService = QcDefectCollectionService;
}
2024-10-08 11:49:38 +08:00
//TODO 生成指定产线和日期的 缺陷收集计划
[HttpGet("generate_defectCollection")]
public IActionResult GenerateDefectConllectionPlan(string line_code,DateTime dateTime)
{
dateTime= ConvertDateTime.ConvertLocalDate(dateTime);
if(string.IsNullOrEmpty(line_code)||dateTime== DateTime.MinValue)
{
throw new CustomException("请求数据为空");
}
var response = _QcDefectCollectionService.GenerateDefectConllectionPlan( line_code, dateTime,HttpContext.GetName());
return SUCCESS(response);
}
2024-09-30 15:31:21 +08:00
/// <summary>
/// 查询缺陷收集列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "qualityManagement:qcdefectcollection:list")]
public IActionResult QueryQcDefectCollection([FromQuery] QcDefectCollectionQueryDto parm)
{
var response = _QcDefectCollectionService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询缺陷收集详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "qualityManagement:qcdefectcollection:query")]
public IActionResult GetQcDefectCollection(string Id)
{
var response = _QcDefectCollectionService.GetInfo(Id);
var info = response.Adapt<QcDefectCollection>();
return SUCCESS(info);
}
/// <summary>
/// 添加缺陷收集
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "qualityManagement:qcdefectcollection:add")]
[Log(Title = "缺陷收集", BusinessType = BusinessType.INSERT)]
public IActionResult AddQcDefectCollection([FromBody] QcDefectCollectionDto parm)
{
var modal = parm.Adapt<QcDefectCollection>().ToCreate(HttpContext);
var response = _QcDefectCollectionService.AddQcDefectCollection(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新缺陷收集
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "qualityManagement:qcdefectcollection:edit")]
[Log(Title = "缺陷收集", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateQcDefectCollection([FromBody] QcDefectCollectionDto parm)
{
var modal = parm.Adapt<QcDefectCollection>().ToUpdate(HttpContext);
var response = _QcDefectCollectionService.UpdateQcDefectCollection(modal);
return ToResponse(response);
}
/// <summary>
/// 删除缺陷收集
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "qualityManagement:qcdefectcollection:delete")]
[Log(Title = "缺陷收集", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteQcDefectCollection(string ids)
{
2024-09-30 15:40:14 +08:00
string[] idsArr = Tools.SpitStrArrary(ids);
2024-09-30 15:31:21 +08:00
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _QcDefectCollectionService.Delete(idsArr);
return ToResponse(response);
}
2024-09-30 16:04:32 +08:00
//TODO 获取产线
[HttpGet("get_all_line")]
public IActionResult GetAllLines()
{
var response = _QcDefectCollectionService.GetAllLines();
2024-10-08 11:49:38 +08:00
return SUCCESS(response);
2024-09-30 16:04:32 +08:00
}
2024-09-30 15:31:21 +08:00
}
}