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/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")]
|
2024-12-30 11:31:40 +08:00
|
|
|
|
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsstoragelocations:list")]
|
2024-12-30 10:13:11 +08:00
|
|
|
|
public IActionResult QueryDevicePartsStorageLocations([FromQuery] DevicePartsStorageLocationsQueryDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _DevicePartsStorageLocationsService.GetList(parm);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
2024-12-30 15:25:40 +08:00
|
|
|
|
|
|
|
|
|
|
//TODO 查询备品备件库位编号
|
|
|
|
|
|
[HttpGet("list_location_code")]
|
|
|
|
|
|
public IActionResult QueryDevicePartsStorageLocationsLocationCode(string query)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _DevicePartsStorageLocationsService.QueryDevicePartsStorageLocationsLocationCode(query);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
2024-12-30 10:13:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询备品备件库位详情
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="LocationId"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("{LocationId}")]
|
2024-12-30 11:31:40 +08:00
|
|
|
|
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsstoragelocations:query")]
|
2024-12-30 10:13:11 +08:00
|
|
|
|
public IActionResult GetDevicePartsStorageLocations(int LocationId)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _DevicePartsStorageLocationsService.GetInfo(LocationId);
|
|
|
|
|
|
|
|
|
|
|
|
var info = response.Adapt<DevicePartsStorageLocations>();
|
|
|
|
|
|
return SUCCESS(info);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 添加备品备件库位
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
2024-12-30 11:31:40 +08:00
|
|
|
|
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsstoragelocations:add")]
|
2024-12-30 10:13:11 +08:00
|
|
|
|
[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]
|
2024-12-30 11:31:40 +08:00
|
|
|
|
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsstoragelocations:edit")]
|
2024-12-30 10:13:11 +08:00
|
|
|
|
[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}")]
|
2024-12-30 11:31:40 +08:00
|
|
|
|
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsstoragelocations:delete")]
|
2024-12-30 10:13:11 +08:00
|
|
|
|
[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);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|