117 lines
3.5 KiB
C#
117 lines
3.5 KiB
C#
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
|
|||
|
|
using DOAN.Admin.WebApi.Filters;
|
|||
|
|
using Infrastructure.Controllers;
|
|||
|
|
using DOAN.ServiceCore.Middleware;
|
|||
|
|
using Mapster;
|
|||
|
|
using Infrastructure.Enums;
|
|||
|
|
using Infrastructure;
|
|||
|
|
using Infrastructure.Attribute;
|
|||
|
|
using DOAN.Common;
|
|||
|
|
using Infrastructure.Model;
|
|||
|
|
using MES_Model.Services.IMaterialService;
|
|||
|
|
using MES_Model.Model.Material.Dto;
|
|||
|
|
using MES_Model.Model.Material;
|
|||
|
|
|
|||
|
|
//创建时间:2025-11-15
|
|||
|
|
namespace MES_Model.Controllers.Material
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// BOM清单
|
|||
|
|
/// </summary>
|
|||
|
|
[Verify]
|
|||
|
|
[Route("MESMODEL/Material/MaterialBom")]
|
|||
|
|
public class MaterialBomController : BaseController
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 接口
|
|||
|
|
/// </summary>
|
|||
|
|
private readonly IMaterialBomService _MaterialBomService;
|
|||
|
|
|
|||
|
|
public MaterialBomController(IMaterialBomService MaterialBomService)
|
|||
|
|
{
|
|||
|
|
_MaterialBomService = MaterialBomService;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询列表
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="parm"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet("list")]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:materialbom:list")]
|
|||
|
|
public IActionResult QueryMaterialBom([FromQuery] MaterialBomQueryDto parm)
|
|||
|
|
{
|
|||
|
|
var response = _MaterialBomService.GetList(parm);
|
|||
|
|
return SUCCESS(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询详情
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="Id"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet("{Id}")]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:materialbom:query")]
|
|||
|
|
public IActionResult GetMaterialBom(string Id)
|
|||
|
|
{
|
|||
|
|
var response = _MaterialBomService.GetInfo(Id);
|
|||
|
|
|
|||
|
|
var info = response.Adapt<MaterialBom>();
|
|||
|
|
return SUCCESS(info);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 添加
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:materialbom:add")]
|
|||
|
|
[Log(Title = "", BusinessType = BusinessType.INSERT)]
|
|||
|
|
public IActionResult AddMaterialBom([FromBody] MaterialBomDto parm)
|
|||
|
|
{
|
|||
|
|
var modal = parm.Adapt<MaterialBom>().ToCreate(HttpContext);
|
|||
|
|
|
|||
|
|
var response = _MaterialBomService.AddMaterialBom(modal);
|
|||
|
|
|
|||
|
|
return SUCCESS(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 更新
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPut]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:materialbom:edit")]
|
|||
|
|
[Log(Title = "", BusinessType = BusinessType.UPDATE)]
|
|||
|
|
public IActionResult UpdateMaterialBom([FromBody] MaterialBomDto parm)
|
|||
|
|
{
|
|||
|
|
var modal = parm.Adapt<MaterialBom>().ToUpdate(HttpContext);
|
|||
|
|
var response = _MaterialBomService.UpdateMaterialBom(modal);
|
|||
|
|
|
|||
|
|
return ToResponse(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpDelete("{ids}")]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:materialbom:delete")]
|
|||
|
|
[Log(Title = "", BusinessType = BusinessType.DELETE)]
|
|||
|
|
public IActionResult DeleteMaterialBom(string ids)
|
|||
|
|
{
|
|||
|
|
int[] idsArr = Tools.SpitIntArrary(ids);
|
|||
|
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
|||
|
|
|
|||
|
|
var response = _MaterialBomService.Delete(idsArr);
|
|||
|
|
|
|||
|
|
return ToResponse(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|