126 lines
4.4 KiB
C#
126 lines
4.4 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using RIZO.Model.Mes.Dto.GatherData;
|
||
using RIZO.Model.Mes.Dto.WorkOrderInfo;
|
||
using RIZO.Model.Mes.GatherData;
|
||
using RIZO.Service.Mes.IMesService.GatherData;
|
||
|
||
//创建时间:2025-11-12
|
||
namespace RIZO.Admin.WebApi.Controllers.Mes.GatherData
|
||
{
|
||
/// <summary>
|
||
/// 生产工艺参数
|
||
/// </summary>
|
||
[Route("mes/ProcessParameter")]
|
||
[AllowAnonymous]
|
||
public class ProcessParameterController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 生产工艺参数接口
|
||
/// </summary>
|
||
private readonly IProcessParameterService _ProcessParameterService;
|
||
|
||
public ProcessParameterController(IProcessParameterService ProcessParameterService)
|
||
{
|
||
_ProcessParameterService = ProcessParameterService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询生产工艺参数列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "processparameter:list")]
|
||
public IActionResult QueryProcessParameter([FromQuery] ProcessParameterQueryDto parm)
|
||
{
|
||
var response = _ProcessParameterService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询生产工艺参数详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "processparameter:query")]
|
||
public IActionResult GetProcessParameter(long Id)
|
||
{
|
||
var response = _ProcessParameterService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<ProcessParameterDto>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加生产工艺参数
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "processparameter:add")]
|
||
[Log(Title = "生产工艺参数", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddProcessParameter([FromBody] ProcessParameterDto parm)
|
||
{
|
||
var modal = parm.Adapt<ProcessParameter>().ToCreate(HttpContext);
|
||
|
||
var response = _ProcessParameterService.AddProcessParameter(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新生产工艺参数
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "processparameter:edit")]
|
||
[Log(Title = "生产工艺参数", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateProcessParameter([FromBody] ProcessParameterDto parm)
|
||
{
|
||
var modal = parm.Adapt<ProcessParameter>().ToUpdate(HttpContext);
|
||
var response = _ProcessParameterService.UpdateProcessParameter(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除生产工艺参数
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("delete/{ids}")]
|
||
[ActionPermissionFilter(Permission = "processparameter:delete")]
|
||
[Log(Title = "生产工艺参数", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteProcessParameter([FromRoute]string ids)
|
||
{
|
||
var idArr = Tools.SplitAndConvert<long>(ids);
|
||
|
||
return ToResponse(_ProcessParameterService.Delete(idArr));
|
||
}
|
||
|
||
/// 导出过程参数
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("export")]
|
||
[Log(Title = "过程参数", BusinessType = BusinessType.EXPORT)]
|
||
public IActionResult Export([FromQuery] ProcessParameterQueryDto parm)
|
||
{
|
||
var list = _ProcessParameterService.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
|
||
);
|
||
}
|
||
}
|
||
} |