本次提交主要包括以下内容: - 新增 GetMmMaterialCategoryOptions 接口,支持获取物料类别下拉框数据,允许匿名访问。 - 移除 MmMaterialCategoryController 相关冗余代码,接口合并至 MmMaterialController。 - MmMaterialCategoryDto 移除部分 Required 校验,新增 MmMaterialCategoryOptionsDto 用于下拉框数据传输。 - IMmMaterialService 接口调整,删除旧的列表方法,新增下拉框查询方法。 - MmMaterialService 实现下拉框数据查询逻辑,支持动态条件过滤并异常处理。 本次改动提升了接口的灵活性和代码可维护性,满足前端下拉框数据需求。
116 lines
3.6 KiB
C#
116 lines
3.6 KiB
C#
using DOAN.Admin.WebApi.Filters;
|
||
using DOAN.Model.BZFM;
|
||
using DOAN.Model.BZFM.Dto;
|
||
using DOAN.Service.BZFM;
|
||
using DOAN.Service.BZFM.IBZFMService;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
|
||
//创建时间:2025-12-25
|
||
namespace DOAN.Admin.WebApi.Controllers.BZFM
|
||
{
|
||
/// <summary>
|
||
/// 物料表
|
||
/// </summary>
|
||
[Verify]
|
||
[Route("mes/productionMaterial/MmMaterial")]
|
||
public class MmMaterialController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 物料表接口
|
||
/// </summary>
|
||
private readonly IMmMaterialService _MmMaterialService;
|
||
|
||
public MmMaterialController(IMmMaterialService MmMaterialService)
|
||
{
|
||
_MmMaterialService = MmMaterialService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询物料表列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "mmmaterial:list")]
|
||
public IActionResult QueryMmMaterial([FromQuery] MmMaterialQueryDto parm)
|
||
{
|
||
var response = _MmMaterialService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询物料表详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "mmmaterial:query")]
|
||
public IActionResult GetMmMaterial(int Id)
|
||
{
|
||
var response = _MmMaterialService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<MmMaterialDto>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加物料表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "mmmaterial:add")]
|
||
[Log(Title = "物料表", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddMmMaterial([FromBody] MmMaterialDto parm)
|
||
{
|
||
var modal = parm.Adapt<MmMaterial>().ToCreate(HttpContext);
|
||
|
||
var response = _MmMaterialService.AddMmMaterial(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新物料表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "mmmaterial:edit")]
|
||
[Log(Title = "物料表", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateMmMaterial([FromBody] MmMaterialDto parm)
|
||
{
|
||
var modal = parm.Adapt<MmMaterial>().ToUpdate(HttpContext);
|
||
var response = _MmMaterialService.UpdateMmMaterial(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除物料表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("delete/{ids}")]
|
||
[ActionPermissionFilter(Permission = "mmmaterial:delete")]
|
||
[Log(Title = "物料表", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteMmMaterial([FromRoute]string ids)
|
||
{
|
||
var idArr = Tools.SplitAndConvert<int>(ids);
|
||
|
||
return ToResponse(_MmMaterialService.Delete(idArr));
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取物料表类别下拉框
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("GetMmMaterialCategoryOptions")]
|
||
[AllowAnonymous]
|
||
public IActionResult GetMmMaterialCategoryOptions([FromBody] MmMaterialCategoryDto parm)
|
||
{
|
||
var response = _MmMaterialService.GetMmMaterialCategoryOptions(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
}
|
||
} |