diff --git a/DOAN.Admin.WebApi/Controllers/MES/SmartScreen/Product/ProductSmartScreenController.cs b/DOAN.Admin.WebApi/Controllers/MES/SmartScreen/Product/ProductSmartScreenController.cs new file mode 100644 index 0000000..e499e48 --- /dev/null +++ b/DOAN.Admin.WebApi/Controllers/MES/SmartScreen/Product/ProductSmartScreenController.cs @@ -0,0 +1,44 @@ +using Microsoft.AspNetCore.Mvc; +using DOAN.Admin.WebApi.Filters; +using DOAN.Service.MES.product.IService; +using DOAN.Service.MES.SmartScreen.Product.IService; + +namespace DOAN.Admin.WebApi.Controllers.MES.SmartScreen.Product +{ + + /// + /// 生产智慧屏 + /// + [Verify] + [Route("mes/SmartScreen/Product")] + public class ProductSmartScreenController : BaseController + { + + private readonly IProductSmartScreenService _productSmartScreenService; + + public ProductSmartScreenController(IProductSmartScreenService productSmartScreenService) + { + _productSmartScreenService = productSmartScreenService; + } + + + /// + /// 数字翻牌器 + /// + /// + [HttpGet("digital_turntable")] + public IActionResult DigitalTurntable() + { + var response= _productSmartScreenService.DigitalTurntable(); + + return SUCCESS(response); + + } + + + + + } + + +} diff --git a/DOAN.Model/MES/SmartScreen/EchartsDto.cs b/DOAN.Model/MES/SmartScreen/EchartsDto.cs new file mode 100644 index 0000000..622a76d --- /dev/null +++ b/DOAN.Model/MES/SmartScreen/EchartsDto.cs @@ -0,0 +1,98 @@ +using Newtonsoft.Json.Converters; + +namespace DOAN.Model.MES.SmartScreen +{ + + + + /// + /// 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 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; + } + + /// + /// echarts X轴 + /// + public class EchartsXAxis + { + public List Data { get; set; } = new List(); + // public string[] Data { get; set; } =Array.Empty(); + + // 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.Model/MES/SmartScreen/Product/DigitalTurntableModel.cs b/DOAN.Model/MES/SmartScreen/Product/DigitalTurntableModel.cs new file mode 100644 index 0000000..d3a861b --- /dev/null +++ b/DOAN.Model/MES/SmartScreen/Product/DigitalTurntableModel.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DOAN.Model.MES.SmartScreen.Product +{ + /// + /// 数字翻牌器 + /// + public class DigitalTurntableModel + { + /// + /// 今日工单数 + /// + public int WorkorderQuantity { get; set; } + + /// + /// 今日已经完成工单数 + /// + public int FinishedWorkorderQuantity { get; set; } + + /// + /// 今日未完成工单数 + /// + public int UnFinishedWorkorderQuantity { get; set; } + + /// + /// 今日生产计划总数 + /// + public int ProductionPlanQuantity { get; set; } + + + /// + /// 今日生产完成总数 + /// + public int ProductionFinishQuantity { get; set; } + + + /// + /// 今天动用组数 + /// + public int GroupQuantity { get; set; } + + + + } +} diff --git a/DOAN.Service/MES/SmartScreen/Product/IService/IProductSmartScreenService.cs b/DOAN.Service/MES/SmartScreen/Product/IService/IProductSmartScreenService.cs new file mode 100644 index 0000000..4c748d5 --- /dev/null +++ b/DOAN.Service/MES/SmartScreen/Product/IService/IProductSmartScreenService.cs @@ -0,0 +1,16 @@ +using DOAN.Model.MES.product; +using DOAN.Model.MES.SmartScreen.Product; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DOAN.Service.MES.SmartScreen.Product.IService +{ + public interface IProductSmartScreenService : IBaseService + { + DigitalTurntableModel DigitalTurntable(); + + } +} diff --git a/DOAN.Service/MES/SmartScreen/Product/ProductSmartScreenService.cs b/DOAN.Service/MES/SmartScreen/Product/ProductSmartScreenService.cs new file mode 100644 index 0000000..dd736d0 --- /dev/null +++ b/DOAN.Service/MES/SmartScreen/Product/ProductSmartScreenService.cs @@ -0,0 +1,51 @@ +using DOAN.Model.MES.product; +using DOAN.Service.MES.product.IService; +using Infrastructure.Attribute; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using DOAN.Service.MES.SmartScreen.Product.IService; +using DOAN.Model.MES.SmartScreen.Product; + +namespace DOAN.Service.MES.SmartScreen.Product +{ + /// + /// 生产智慧屏 + /// + [AppService(ServiceType = typeof(IProductSmartScreenService), ServiceLifetime = LifeTime.Transient)] + public class ProductSmartScreenService : BaseService, IProductSmartScreenService + { + /// + /// 数字翻牌器 + /// + /// + + public DigitalTurntableModel DigitalTurntable() + { + DigitalTurntableModel digital=new DigitalTurntableModel(); + digital.WorkorderQuantity = Context.Queryable().Where(it=>it.WorkorderDate==DateTime.Today).Count(); + + digital.FinishedWorkorderQuantity=Context.Queryable().Where(it => it.WorkorderDate == DateTime.Today) + .Where(it=>it.Status==2) + .Count(); + + digital.UnFinishedWorkorderQuantity = Context.Queryable().Where(it => it.WorkorderDate == DateTime.Today) + .Where(it => it.Status <2) + .Count(); + + digital.ProductionPlanQuantity = Context.Queryable().Where(it => it.WorkorderDate == DateTime.Today).Sum(it=>it.PlanNum??0); + + + digital.ProductionFinishQuantity = Context.Queryable().Where(it => it.JobDate >= DateTime.Today && it.JobDate < DateTime.Today.AddDays(1)) + .Where(it => it.ProcessId == 90).Sum(it => it.FinishNum??0); + + + digital.GroupQuantity=Context.Queryable().Where(it => it.WorkorderDate == DateTime.Today).GroupBy(it=>it.GroupCode).Count(); + + + return digital; + } + } +} diff --git a/DOAN.Service/Mobile/ReportFlowService.cs b/DOAN.Service/Mobile/ReportFlowService.cs index d3074d3..ace5c56 100644 --- a/DOAN.Service/Mobile/ReportFlowService.cs +++ b/DOAN.Service/Mobile/ReportFlowService.cs @@ -44,7 +44,7 @@ public class ReportFlowService : BaseService, IReportFlowServic bool Exist = Context.Queryable().Where(it => it.Workorder == workorder && it.ProcessId == processId).Any(); string NickName= Context.Queryable().Where(it=>it.UserName==Worker).Select(it=>it.NickName).First(); - Worker = string.IsNullOrEmpty(NickName) ? Worker : NickName; + Worker = string.IsNullOrEmpty(NickName) ? Worker + "|异常人员|" : NickName; if (Exist) { result = Context.Updateable().Where(it => it.Workorder == workorder && it.ProcessId == processId) @@ -86,7 +86,7 @@ public class ReportFlowService : BaseService, IReportFlowServic int result = 0; bool Exist = Context.Queryable().Where(it => it.Workorder == workorder && it.ProcessId == process).Any(); string NickName = Context.Queryable().Where(it => it.UserName == Worker).Select(it => it.NickName).First(); - Worker = string.IsNullOrEmpty(NickName) ? Worker : NickName; + Worker = string.IsNullOrEmpty(NickName) ? Worker + "|异常人员|" : NickName; if (Exist) { result = Context.Updateable().Where(it => it.Workorder == workorder && it.ProcessId == process) @@ -132,7 +132,7 @@ public class ReportFlowService : BaseService, IReportFlowServic int result = 0; bool Exist = Context.Queryable().Where(it => it.Workorder == workorder && it.ProcessId == processId).Any(); string NickName = Context.Queryable().Where(it => it.UserName == Worker).Select(it => it.NickName).First(); - Worker = string.IsNullOrEmpty(NickName) ? Worker : NickName; + Worker = string.IsNullOrEmpty(NickName) ? Worker+"|异常人员|" : NickName; if (Exist) { result = Context.Updateable()