2025-02-27 19:58:43 +08:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using DOAN.Service.MES.dev.IService;
|
|
|
|
|
|
using DOAN.Model.MES.dev.Dto;
|
|
|
|
|
|
using DOAN.Admin.WebApi.Filters;
|
|
|
|
|
|
using DOAN.Model.MES.dev.Dto;
|
|
|
|
|
|
using DOAN.Model.MES.dev;
|
|
|
|
|
|
using Infrastructure.Converter;
|
|
|
|
|
|
|
|
|
|
|
|
//创建时间:2024-05-27
|
|
|
|
|
|
namespace DOAN.Admin.WebApi.Controllers
|
|
|
|
|
|
{
|
2025-03-18 16:19:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设备运行绩效分析
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Verify]
|
|
|
|
|
|
[Route("mes/deviceManagement/DevicePerformance")]
|
|
|
|
|
|
public class DevicePerformanceController : BaseController
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设备运行绩效分析接口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly IDevicePerformanceService _DevicePerformanceService;
|
|
|
|
|
|
|
|
|
|
|
|
public DevicePerformanceController(IDevicePerformanceService DevicePerformanceService)
|
|
|
|
|
|
{
|
|
|
|
|
|
_DevicePerformanceService = DevicePerformanceService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询设备运行绩效分析列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost("list")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:deviceperformance:list")]
|
|
|
|
|
|
public IActionResult QueryDevicePerformance([FromBody] DevicePerformanceQueryDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
2025-03-18 11:31:07 +08:00
|
|
|
|
var response = _DevicePerformanceService.GetList(parm);
|
2025-03-18 16:19:31 +08:00
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询设备运行绩效分析详情
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="Id"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("{Id}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:deviceperformance:query")]
|
|
|
|
|
|
public IActionResult GetDevicePerformance(string Id)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _DevicePerformanceService.GetInfo(Id);
|
|
|
|
|
|
|
|
|
|
|
|
var info = response.Adapt<DevicePerformance>();
|
|
|
|
|
|
return SUCCESS(info);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 添加设备运行绩效分析
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:deviceperformance:add")]
|
|
|
|
|
|
[Log(Title = "设备运行绩效分析", BusinessType = BusinessType.INSERT)]
|
|
|
|
|
|
public IActionResult AddDevicePerformance([FromBody] DevicePerformanceDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var modal = parm.Adapt<DevicePerformance>().ToCreate(HttpContext);
|
|
|
|
|
|
|
|
|
|
|
|
var response = _DevicePerformanceService.AddDevicePerformance(modal);
|
|
|
|
|
|
string data = "";
|
|
|
|
|
|
if (response == -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
data = "填写日期不能重复";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2025-03-18 11:31:07 +08:00
|
|
|
|
data = "成功";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-18 16:19:31 +08:00
|
|
|
|
return SUCCESS(data);
|
|
|
|
|
|
}
|
2025-02-27 19:58:43 +08:00
|
|
|
|
|
2025-03-18 16:19:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 更新设备运行绩效分析
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPut]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:deviceperformance:edit")]
|
|
|
|
|
|
[Log(Title = "设备运行绩效分析", BusinessType = BusinessType.UPDATE)]
|
|
|
|
|
|
public IActionResult UpdateDevicePerformance([FromBody] DevicePerformanceDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var modal = parm.Adapt<DevicePerformance>().ToUpdate(HttpContext);
|
|
|
|
|
|
var response = _DevicePerformanceService.UpdateDevicePerformance(modal);
|
2025-02-27 19:58:43 +08:00
|
|
|
|
|
2025-03-18 16:19:31 +08:00
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
2025-02-27 19:58:43 +08:00
|
|
|
|
|
2025-03-18 16:19:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 删除设备运行绩效分析
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpDelete("{ids}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:deviceperformance:delete")]
|
|
|
|
|
|
[Log(Title = "设备运行绩效分析", BusinessType = BusinessType.DELETE)]
|
|
|
|
|
|
public IActionResult DeleteDevicePerformance(string ids)
|
|
|
|
|
|
{
|
|
|
|
|
|
string[] idsArr = Tools.SpitStrArrary(ids);
|
|
|
|
|
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
2025-02-27 19:58:43 +08:00
|
|
|
|
|
2025-03-18 16:19:31 +08:00
|
|
|
|
var response = _DevicePerformanceService.Delete(idsArr);
|
2025-02-27 19:58:43 +08:00
|
|
|
|
|
2025-03-18 16:19:31 +08:00
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
2025-02-27 19:58:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-18 16:19:31 +08:00
|
|
|
|
}
|
2025-02-27 19:58:43 +08:00
|
|
|
|
}
|