110 lines
3.5 KiB
C#
110 lines
3.5 KiB
C#
|
|
using DOAN.Admin.WebApi.Filters;
|
|||
|
|
using DOAN.Model.MES.dev.Dto;
|
|||
|
|
using DOAN.Model.MES.dev;
|
|||
|
|
using DOAN.Service.MES.dev;
|
|||
|
|
using DOAN.Service.MES.dev.IService;
|
|||
|
|
using Microsoft.AspNetCore.Http;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
using SqlSugar;
|
|||
|
|
|
|||
|
|
namespace DOAN.WebApi.Controllers.MES.dev
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备保全率
|
|||
|
|
/// </summary>
|
|||
|
|
[Verify]
|
|||
|
|
[Route("business/DeviceUptime")]
|
|||
|
|
public class DeviceUptimeController : BaseController
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备保全率接口
|
|||
|
|
/// </summary>
|
|||
|
|
private readonly IDeviceUptimeService _DeviceUptimeService;
|
|||
|
|
|
|||
|
|
public DeviceUptimeController(IDeviceUptimeService DeviceUptimeService)
|
|||
|
|
{
|
|||
|
|
_DeviceUptimeService = DeviceUptimeService;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询设备保全率列表
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="parm"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet("list")]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:deviceuptime:list")]
|
|||
|
|
public IActionResult QueryDeviceUptime([FromQuery] DeviceUptimeQueryDto parm)
|
|||
|
|
{
|
|||
|
|
var response = _DeviceUptimeService.GetList(parm);
|
|||
|
|
return SUCCESS(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询设备保全率详情
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="Id"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet("{Id}")]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:deviceuptime:query")]
|
|||
|
|
public IActionResult GetDeviceUptime(string Id)
|
|||
|
|
{
|
|||
|
|
var response = _DeviceUptimeService.GetInfo(Id);
|
|||
|
|
|
|||
|
|
var info = response.Adapt<DeviceUptime>();
|
|||
|
|
return SUCCESS(info);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 添加设备保全率
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:deviceuptime:add")]
|
|||
|
|
[Log(Title = "设备保全率", BusinessType = BusinessType.INSERT)]
|
|||
|
|
public IActionResult AddDeviceUptime([FromBody] DeviceUptimeDto parm)
|
|||
|
|
{
|
|||
|
|
var modal = parm.Adapt<DeviceUptime>().ToCreate(HttpContext);
|
|||
|
|
modal.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
|||
|
|
var response = _DeviceUptimeService.AddDeviceUptime(modal);
|
|||
|
|
return SUCCESS(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 更新设备保全率
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPut]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:deviceuptime:edit")]
|
|||
|
|
[Log(Title = "设备保全率", BusinessType = BusinessType.UPDATE)]
|
|||
|
|
public IActionResult UpdateDeviceUptime([FromBody] DeviceUptimeDto parm)
|
|||
|
|
{
|
|||
|
|
var modal = parm.Adapt<DeviceUptime>().ToUpdate(HttpContext);
|
|||
|
|
var response = _DeviceUptimeService.UpdateDeviceUptime(modal);
|
|||
|
|
|
|||
|
|
return ToResponse(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除设备保全率
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpDelete("{ids}")]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:deviceuptime:delete")]
|
|||
|
|
[Log(Title = "设备保全率", BusinessType = BusinessType.DELETE)]
|
|||
|
|
public IActionResult DeleteDeviceUptime(string ids)
|
|||
|
|
{
|
|||
|
|
int[] idsArr = Tools.SpitIntArrary(ids);
|
|||
|
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
|||
|
|
|
|||
|
|
var response = _DeviceUptimeService.Delete(idsArr);
|
|||
|
|
|
|||
|
|
return ToResponse(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|