diff --git a/DOAN.Admin.WebApi/Controllers/MES/Console/ConsoleController.cs b/DOAN.Admin.WebApi/Controllers/MES/Console/ConsoleController.cs
index c77ec74..f10069a 100644
--- a/DOAN.Admin.WebApi/Controllers/MES/Console/ConsoleController.cs
+++ b/DOAN.Admin.WebApi/Controllers/MES/Console/ConsoleController.cs
@@ -14,9 +14,9 @@ public class ConsoleController : BaseController
{
private readonly IConsoleService consoleService;
- public ConsoleController(IConsoleService consoleService)
+ public ConsoleController(IConsoleService consoleService)
{
- this.consoleService=consoleService;
+ this.consoleService = consoleService;
}
//TODO 获取色块看板信息
@@ -31,6 +31,15 @@ public class ConsoleController : BaseController
return SUCCESS(response);
}
- //TODO 线 物料需求数 / 物料备料数
+ //TODO 线 任务数/工单数
+ [HttpGet("get_moudel02")]
+
+ public IActionResult GetLineOfTaskNumAndWorkorder()
+ {
+
+ var response = consoleService.GetLineOfTaskNumAndWorkorder();
+ return SUCCESS(response);
+ }
+
}
\ No newline at end of file
diff --git a/DOAN.Model/echarts/EchartsDto.cs b/DOAN.Model/echarts/EchartsDto.cs
new file mode 100644
index 0000000..3c2c76e
--- /dev/null
+++ b/DOAN.Model/echarts/EchartsDto.cs
@@ -0,0 +1,93 @@
+using Newtonsoft.Json.Converters;
+
+namespace DOAN.Model.mes.echarts
+{
+
+
+
+ ///
+ /// echarts 通用Options返回值
+ ///
+ public class EchartsOptions
+ {
+ public EchartsTitle Title { get; set; } = null;
+ public EchartsXAxis XAxis { get; set; } = null;
+ public EchartsYAxis YAxis { get; set; } = null;
+ public List Series { get; set; } = new List();
+ }
+
+ ///
+ /// echarts图表标题
+ ///
+ public class EchartsTitle
+ {
+ public string Text { get; set; } = string.Empty;
+ public string SubText { get; set; } = string.Empty;
+ }
+
+ ///
+ /// echarts X轴
+ ///
+ public class EchartsXAxis
+ {
+ public List Data { get; set; } = new List();
+
+ // value 数值轴,适用于连续数据 category 类目轴,适用于离散的类目数据 time 时间轴,适用于连续的时序数据 log 对数轴。适用于对数数据
+ public string Type { get; set; } = "category";
+ public string Max { get; set; }
+ public string Min { get; set; }
+ }
+
+ ///
+ /// echarts Y轴
+ ///
+ public class EchartsYAxis
+ {
+ public List Data { get; set; } = new List();
+
+ // value 数值轴,适用于连续数据 category 类目轴,适用于离散的类目数据 time 时间轴,适用于连续的时序数据 log 对数轴。适用于对数数据
+ public string Type { get; set; } = "category";
+ public string Max { get; set; }
+ public string Min { get; set; }
+
+ }
+
+ ///
+ /// echarts图表series返回值
+ ///
+ public class EchartsSeries
+ {
+ ///
+ /// 标签名称
+ ///
+ public string Name { get; set; } = "category";
+
+ ///
+ /// bar-柱状图 line-折线图 EchartsSeriesType enum结构
+ ///
+ public string Type { get; set; } = "bar";
+
+ ///
+ /// 参数值
+ ///
+ public List Data { get; set; } = new List();
+
+
+ }
+
+ ///
+ /// echarts图表series返回值内容
+ ///
+ public class EchartsSeriesData
+ {
+ ///
+ /// 标签名称
+ ///
+ public string Name { get; set; } = string.Empty;
+
+ ///
+ /// 参数值
+ ///
+ public decimal Value { get; set; } = new decimal();
+ }
+}
diff --git a/DOAN.Service/MES/Console_/ConsoleService.cs b/DOAN.Service/MES/Console_/ConsoleService.cs
index bb92740..702626c 100644
--- a/DOAN.Service/MES/Console_/ConsoleService.cs
+++ b/DOAN.Service/MES/Console_/ConsoleService.cs
@@ -1,4 +1,6 @@
+using DOAN.Model.mes.echarts;
using DOAN.Model.MES.andon;
+using DOAN.Model.MES.base_;
using DOAN.Model.MES.console;
using DOAN.Model.MES.dev;
using DOAN.Model.MES.mm;
@@ -7,6 +9,7 @@ using DOAN.Model.MES.quality.FQC;
using DOAN.Model.MES.quality.IPQC;
using DOAN.Service.MES.Console_.IService;
using Infrastructure.Attribute;
+using System.Collections.Generic;
namespace DOAN.Service.MES.Console_;
@@ -57,4 +60,70 @@ public class ConsoleService : BaseService, IConsoleService
});
return consoleMoudle01;
}
+
+
+
+ ///
+ /// 获取线 任务数/工单数
+ ///
+ ///
+ public EchartsOptions GetLineOfTaskNumAndWorkorder()
+ {
+ EchartsOptions echartsOptions = new EchartsOptions();
+
+ EchartsTitle Title=new EchartsTitle();
+ Title.Text = "今日产线产能";
+ Title.SubText = "今日产线工单和任务数对比";
+ echartsOptions.Title = Title;
+
+ EchartsXAxis XAxis=new EchartsXAxis();
+
+ XAxis.Type = "category";
+
+ XAxis.Data =Context.Queryable().OrderBy(it=>it.Code).Select(it => it.Name).ToList();
+ echartsOptions.XAxis = XAxis;
+
+ EchartsYAxis YAxis=new EchartsYAxis();
+ YAxis.Type = "value";
+ echartsOptions.YAxis = YAxis;
+
+ List Series=new List();
+ EchartsSeries serie01 = new EchartsSeries();
+ serie01.Name = "工单数";
+ serie01.Type = "bar";
+
+ List EchartsSeriesDataList = Context.Queryable().LeftJoin((r, w) => r.Code == w.LineCode)
+ .Where((r,w)=>w.WorkorderDate == DateTime.Now.Date)
+ .OrderBy((r, w) => r.Code)
+ .GroupBy((r, w) => r.Name)
+ .Select((r, w) => new EchartsSeriesData {
+ Name=r.Name,
+ Value=SqlFunc.AggregateCount(w)
+
+ }).ToList();
+ serie01.Data = EchartsSeriesDataList;
+ Series.Add(serie01);
+
+ EchartsSeries serie02 = new EchartsSeries();
+ serie02.Name = "任务数";
+ serie02.Type = "bar";
+
+ List EchartsSeriesDataList02 = Context.Queryable().LeftJoin((r, w) => r.Code == w.LineCode)
+ .Where((r, w) => w.TaskDate == DateTime.Now.Date)
+ .OrderBy((r, w) => r.Code)
+ .GroupBy((r, w) => r.Name)
+ .Select((r, w) => new EchartsSeriesData
+ {
+ Name = r.Name,
+ Value = SqlFunc.AggregateCount(w)
+
+ }).ToList();
+ serie02.Data = EchartsSeriesDataList;
+ Series.Add(serie02);
+
+ echartsOptions.Series= Series;
+
+
+ return echartsOptions;
+ }
}
\ No newline at end of file
diff --git a/DOAN.Service/MES/Console_/IService/IConsoleService.cs b/DOAN.Service/MES/Console_/IService/IConsoleService.cs
index 1294aab..e666fcf 100644
--- a/DOAN.Service/MES/Console_/IService/IConsoleService.cs
+++ b/DOAN.Service/MES/Console_/IService/IConsoleService.cs
@@ -2,11 +2,15 @@
using DOAN.Model.MES.console;
using DOAN.Model.MES.product;
+using DOAN.Model.mes.echarts;
namespace DOAN.Service.MES.Console_.IService;
public interface IConsoleService : IBaseService
{
- ConsoleMoudle01 GetColorBlockKanbanInformation();
+ ConsoleMoudle01 GetColorBlockKanbanInformation();
+
+
+ EchartsOptions GetLineOfTaskNumAndWorkorder();
}
\ No newline at end of file