zhuangpei-mesbackend/MDM/Controllers/Plant/PlantWorkstationController.cs

149 lines
4.8 KiB
C#
Raw Normal View History

2025-11-15 14:33:00 +08:00
using DOAN.Admin.WebApi.Filters;
2026-01-04 14:24:43 +08:00
using DOAN.Common;
2025-11-15 14:33:00 +08:00
using DOAN.ServiceCore.Middleware;
using Infrastructure;
using Infrastructure.Attribute;
2026-01-04 14:24:43 +08:00
using Infrastructure.Controllers;
using Infrastructure.Enums;
2025-11-15 14:33:00 +08:00
using Infrastructure.Model;
2026-01-04 14:24:43 +08:00
using Mapster;
2025-11-16 15:16:51 +08:00
using MDM.Model.Plant;
using MDM.Model.Plant.Dto;
2026-01-04 14:24:43 +08:00
using MDM.Services.IPlantService;
using MDM.Services.Plant;
using Microsoft.AspNetCore.Mvc;
2025-11-15 14:33:00 +08:00
//创建时间2025-11-15
2025-11-16 15:16:51 +08:00
namespace MDM.Controllers.Plant
2025-11-15 14:33:00 +08:00
{
/// <summary>
/// 工站/资源组
/// </summary>
[Verify]
2025-11-16 15:16:51 +08:00
[Route("MasterDataManagement/Plant/PlantWorkstation")]
2025-11-15 14:33:00 +08:00
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);
}
2026-01-04 14:24:43 +08:00
//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")]
2026-01-04 15:33:27 +08:00
public IActionResult GetWorkShop(string site_code,string workshop_code)
2026-01-04 14:24:43 +08:00
{
2026-01-04 15:33:27 +08:00
var response = _PlantWorkstationService.GetWorkShop(site_code,workshop_code);
2026-01-04 14:24:43 +08:00
return SUCCESS(response);
}
//获取产线
[HttpGet("get_productlinebody")]
2026-01-04 15:33:27 +08:00
public IActionResult GetProductlinebody(string site_code, string workshop_code,string linecode)
2026-01-04 14:24:43 +08:00
{
2026-01-04 15:33:27 +08:00
var response = _PlantWorkstationService.GetPlantProductlinebodies(site_code, workshop_code,linecode);
2026-01-04 14:24:43 +08:00
return SUCCESS(response);
}
2025-11-15 14:33:00 +08:00
}
}