85 lines
2.8 KiB
C#
85 lines
2.8 KiB
C#
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;
|
|
}
|
|
/// <summary>
|
|
/// 月生产数据统计列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("listMonth")]
|
|
public IActionResult QueryMonthProduct([FromQuery] MonthProductDto parm)
|
|
{
|
|
var response = _ProPlanAchievementrateVersion2Service.GetQueryMonthProduct(parm);
|
|
return SUCCESS(response);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设备开机率
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("devicePoweronRate")]
|
|
public IActionResult DevicePoweronRate()
|
|
{
|
|
var response = _ReportService.DevicePoweronRate(DateTime.Today);
|
|
return SUCCESS(response);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设备停机率
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("deviceDowntimeRate")]
|
|
public IActionResult DeviceDowntimeRate()
|
|
{
|
|
var response = _ReportService.DeviceDowntimeRate(DateTime.Today);
|
|
return SUCCESS(response);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 日生产完成率
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[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);
|
|
|
|
}
|
|
}
|
|
}
|