From d77828a202fcd9b19ae6168ef9d81c5a19da7d26 Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Tue, 19 Nov 2024 17:15:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=20=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=B7=A5=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProWorkorderUpdateLogController.cs | 106 ++++++++++++++++++ DOAN.Admin.WebApi/DOAN.WebApi.csproj | 1 + DOAN.Model/DOAN.Model.csproj | 1 + .../exception/Dto/ProWorkorderUpdateLogDto.cs | 39 +++++++ .../MES/exception/ProWorkorderUpdateLog.cs | 72 ++++++++++++ DOAN.Service/MES/Console_/ConsoleService.cs | 4 +- .../IService/IProductBigScreenService.cs | 1 + .../MES/bigScreen/Product2BigScreenService.cs | 13 ++- .../MES/bigScreen/ProductBigScreenService.cs | 1 + .../IService/IProWorkorderUpdateLogService.cs | 23 ++++ .../exception/ProWorkorderUpdateLogService.cs | 87 ++++++++++++++ .../MES/product/ProWorkorderService.cs | 5 +- 12 files changed, 343 insertions(+), 10 deletions(-) create mode 100644 DOAN.Admin.WebApi/Controllers/MES/exception/ProWorkorderUpdateLogController.cs create mode 100644 DOAN.Model/MES/exception/Dto/ProWorkorderUpdateLogDto.cs create mode 100644 DOAN.Model/MES/exception/ProWorkorderUpdateLog.cs create mode 100644 DOAN.Service/MES/exception/IService/IProWorkorderUpdateLogService.cs create mode 100644 DOAN.Service/MES/exception/ProWorkorderUpdateLogService.cs diff --git a/DOAN.Admin.WebApi/Controllers/MES/exception/ProWorkorderUpdateLogController.cs b/DOAN.Admin.WebApi/Controllers/MES/exception/ProWorkorderUpdateLogController.cs new file mode 100644 index 0000000..49123ef --- /dev/null +++ b/DOAN.Admin.WebApi/Controllers/MES/exception/ProWorkorderUpdateLogController.cs @@ -0,0 +1,106 @@ +using Microsoft.AspNetCore.Mvc; +using DOAN.Model.Dto; + +using DOAN.Admin.WebApi.Filters; +using DOAN.Model.MES.exception; +using DOAN.Model.MES.exception.Dto; +using DOAN.Service.exception.IService; + +//创建时间:2024-11-19 +namespace DOAN.Admin.WebApi.Controllers +{ + /// + /// 工单修改日志表 + /// + [Verify] + [Route("business/ProWorkorderUpdateLog")] + public class ProWorkorderUpdateLogController : BaseController + { + /// + /// 工单修改日志表接口 + /// + private readonly IProWorkorderUpdateLogService _ProWorkorderUpdateLogService; + + public ProWorkorderUpdateLogController(IProWorkorderUpdateLogService ProWorkorderUpdateLogService) + { + _ProWorkorderUpdateLogService = ProWorkorderUpdateLogService; + } + + /// + /// 查询工单修改日志表列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "business:proworkorderupdatelog:list")] + public IActionResult QueryProWorkorderUpdateLog([FromQuery] ProWorkorderUpdateLogQueryDto parm) + { + var response = _ProWorkorderUpdateLogService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询工单修改日志表详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "business:proworkorderupdatelog:query")] + public IActionResult GetProWorkorderUpdateLog(string Id) + { + var response = _ProWorkorderUpdateLogService.GetInfo(Id); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加工单修改日志表 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "business:proworkorderupdatelog:add")] + [Log(Title = "工单修改日志表", BusinessType = BusinessType.INSERT)] + public IActionResult AddProWorkorderUpdateLog([FromBody] ProWorkorderUpdateLogDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _ProWorkorderUpdateLogService.AddProWorkorderUpdateLog(modal); + + return SUCCESS(response); + } + + /// + /// 更新工单修改日志表 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "business:proworkorderupdatelog:edit")] + [Log(Title = "工单修改日志表", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateProWorkorderUpdateLog([FromBody] ProWorkorderUpdateLogDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _ProWorkorderUpdateLogService.UpdateProWorkorderUpdateLog(modal); + + return ToResponse(response); + } + + /// + /// 删除工单修改日志表 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "business:proworkorderupdatelog:delete")] + [Log(Title = "工单修改日志表", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteProWorkorderUpdateLog(string ids) + { + int[] idsArr = Tools.SpitIntArrary(ids); + if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } + + var response = _ProWorkorderUpdateLogService.Delete(idsArr); + + return ToResponse(response); + } + } +} \ No newline at end of file diff --git a/DOAN.Admin.WebApi/DOAN.WebApi.csproj b/DOAN.Admin.WebApi/DOAN.WebApi.csproj index 0be8625..63012b8 100644 --- a/DOAN.Admin.WebApi/DOAN.WebApi.csproj +++ b/DOAN.Admin.WebApi/DOAN.WebApi.csproj @@ -33,6 +33,7 @@ + diff --git a/DOAN.Model/DOAN.Model.csproj b/DOAN.Model/DOAN.Model.csproj index a884287..9dcc718 100644 --- a/DOAN.Model/DOAN.Model.csproj +++ b/DOAN.Model/DOAN.Model.csproj @@ -26,6 +26,7 @@ true Never + diff --git a/DOAN.Model/MES/exception/Dto/ProWorkorderUpdateLogDto.cs b/DOAN.Model/MES/exception/Dto/ProWorkorderUpdateLogDto.cs new file mode 100644 index 0000000..97e017b --- /dev/null +++ b/DOAN.Model/MES/exception/Dto/ProWorkorderUpdateLogDto.cs @@ -0,0 +1,39 @@ +using System.ComponentModel.DataAnnotations; + +namespace DOAN.Model.MES.exception.Dto +{ + /// + /// 工单修改日志表查询对象 + /// + public class ProWorkorderUpdateLogQueryDto : PagerInfo + {} + + /// + /// 工单修改日志表输入输出对象 + /// + public class ProWorkorderUpdateLogDto + { + [Required(ErrorMessage = "雪花不能为空")] + public string Id { get; set; } + + public string Workorder { get; set; } + + public string Log { get; set; } + + public string ResponsiblePerson { get; set; } + + public string Reason { get; set; } + + public DateTime? ChangeTime { get; set; } + + public string Operator { get; set; } + + public DateTime? CreatedTime { get; set; } + + public string CreatedBy { get; set; } + + public DateTime? UpdatedTime { get; set; } + + public string UpdatedBy { get; set; } + } +} \ No newline at end of file diff --git a/DOAN.Model/MES/exception/ProWorkorderUpdateLog.cs b/DOAN.Model/MES/exception/ProWorkorderUpdateLog.cs new file mode 100644 index 0000000..9523915 --- /dev/null +++ b/DOAN.Model/MES/exception/ProWorkorderUpdateLog.cs @@ -0,0 +1,72 @@ + +namespace DOAN.Model.MES.exception +{ + /// + /// 工单修改日志表 + /// + [SugarTable("pro_workorder_update_log")] + public class ProWorkorderUpdateLog + { + /// + /// 雪花 + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false)] + public string Id { get; set; } + + /// + /// 工单号 + /// + public string Workorder { get; set; } + + /// + /// 日志 + /// + public string Log { get; set; } + + /// + /// 责任人 + /// + [SugarColumn(ColumnName = "responsible_person")] + public string ResponsiblePerson { get; set; } + + /// + /// 产生原因 + /// + public string Reason { get; set; } + + /// + /// 状态更改时间 + /// + [SugarColumn(ColumnName = "change_time")] + public DateTime? ChangeTime { get; set; } + + /// + /// 操作者 + /// + public string Operator { get; set; } + + /// + /// CreatedTime + /// + [SugarColumn(ColumnName = "created_time")] + public DateTime? CreatedTime { get; set; } + + /// + /// CreatedBy + /// + [SugarColumn(ColumnName = "created_by")] + public string CreatedBy { get; set; } + + /// + /// UpdatedTime + /// + [SugarColumn(ColumnName = "updated_time")] + public DateTime? UpdatedTime { get; set; } + + /// + /// UpdatedBy + /// + [SugarColumn(ColumnName = "updated_by")] + public string UpdatedBy { get; set; } + } +} \ No newline at end of file diff --git a/DOAN.Service/MES/Console_/ConsoleService.cs b/DOAN.Service/MES/Console_/ConsoleService.cs index 5d5bc5c..ba6ce12 100644 --- a/DOAN.Service/MES/Console_/ConsoleService.cs +++ b/DOAN.Service/MES/Console_/ConsoleService.cs @@ -10,13 +10,14 @@ using DOAN.Model.MES.quality.IPQC; using DOAN.Service.MES.Console_.IService; using Infrastructure.Attribute; using System.Collections.Generic; +using DOAN.Model.MES.exception; namespace DOAN.Service.MES.Console_; [AppService(ServiceType = typeof(IConsoleService), ServiceLifetime = LifeTime.Transient)] public class ConsoleService : BaseService, IConsoleService { - /// + /// /// 获取色块看板信息 /// /// @@ -62,7 +63,6 @@ public class ConsoleService : BaseService, IConsoleService } - /// /// 获取线 工单数/任务数 /// diff --git a/DOAN.Service/MES/bigScreen/IService/IProductBigScreenService.cs b/DOAN.Service/MES/bigScreen/IService/IProductBigScreenService.cs index 7fd1c29..212170a 100644 --- a/DOAN.Service/MES/bigScreen/IService/IProductBigScreenService.cs +++ b/DOAN.Service/MES/bigScreen/IService/IProductBigScreenService.cs @@ -1,6 +1,7 @@ using DOAN.Model.MES.bigscreen.Dto; using DOAN.Model.MES.dev; using DOAN.Model.mes.echarts; +using DOAN.Model.MES.exception; using DOAN.Model.MES.product; namespace DOAN.Service.MES.bigScreen.IService; diff --git a/DOAN.Service/MES/bigScreen/Product2BigScreenService.cs b/DOAN.Service/MES/bigScreen/Product2BigScreenService.cs index 2ce14cb..3dfd928 100644 --- a/DOAN.Service/MES/bigScreen/Product2BigScreenService.cs +++ b/DOAN.Service/MES/bigScreen/Product2BigScreenService.cs @@ -1,6 +1,7 @@ using DOAN.Model.MES.base_; using DOAN.Model.MES.bigscreen.Dto; using DOAN.Model.mes.echarts; +using DOAN.Model.MES.exception; using DOAN.Model.MES.product; using DOAN.Service.MES.bigScreen.IService; using Infrastructure.Attribute; @@ -62,7 +63,7 @@ namespace DOAN.Service.MES.bigScreen { return Context.Queryable().LeftJoin((w, r) => w.Workorder == r.FkWorkorder) .LeftJoin((w, r, g)=>w.GroupCode==g.GroupCode) - .Where((w, r,g) => w.WorkorderDate == DateTime.Today) + .Where((w, r,g) => w.WorkorderDate == DateTime.Today&&g.Status==1) .GroupBy((w, r,g) => w.GroupCode) .OrderBy((w,r,g)=>g.Id) .Select((w, r) => new TodayGroupProductionProgress() @@ -81,7 +82,7 @@ namespace DOAN.Service.MES.bigScreen //x轴 EchartsXAxis XAxis = new EchartsXAxis(); - List Data = Context.Queryable().OrderBy(it => it.Id).Select(it => it.GroupCode).ToList(); + List Data = Context.Queryable().Where(it=>it.Status==1).OrderBy(it => it.Id).Select(it => it.GroupCode).ToList(); XAxis.Data = Data; echartsOptions.XAxis = XAxis; @@ -157,7 +158,7 @@ namespace DOAN.Service.MES.bigScreen //x轴 EchartsXAxis XAxis = new EchartsXAxis(); - List Data = Context.Queryable().OrderBy(it => it.Id).Select(it => it.GroupCode).ToList(); + List Data = Context.Queryable().Where(it=>it.Status==1).OrderBy(it => it.Id).Select(it => it.GroupCode).ToList(); XAxis.Data = Data; echartsOptions.XAxis = XAxis; @@ -279,11 +280,11 @@ namespace DOAN.Service.MES.bigScreen DateTime lastDayOfMonth = new DateTime(today.Year, today.Month, DateTime.DaysInMonth(today.Year, today.Month)); EchartsOptions echartsOptions = new EchartsOptions(); - EchartsTitle Title = new EchartsTitle("本月生产产品种类TOP10", "本月生产产品种类TOP10"); + EchartsTitle Title = new EchartsTitle("本月生产产品TOP10", "本月生产产品TOP10"); echartsOptions.Title = Title; EchartsSeries LineSeries = new EchartsSeries(); - LineSeries.Name = "不同产品种类的本月生产的数量"; + LineSeries.Name = "不同产品的本月生产的数量"; LineSeries.Type = "bar"; LineSeries.Data = Context.Queryable() @@ -369,7 +370,7 @@ namespace DOAN.Service.MES.bigScreen // 各个组的产量系列 - string[] groupArray = Context.Queryable().OrderBy(it => it.Id).Select(it => it.GroupCode) + string[] groupArray = Context.Queryable().Where(it=>it.Status==1).OrderBy(it => it.Id).Select(it => it.GroupCode) .ToArray(); if (groupArray.Length > 0) { diff --git a/DOAN.Service/MES/bigScreen/ProductBigScreenService.cs b/DOAN.Service/MES/bigScreen/ProductBigScreenService.cs index 72b9b2d..f96abe8 100644 --- a/DOAN.Service/MES/bigScreen/ProductBigScreenService.cs +++ b/DOAN.Service/MES/bigScreen/ProductBigScreenService.cs @@ -2,6 +2,7 @@ using System.Linq; using DOAN.Model.MES.bigscreen.Dto; using DOAN.Model.MES.dev; using DOAN.Model.mes.echarts; +using DOAN.Model.MES.exception; using DOAN.Model.MES.product; using DOAN.Service.MES.bigScreen.IService; using Infrastructure; diff --git a/DOAN.Service/MES/exception/IService/IProWorkorderUpdateLogService.cs b/DOAN.Service/MES/exception/IService/IProWorkorderUpdateLogService.cs new file mode 100644 index 0000000..666498c --- /dev/null +++ b/DOAN.Service/MES/exception/IService/IProWorkorderUpdateLogService.cs @@ -0,0 +1,23 @@ +using System; +using DOAN.Model; +using DOAN.Model.Dto; +using DOAN.Model.MES.exception.Dto; +using DOAN.Model.MES.exception; +using System.Collections.Generic; + +namespace DOAN.Service.exception.IService +{ + /// + /// 工单修改日志表service接口 + /// + public interface IProWorkorderUpdateLogService : IBaseService + { + PagedInfo GetList(ProWorkorderUpdateLogQueryDto parm); + + ProWorkorderUpdateLog GetInfo(string Id); + + ProWorkorderUpdateLog AddProWorkorderUpdateLog(ProWorkorderUpdateLog parm); + + int UpdateProWorkorderUpdateLog(ProWorkorderUpdateLog parm); + } +} diff --git a/DOAN.Service/MES/exception/ProWorkorderUpdateLogService.cs b/DOAN.Service/MES/exception/ProWorkorderUpdateLogService.cs new file mode 100644 index 0000000..320f103 --- /dev/null +++ b/DOAN.Service/MES/exception/ProWorkorderUpdateLogService.cs @@ -0,0 +1,87 @@ +using System; +using SqlSugar; +using Infrastructure.Attribute; +using Infrastructure.Extensions; +using DOAN.Model; +using DOAN.Model.Dto; +using DOAN.Model.MES.exception.Dto; +using DOAN.Model.MES.exception; +using DOAN.Repository; + +using System.Linq; +using DOAN.Service.exception.IService; + +namespace DOAN.Service.exception.Service +{ + /// + /// 工单修改日志表Service业务层处理 + /// + [AppService(ServiceType = typeof(IProWorkorderUpdateLogService), ServiceLifetime = LifeTime.Transient)] + public class ProWorkorderUpdateLogService : BaseService, IProWorkorderUpdateLogService + { + /// + /// 查询工单修改日志表列表 + /// + /// + /// + public PagedInfo GetList(ProWorkorderUpdateLogQueryDto parm) + { + var predicate = Expressionable.Create(); + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public ProWorkorderUpdateLog GetInfo(string Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加工单修改日志表 + /// + /// + /// + public ProWorkorderUpdateLog AddProWorkorderUpdateLog(ProWorkorderUpdateLog model) + { + return Context.Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改工单修改日志表 + /// + /// + /// + public int UpdateProWorkorderUpdateLog(ProWorkorderUpdateLog model) + { + //var response = Update(w => w.Id == model.Id, it => new ProWorkorderUpdateLog() + //{ + // Workorder = model.Workorder, + // Log = model.Log, + // ResponsiblePerson = model.ResponsiblePerson, + // Reason = model.Reason, + // ChangeTime = model.ChangeTime, + // Operator = model.Operator, + // CreatedTime = model.CreatedTime, + // CreatedBy = model.CreatedBy, + // UpdatedTime = model.UpdatedTime, + // UpdatedBy = model.UpdatedBy, + //}); + //return response; + return Update(model, true); + } + } +} \ No newline at end of file diff --git a/DOAN.Service/MES/product/ProWorkorderService.cs b/DOAN.Service/MES/product/ProWorkorderService.cs index 3fb5d0f..ac87300 100644 --- a/DOAN.Service/MES/product/ProWorkorderService.cs +++ b/DOAN.Service/MES/product/ProWorkorderService.cs @@ -32,6 +32,7 @@ using DOAN.Model.MES.group; using Mapster; using Microsoft.AspNetCore.Authentication; using System.Reflection; +using DOAN.Model.MES.exception; using Infrastructure; using Infrastructure.Converter; using Microsoft.Extensions.Logging; @@ -189,13 +190,13 @@ namespace DOAN.Service.MES.product public int UpdateProWorkorder(ProWorkorder model) { //增加日志 - ProWorkorderUpdateLog logObj = new ProWorkorderUpdateLog(); + /*ProWorkorderUpdateLog logObj = new ProWorkorderUpdateLog(); logObj.Id = XueHua; logObj.Workorder = model.Workorder; logObj.Log = "修改生产工单"; logObj.ChangeTime = DateTime.Now; logObj.Operator = model.CreatedBy; - Context.Insertable(logObj).ExecuteCommand(); + Context.Insertable(logObj).ExecuteCommand();*/ var response = Update(w => w.Id == model.Id, it => new ProWorkorder() {