using Microsoft.AspNetCore.Mvc;
using RIZO.Model;
using RIZO.Model.Mes.Dto.Process;
using RIZO.Model.Mes.Process;
using RIZO.Service.Mes.IMesService.Process;
//创建时间:2025-11-04
namespace RIZO.Admin.WebApi.Controllers.Mes.Process
{
///
/// 工序表
///
[Route("mes/OperationInfo")]
[AllowAnonymous]
public class OperationInfoController : BaseController
{
///
/// 工序表接口
///
private readonly IOperationInfoService _OperationInfoService;
public OperationInfoController(IOperationInfoService OperationInfoService)
{
_OperationInfoService = OperationInfoService;
}
///
/// 查询工序表列表
///
///
///
[HttpGet("list")]
[ActionPermissionFilter(Permission = "operationinfo:list")]
public IActionResult QueryOperationInfo([FromQuery] OperationInfoQueryDto parm)
{
var response = _OperationInfoService.GetList(parm);
return SUCCESS(response);
}
///
/// 查询工序表详情
///
///
///
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "operationinfo:query")]
public IActionResult GetOperationInfo(long Id)
{
var response = _OperationInfoService.GetInfo(Id);
var info = response.Adapt();
return SUCCESS(info);
}
///
/// 添加工序表
///
///
[HttpPost]
[ActionPermissionFilter(Permission = "operationinfo:add")]
[Log(Title = "工序表", BusinessType = BusinessType.INSERT)]
public IActionResult AddOperationInfo([FromBody] OperationInfoDto parm)
{
var modal = parm.Adapt().ToCreate(HttpContext);
var response = _OperationInfoService.AddOperationInfo(modal);
return SUCCESS(response);
}
///
/// 更新工序表
///
///
[HttpPut]
[ActionPermissionFilter(Permission = "operationinfo:edit")]
[Log(Title = "工序表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateOperationInfo([FromBody] OperationInfoDto parm)
{
var modal = parm.Adapt().ToUpdate(HttpContext);
var response = _OperationInfoService.UpdateOperationInfo(modal);
return ToResponse(response);
}
///
/// 删除工序表
///
///
[HttpPost("delete/{ids}")]
[ActionPermissionFilter(Permission = "operationinfo:delete")]
[Log(Title = "工序表", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteOperationInfo([FromRoute]string ids)
{
var idArr = Tools.SplitAndConvert(ids);
return ToResponse(_OperationInfoService.Delete(idArr));
}
///
/// 通过工艺路线编码分页查询工序表详情
///
/// 工艺路线编码
[HttpPost("getOperationInfoByProcessCode")]
//[ActionPermissionFilter(Permission = "operationinfo:query")]
public IActionResult GetOperationInfoByProcessCode([FromBody] OperationInfoQueryDto parm)
{
// 校验参数
if (parm == null || !parm.processCode.Any())
{
return SUCCESS(new PagedInfo()); // 非法参数返回空分页
}
// 调用服务层分页查询(需同步修改服务层方法)
var pagedResult = _OperationInfoService.GetOperationInfoByProcessCode(parm);
return SUCCESS(pagedResult);
}
}
}