102 lines
3.3 KiB
C#
102 lines
3.3 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using DOAN.Model.PBL.Dto;
|
||
using DOAN.Model.PBL;
|
||
using DOAN.Service.PBL.IService;
|
||
using DOAN.Admin.WebApi.Filters;
|
||
|
||
//创建时间:2024-09-23
|
||
namespace DOAN.Admin.WebApi.Controllers.PBL
|
||
{
|
||
/// <summary>
|
||
/// 物料清单
|
||
/// </summary>
|
||
[Verify]
|
||
[Route("PBL/Billofmaterials")]
|
||
public class BillofmaterialsController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 物料清单接口
|
||
/// </summary>
|
||
private readonly IBillofmaterialsService _BillofmaterialsService;
|
||
|
||
public BillofmaterialsController(IBillofmaterialsService BillofmaterialsService)
|
||
{
|
||
_BillofmaterialsService = BillofmaterialsService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询物料清单列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "billofmaterials:list")]
|
||
public IActionResult QueryBillofmaterials([FromQuery] BillofmaterialsQueryDto parm)
|
||
{
|
||
var response = _BillofmaterialsService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询物料清单详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "billofmaterials:query")]
|
||
public IActionResult GetBillofmaterials(int Id)
|
||
{
|
||
var response = _BillofmaterialsService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<BillofmaterialsDto>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加物料清单
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "billofmaterials:add")]
|
||
[Log(Title = "物料清单", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddBillofmaterials([FromBody] BillofmaterialsDto parm)
|
||
{
|
||
var modal = parm.Adapt<Billofmaterials>().ToCreate(HttpContext);
|
||
|
||
var response = _BillofmaterialsService.AddBillofmaterials(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新物料清单
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "billofmaterials:edit")]
|
||
[Log(Title = "物料清单", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateBillofmaterials([FromBody] BillofmaterialsDto parm)
|
||
{
|
||
var modal = parm.Adapt<Billofmaterials>().ToUpdate(HttpContext);
|
||
var response = _BillofmaterialsService.UpdateBillofmaterials(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除物料清单
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("delete/{ids}")]
|
||
[ActionPermissionFilter(Permission = "billofmaterials:delete")]
|
||
[Log(Title = "物料清单", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteBillofmaterials([FromRoute]string ids)
|
||
{
|
||
var idArr = Tools.SplitAndConvert<int>(ids);
|
||
|
||
return ToResponse(_BillofmaterialsService.Delete(idArr));
|
||
}
|
||
|
||
}
|
||
} |