zhuangpei-mesbackend/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DevicePartsStorageLocationsController.cs
2024-12-30 15:25:40 +08:00

119 lines
4.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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/DevicePartsStorageLocations")]
public class DevicePartsStorageLocationsController : BaseController
{
/// <summary>
/// 备品备件库位接口
/// </summary>
private readonly IDevicePartsStorageLocationsService _DevicePartsStorageLocationsService;
public DevicePartsStorageLocationsController(IDevicePartsStorageLocationsService DevicePartsStorageLocationsService)
{
_DevicePartsStorageLocationsService = DevicePartsStorageLocationsService;
}
/// <summary>
/// 查询备品备件库位列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsstoragelocations:list")]
public IActionResult QueryDevicePartsStorageLocations([FromQuery] DevicePartsStorageLocationsQueryDto parm)
{
var response = _DevicePartsStorageLocationsService.GetList(parm);
return SUCCESS(response);
}
//TODO 查询备品备件库位编号
[HttpGet("list_location_code")]
public IActionResult QueryDevicePartsStorageLocationsLocationCode(string query)
{
var response = _DevicePartsStorageLocationsService.QueryDevicePartsStorageLocationsLocationCode(query);
return SUCCESS(response);
}
/// <summary>
/// 查询备品备件库位详情
/// </summary>
/// <param name="LocationId"></param>
/// <returns></returns>
[HttpGet("{LocationId}")]
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsstoragelocations:query")]
public IActionResult GetDevicePartsStorageLocations(int LocationId)
{
var response = _DevicePartsStorageLocationsService.GetInfo(LocationId);
var info = response.Adapt<DevicePartsStorageLocations>();
return SUCCESS(info);
}
/// <summary>
/// 添加备品备件库位
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsstoragelocations:add")]
[Log(Title = "备品备件库位", BusinessType = BusinessType.INSERT)]
public IActionResult AddDevicePartsStorageLocations([FromBody] DevicePartsStorageLocationsDto parm)
{
var modal = parm.Adapt<DevicePartsStorageLocations>().ToCreate(HttpContext);
var response = _DevicePartsStorageLocationsService.AddDevicePartsStorageLocations(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新备品备件库位
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsstoragelocations:edit")]
[Log(Title = "备品备件库位", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateDevicePartsStorageLocations([FromBody] DevicePartsStorageLocationsDto parm)
{
var modal = parm.Adapt<DevicePartsStorageLocations>().ToUpdate(HttpContext);
var response = _DevicePartsStorageLocationsService.UpdateDevicePartsStorageLocations(modal);
return ToResponse(response);
}
/// <summary>
/// 删除备品备件库位
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsstoragelocations:delete")]
[Log(Title = "备品备件库位", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteDevicePartsStorageLocations(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _DevicePartsStorageLocationsService.Delete(idsArr);
return ToResponse(response);
}
}
}