using DOAN.Admin.WebApi.Filters; using DOAN.Model; using DOAN.Model.MES; using DOAN.Model.MES.product.Dto; using DOAN.Service.MES.product; using DOAN.Service.MES.product.IService; using DOAN.Service.MES.report.IService; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using NPOI.HPSF; namespace DOAN.WebApi.Controllers { //[Verify] [Route("mes/reportManagement/report")] [ApiExplorerSettings(GroupName = "MES")] public class ReportController : BaseController { private readonly IProPlanAchievementrateVersion2Service _ProPlanAchievementrateVersion2Service; private readonly IReportService _ReportService; public ReportController(IProPlanAchievementrateVersion2Service ProPlanAchievementrateService, IReportService ReportService) { _ProPlanAchievementrateVersion2Service = ProPlanAchievementrateService; _ReportService = ReportService; } /// /// 月生产数据统计列表 /// /// /// [HttpGet("listMonth")] public IActionResult QueryMonthProduct([FromQuery] MonthProductDto parm) { var response = _ProPlanAchievementrateVersion2Service.GetQueryMonthProduct(parm); return SUCCESS(response); } /// /// 设备开机率 /// /// [HttpGet("devicePoweronRate")] public IActionResult DevicePoweronRate() { var response = _ReportService.DevicePoweronRate(DateTime.Today); return SUCCESS(response); } /// /// 设备停机率 /// /// [HttpGet("deviceDowntimeRate")] public IActionResult DeviceDowntimeRate() { var response = _ReportService.DeviceDowntimeRate(DateTime.Today); return SUCCESS(response); } /// /// 日生产完成率 /// /// [HttpGet("productionCompletionRate")] public IActionResult ProductionCompletionRate() { var response = _ReportService.ProductionCompletionRate(DateTime.Today); return SUCCESS(response); } [HttpGet("exportMonthProduct")] [Log(Title = "工单导出", BusinessType = BusinessType.EXPORT)] [AllowAnonymous] public IActionResult ExportMonthProduct([FromQuery] MonthProductDto parm) { var (fileBytes, fileName) = _ProPlanAchievementrateVersion2Service.ExportMonthProduct(parm); string contnetType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; return File(fileBytes,contnetType,fileName); } } }