2025-11-11 09:50:52 +08:00

123 lines
4.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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