Valeo_Line_MES_backend/MDM/Controllers/Plant/PlantWorkstationController.cs

150 lines
4.9 KiB
C#
Raw Normal View History

2026-01-10 13:47:54 +08:00
using RIZO.Admin.WebApi.Filters;
using RIZO.Common;
using RIZO.ServiceCore.Middleware;
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 MDM.Services.Plant;
using Microsoft.AspNetCore.Mvc;
2026-01-17 10:42:02 +08:00
using Microsoft.AspNetCore.Authorization;
2026-01-10 13:47:54 +08:00
//创建时间2025-11-15
namespace MDM.Controllers.Plant
{
/// <summary>
/// 工站/资源组
/// </summary>
2026-01-17 10:42:02 +08:00
[AllowAnonymous]
2026-01-10 13:47:54 +08:00
[Route("MasterDataManagement/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);
}
//TODO 获取工厂
/// <summary>
/// 获取工厂
/// </summary>
/// <param name="site_code">工厂code</param>
/// <returns></returns>
[HttpGet("get_factory_site")]
2026-01-10 17:53:41 +08:00
public IActionResult GetFactorySite(string? site_code)
2026-01-10 13:47:54 +08:00
{
var response = _PlantWorkstationService.GetFactorySite(site_code);
return SUCCESS(response);
}
//获取车间
[HttpGet("get_workshop")]
2026-01-10 17:53:41 +08:00
public IActionResult GetWorkShop(string? site_code,string? workshop_code)
2026-01-10 13:47:54 +08:00
{
var response = _PlantWorkstationService.GetWorkShop(site_code,workshop_code);
return SUCCESS(response);
}
//获取产线
[HttpGet("get_productlinebody")]
2026-01-10 17:53:41 +08:00
public IActionResult GetProductlinebody(string? site_code, string? workshop_code,string? linecode)
2026-01-10 13:47:54 +08:00
{
var response = _PlantWorkstationService.GetPlantProductlinebodies(site_code, workshop_code,linecode);
return SUCCESS(response);
}
}
}