117 lines
3.7 KiB
C#
117 lines
3.7 KiB
C#
|
|
using Infrastructure;
|
|||
|
|
using Infrastructure.Attribute;
|
|||
|
|
using Infrastructure.Controllers;
|
|||
|
|
using Infrastructure.Enums;
|
|||
|
|
using Infrastructure.Model;
|
|||
|
|
using Mapster;
|
|||
|
|
using MDM.Model.Plant;
|
|||
|
|
using MDM.Model.Plant.Dto;
|
|||
|
|
using MDM.Services.IPlantService;
|
|||
|
|
using Microsoft.AspNetCore.Authorization;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
using RIZO.Admin.WebApi.Filters;
|
|||
|
|
using RIZO.Common;
|
|||
|
|
using RIZO.ServiceCore.Middleware;
|
|||
|
|
|
|||
|
|
//创建时间:2025-11-15
|
|||
|
|
namespace MDM.Controllers.Plant
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// PLC点位
|
|||
|
|
/// </summary>
|
|||
|
|
[Verify]
|
|||
|
|
[Route("MasterDataManagement/Plant/PlantPlcIoPoint")]
|
|||
|
|
public class PlantPlcIoPointController : BaseController
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// PLC点位接口
|
|||
|
|
/// </summary>
|
|||
|
|
private readonly IPlantPlcIoPointService _PlantPlcIoPointService;
|
|||
|
|
|
|||
|
|
public PlantPlcIoPointController(IPlantPlcIoPointService PlantPlcIoPointService)
|
|||
|
|
{
|
|||
|
|
_PlantPlcIoPointService = PlantPlcIoPointService;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询PLC点位列表
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="parm"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet("list")]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:plantplciopoint:list")]
|
|||
|
|
public IActionResult QueryPlantPlcIoPoint([FromQuery] PlantPlcIoPointQueryDto parm)
|
|||
|
|
{
|
|||
|
|
var response = _PlantPlcIoPointService.GetList(parm);
|
|||
|
|
return SUCCESS(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询PLC点位详情
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="Id"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet("{Id}")]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:plantplciopoint:query")]
|
|||
|
|
public IActionResult GetPlantPlcIoPoint(int Id)
|
|||
|
|
{
|
|||
|
|
var response = _PlantPlcIoPointService.GetInfo(Id);
|
|||
|
|
|
|||
|
|
var info = response.Adapt<PlantPlcIoPoint>();
|
|||
|
|
return SUCCESS(info);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 添加PLC点位
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:plantplciopoint:add")]
|
|||
|
|
[Log(Title = "PLC点位", BusinessType = BusinessType.INSERT)]
|
|||
|
|
public IActionResult AddPlantPlcIoPoint([FromBody] PlantPlcIoPointDto parm)
|
|||
|
|
{
|
|||
|
|
var modal = parm.Adapt<PlantPlcIoPoint>().ToCreate(HttpContext);
|
|||
|
|
|
|||
|
|
var response = _PlantPlcIoPointService.AddPlantPlcIoPoint(modal);
|
|||
|
|
|
|||
|
|
return SUCCESS(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 更新PLC点位
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPut]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:plantplciopoint:edit")]
|
|||
|
|
[Log(Title = "PLC点位", BusinessType = BusinessType.UPDATE)]
|
|||
|
|
public IActionResult UpdatePlantPlcIoPoint([FromBody] PlantPlcIoPointDto parm)
|
|||
|
|
{
|
|||
|
|
var modal = parm.Adapt<PlantPlcIoPoint>().ToUpdate(HttpContext);
|
|||
|
|
var response = _PlantPlcIoPointService.UpdatePlantPlcIoPoint(modal);
|
|||
|
|
|
|||
|
|
return ToResponse(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除PLC点位
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpDelete("{ids}")]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:plantplciopoint:delete")]
|
|||
|
|
[Log(Title = "PLC点位", BusinessType = BusinessType.DELETE)]
|
|||
|
|
public IActionResult DeletePlantPlcIoPoint(string ids)
|
|||
|
|
{
|
|||
|
|
int[] idsArr = Tools.SpitIntArrary(ids);
|
|||
|
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
|||
|
|
|
|||
|
|
var response = _PlantPlcIoPointService.Delete(idsArr);
|
|||
|
|
|
|||
|
|
return ToResponse(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|