Valeo_Line_MES_backend/MDM/Controllers/Plant/PlantProductlinebodyController.cs

150 lines
5.0 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;
//创建时间2025-11-15
namespace MDM.Controllers.Plant
{
/// <summary>
/// 产线/线体/工作中心
/// </summary>
[Verify]
[Route("MasterDataManagement/Plant/PlantProductlinebody")]
public class PlantProductlinebodyController : BaseController
{
/// <summary>
/// 产线/线体/工作中心接口
/// </summary>
private readonly IPlantProductlinebodyService _PlantProductlinebodyService;
public PlantProductlinebodyController(IPlantProductlinebodyService PlantProductlinebodyService)
{
_PlantProductlinebodyService = PlantProductlinebodyService;
}
/// <summary>
/// 查询产线/线体/工作中心列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "business:plantproductlinebody:list")]
public IActionResult QueryPlantProductlinebody([FromQuery] PlantProductlinebodyQueryDto parm)
{
var response = _PlantProductlinebodyService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询产线/线体/工作中心详情
/// </summary>
/// <param name="LineId"></param>
/// <returns></returns>
[HttpGet("{LineId}")]
[ActionPermissionFilter(Permission = "business:plantproductlinebody:query")]
public IActionResult GetPlantProductlinebody(int LineId)
{
var response = _PlantProductlinebodyService.GetInfo(LineId);
var info = response.Adapt<PlantProductlinebody>();
return SUCCESS(info);
}
/// <summary>
/// 添加产线/线体/工作中心
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "business:plantproductlinebody:add")]
[Log(Title = "产线/线体/工作中心", BusinessType = BusinessType.INSERT)]
public IActionResult AddPlantProductlinebody([FromBody] PlantProductlinebodyDto parm)
{
var modal = parm.Adapt<PlantProductlinebody>().ToCreate(HttpContext);
var response = _PlantProductlinebodyService.AddPlantProductlinebody(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新产线/线体/工作中心
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "business:plantproductlinebody:edit")]
[Log(Title = "产线/线体/工作中心", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdatePlantProductlinebody([FromBody] PlantProductlinebodyDto parm)
{
var modal = parm.Adapt<PlantProductlinebody>().ToUpdate(HttpContext);
var response = _PlantProductlinebodyService.UpdatePlantProductlinebody(modal);
return ToResponse(response);
}
/// <summary>
/// 删除产线/线体/工作中心
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "business:plantproductlinebody:delete")]
[Log(Title = "产线/线体/工作中心", BusinessType = BusinessType.DELETE)]
public IActionResult DeletePlantProductlinebody(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _PlantProductlinebodyService.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 = _PlantProductlinebodyService.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 = _PlantProductlinebodyService.GetWorkShop(site_code,workshop_code);
return SUCCESS(response);
}
//TODO 获取产线的所有工站
[HttpGet("get_workstation_list")]
public IActionResult GetWorkstationList(int id)
{
var response = _PlantProductlinebodyService.GetWorkstationList(id);
return SUCCESS(response);
}
}
}