zhuangpei-mesbackend/MES_Model/Controllers/Plant/PlantWorkstationController.cs

114 lines
3.7 KiB
C#
Raw Normal View History

2025-11-15 14:33:00 +08:00
using Microsoft.AspNetCore.Mvc;
using DOAN.Admin.WebApi.Filters;
using Infrastructure.Controllers;
using DOAN.ServiceCore.Middleware;
using Mapster;
using Infrastructure.Enums;
using Infrastructure;
using Infrastructure.Attribute;
using DOAN.Common;
using Infrastructure.Model;
using MES_Model.Services.IPlantService;
//创建时间2025-11-15
namespace MES_Model.Controllers.Plant
{
/// <summary>
/// 工站/资源组
/// </summary>
[Verify]
[Route("MESMODEL/Plant/PlantWorkstation")]
public class PlantWorkstationController : BaseController
{
/// <summary>
/// 工站/资源组接口
/// </summary>
private readonly IPlantWorkstationService _PlantWorkstationService;
public PlantWorkstationController(IPlantWorkstationService PlantWorkstationService)
{
_PlantWorkstationService = PlantWorkstationService;
}
/// <summary>
/// 查询工站/资源组列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "business:plantworkstation:list")]
public IActionResult QueryPlantWorkstation([FromQuery] PlantWorkstationQueryDto parm)
{
var response = _PlantWorkstationService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询工站/资源组详情
/// </summary>
/// <param name="WorkstationId"></param>
/// <returns></returns>
[HttpGet("{WorkstationId}")]
[ActionPermissionFilter(Permission = "business:plantworkstation:query")]
public IActionResult GetPlantWorkstation(int WorkstationId)
{
var response = _PlantWorkstationService.GetInfo(WorkstationId);
var info = response.Adapt<PlantWorkstation>();
return SUCCESS(info);
}
/// <summary>
/// 添加工站/资源组
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "business:plantworkstation:add")]
[Log(Title = "工站/资源组", BusinessType = BusinessType.INSERT)]
public IActionResult AddPlantWorkstation([FromBody] PlantWorkstationDto parm)
{
var modal = parm.Adapt<PlantWorkstation>().ToCreate(HttpContext);
var response = _PlantWorkstationService.AddPlantWorkstation(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新工站/资源组
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "business:plantworkstation:edit")]
[Log(Title = "工站/资源组", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdatePlantWorkstation([FromBody] PlantWorkstationDto parm)
{
var modal = parm.Adapt<PlantWorkstation>().ToUpdate(HttpContext);
var response = _PlantWorkstationService.UpdatePlantWorkstation(modal);
return ToResponse(response);
}
/// <summary>
/// 删除工站/资源组
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "business:plantworkstation:delete")]
[Log(Title = "工站/资源组", BusinessType = BusinessType.DELETE)]
public IActionResult DeletePlantWorkstation(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _PlantWorkstationService.Delete(idsArr);
return ToResponse(response);
}
}
}