今日班组产能

This commit is contained in:
qianhao.xu 2024-11-07 13:53:33 +08:00
parent 8acc43b565
commit 63182d725d
3 changed files with 59 additions and 4 deletions

View File

@ -31,7 +31,7 @@ public class ConsoleController : BaseController
return SUCCESS(response);
}
//TODO 线 任务数/工单
//TODO 线 工单数/任务数
[HttpGet("get_moudel02")]
public IActionResult GetLineOfTaskNumAndWorkorder()
@ -41,5 +41,12 @@ public class ConsoleController : BaseController
return SUCCESS(response);
}
//TODO 班组工单数 今日班组产能
public IActionResult GetGroupWorkOrderNum()
{
var response = consoleService.GetGroupWorkOrderNum();
return SUCCESS(response);
}
}

View File

@ -64,7 +64,7 @@ public class ConsoleService : BaseService<ProWorkorder>, IConsoleService
/// <summary>
/// 获取线 任务数/工单数
/// 获取线 工单数/任务
/// </summary>
/// <returns></returns>
public EchartsOptions GetLineOfTaskNumAndWorkorder()
@ -94,7 +94,7 @@ public class ConsoleService : BaseService<ProWorkorder>, IConsoleService
List<EchartsSeriesData> EchartsSeriesDataList = Context.Queryable<BaseWorkRoute>().LeftJoin<ProWorkorder>((r, w) => r.Code == w.LineCode)
.Where((r,w)=>w.WorkorderDate == DateTime.Now.Date)
.OrderBy((r, w) => r.Code)
.OrderBy((r, w) => r.Id)
.GroupBy((r, w) => r.Name)
.Select((r, w) => new EchartsSeriesData {
Name=r.Name,
@ -110,7 +110,7 @@ public class ConsoleService : BaseService<ProWorkorder>, IConsoleService
List<EchartsSeriesData> EchartsSeriesDataList02 = Context.Queryable<BaseWorkRoute>().LeftJoin<MmPreparationTaskLine>((r, w) => r.Code == w.LineCode)
.Where((r, w) => w.TaskDate == DateTime.Now.Date)
.OrderBy((r, w) => r.Code)
.OrderBy((r, w) => r.Id)
.GroupBy((r, w) => r.Name)
.Select((r, w) => new EchartsSeriesData
{
@ -126,4 +126,49 @@ public class ConsoleService : BaseService<ProWorkorder>, IConsoleService
return echartsOptions;
}
/// <summary>
/// 班组工单数今日班组产能
/// </summary>
/// <returns></returns>
public EchartsOptions GetGroupWorkOrderNum()
{
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<BaseWorkRoute>().OrderBy(it => it.Code).Select(it => it.Name).ToList();
echartsOptions.XAxis = XAxis;
EchartsYAxis YAxis = new EchartsYAxis();
YAxis.Type = "value";
echartsOptions.YAxis = YAxis;
List<EchartsSeries> Series = new List<EchartsSeries>();
EchartsSeries serie01 = new EchartsSeries();
serie01.Name = "工单数";
serie01.Type = "bar";
List<EchartsSeriesData> EchartsSeriesDataList = Context.Queryable<BaseGroup>().LeftJoin<ProWorkorder>((r, w) => r.GroupCode == w.GroupCode)
.Where((r, w) => w.WorkorderDate == DateTime.Now.Date)
.OrderBy((r, w) => r.Id)
.GroupBy((r, w) => r.GroupCode)
.Select((r, w) => new EchartsSeriesData
{
Name = r.GroupName,
Value = SqlFunc.AggregateCount(w)
}).ToList();
serie01.Data = EchartsSeriesDataList;
Series.Add(serie01);
echartsOptions.Series = Series;
return echartsOptions;
}
}

View File

@ -13,4 +13,7 @@ public interface IConsoleService : IBaseService<ProWorkorder>
EchartsOptions GetLineOfTaskNumAndWorkorder();
EchartsOptions GetGroupWorkOrderNum();
}