From 31ea66b1b74a09ec8baad501e19c2e318c581305 Mon Sep 17 00:00:00 2001 From: chenlin Date: Mon, 26 Jan 2026 15:47:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E5=A4=A7=E5=B1=8F=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MES/report/ReportController.cs | 12 +++++++++ DOAN.Model/MES/report/MonthProuctModel.cs | 15 +++++++++++ .../MES/report/IService/IReportService.cs | 2 ++ DOAN.Service/MES/report/ReportService.cs | 27 +++++++++++++++++++ 4 files changed, 56 insertions(+) diff --git a/DOAN.Admin.WebApi/Controllers/MES/report/ReportController.cs b/DOAN.Admin.WebApi/Controllers/MES/report/ReportController.cs index c9c639d..bfc7d69 100644 --- a/DOAN.Admin.WebApi/Controllers/MES/report/ReportController.cs +++ b/DOAN.Admin.WebApi/Controllers/MES/report/ReportController.cs @@ -96,5 +96,17 @@ namespace DOAN.WebApi.Controllers return File(fileBytes,contnetType,fileName); } + + + /// + /// 生产大屏报表 + /// + /// + [HttpGet("productionReport")] + public IActionResult ProductionReport() + { + var response = _ReportService.ProductionReport(DateTime.Now); + return SUCCESS(response); + } } } diff --git a/DOAN.Model/MES/report/MonthProuctModel.cs b/DOAN.Model/MES/report/MonthProuctModel.cs index 343dd18..6767ff4 100644 --- a/DOAN.Model/MES/report/MonthProuctModel.cs +++ b/DOAN.Model/MES/report/MonthProuctModel.cs @@ -120,4 +120,19 @@ namespace DOAN.Model.MES.report public int PlanNum { get; set; } public int CompletionNum { get; set; } } + + public class ProductionReportModel + { + public string WorkOrder { get; set; } + public string GroupName { get; set; } + public string LineName { get; set; } + public string ProductionName { get; set; } + public int PlanNum { get; set; } + public int CompletionNum { get; set; } + public double CompletionRate { get; set; } + public double QualifiedRate { get; set; } + public double UnqualifiedRate { get; set; } + public string StatusName { get; set; } + public int? Status { get; set; } + } } diff --git a/DOAN.Service/MES/report/IService/IReportService.cs b/DOAN.Service/MES/report/IService/IReportService.cs index 1eea3e9..ce31853 100644 --- a/DOAN.Service/MES/report/IService/IReportService.cs +++ b/DOAN.Service/MES/report/IService/IReportService.cs @@ -20,5 +20,7 @@ namespace DOAN.Service.MES.report.IService List ProductionCompletionRate(DateTime dateTime); List MonthlyProductionCompletionRate(DateTime dateTime); + + List ProductionReport(DateTime dateTime); } } diff --git a/DOAN.Service/MES/report/ReportService.cs b/DOAN.Service/MES/report/ReportService.cs index 65e35ef..d082c4f 100644 --- a/DOAN.Service/MES/report/ReportService.cs +++ b/DOAN.Service/MES/report/ReportService.cs @@ -310,5 +310,32 @@ namespace DOAN.Service.MES.report return (firstDay, lastDayDate); } + + public List ProductionReport(DateTime dateTime) + { + var dt = dateTime.ToString("yyyy-MM-dd"); + var woList = Context.Queryable() + .LeftJoin((a, b) => a.Workorder == b.FkWorkorder) + .LeftJoin((a, b, c) => a.LineCode == c.Code) + .LeftJoin((a, b, c, d) => a.GroupCode == d.GroupCode) + .Where((a, b, c, d) => a.WorkorderDate.Value.ToString("yyyy-MM-dd") == dt) + .Select((a, b, c, d) => new ProductionReportModel + { + WorkOrder = a.Workorder, + ProductionName = a.ProductionName, + PlanNum = a.DeliveryNum ?? 0, + CompletionNum = b.FinishedNum ?? 0, + CompletionRate = SqlFunc.Round((b.FinishedNum ?? 0) * 100.0 / (a.DeliveryNum ?? 0), 2), + QualifiedRate = b.FinishedNum.HasValue ? SqlFunc.Round((b.QualifiedNumber ?? 0) * 100.0 / (b.FinishedNum ?? 0), 2) : 0, + UnqualifiedRate = b.FinishedNum.HasValue ? SqlFunc.Round((b.UnqualifiedNumber ?? 0) * 100.0 / (b.FinishedNum ?? 0), 2) : 0, + Status = a.Status, + LineName = c.Name, + GroupName = d.GroupName + }).ToList(); + + woList.ForEach(t => t.StatusName = GetStatusName(t.Status ?? 0)); + + return woList; + } } }