2024-09-30 15:31:21 +08:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using DOAN.Model.Dto;
|
|
|
|
|
|
using DOAN.Admin.WebApi.Filters;
|
2024-10-08 11:49:38 +08:00
|
|
|
|
using DOAN.Infrastructure;
|
|
|
|
|
|
using Aliyun.OSS;
|
2024-10-12 16:30:09 +08:00
|
|
|
|
using DOAN.Service.MES.quality.IPQC.IService;
|
|
|
|
|
|
using DOAN.Model.MES.quality.IPQC.Dto;
|
|
|
|
|
|
using DOAN.Model.MES.quality.IPQC;
|
2024-09-30 15:31:21 +08:00
|
|
|
|
|
|
|
|
|
|
//创建时间:2024-09-30
|
2024-10-12 16:30:09 +08:00
|
|
|
|
namespace DOAN.WebApi.Controllers.MES.quality.IPQC
|
2024-09-30 15:31:21 +08:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 缺陷收集
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Verify]
|
2024-10-12 16:47:46 +08:00
|
|
|
|
[Route("mes/qualityManagement/IPQC/QcDefectCollection")]
|
2024-09-30 15:31:21 +08:00
|
|
|
|
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")]
|
2024-10-08 14:09:28 +08:00
|
|
|
|
public IActionResult GenerateDefectConllectionPlan(string line_code, DateTime dateTime)
|
2024-10-08 11:49:38 +08:00
|
|
|
|
{
|
2024-10-08 14:09:28 +08:00
|
|
|
|
dateTime = ConvertDateTime.ConvertLocalDate(dateTime);
|
|
|
|
|
|
if (string.IsNullOrEmpty(line_code) || dateTime == DateTime.MinValue)
|
2024-10-08 11:49:38 +08:00
|
|
|
|
{
|
|
|
|
|
|
throw new CustomException("请求数据为空");
|
|
|
|
|
|
}
|
2024-10-08 14:09:28 +08:00
|
|
|
|
var response = _QcDefectCollectionService.GenerateDefectConllectionPlan(line_code, dateTime, HttpContext.GetName());
|
2024-10-08 11:49:38 +08:00
|
|
|
|
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);
|
2024-10-08 14:09:28 +08:00
|
|
|
|
|
2024-09-30 15:31:21 +08:00
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-08 14:09:28 +08:00
|
|
|
|
//TODO 复制同种物料
|
2024-10-08 14:11:37 +08:00
|
|
|
|
[HttpGet("copySameMaterial")]
|
2024-10-12 16:30:09 +08:00
|
|
|
|
public IActionResult CopySameMaterial(string id)
|
2024-10-08 14:09:28 +08:00
|
|
|
|
{
|
2024-10-12 16:30:09 +08:00
|
|
|
|
if (string.IsNullOrEmpty(id))
|
2024-10-08 14:09:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
throw new CustomException("id为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
var response = _QcDefectCollectionService.CopySameMaterial(id);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-30 15:31:21 +08:00
|
|
|
|
/// <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-11-04 14:49:16 +08:00
|
|
|
|
|
|
|
|
|
|
//TODO 获取所有供应商
|
|
|
|
|
|
[HttpGet("get_add_supplier")]
|
|
|
|
|
|
public IActionResult GetAddSupplier(string supplierCode)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _QcDefectCollectionService.GetAllSuppliers(supplierCode);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2024-09-30 16:04:32 +08:00
|
|
|
|
|
2024-09-30 15:31:21 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|