138 lines
5.0 KiB
C#
138 lines
5.0 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using RIZO.Model.Mes.Dto.WorkOrderInfo;
|
||
using RIZO.Model.Mes.WorkOrderInfo;
|
||
using RIZO.Service.Mes.IMesService.WorkOrderInfo;
|
||
using RIZO.Service.Mes.WorkOrderInfo;
|
||
|
||
//创建时间:2025-11-19
|
||
namespace RIZO.Admin.WebApi.Controllers.Mes.WorkOrderInfo
|
||
{
|
||
/// <summary>
|
||
/// 产品检验记录表
|
||
/// </summary>
|
||
[Route("mes/ProductInspection")]
|
||
public class ProductInspectionController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 产品检验记录表接口
|
||
/// </summary>
|
||
private readonly IProductInspectionService _ProductInspectionService;
|
||
|
||
public ProductInspectionController(IProductInspectionService ProductInspectionService)
|
||
{
|
||
_ProductInspectionService = ProductInspectionService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询产品检验记录表列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "productinspection:list")]
|
||
public IActionResult QueryProductInspection([FromQuery] ProductInspectionQueryDto parm)
|
||
{
|
||
var response = _ProductInspectionService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询产品检验记录表详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "productinspection:query")]
|
||
public IActionResult GetProductInspection(long Id)
|
||
{
|
||
var response = _ProductInspectionService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<ProductInspectionDto>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加产品检验记录表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "productinspection:add")]
|
||
[Log(Title = "产品检验记录表", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddProductInspection([FromBody] ProductInspectionDto parm)
|
||
{
|
||
var modal = parm.Adapt<ProductInspection>().ToCreate(HttpContext);
|
||
|
||
var response = _ProductInspectionService.AddProductInspection(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新产品检验记录表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "productinspection:edit")]
|
||
[Log(Title = "产品检验记录表", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateProductInspection([FromBody] ProductInspectionDto parm)
|
||
{
|
||
var modal = parm.Adapt<ProductInspection>().ToUpdate(HttpContext);
|
||
var response = _ProductInspectionService.UpdateProductInspection(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除产品检验记录表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("delete/{ids}")]
|
||
[ActionPermissionFilter(Permission = "productinspection:delete")]
|
||
[Log(Title = "产品检验记录表", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteProductInspection([FromRoute]string ids)
|
||
{
|
||
var idArr = Tools.SplitAndConvert<long>(ids);
|
||
|
||
return ToResponse(_ProductInspectionService.Delete(idArr));
|
||
}
|
||
|
||
/// <summary>
|
||
/// 导出产品检验数据
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("export")]
|
||
[Log(Title = "产品检验数据", BusinessType = BusinessType.EXPORT)]
|
||
public IActionResult Export([FromQuery] ProductInspectionQueryDto parm)
|
||
{
|
||
var list = _ProductInspectionService.GetListExport(parm).Result;
|
||
if (list == null || list.Count <= 0)
|
||
{
|
||
return ToResponse(ResultCode.FAIL, "没有要导出的数据");
|
||
}
|
||
var (sFileName, sFilePath) = ExportExcelMini(list, "产品检验数据", "产品检验数据");
|
||
if (string.IsNullOrWhiteSpace(sFilePath))
|
||
{
|
||
return ToResponse(ResultCode.FAIL, "Excel生成失败");
|
||
}
|
||
return PhysicalFile(
|
||
sFilePath,
|
||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||
sFileName,
|
||
true
|
||
);
|
||
}
|
||
|
||
[HttpPost("Import")]
|
||
//[ActionPermissionFilter(Permission = "materialinfo:import")]
|
||
[Log(Title = "导入保存产品检验数据", BusinessType = BusinessType.IMPORT)]
|
||
public IActionResult ImportMaterialInfo([FromQuery] string userId, [FromQuery] string userName, [FromForm] IFormFile file)
|
||
{
|
||
var stream = file.OpenReadStream();
|
||
var fileName = file.FileName;
|
||
var response = _ProductInspectionService.Import(stream, userId, userName);
|
||
return ToResponse(response);
|
||
}
|
||
|
||
}
|
||
} |