2025-11-15 14:33:00 +08:00
|
|
|
|
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;
|
2025-11-16 15:16:51 +08:00
|
|
|
|
using MDM.Services.IMaterialService;
|
|
|
|
|
|
using MDM.Model.Material.Dto;
|
|
|
|
|
|
using MDM.Model.Material;
|
2025-11-15 14:33:00 +08:00
|
|
|
|
|
|
|
|
|
|
//创建时间:2025-11-15
|
2025-11-16 15:16:51 +08:00
|
|
|
|
namespace MDM.Controllers.Material
|
2025-11-15 14:33:00 +08:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 物料清单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Verify]
|
2025-11-16 15:16:51 +08:00
|
|
|
|
[Route("MasterDataManagement/Material/MaterialList")]
|
2025-11-15 14:33:00 +08:00
|
|
|
|
public class MaterialListController : BaseController
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 物料清单接口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly IMaterialListService _MaterialListService;
|
|
|
|
|
|
|
|
|
|
|
|
public MaterialListController(IMaterialListService MaterialListService)
|
|
|
|
|
|
{
|
|
|
|
|
|
_MaterialListService = MaterialListService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询物料清单列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("list")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:materiallist:list")]
|
|
|
|
|
|
public IActionResult QueryMaterialList([FromQuery] MaterialListQueryDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _MaterialListService.GetList(parm);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询物料清单详情
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="Id"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("{Id}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:materiallist:query")]
|
|
|
|
|
|
public IActionResult GetMaterialList(string Id)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _MaterialListService.GetInfo(Id);
|
|
|
|
|
|
|
|
|
|
|
|
var info = response.Adapt<MaterialList>();
|
|
|
|
|
|
return SUCCESS(info);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 添加物料清单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:materiallist:add")]
|
|
|
|
|
|
[Log(Title = "物料清单", BusinessType = BusinessType.INSERT)]
|
|
|
|
|
|
public IActionResult AddMaterialList([FromBody] MaterialListDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var modal = parm.Adapt<MaterialList>().ToCreate(HttpContext);
|
|
|
|
|
|
|
|
|
|
|
|
var response = _MaterialListService.AddMaterialList(modal);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 更新物料清单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPut]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:materiallist:edit")]
|
|
|
|
|
|
[Log(Title = "物料清单", BusinessType = BusinessType.UPDATE)]
|
|
|
|
|
|
public IActionResult UpdateMaterialList([FromBody] MaterialListDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var modal = parm.Adapt<MaterialList>().ToUpdate(HttpContext);
|
|
|
|
|
|
var response = _MaterialListService.UpdateMaterialList(modal);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 删除物料清单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpDelete("{ids}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:materiallist:delete")]
|
|
|
|
|
|
[Log(Title = "物料清单", BusinessType = BusinessType.DELETE)]
|
|
|
|
|
|
public IActionResult DeleteMaterialList(string ids)
|
|
|
|
|
|
{
|
|
|
|
|
|
int[] idsArr = Tools.SpitIntArrary(ids);
|
|
|
|
|
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
|
|
|
|
|
|
|
|
|
|
|
var response = _MaterialListService.Delete(idsArr);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|