zhuangpei-mesbackend/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DevicePartsSuppliersController.cs

119 lines
4.1 KiB
C#
Raw Normal View History

2024-12-30 10:13:11 +08:00
using Microsoft.AspNetCore.Mvc;
using DOAN.Model.Dto;
using DOAN.Admin.WebApi.Filters;
using DOAN.Model.MES.dev;
using DOAN.Model.MES.dev.Dto;
using DOAN.Service.MES.dev.IService;
//创建时间2024-12-30
namespace DOAN.Admin.WebApi.Controllers
{
/// <summary>
/// 备品备件供应商
/// </summary>
[Verify]
[Route("mes/deviceManagement/Parts/DevicePartsSuppliers")]
public class DevicePartsSuppliersController : BaseController
{
/// <summary>
/// 备品备件供应商接口
/// </summary>
private readonly IDevicePartsSuppliersService _DevicePartsSuppliersService;
public DevicePartsSuppliersController(IDevicePartsSuppliersService DevicePartsSuppliersService)
{
_DevicePartsSuppliersService = DevicePartsSuppliersService;
}
/// <summary>
/// 查询备品备件供应商列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
2024-12-30 11:31:40 +08:00
[ActionPermissionFilter(Permission = "deviceManagement:devicepartssuppliers:list")]
2024-12-30 10:13:11 +08:00
public IActionResult QueryDevicePartsSuppliers([FromQuery] DevicePartsSuppliersQueryDto parm)
{
var response = _DevicePartsSuppliersService.GetList(parm);
return SUCCESS(response);
}
2024-12-30 16:20:01 +08:00
//TODO 查询供应商
[HttpGet("list_supplier_No_Page")]
public IActionResult GetListSupplier(string query)
{
var response = _DevicePartsSuppliersService.GetListSupplier(query);
return SUCCESS(response);
}
2024-12-30 10:13:11 +08:00
/// <summary>
/// 查询备品备件供应商详情
/// </summary>
/// <param name="SupplierId"></param>
/// <returns></returns>
[HttpGet("{SupplierId}")]
2024-12-30 11:31:40 +08:00
[ActionPermissionFilter(Permission = "deviceManagement:devicepartssuppliers:query")]
2024-12-30 10:13:11 +08:00
public IActionResult GetDevicePartsSuppliers(int SupplierId)
{
var response = _DevicePartsSuppliersService.GetInfo(SupplierId);
var info = response.Adapt<DevicePartsSuppliers>();
return SUCCESS(info);
}
/// <summary>
/// 添加备品备件供应商
/// </summary>
/// <returns></returns>
[HttpPost]
2024-12-30 11:31:40 +08:00
[ActionPermissionFilter(Permission = "deviceManagement:devicepartssuppliers:add")]
2024-12-30 10:13:11 +08:00
[Log(Title = "备品备件供应商", BusinessType = BusinessType.INSERT)]
public IActionResult AddDevicePartsSuppliers([FromBody] DevicePartsSuppliersDto parm)
{
var modal = parm.Adapt<DevicePartsSuppliers>().ToCreate(HttpContext);
var response = _DevicePartsSuppliersService.AddDevicePartsSuppliers(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新备品备件供应商
/// </summary>
/// <returns></returns>
[HttpPut]
2024-12-30 11:31:40 +08:00
[ActionPermissionFilter(Permission = "deviceManagement:devicepartssuppliers:edit")]
2024-12-30 10:13:11 +08:00
[Log(Title = "备品备件供应商", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateDevicePartsSuppliers([FromBody] DevicePartsSuppliersDto parm)
{
var modal = parm.Adapt<DevicePartsSuppliers>().ToUpdate(HttpContext);
var response = _DevicePartsSuppliersService.UpdateDevicePartsSuppliers(modal);
return ToResponse(response);
}
/// <summary>
/// 删除备品备件供应商
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
2024-12-30 11:31:40 +08:00
[ActionPermissionFilter(Permission = "deviceManagement:devicepartssuppliers:delete")]
2024-12-30 10:13:11 +08:00
[Log(Title = "备品备件供应商", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteDevicePartsSuppliers(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _DevicePartsSuppliersService.Delete(idsArr);
return ToResponse(response);
}
}
}