- 在IProReportworkService接口中添加导出方法定义 - 实现报工数据导出服务逻辑 - 添加导出API接口 - 为ProReportworkDto添加ExcelColumn属性用于导出映射 - 调整查询参数类型为可空类型以支持更灵活的查询
171 lines
5.5 KiB
C#
171 lines
5.5 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using DOAN.Model.BZFM.Dto;
|
||
using DOAN.Model.BZFM;
|
||
|
||
using DOAN.Admin.WebApi.Filters;
|
||
using DOAN.Model.MES.product;
|
||
using DOAN.Service.MES.product.IService;
|
||
using Infrastructure.Converter;
|
||
using DOAN.Common;
|
||
using Microsoft.AspNetCore.Authorization;
|
||
|
||
//创建时间:2024-12-03
|
||
namespace DOAN.Admin.WebApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 报工
|
||
/// </summary>
|
||
[Verify]
|
||
[Route("mes/productManagement/ProReportwork")]
|
||
public class ProReportworkController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 报工接口
|
||
/// </summary>
|
||
private readonly IProReportworkService _ProReportworkService;
|
||
|
||
public ProReportworkController(IProReportworkService ProReportworkService)
|
||
{
|
||
_ProReportworkService = ProReportworkService;
|
||
}
|
||
|
||
//TODO 查询工艺路线
|
||
[HttpGet("get_route")]
|
||
public IActionResult GetRoute()
|
||
{
|
||
var response = _ProReportworkService.GetRoute();
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
//TODO 根据工艺路线查询工序
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <param name="route_id">工艺路线id</param>
|
||
/// <returns></returns>
|
||
[HttpGet("get_process_by_route")]
|
||
public IActionResult GetProcessByRoute(int route_id)
|
||
{
|
||
var response = _ProReportworkService.GetProcessByRoute(route_id);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询报工列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpPost("list")]
|
||
[ActionPermissionFilter(Permission = "proreportwork:list")]
|
||
public IActionResult QueryProReportwork([FromBody] ProReportworkQueryDto parm)
|
||
{
|
||
parm.JobDateTime[0] = DOANConvertDate.ConvertLocalDate(parm.JobDateTime[0]);
|
||
parm.JobDateTime[1] = DOANConvertDate.ConvertLocalDate(parm.JobDateTime[1]);
|
||
var response = _ProReportworkService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询工序列表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("baseworkprocesseslist")]
|
||
[ActionPermissionFilter(Permission = "proreportwork:baseworkprocesseslist")]
|
||
public IActionResult QueryBaseWorkProcesses()
|
||
{
|
||
|
||
var response = _ProReportworkService.GetBaseWorkProcesses();
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询报工详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "proreportwork:query")]
|
||
public IActionResult GetProReportwork(string Id)
|
||
{
|
||
var response = _ProReportworkService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<ProReportworkDto>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加报工
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "proreportwork:add")]
|
||
[Log(Title = "报工", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddProReportwork([FromBody] ProReportworkDto parm)
|
||
{
|
||
var modal = parm.Adapt<ProReportwork01>().ToCreate(HttpContext);
|
||
|
||
var response = _ProReportworkService.AddProReportwork(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新报工
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "proreportwork:edit")]
|
||
[Log(Title = "报工", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateProReportwork([FromBody] ProReportworkDto parm)
|
||
{
|
||
var modal = parm.Adapt<ProReportwork01>().ToUpdate(HttpContext);
|
||
var response = _ProReportworkService.UpdateProReportwork(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除报工
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("delete/{ids}")]
|
||
[ActionPermissionFilter(Permission = "proreportwork:delete")]
|
||
[Log(Title = "报工", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteProReportwork([FromRoute] string ids)
|
||
{
|
||
var idArr = Tools.SplitAndConvert<string>(ids);
|
||
|
||
return ToResponse(_ProReportworkService.Delete(idArr));
|
||
}
|
||
|
||
/// <summary>
|
||
/// 导出报工数据
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpPost("export")]
|
||
[Log(Title = "报工导出", BusinessType = BusinessType.EXPORT)]
|
||
[AllowAnonymous]
|
||
public IActionResult WorkOrderExport([FromBody] ProReportworkQueryDto parm)
|
||
{
|
||
// 转换日期格式
|
||
if (parm.JobDateTime != null && parm.JobDateTime.Length == 2)
|
||
{
|
||
parm.JobDateTime[0] = DOANConvertDate.ConvertLocalDate(parm.JobDateTime[0]);
|
||
parm.JobDateTime[1] = DOANConvertDate.ConvertLocalDate(parm.JobDateTime[1]);
|
||
}
|
||
|
||
// 忽略分页,执行全量数据查询
|
||
parm.PageNum = 1;
|
||
parm.PageSize = int.MaxValue;
|
||
|
||
var list = _ProReportworkService.GetExportList(parm);
|
||
|
||
var result = ExportExcelMini(list, "proreportwork", "报工数据");
|
||
return ExportExcel(result.Item2, result.Item1);
|
||
}
|
||
|
||
}
|
||
} |