119 lines
4.1 KiB
C#
119 lines
4.1 KiB
C#
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")]
|
||
[ActionPermissionFilter(Permission = "deviceManagement:devicepartssuppliers:list")]
|
||
public IActionResult QueryDevicePartsSuppliers([FromQuery] DevicePartsSuppliersQueryDto parm)
|
||
{
|
||
var response = _DevicePartsSuppliersService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
//TODO 查询供应商
|
||
[HttpGet("list_supplier_No_Page")]
|
||
public IActionResult GetListSupplier(string query)
|
||
{
|
||
var response = _DevicePartsSuppliersService.GetListSupplier(query);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询备品备件供应商详情
|
||
/// </summary>
|
||
/// <param name="SupplierId"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{SupplierId}")]
|
||
[ActionPermissionFilter(Permission = "deviceManagement:devicepartssuppliers:query")]
|
||
public IActionResult GetDevicePartsSuppliers(int SupplierId)
|
||
{
|
||
var response = _DevicePartsSuppliersService.GetInfo(SupplierId);
|
||
|
||
var info = response.Adapt<DevicePartsSuppliers>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加备品备件供应商
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "deviceManagement:devicepartssuppliers:add")]
|
||
[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]
|
||
[ActionPermissionFilter(Permission = "deviceManagement:devicepartssuppliers:edit")]
|
||
[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}")]
|
||
[ActionPermissionFilter(Permission = "deviceManagement:devicepartssuppliers:delete")]
|
||
[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);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
} |