85 lines
2.8 KiB
C#
Raw Normal View History

2026-01-20 15:54:58 +08:00
using DOAN.Admin.WebApi.Filters;
2026-01-26 09:55:25 +08:00
using DOAN.Model;
2026-01-20 15:54:58 +08:00
using DOAN.Model.MES;
using DOAN.Model.MES.product.Dto;
2026-01-26 09:55:25 +08:00
using DOAN.Service.MES.product;
2026-01-20 15:54:58 +08:00
using DOAN.Service.MES.product.IService;
2026-01-21 11:16:34 +08:00
using DOAN.Service.MES.report.IService;
2026-01-20 15:54:58 +08:00
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
2026-01-26 09:55:25 +08:00
using NPOI.HPSF;
2026-01-20 15:54:58 +08:00
namespace DOAN.WebApi.Controllers
{
2026-01-22 14:30:44 +08:00
//[Verify]
2026-01-20 15:54:58 +08:00
[Route("mes/reportManagement/report")]
[ApiExplorerSettings(GroupName = "MES")]
public class ReportController : BaseController
{
private readonly IProPlanAchievementrateVersion2Service _ProPlanAchievementrateVersion2Service;
2026-01-21 11:16:34 +08:00
private readonly IReportService _ReportService;
2026-01-20 15:54:58 +08:00
2026-01-21 11:16:34 +08:00
public ReportController(IProPlanAchievementrateVersion2Service ProPlanAchievementrateService, IReportService ReportService)
2026-01-20 15:54:58 +08:00
{
_ProPlanAchievementrateVersion2Service = ProPlanAchievementrateService;
2026-01-26 09:55:25 +08:00
_ReportService = ReportService;
2026-01-20 15:54:58 +08:00
}
/// <summary>
/// 月生产数据统计列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("listMonth")]
2026-01-26 09:55:25 +08:00
public IActionResult QueryMonthProduct([FromQuery] MonthProductDto parm)
2026-01-20 15:54:58 +08:00
{
2026-01-26 09:55:25 +08:00
var response = _ProPlanAchievementrateVersion2Service.GetQueryMonthProduct(parm);
2026-01-20 15:54:58 +08:00
return SUCCESS(response);
}
2026-01-21 11:16:34 +08:00
2026-01-22 14:30:44 +08:00
/// <summary>
/// 设备开机率
/// </summary>
/// <returns></returns>
2026-01-21 11:16:34 +08:00
[HttpGet("devicePoweronRate")]
public IActionResult DevicePoweronRate()
{
var response = _ReportService.DevicePoweronRate(DateTime.Today);
return SUCCESS(response);
}
2026-01-22 14:30:44 +08:00
/// <summary>
/// 设备停机率
/// </summary>
/// <returns></returns>
[HttpGet("deviceDowntimeRate")]
public IActionResult DeviceDowntimeRate()
{
var response = _ReportService.DeviceDowntimeRate(DateTime.Today);
return SUCCESS(response);
}
2026-01-23 13:31:28 +08:00
/// <summary>
2026-01-24 09:19:42 +08:00
/// 日生产完成率
2026-01-23 13:31:28 +08:00
/// </summary>
/// <returns></returns>
[HttpGet("productionCompletionRate")]
public IActionResult ProductionCompletionRate()
{
var response = _ReportService.ProductionCompletionRate(DateTime.Today);
return SUCCESS(response);
}
2026-01-24 09:19:42 +08:00
2026-01-26 09:55:25 +08:00
[HttpGet("exportMonthProduct")]
[Log(Title = "工单导出", BusinessType = BusinessType.EXPORT)]
[AllowAnonymous]
public IActionResult ExportMonthProduct([FromQuery] MonthProductDto parm)
2026-01-24 09:19:42 +08:00
{
2026-01-26 09:55:25 +08:00
var (fileBytes, fileName) = _ProPlanAchievementrateVersion2Service.ExportMonthProduct(parm);
string contnetType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
return File(fileBytes,contnetType,fileName);
2026-01-24 09:19:42 +08:00
}
2026-01-20 15:54:58 +08:00
}
}