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")]
|
2026-01-27 09:04:49 +08:00
|
|
|
|
public IActionResult DevicePoweronRate([FromQuery] DeviceReportDto param)
|
2026-01-21 11:16:34 +08:00
|
|
|
|
{
|
2026-01-26 15:11:57 +08:00
|
|
|
|
var response = _ReportService.DevicePoweronRate(param);
|
2026-01-21 11:16:34 +08:00
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
2026-01-22 14:30:44 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设备停机率
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("deviceDowntimeRate")]
|
2026-01-27 09:04:49 +08:00
|
|
|
|
public IActionResult DeviceDowntimeRate([FromQuery] DeviceReportDto param)
|
2026-01-22 14:30:44 +08:00
|
|
|
|
{
|
2026-01-26 15:11:57 +08:00
|
|
|
|
var response = _ReportService.DeviceDowntimeRate(param);
|
2026-01-22 14:30:44 +08:00
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
2026-01-23 13:31:28 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2026-01-26 17:11:29 +08:00
|
|
|
|
/// 实时产出
|
2026-01-23 13:31:28 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("productionCompletionRate")]
|
2026-01-27 09:04:49 +08:00
|
|
|
|
public IActionResult ProductionCompletionRate([FromQuery] string groupName)
|
2026-01-23 13:31:28 +08:00
|
|
|
|
{
|
2026-02-04 14:34:29 +08:00
|
|
|
|
DateTime dt = new DateTime(2026, 1, 27);
|
2026-02-05 09:59:12 +08:00
|
|
|
|
dt = DateTime.Today;
|
2026-02-04 14:34:29 +08:00
|
|
|
|
var response = _ReportService.ProductionCompletionRate(groupName, dt); //DateTime.Today
|
2026-01-23 13:31:28 +08:00
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
2026-01-24 09:19:42 +08:00
|
|
|
|
|
2026-01-26 10:36:59 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 月生产完成率
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("monthlyProductionCompletionRate")]
|
|
|
|
|
|
public IActionResult MonthlyProductionCompletionRate()
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _ReportService.MonthlyProductionCompletionRate(DateTime.Today);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 月生产数据导出
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns></returns>
|
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-26 15:47:41 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 生产大屏报表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("productionReport")]
|
|
|
|
|
|
public IActionResult ProductionReport()
|
|
|
|
|
|
{
|
2026-02-04 14:34:29 +08:00
|
|
|
|
DateTime dt = new DateTime(2026, 1, 27);
|
|
|
|
|
|
//dt = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
var response = _ReportService.ProductionReport(dt);
|
2026-01-26 15:47:41 +08:00
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
2026-01-26 18:41:05 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2026-02-05 09:59:12 +08:00
|
|
|
|
/// 生产大屏达成率,取消不需要
|
2026-01-26 18:41:05 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("productionReportRate")]
|
|
|
|
|
|
public IActionResult ProductionReportRate()
|
|
|
|
|
|
{
|
2026-02-04 14:34:29 +08:00
|
|
|
|
DateTime dt = new DateTime(2026, 1, 27);
|
|
|
|
|
|
//dt = DateTime.Now;
|
2026-02-05 09:59:12 +08:00
|
|
|
|
var response = _ReportService.ProductionReportRate2(dt);
|
2026-01-26 18:41:05 +08:00
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
2026-02-05 09:59:12 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 生产大屏周达成率,合格率,异常率
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("productionReportWeekRate")]
|
|
|
|
|
|
public IActionResult ProductionReportWeekRate()
|
|
|
|
|
|
{
|
|
|
|
|
|
DateTime dt = new DateTime(2026, 1, 27);
|
|
|
|
|
|
//dt = DateTime.Now;
|
|
|
|
|
|
var response = _ReportService.ProductionReportRate(dt,1);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 生产大屏月达成率,合格率,异常率
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("productionReportMonthRate")]
|
|
|
|
|
|
public IActionResult ProductionReportMonthRate()
|
|
|
|
|
|
{
|
|
|
|
|
|
DateTime dt = new DateTime(2026, 1, 27);
|
|
|
|
|
|
//dt = DateTime.Now;
|
|
|
|
|
|
var response = _ReportService.ProductionReportRate(dt, 2);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-20 15:54:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|