Valeo_Line_MES_backend/MDM/Controllers/Recipe/PfRecipeVersionController.cs

146 lines
4.9 KiB
C#
Raw Normal View History

2026-01-10 13:47:54 +08:00
using Microsoft.AspNetCore.Mvc;
using RIZO.Model.MES.recipe;
using RIZO.Model.MES.recipe.Dto;
using RIZO.Service.MES.recipe.IService;
using Infrastructure.Controllers;
using Microsoft.AspNetCore.Authorization;
using Mapster;
using Infrastructure;
using Infrastructure.Enums;
using Infrastructure.Attribute;
using RIZO.ServiceCore.Middleware;
using Infrastructure.Model;
//创建时间2025-12-05
namespace RIZO.WebApi.Controllers.MES.recipe
{
/// <summary>
/// 配方版本控制表
/// </summary>
2026-01-10 16:42:55 +08:00
[Route("MasterDataManagement/Recipe/PfRecipeVersion")]
2026-01-10 13:47:54 +08:00
[AllowAnonymous]
public class PfRecipeVersionController : BaseController
{
/// <summary>
/// 配方版本控制表接口
/// </summary>
private readonly IPfRecipeVersionService _PfRecipeVersionService;
public PfRecipeVersionController(IPfRecipeVersionService PfRecipeVersionService)
{
_PfRecipeVersionService = PfRecipeVersionService;
}
/// <summary>
/// 查询配方版本控制表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "pfrecipeversion:list")]
public IActionResult QueryPfRecipeVersion([FromQuery] PfRecipeVersionQueryDto parm)
{
var response = _PfRecipeVersionService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询配方版本控制表详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "pfrecipeversion:query")]
public IActionResult GetPfRecipeVersion(int Id)
{
var response = _PfRecipeVersionService.GetInfo(Id);
var info = response.Adapt<PfRecipeVersionDto>();
return SUCCESS(info);
}
/// <summary>
/// 添加配方版本控制表
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "pfrecipeversion:add")]
[Log(Title = "配方版本控制表", BusinessType = BusinessType.INSERT)]
public IActionResult AddPfRecipeVersion([FromBody] PfRecipeVersionDto parm)
{
var modal = parm.Adapt<PfRecipeVersion>().ToCreate(HttpContext);
var response = _PfRecipeVersionService.AddPfRecipeVersion(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新配方版本控制表
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "pfrecipeversion:edit")]
[Log(Title = "配方版本控制表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdatePfRecipeVersion([FromBody] PfRecipeVersionDto parm)
{
var modal = parm.Adapt<PfRecipeVersion>().ToUpdate(HttpContext);
var response = _PfRecipeVersionService.UpdatePfRecipeVersion(modal);
return ToResponse(response);
}
/// <summary>
/// 删除配方版本控制表
/// </summary>
/// <returns></returns>
[HttpPost("delete/{ids}")]
[ActionPermissionFilter(Permission = "pfrecipeversion:delete")]
[Log(Title = "配方版本控制表", BusinessType = BusinessType.DELETE)]
public IActionResult DeletePfRecipeVersion([FromRoute]string ids)
{
var idArr = int.Parse(ids);
return ToResponse(_PfRecipeVersionService.Delete(idArr));
}
/// <summary>
/// 添加配方版本控制表和参数信息
/// </summary>
/// <returns></returns>
[HttpPost("createPfRecipeVersionAndParameters")]
[ActionPermissionFilter(Permission = "pfrecipeversion:add")]
[Log(Title = "配方版本控制表和参数新增", BusinessType = BusinessType.INSERT)]
public ApiResult CreatePfRecipeVersionAndParameters([FromBody] PfRecipeVersionDto parm)
{
var response = _PfRecipeVersionService.CreatePfRecipeVersionAndParameters(parm);
return response;
}
[HttpGet("latestVersion")]
[ActionPermissionFilter(Permission = "pfrecipeversion:list")]
public ApiResult QuerylatestVersion([FromQuery] PfRecipeVersionQueryDto parm)
{
var response = _PfRecipeVersionService.QuerylatestVersion(parm);
return response;
}
/// <summary>
/// 添加配方版本控制表和参数信息
/// </summary>
/// <returns></returns>
[HttpPost("delPfRecipeVersion")]
[Log(Title = "配方版本控制表删除", BusinessType = BusinessType.DELETE)]
public ApiResult DELPfRecipeVersion([FromBody] PfRecipeVersionDto parm)
{
var response = _PfRecipeVersionService.DELPfRecipeVersion(parm);
return response;
}
}
}