123 lines
3.9 KiB
C#
123 lines
3.9 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using DOAN.Model.MES.base_.Dto;
|
||
using DOAN.Model.MES.base_;
|
||
using DOAN.Service.MES.base_.IService;
|
||
using DOAN.Admin.WebApi.Filters;
|
||
//创建时间:2024-07-15
|
||
namespace DOAN.Admin.WebApi.Controllers
|
||
{
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
[Verify]
|
||
[Route("mes/baseManagement/BaseMaterialBOM")]
|
||
public class BaseMaterialBomController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 接口
|
||
/// </summary>
|
||
private readonly IBaseMaterialBomService _BaseMaterialBomService;
|
||
|
||
public BaseMaterialBomController(IBaseMaterialBomService BaseMaterialBomService)
|
||
{
|
||
_BaseMaterialBomService = BaseMaterialBomService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basematerialbom:list")]
|
||
public IActionResult QueryBaseMaterialBom([FromQuery] BaseMaterialBomQueryDto parm)
|
||
{
|
||
var response = _BaseMaterialBomService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
//TODO 获取母件
|
||
[HttpPost("get_monter_inv")]
|
||
public IActionResult GetMonterInvList([FromBody] BaseMaterialBomQueryDto parm)
|
||
{
|
||
var response = _BaseMaterialBomService.GetMonterInvList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
//TODO 获取子件
|
||
[HttpPost("get_son_inv")]
|
||
public IActionResult GetSonInvList([FromBody] BaseMaterialBomQueryDto parm)
|
||
{
|
||
|
||
var response = _BaseMaterialBomService.GetSonInvList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basematerialbom:query")]
|
||
public IActionResult GetBaseMaterialBom(string Id)
|
||
{
|
||
var response = _BaseMaterialBomService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<BaseMaterialBom>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basematerialbom:add")]
|
||
[Log(Title = "", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddBaseMaterialBom([FromBody] BaseMaterialBomDto parm)
|
||
{
|
||
var modal = parm.Adapt<BaseMaterialBom>().ToCreate(HttpContext);
|
||
|
||
var response = _BaseMaterialBomService.AddBaseMaterialBom(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basematerialbom:edit")]
|
||
[Log(Title = "", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateBaseMaterialBom([FromBody] BaseMaterialBomDto parm)
|
||
{
|
||
var modal = parm.Adapt<BaseMaterialBom>().ToUpdate(HttpContext);
|
||
var response = _BaseMaterialBomService.UpdateBaseMaterialBom(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpDelete("{ids}")]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basematerialbom:delete")]
|
||
[Log(Title = "", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteBaseMaterialBom(string ids)
|
||
{
|
||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||
|
||
var response = _BaseMaterialBomService.Delete(idsArr);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
} |