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 { /// /// 产线/线体/工作中心 /// [Verify] [Route("MasterDataManagement/Plant/PlantProductlinebody")] public class PlantProductlinebodyController : BaseController { /// /// 产线/线体/工作中心接口 /// private readonly IPlantProductlinebodyService _PlantProductlinebodyService; public PlantProductlinebodyController(IPlantProductlinebodyService PlantProductlinebodyService) { _PlantProductlinebodyService = PlantProductlinebodyService; } /// /// 查询产线/线体/工作中心列表 /// /// /// [HttpGet("list")] [ActionPermissionFilter(Permission = "business:plantproductlinebody:list")] public IActionResult QueryPlantProductlinebody([FromQuery] PlantProductlinebodyQueryDto parm) { var response = _PlantProductlinebodyService.GetList(parm); return SUCCESS(response); } /// /// 查询产线/线体/工作中心详情 /// /// /// [HttpGet("{LineId}")] [ActionPermissionFilter(Permission = "business:plantproductlinebody:query")] public IActionResult GetPlantProductlinebody(int LineId) { var response = _PlantProductlinebodyService.GetInfo(LineId); var info = response.Adapt(); return SUCCESS(info); } /// /// 添加产线/线体/工作中心 /// /// [HttpPost] [ActionPermissionFilter(Permission = "business:plantproductlinebody:add")] [Log(Title = "产线/线体/工作中心", BusinessType = BusinessType.INSERT)] public IActionResult AddPlantProductlinebody([FromBody] PlantProductlinebodyDto parm) { var modal = parm.Adapt().ToCreate(HttpContext); var response = _PlantProductlinebodyService.AddPlantProductlinebody(modal); return SUCCESS(response); } /// /// 更新产线/线体/工作中心 /// /// [HttpPut] [ActionPermissionFilter(Permission = "business:plantproductlinebody:edit")] [Log(Title = "产线/线体/工作中心", BusinessType = BusinessType.UPDATE)] public IActionResult UpdatePlantProductlinebody([FromBody] PlantProductlinebodyDto parm) { var modal = parm.Adapt().ToUpdate(HttpContext); var response = _PlantProductlinebodyService.UpdatePlantProductlinebody(modal); return ToResponse(response); } /// /// 删除产线/线体/工作中心 /// /// [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 获取工厂 /// /// 获取工厂 /// /// 工厂code /// [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); } } }