using DOAN.Admin.WebApi.Filters; using DOAN.Model.MES.quality.IQC; using DOAN.Model.MES.quality.IQC.Dto; using DOAN.Model.MES.Quality.FQC.Dto; using DOAN.Service.MES.quality.FQC.IService; using Microsoft.AspNetCore.Mvc; //创建时间:2024-10-10 namespace DOAN.WebApi.Controllers.MES.quality.FQC { /// /// 成品检验 缺陷收集 /// [AllowAnonymous] [Route("mes/qualityManagement/FQC/QcFinishedproductDefect")] public class QcFinishedproductDefectController : BaseController { private readonly IQcFinishedproductDefectService qcFinishedproductDefectService; public QcFinishedproductDefectController(IQcFinishedproductDefectService qcFinishedproductDefectService) { this.qcFinishedproductDefectService = qcFinishedproductDefectService; } //TODO 增加 缺陷数 [HttpGet("add_defect_num")] public IActionResult AddDefectNum([FromQuery] QueryFQCDto queryFQCDto) { if (string.IsNullOrEmpty(queryFQCDto.WorkOrder) || string.IsNullOrEmpty(queryFQCDto.DefectCode)) { throw new CustomException("WorkOrder为空||DefectCode为空"); } var response = qcFinishedproductDefectService.AddDefectNum(queryFQCDto); return SUCCESS(response); } //TODO 修改缺陷数 [HttpGet("update_defect_num")] public IActionResult UpdateDefectNum([FromQuery] QueryFQCDto queryFQCDto) { if (string.IsNullOrEmpty(queryFQCDto.WorkOrder) || string.IsNullOrEmpty(queryFQCDto.DefectCode)) { throw new CustomException("WorkOrder为空||DefectCode为空"); } var response = qcFinishedproductDefectService.UpdateDefectNum(queryFQCDto); return SUCCESS(response); } //TODO 查询指定工单下的缺陷 [HttpGet("search_defects")] public IActionResult SearchDefectList(string WorkOrder) { if (string.IsNullOrEmpty(WorkOrder) ) { throw new CustomException("WorkOrder为空"); } var response = qcFinishedproductDefectService.SearchDefectList(WorkOrder); return SUCCESS(response); } //TODO 分页查询缺陷统计 [HttpPost("search_defect_Statistics_page")] public IActionResult SearchDefectStatisticsPage([FromBody]QueryFQCShowDto queryFQCShow) { if(queryFQCShow == null) { throw new CustomException("queryFQCShow为空"); } var response = qcFinishedproductDefectService.SearchDefectStatisticsPage(queryFQCShow); return SUCCESS(response); } } }