diff --git a/DOAN.Admin.WebApi/Controllers/MES/BigScreen/product/ProductController.cs b/DOAN.Admin.WebApi/Controllers/MES/BigScreen/product/ProductController.cs index 4a9365a..02840fc 100644 --- a/DOAN.Admin.WebApi/Controllers/MES/BigScreen/product/ProductController.cs +++ b/DOAN.Admin.WebApi/Controllers/MES/BigScreen/product/ProductController.cs @@ -56,5 +56,65 @@ namespace DOAN.WebApi.Controllers.MES.BigScreen return SUCCESS(response); } + + /// + /// 今日超时工单占比 + /// + /// + [HttpGet("get_moudle04")] + public IActionResult GetMoudle04() + { + EchartsOptions response= productBigScreenService.GetMoudle04(); + + return SUCCESS(response); + } + + /// + /// 前七日工单异常分布占比 + /// + /// + [HttpGet("get_moudle05")] + public IActionResult GetMoudle05() + { + EchartsOptions response= productBigScreenService.GetMoudle05(); + + return SUCCESS(response); + } + + /// + /// 获取今日工单列表 + /// + /// + [HttpGet("get_moudle06")] + public IActionResult GetMoudle06() + { + var response= productBigScreenService.GetMoudle06(); + + return SUCCESS(response); + } + + /// + /// 获取今日异常工单列表 + /// + /// + [HttpGet("get_moudle07")] + public IActionResult GetMoudle07() + { + var response= productBigScreenService.GetMoudle07(); + + return SUCCESS(response); + } + + /// + /// 获取昨天工单报工数 + /// + /// + [HttpGet("get_moudle08")] + public IActionResult GetMoudle08() + { + var response= productBigScreenService.GetMoudle07(); + + return SUCCESS(response); + } } } \ No newline at end of file diff --git a/DOAN.Admin.WebApi/DataProtection/key-f4eecf5f-e6e6-4130-b2e6-2e4f58296a18.xml b/DOAN.Admin.WebApi/DataProtection/key-f4eecf5f-e6e6-4130-b2e6-2e4f58296a18.xml new file mode 100644 index 0000000..8cbc21b --- /dev/null +++ b/DOAN.Admin.WebApi/DataProtection/key-f4eecf5f-e6e6-4130-b2e6-2e4f58296a18.xml @@ -0,0 +1,16 @@ + + + 2024-11-11T03:13:49.8611403Z + 2024-11-11T03:13:49.7226248Z + 2025-02-09T03:13:49.7226248Z + + + + + + + +2NuWJkK/DyWDdPyBElzUEupSNfcd6V3wy4TQhfIEx0PmgjFnZVnUaLa4ODHiTTPFu3nnjWA5UQQ5yVTNq9X9A== + + + + \ No newline at end of file diff --git a/DOAN.Model/MES/bigscreen/Dto/WorkOrderBigScreenDto.cs b/DOAN.Model/MES/bigscreen/Dto/WorkOrderBigScreenDto.cs new file mode 100644 index 0000000..e3fb007 --- /dev/null +++ b/DOAN.Model/MES/bigscreen/Dto/WorkOrderBigScreenDto.cs @@ -0,0 +1,35 @@ +namespace DOAN.Model.MES.bigscreen.Dto; + +public class WorkOrderBigScreenDto +{ + /// + /// 工单号 + /// + public string Workorder { get; set; } + + + /// + /// 产品名称 + /// + public string ProductionName { get; set; } + + /// + /// 存货编码 + /// + public string ProductionCode { get; set; } + + /// + /// 派发数量 + /// + public int? DispatchNum { get; set; } + + /// + /// 完成数量 + /// + public int? FinishedNum { get; set; } + + /// + /// 状态 + /// + public int Status { get; set; } +} \ No newline at end of file diff --git a/DOAN.Model/echarts/EchartsDto.cs b/DOAN.Model/echarts/EchartsDto.cs index 4c5725d..ab328c6 100644 --- a/DOAN.Model/echarts/EchartsDto.cs +++ b/DOAN.Model/echarts/EchartsDto.cs @@ -21,6 +21,13 @@ namespace DOAN.Model.mes.echarts /// public class EchartsTitle { + public EchartsTitle(string Text,string SubText) + { + this.Text = Text; + this.SubText = SubText; + } + + public EchartsTitle(){} public string Text { get; set; } = string.Empty; public string SubText { get; set; } = string.Empty; } diff --git a/DOAN.Service/MES/bigScreen/IService/IProductBigScreenService.cs b/DOAN.Service/MES/bigScreen/IService/IProductBigScreenService.cs index eb09765..7fd1c29 100644 --- a/DOAN.Service/MES/bigScreen/IService/IProductBigScreenService.cs +++ b/DOAN.Service/MES/bigScreen/IService/IProductBigScreenService.cs @@ -1,13 +1,22 @@ using DOAN.Model.MES.bigscreen.Dto; using DOAN.Model.MES.dev; using DOAN.Model.mes.echarts; +using DOAN.Model.MES.product; namespace DOAN.Service.MES.bigScreen.IService; -public interface IProductBigScreenService : IBaseService +public interface IProductBigScreenService : IBaseService { ProductBigScreenMoudle01Dto GetMoudle01(); EchartsOptions GetMoudle02(); EchartsOptions GetMoudle03(); + EchartsOptions GetMoudle04(); + EchartsOptions GetMoudle05(); + + List GetMoudle06(); + + List GetMoudle07(); + + List GetMoudle08(); } \ No newline at end of file diff --git a/DOAN.Service/MES/bigScreen/ProductBigScreenService.cs b/DOAN.Service/MES/bigScreen/ProductBigScreenService.cs index 6baae1a..dabda7f 100644 --- a/DOAN.Service/MES/bigScreen/ProductBigScreenService.cs +++ b/DOAN.Service/MES/bigScreen/ProductBigScreenService.cs @@ -3,7 +3,9 @@ using DOAN.Model.MES.dev; using DOAN.Model.mes.echarts; using DOAN.Model.MES.product; using DOAN.Service.MES.bigScreen.IService; +using Infrastructure; using Infrastructure.Attribute; +using Mapster; namespace DOAN.Service.MES.bigScreen; @@ -11,8 +13,10 @@ namespace DOAN.Service.MES.bigScreen; /// 生产大屏 /// [AppService(ServiceType = typeof(IProductBigScreenService), ServiceLifetime = LifeTime.Transient)] -public class ProductBigScreenService : BaseService, IProductBigScreenService +public class ProductBigScreenService : BaseService, IProductBigScreenService { + private IProductBigScreenService _productBigScreenServiceImplementation; + /// /// /// @@ -82,7 +86,7 @@ public class ProductBigScreenService : BaseService, IProductBigSc var SeriesData = Context.Queryable() .LeftJoin((w, r) => - w.Workorder == r.FkWorkorder && w.WorkorderDate > today && w.WorkorderDate < today.AddDays(-7)) + w.Workorder == r.FkWorkorder && w.WorkorderDate > today.AddDays(1) && w.WorkorderDate < today.AddDays(-6)) .Select((w, r) => new EchartsSeriesData { Name = w.WorkorderDate.Value.ToString("yyyy-MM-dd"), @@ -145,6 +149,103 @@ public class ProductBigScreenService : BaseService, IProductBigSc return LineEchart; } + public EchartsOptions GetMoudle04() + { + var LineEchart = new EchartsOptions(); + + LineEchart.Title = new EchartsTitle("今日超时工单占比", "今日超时工单占比"); + + // List Series=new List(); + EchartsSeries SeriesData = new EchartsSeries(); + + + int OverTimeWorkorder= Context.Queryable().Where(it => it.WorkorderDate == DateTime.Today) + .Where(it => it.Status == 3) + .Where(it => (it.EndTime.Value - it.StartTime.Value).TotalSeconds > (it.Beat ?? 1 * it.DeliveryNum ?? 1)) + .Count(); + + EchartsSeriesData Series = new EchartsSeriesData(); + Series.Name = "超时工单数"; + Series.Value = OverTimeWorkorder; + + int StandrandWorkorder= Context.Queryable().Where(it => it.WorkorderDate == DateTime.Today) + .Where(it => it.Status == 3) + .Where(it => (it.EndTime.Value - it.StartTime.Value).TotalSeconds <= (it.Beat ?? 1 * it.DeliveryNum ?? 1)) + .Count(); + EchartsSeriesData Series2 = new EchartsSeriesData(); + Series2.Name = "不超时工单数"; + Series2.Value = StandrandWorkorder; + + SeriesData.Data = new List() { Series, Series2 }; + SeriesData.Type = "pie"; + LineEchart.Series= new List(){SeriesData}; + + + + return LineEchart; + + } + + + public EchartsOptions GetMoudle05() + { + var LineEchart = new EchartsOptions(); + + LineEchart.Title = new EchartsTitle("前七日工单异常分布占比", "前七日工单异常分布占比"); + + // List Series=new List(); + EchartsSeries SeriesData = new EchartsSeries(); + + var EchartsSeriesDataList= Context.Queryable().LeftJoin((w, l) => + w.Workorder == l.Workorder && w.WorkorderDate < DateTime.Today.AddDays(1) && + w.WorkorderDate < DateTime.Today.AddDays(-6)) + .GroupBy((w, r) => r.Log) + .Select((w, r) => new EchartsSeriesData + { + Name = r.Log, + Value = SqlFunc.AggregateCount(r) + + }).ToList(); + + + + + + + SeriesData.Type = "pie"; + SeriesData.Data = EchartsSeriesDataList; + LineEchart.Series= new List(){SeriesData}; + + + + return LineEchart; + + + } + + + public List GetMoudle06() + { + + return Context.Queryable().Where(it => it.WorkorderDate == DateTime.Today) + .ToList().Adapt>(); + } + + public List GetMoudle07() + { + return Context.Queryable() + .LeftJoin((w, l) => w.Workorder == l.Workorder && w.WorkorderDate == DateTime.Today) + .Select((w, l) => l) + .ToList(); + } + + public List GetMoudle08() + { + + return Context.Queryable().Where(it => it.WorkorderDate == DateTime.Today.AddDays(1)) + .ToList().Adapt>(); + } + private static DateTime GetStartOfWeek(DateTime dt) {