生产大屏

This commit is contained in:
qianhao.xu 2024-11-11 14:13:55 +08:00
parent 7a673f8893
commit 89aeb55de2
6 changed files with 231 additions and 3 deletions

View File

@ -56,5 +56,65 @@ namespace DOAN.WebApi.Controllers.MES.BigScreen
return SUCCESS(response);
}
/// <summary>
/// 今日超时工单占比
/// </summary>
/// <returns></returns>
[HttpGet("get_moudle04")]
public IActionResult GetMoudle04()
{
EchartsOptions response= productBigScreenService.GetMoudle04();
return SUCCESS(response);
}
/// <summary>
/// 前七日工单异常分布占比
/// </summary>
/// <returns></returns>
[HttpGet("get_moudle05")]
public IActionResult GetMoudle05()
{
EchartsOptions response= productBigScreenService.GetMoudle05();
return SUCCESS(response);
}
/// <summary>
/// 获取今日工单列表
/// </summary>
/// <returns></returns>
[HttpGet("get_moudle06")]
public IActionResult GetMoudle06()
{
var response= productBigScreenService.GetMoudle06();
return SUCCESS(response);
}
/// <summary>
/// 获取今日异常工单列表
/// </summary>
/// <returns></returns>
[HttpGet("get_moudle07")]
public IActionResult GetMoudle07()
{
var response= productBigScreenService.GetMoudle07();
return SUCCESS(response);
}
/// <summary>
/// 获取昨天工单报工数
/// </summary>
/// <returns></returns>
[HttpGet("get_moudle08")]
public IActionResult GetMoudle08()
{
var response= productBigScreenService.GetMoudle07();
return SUCCESS(response);
}
}
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<key id="f4eecf5f-e6e6-4130-b2e6-2e4f58296a18" version="1">
<creationDate>2024-11-11T03:13:49.8611403Z</creationDate>
<activationDate>2024-11-11T03:13:49.7226248Z</activationDate>
<expirationDate>2025-02-09T03:13:49.7226248Z</expirationDate>
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
<descriptor>
<encryption algorithm="AES_256_CBC" />
<validation algorithm="HMACSHA256" />
<masterKey xmlns:p4="http://schemas.asp.net/2015/03/dataProtection" p4:requiresEncryption="true">
<!-- Warning: the key below is in an unencrypted form. -->
<value>+2NuWJkK/DyWDdPyBElzUEupSNfcd6V3wy4TQhfIEx0PmgjFnZVnUaLa4ODHiTTPFu3nnjWA5UQQ5yVTNq9X9A==</value>
</masterKey>
</descriptor>
</descriptor>
</key>

View File

@ -0,0 +1,35 @@
namespace DOAN.Model.MES.bigscreen.Dto;
public class WorkOrderBigScreenDto
{
/// <summary>
/// 工单号
/// </summary>
public string Workorder { get; set; }
/// <summary>
/// 产品名称
/// </summary>
public string ProductionName { get; set; }
/// <summary>
/// 存货编码
/// </summary>
public string ProductionCode { get; set; }
/// <summary>
/// 派发数量
/// </summary>
public int? DispatchNum { get; set; }
/// <summary>
/// 完成数量
/// </summary>
public int? FinishedNum { get; set; }
/// <summary>
/// 状态
/// </summary>
public int Status { get; set; }
}

View File

@ -21,6 +21,13 @@ namespace DOAN.Model.mes.echarts
///</summary>
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;
}

View File

@ -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<DeviceAccount>
public interface IProductBigScreenService : IBaseService<ProWorkorder>
{
ProductBigScreenMoudle01Dto GetMoudle01();
EchartsOptions GetMoudle02();
EchartsOptions GetMoudle03();
EchartsOptions GetMoudle04();
EchartsOptions GetMoudle05();
List<WorkOrderBigScreenDto> GetMoudle06();
List<ProWorkorderUpdateLog> GetMoudle07();
List<WorkOrderBigScreenDto> GetMoudle08();
}

View File

@ -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;
/// 生产大屏
/// </summary>
[AppService(ServiceType = typeof(IProductBigScreenService), ServiceLifetime = LifeTime.Transient)]
public class ProductBigScreenService : BaseService<DeviceAccount>, IProductBigScreenService
public class ProductBigScreenService : BaseService<ProWorkorder>, IProductBigScreenService
{
private IProductBigScreenService _productBigScreenServiceImplementation;
/// <summary>
/// </summary>
/// <returns></returns>
@ -82,7 +86,7 @@ public class ProductBigScreenService : BaseService<DeviceAccount>, IProductBigSc
var SeriesData = Context.Queryable<ProWorkorder>()
.LeftJoin<ProReportwork>((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<DeviceAccount>, IProductBigSc
return LineEchart;
}
public EchartsOptions GetMoudle04()
{
var LineEchart = new EchartsOptions();
LineEchart.Title = new EchartsTitle("今日超时工单占比", "今日超时工单占比");
// List<EchartsSeries> Series=new List<EchartsSeries>();
EchartsSeries SeriesData = new EchartsSeries();
int OverTimeWorkorder= Context.Queryable<ProWorkorder>().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<ProWorkorder>().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<EchartsSeriesData>() { Series, Series2 };
SeriesData.Type = "pie";
LineEchart.Series= new List<EchartsSeries>(){SeriesData};
return LineEchart;
}
public EchartsOptions GetMoudle05()
{
var LineEchart = new EchartsOptions();
LineEchart.Title = new EchartsTitle("前七日工单异常分布占比", "前七日工单异常分布占比");
// List<EchartsSeries> Series=new List<EchartsSeries>();
EchartsSeries SeriesData = new EchartsSeries();
var EchartsSeriesDataList= Context.Queryable<ProWorkorder>().LeftJoin<ProWorkorderUpdateLog>((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<EchartsSeries>(){SeriesData};
return LineEchart;
}
public List<WorkOrderBigScreenDto> GetMoudle06()
{
return Context.Queryable<ProWorkorder>().Where(it => it.WorkorderDate == DateTime.Today)
.ToList().Adapt<List<WorkOrderBigScreenDto>>();
}
public List<ProWorkorderUpdateLog> GetMoudle07()
{
return Context.Queryable<ProWorkorder>()
.LeftJoin<ProWorkorderUpdateLog>((w, l) => w.Workorder == l.Workorder && w.WorkorderDate == DateTime.Today)
.Select((w, l) => l)
.ToList();
}
public List<WorkOrderBigScreenDto> GetMoudle08()
{
return Context.Queryable<ProWorkorder>().Where(it => it.WorkorderDate == DateTime.Today.AddDays(1))
.ToList().Adapt<List<WorkOrderBigScreenDto>>();
}
private static DateTime GetStartOfWeek(DateTime dt)
{