2025-11-25 15:43:58 +08:00
|
|
|
|
using Infrastructure;
|
|
|
|
|
|
using Infrastructure.Attribute;
|
2025-11-25 20:07:20 +08:00
|
|
|
|
using Infrastructure.Controllers;
|
|
|
|
|
|
using Infrastructure.Enums;
|
2025-11-25 15:43:58 +08:00
|
|
|
|
using Infrastructure.Model;
|
2025-11-25 20:07:20 +08:00
|
|
|
|
using Mapster;
|
2025-11-25 15:43:58 +08:00
|
|
|
|
using MDM.Model.Process;
|
2025-11-25 20:07:20 +08:00
|
|
|
|
using MDM.Model.Process.Dto;
|
|
|
|
|
|
using MDM.Services.IProcessService;
|
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using RIZO.Admin.WebApi.Filters;
|
|
|
|
|
|
using RIZO.Common;
|
|
|
|
|
|
using RIZO.ServiceCore.Middleware;
|
2025-11-25 15:43:58 +08:00
|
|
|
|
|
|
|
|
|
|
//创建时间:2025-11-15
|
|
|
|
|
|
namespace MDM.Controllers.Process
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 工艺参数表(如温度、压力、时间等,关联工艺路线与工序)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Route("MasterDataManagement/Process/ProcessParameter")]
|
2025-11-25 20:07:20 +08:00
|
|
|
|
[AllowAnonymous]
|
2025-11-25 15:43:58 +08:00
|
|
|
|
public class ProcessParameterController : BaseController
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 工艺参数表(如温度、压力、时间等,关联工艺路线与工序)接口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly IProcessParameterService _ProcessParameterService;
|
|
|
|
|
|
|
|
|
|
|
|
public ProcessParameterController(IProcessParameterService ProcessParameterService)
|
|
|
|
|
|
{
|
|
|
|
|
|
_ProcessParameterService = ProcessParameterService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询工艺参数表(如温度、压力、时间等,关联工艺路线与工序)列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("list")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:processparameter:list")]
|
|
|
|
|
|
public IActionResult QueryProcessParameter([FromQuery] ProcessParameterQueryDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _ProcessParameterService.GetList(parm);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询工艺参数表(如温度、压力、时间等,关联工艺路线与工序)详情
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="Id"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("{Id}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:processparameter:query")]
|
|
|
|
|
|
public IActionResult GetProcessParameter(int Id)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _ProcessParameterService.GetInfo(Id);
|
|
|
|
|
|
|
|
|
|
|
|
var info = response.Adapt<ProcessParameter>();
|
|
|
|
|
|
return SUCCESS(info);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 添加工艺参数表(如温度、压力、时间等,关联工艺路线与工序)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:processparameter:add")]
|
|
|
|
|
|
[Log(Title = "工艺参数表(如温度、压力、时间等,关联工艺路线与工序)", BusinessType = BusinessType.INSERT)]
|
|
|
|
|
|
public IActionResult AddProcessParameter([FromBody] ProcessParameterDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var modal = parm.Adapt<ProcessParameter>().ToCreate(HttpContext);
|
|
|
|
|
|
|
|
|
|
|
|
var response = _ProcessParameterService.AddProcessParameter(modal);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 更新工艺参数表(如温度、压力、时间等,关联工艺路线与工序)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPut]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:processparameter:edit")]
|
|
|
|
|
|
[Log(Title = "工艺参数表(如温度、压力、时间等,关联工艺路线与工序)", BusinessType = BusinessType.UPDATE)]
|
|
|
|
|
|
public IActionResult UpdateProcessParameter([FromBody] ProcessParameterDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var modal = parm.Adapt<ProcessParameter>().ToUpdate(HttpContext);
|
|
|
|
|
|
var response = _ProcessParameterService.UpdateProcessParameter(modal);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 删除工艺参数表(如温度、压力、时间等,关联工艺路线与工序)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpDelete("{ids}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:processparameter:delete")]
|
|
|
|
|
|
[Log(Title = "工艺参数表(如温度、压力、时间等,关联工艺路线与工序)", BusinessType = BusinessType.DELETE)]
|
|
|
|
|
|
public IActionResult DeleteProcessParameter(string ids)
|
|
|
|
|
|
{
|
|
|
|
|
|
int[] idsArr = Tools.SpitIntArrary(ids);
|
|
|
|
|
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
|
|
|
|
|
|
|
|
|
|
|
var response = _ProcessParameterService.Delete(idsArr);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-25 19:11:46 +08:00
|
|
|
|
/// 导出过程参数
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("export")]
|
|
|
|
|
|
[Log(Title = "过程参数", BusinessType = BusinessType.EXPORT)]
|
|
|
|
|
|
public IActionResult Export([FromQuery] ProcessParameterQueryDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var list = _ProcessParameterService.GetListExport(parm).Result;
|
|
|
|
|
|
if (list == null || list.Count <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
return ToResponse(ResultCode.FAIL, "没有要导出的数据");
|
|
|
|
|
|
}
|
|
|
|
|
|
var (sFileName, sFilePath) = ExportExcelMini(list, "过程参数", "过程参数");
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(sFilePath))
|
|
|
|
|
|
{
|
|
|
|
|
|
return ToResponse(ResultCode.FAIL, "Excel生成失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
return PhysicalFile(
|
|
|
|
|
|
sFilePath,
|
|
|
|
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
|
|
|
|
sFileName,
|
|
|
|
|
|
true
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2025-11-25 15:43:58 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|