121 lines
3.8 KiB
C#
121 lines
3.8 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using DOAN.Model.Dto;
|
||
using DOAN.Model.MES.base_.Dto;
|
||
using DOAN.Model.MES.base_;
|
||
using DOAN.Service.MES.base_.IService;
|
||
using DOAN.Admin.WebApi.Filters;
|
||
|
||
//创建时间:2024-07-08
|
||
namespace DOAN.Admin.WebApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 设备信息
|
||
/// </summary>
|
||
[Verify]
|
||
[Route("mes/baseManagement/BaseDevice")]
|
||
public class BaseDeviceController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 设备信息接口
|
||
/// </summary>
|
||
private readonly IBaseDeviceService _BaseDeviceService;
|
||
|
||
public BaseDeviceController(IBaseDeviceService BaseDeviceService)
|
||
{
|
||
_BaseDeviceService = BaseDeviceService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询设备信息列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basedevice:list")]
|
||
public IActionResult QueryBaseDevice([FromQuery] BaseDeviceQueryDto parm)
|
||
{
|
||
var response = _BaseDeviceService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
/// <summary>
|
||
/// 查询设备信息列表 未绑定工位的设备和已经绑定的
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list_no_bind")]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basedevice:list")]
|
||
public IActionResult QueryBaseDevice_nobind(int id )
|
||
{
|
||
var response = _BaseDeviceService.GetList_nobind(id);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询设备信息详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basedevice:query")]
|
||
public IActionResult GetBaseDevice(int Id)
|
||
{
|
||
var response = _BaseDeviceService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<BaseDevice>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加设备信息
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basedevice:add")]
|
||
[Log(Title = "设备信息", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddBaseDevice([FromBody] BaseDeviceDto parm)
|
||
{
|
||
var modal = parm.Adapt<BaseDevice>().ToCreate(HttpContext);
|
||
|
||
var response = _BaseDeviceService.AddBaseDevice(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新设备信息
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basedevice:edit")]
|
||
[Log(Title = "设备信息", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateBaseDevice([FromBody] BaseDeviceDto parm)
|
||
{
|
||
var modal = parm.Adapt<BaseDevice>().ToUpdate(HttpContext);
|
||
var response = _BaseDeviceService.UpdateBaseDevice(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除设备信息
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpDelete("{ids}")]
|
||
[ActionPermissionFilter(Permission = "baseManagement:basedevice:delete")]
|
||
[Log(Title = "设备信息", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteBaseDevice(string ids)
|
||
{
|
||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||
|
||
var response = _BaseDeviceService.Delete(idsArr);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
} |