118 lines
3.8 KiB
C#
118 lines
3.8 KiB
C#
|
|
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 Microsoft.AspNetCore.Authorization;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
using RIZO.Admin.WebApi.Filters;
|
|||
|
|
using RIZO.Common;
|
|||
|
|
using RIZO.ServiceCore.Middleware;
|
|||
|
|
|
|||
|
|
//创建时间:2025-11-15
|
|||
|
|
namespace MDM.Controllers.Plant
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 工厂/站点
|
|||
|
|
/// </summary>
|
|||
|
|
[Verify]
|
|||
|
|
[Route("MasterDataManagement/Plant/PlantFactorySite")]
|
|||
|
|
[AllowAnonymous]
|
|||
|
|
public class PlantFactorySiteController : BaseController
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 工厂/站点接口
|
|||
|
|
/// </summary>
|
|||
|
|
private readonly IPlantFactorySiteService _PlantFactorySiteService;
|
|||
|
|
|
|||
|
|
public PlantFactorySiteController(IPlantFactorySiteService PlantFactorySiteService)
|
|||
|
|
{
|
|||
|
|
_PlantFactorySiteService = PlantFactorySiteService;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询工厂/站点列表
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="parm"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet("list")]
|
|||
|
|
//[ActionPermissionFilter(Permission = "business:plantfactorysite:list")]
|
|||
|
|
public IActionResult QueryPlantFactorySite([FromQuery] PlantFactorySiteQueryDto parm)
|
|||
|
|
{
|
|||
|
|
var response = _PlantFactorySiteService.GetList(parm);
|
|||
|
|
return SUCCESS(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询工厂/站点详情
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="SiteId"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet("{SiteId}")]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:plantfactorysite:query")]
|
|||
|
|
public IActionResult GetPlantFactorySite(int SiteId)
|
|||
|
|
{
|
|||
|
|
var response = _PlantFactorySiteService.GetInfo(SiteId);
|
|||
|
|
|
|||
|
|
var info = response.Adapt<PlantFactorySite>();
|
|||
|
|
return SUCCESS(info);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 添加工厂/站点
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:plantfactorysite:add")]
|
|||
|
|
[Log(Title = "工厂/站点", BusinessType = BusinessType.INSERT)]
|
|||
|
|
public IActionResult AddPlantFactorySite([FromBody] PlantFactorySiteDto parm)
|
|||
|
|
{
|
|||
|
|
var modal = parm.Adapt<PlantFactorySite>().ToCreate(HttpContext);
|
|||
|
|
|
|||
|
|
var response = _PlantFactorySiteService.AddPlantFactorySite(modal);
|
|||
|
|
|
|||
|
|
return SUCCESS(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 更新工厂/站点
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPut]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:plantfactorysite:edit")]
|
|||
|
|
[Log(Title = "工厂/站点", BusinessType = BusinessType.UPDATE)]
|
|||
|
|
public IActionResult UpdatePlantFactorySite([FromBody] PlantFactorySiteDto parm)
|
|||
|
|
{
|
|||
|
|
var modal = parm.Adapt<PlantFactorySite>().ToUpdate(HttpContext);
|
|||
|
|
var response = _PlantFactorySiteService.UpdatePlantFactorySite(modal);
|
|||
|
|
|
|||
|
|
return ToResponse(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除工厂/站点
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpDelete("{ids}")]
|
|||
|
|
[ActionPermissionFilter(Permission = "business:plantfactorysite:delete")]
|
|||
|
|
[Log(Title = "工厂/站点", BusinessType = BusinessType.DELETE)]
|
|||
|
|
public IActionResult DeletePlantFactorySite(string ids)
|
|||
|
|
{
|
|||
|
|
int[] idsArr = Tools.SpitIntArrary(ids);
|
|||
|
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
|||
|
|
|
|||
|
|
var response = _PlantFactorySiteService.Delete(idsArr);
|
|||
|
|
|
|||
|
|
return ToResponse(response);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|