Valeo_Line_MES_backend/MDM/Controllers/Plant/PlantProductlinebodyController.cs
gcw_MV9p2JJN 61b23ae4be 1
2026-01-10 17:53:41 +08:00

150 lines
5.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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")]
public IActionResult GetFactorySite(string? site_code)
{
var response = _PlantProductlinebodyService.GetFactorySite(site_code);
return SUCCESS(response);
}
//获取车间
[HttpGet("get_workshop")]
public IActionResult GetWorkShop(string? site_code, string? workshop_code)
{
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);
}
}
}