using Microsoft.AspNetCore.Mvc; using RIZO.Model.MES.recipe; using RIZO.Model.MES.recipe.Dto; using RIZO.Service.MES.recipe.IService; using Microsoft.AspNetCore.Authorization; using Infrastructure.Controllers; using Mapster; using Infrastructure; using Infrastructure.Attribute; using RIZO.ServiceCore.Middleware; using Infrastructure.Enums; //创建时间:2025-12-05 namespace RIZO.WebApi.Controllers.MES.recipe { /// /// 产品配方关联表 /// [Route("MasterDataManagement/Recipe/PfRefProductRecipe")] [AllowAnonymous] public class PfRefProductRecipeController : BaseController { /// /// 产品配方关联表接口 /// private readonly IPfRefProductRecipeService _PfRefProductRecipeService; public PfRefProductRecipeController(IPfRefProductRecipeService PfRefProductRecipeService) { _PfRefProductRecipeService = PfRefProductRecipeService; } /// /// 查询产品配方关联表列表 /// /// /// [HttpGet("list")] [ActionPermissionFilter(Permission = "pfrefproductrecipe:list")] public IActionResult QueryPfRefProductRecipe([FromQuery] PfRefProductRecipeQueryDto parm) { var response = _PfRefProductRecipeService.GetList(parm); return SUCCESS(response); } /// /// 查询产品配方关联表详情 /// /// /// [HttpGet("{Id}")] [ActionPermissionFilter(Permission = "pfrefproductrecipe:query")] public IActionResult GetPfRefProductRecipe(int Id) { var response = _PfRefProductRecipeService.GetInfo(Id); var info = response.Adapt(); return SUCCESS(info); } /// /// 添加产品配方关联表 /// /// [HttpPost] [ActionPermissionFilter(Permission = "pfrefproductrecipe:add")] [Log(Title = "产品配方关联表", BusinessType = BusinessType.INSERT)] public IActionResult AddPfRefProductRecipe([FromBody] PfRefProductRecipeDto parm) { var modal = parm.Adapt().ToCreate(HttpContext); var response = _PfRefProductRecipeService.AddPfRefProductRecipe(modal); return SUCCESS(response); } /// /// 更新产品配方关联表 /// /// [HttpPut] [ActionPermissionFilter(Permission = "pfrefproductrecipe:edit")] [Log(Title = "产品配方关联表", BusinessType = BusinessType.UPDATE)] public IActionResult UpdatePfRefProductRecipe([FromBody] PfRefProductRecipeDto parm) { var modal = parm.Adapt().ToUpdate(HttpContext); var response = _PfRefProductRecipeService.UpdatePfRefProductRecipe(modal); return ToResponse(response); } /// /// 删除产品配方关联表 /// /// [HttpPost("delete/{ids}")] [ActionPermissionFilter(Permission = "pfrefproductrecipe:delete")] [Log(Title = "产品配方关联表", BusinessType = BusinessType.DELETE)] public IActionResult DeletePfRefProductRecipe([FromRoute]string ids) { var idArr = int.Parse(ids); return ToResponse(_PfRefProductRecipeService.Delete(idArr)); } [HttpGet("getRecipeCodePullDown")] public IActionResult GetRecipeCodePullDown() { var response = _PfRefProductRecipeService.GetRecipeCodePullDown(); return SUCCESS(response); } } }