2025-09-23 15:11:18 +08:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
|
|
using ZR.Service.MES.dev.IService;
|
|
|
|
|
|
using ZR.Model.MES.dev.Dto;
|
|
|
|
|
|
|
|
|
|
|
|
using ZR.Model.MES.dev;
|
|
|
|
|
|
using Org.BouncyCastle.Crypto;
|
|
|
|
|
|
using Aliyun.OSS;
|
|
|
|
|
|
using ZR.Admin.WebApi.Filters;
|
|
|
|
|
|
using ZR.Admin.WebApi.Controllers;
|
|
|
|
|
|
using ZR.Admin.WebApi.Extensions;
|
|
|
|
|
|
|
|
|
|
|
|
//创建时间:2024-05-21
|
|
|
|
|
|
namespace ZR.Admin.WebApi.Controllers
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设备检查项
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Route("mes/deviceManagement/DeviceInspect")]
|
2025-12-12 10:08:26 +08:00
|
|
|
|
[AllowAnonymous]
|
2025-09-23 15:11:18 +08:00
|
|
|
|
public class DeviceInspectController : BaseController
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设备检查项接口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly IDeviceInspectService _DeviceInspectService;
|
|
|
|
|
|
|
|
|
|
|
|
public DeviceInspectController(IDeviceInspectService DeviceInspectService)
|
|
|
|
|
|
{
|
|
|
|
|
|
_DeviceInspectService = DeviceInspectService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询设备检查项列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("list")]
|
|
|
|
|
|
|
|
|
|
|
|
public IActionResult QueryDeviceInspect([FromQuery] DeviceInspectQueryDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _DeviceInspectService.GetList(parm);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设备绑定模块 查询未绑定且状态为1 的设备检查项 Isbind=1 获取已经绑定 Isbind=0 获取未绑定
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"> </param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("list2")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:list")]
|
|
|
|
|
|
public IActionResult QueryDeviceInspect2([FromQuery] DeviceInspectQueryDto2 parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _DeviceInspectService.GetList2(parm);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询设备检查项详情
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="Id"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("{Id}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:query")]
|
|
|
|
|
|
public IActionResult GetDeviceInspect(int Id)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _DeviceInspectService.GetInfo(Id);
|
|
|
|
|
|
|
|
|
|
|
|
var info = response.Adapt<DeviceInspect>();
|
|
|
|
|
|
return SUCCESS(info);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 添加设备检查项
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:add")]
|
|
|
|
|
|
[Log(Title = "设备检查项", BusinessType = BusinessType.INSERT)]
|
|
|
|
|
|
public IActionResult AddDeviceInspect([FromBody] DeviceInspectDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var modal = parm.Adapt<DeviceInspect>().ToCreate(HttpContext);
|
|
|
|
|
|
|
|
|
|
|
|
var response = _DeviceInspectService.AddDeviceInspect(modal);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 更新设备检查项
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPut]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:edit")]
|
|
|
|
|
|
[Log(Title = "设备检查项", BusinessType = BusinessType.UPDATE)]
|
|
|
|
|
|
public IActionResult UpdateDeviceInspect([FromBody] DeviceInspectDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var modal = parm.Adapt<DeviceInspect>().ToUpdate(HttpContext);
|
|
|
|
|
|
var response = _DeviceInspectService.UpdateDeviceInspect(modal);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 删除设备检查项
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpDelete("{ids}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:delete")]
|
|
|
|
|
|
[Log(Title = "设备检查项", BusinessType = BusinessType.DELETE)]
|
|
|
|
|
|
public IActionResult DeleteDeviceInspect(string ids)
|
|
|
|
|
|
{
|
|
|
|
|
|
int[] idsArr = Tools.SpitIntArrary(ids);
|
|
|
|
|
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
|
|
|
|
|
|
|
|
|
|
|
var response = _DeviceInspectService.Delete(idsArr);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 增加设备和设备检查项绑定关系
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost("addbind")]
|
|
|
|
|
|
public IActionResult AddBindrelative([FromBody] DeviceInspectQueryDto3 parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (parm == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SUCCESS(null);
|
|
|
|
|
|
}
|
|
|
|
|
|
var response = _DeviceInspectService.AddBindrelative(parm,HttpContext.GetName());
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 删除设备和设备检查项绑定关系
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="account_id"></param>
|
|
|
|
|
|
/// <param name="inspect_id"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("removebind")]
|
|
|
|
|
|
public IActionResult RemoveBindrelative(int account_id, int inspect_id)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (inspect_id <= 0 || account_id <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SUCCESS(null);
|
|
|
|
|
|
}
|
|
|
|
|
|
var response = _DeviceInspectService.RemoveBindrelative(account_id, inspect_id);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排关系
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost("sort")]
|
|
|
|
|
|
public IActionResult SortBindrelative([FromBody] List<DeviceRelAccountInspect> parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (parm == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SUCCESS(null);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var modal = parm.ToUpdate(HttpContext);
|
|
|
|
|
|
var response = _DeviceInspectService.SortBindrelative(parm);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|