Valeo_Line_MES_backend/MDM/Controllers/Plant/PlantWorkstationController.cs
2026-01-31 10:00:18 +08:00

156 lines
5.1 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;
using Microsoft.AspNetCore.Authorization;
//创建时间2025-11-15
namespace MDM.Controllers.Plant
{
/// <summary>
/// 工站/资源组
/// </summary>
[AllowAnonymous]
[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")]
public IActionResult GetFactorySite(string? site_code)
{
var response = _PlantWorkstationService.GetFactorySite(site_code);
return SUCCESS(response);
}
//获取车间
[HttpGet("get_workshop")]
public IActionResult GetWorkShop(string? site_code,string? workshop_code)
{
var response = _PlantWorkstationService.GetWorkShop(site_code,workshop_code);
return SUCCESS(response);
}
//获取产线
[HttpGet("get_productlinebody")]
public IActionResult GetProductlinebody(string? site_code, string? workshop_code,string? linecode)
{
var response = _PlantWorkstationService.GetPlantProductlinebodies(site_code, workshop_code,linecode);
return SUCCESS(response);
}
//获取工站下拉
[HttpGet("getWorkstationPulldown")]
public ApiResult GetWorkstationPulldown()
{
var response = _PlantWorkstationService.GetWorkstationPulldown();
return response;
}
}
}