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 { /// /// 备品备件供应商 /// [Verify] [Route("mes/deviceManagement/Parts/DevicePartsSuppliers")] public class DevicePartsSuppliersController : BaseController { /// /// 备品备件供应商接口 /// private readonly IDevicePartsSuppliersService _DevicePartsSuppliersService; public DevicePartsSuppliersController(IDevicePartsSuppliersService DevicePartsSuppliersService) { _DevicePartsSuppliersService = DevicePartsSuppliersService; } /// /// 查询备品备件供应商列表 /// /// /// [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); } /// /// 查询备品备件供应商详情 /// /// /// [HttpGet("{SupplierId}")] [ActionPermissionFilter(Permission = "deviceManagement:devicepartssuppliers:query")] public IActionResult GetDevicePartsSuppliers(int SupplierId) { var response = _DevicePartsSuppliersService.GetInfo(SupplierId); var info = response.Adapt(); return SUCCESS(info); } /// /// 添加备品备件供应商 /// /// [HttpPost] [ActionPermissionFilter(Permission = "deviceManagement:devicepartssuppliers:add")] [Log(Title = "备品备件供应商", BusinessType = BusinessType.INSERT)] public IActionResult AddDevicePartsSuppliers([FromBody] DevicePartsSuppliersDto parm) { var modal = parm.Adapt().ToCreate(HttpContext); var response = _DevicePartsSuppliersService.AddDevicePartsSuppliers(modal); return SUCCESS(response); } /// /// 更新备品备件供应商 /// /// [HttpPut] [ActionPermissionFilter(Permission = "deviceManagement:devicepartssuppliers:edit")] [Log(Title = "备品备件供应商", BusinessType = BusinessType.UPDATE)] public IActionResult UpdateDevicePartsSuppliers([FromBody] DevicePartsSuppliersDto parm) { var modal = parm.Adapt().ToUpdate(HttpContext); var response = _DevicePartsSuppliersService.UpdateDevicePartsSuppliers(modal); return ToResponse(response); } /// /// 删除备品备件供应商 /// /// [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); } } }