From 4e8dcb6677b3263d40d10b989a7946c5cecfa553 Mon Sep 17 00:00:00 2001 From: quowingwang Date: Tue, 3 Mar 2026 19:46:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E7=81=AF=E5=8C=BA=E5=9F=9F=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=AE=89=E6=8E=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/andon/AndonWorkTimeController.cs | 103 ++++++++++++++++++ ...y-4c5a762f-ed89-4b83-9e83-1c6332c4533c.xml | 16 +++ ZR.Admin.WebApi/Program.cs | 6 +- ZR.Admin.WebApi/appsettings.development.json | 6 +- ZR.Model/MES/andon/AndonAlarmRecord.cs | 6 + ZR.Model/MES/andon/AndonWorkTime.cs | 66 +++++++++++ ZR.Model/MES/andon/Dto/AndonAlarmRecordDto.cs | 2 + ZR.Model/MES/andon/Dto/AndonWorkTimeDto.cs | 42 +++++++ ZR.Model/ZR.Model.csproj | 1 - ZR.Service/ZR.Service.csproj | 1 - ZR.Service/mes/andon/AndonWorkTimeService.cs | 83 ++++++++++++++ .../andon/IService/IAndonWorkTimeService.cs | 25 +++++ 12 files changed, 350 insertions(+), 7 deletions(-) create mode 100644 ZR.Admin.WebApi/Controllers/mes/andon/AndonWorkTimeController.cs create mode 100644 ZR.Admin.WebApi/DataProtection/key-4c5a762f-ed89-4b83-9e83-1c6332c4533c.xml create mode 100644 ZR.Model/MES/andon/AndonWorkTime.cs create mode 100644 ZR.Model/MES/andon/Dto/AndonWorkTimeDto.cs create mode 100644 ZR.Service/mes/andon/AndonWorkTimeService.cs create mode 100644 ZR.Service/mes/andon/IService/IAndonWorkTimeService.cs diff --git a/ZR.Admin.WebApi/Controllers/mes/andon/AndonWorkTimeController.cs b/ZR.Admin.WebApi/Controllers/mes/andon/AndonWorkTimeController.cs new file mode 100644 index 00000000..9d1e49ac --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/andon/AndonWorkTimeController.cs @@ -0,0 +1,103 @@ +using Microsoft.AspNetCore.Mvc; +using ZR.Admin.WebApi.Extensions; +using ZR.Admin.WebApi.Filters; +using ZR.Model.MES.andon; +using ZR.Model.MES.andon.Dto; +using ZR.Service.mes.andon.Iservice; + +//创建时间:2025-12-10 +namespace ZR.Admin.WebApi.Controllers.andon +{ + /// + /// 安灯区域工作时间表 + /// + [Route("mes/AndonWorkTime")] + [AllowAnonymous] + public class AndonWorkTimeController : BaseController + { + /// + /// 安灯区域工作时间表接口 + /// + private readonly IAndonWorkTimeService _AndonWorkTimeService; + + public AndonWorkTimeController(IAndonWorkTimeService AndonWorkTimeService) + { + _AndonWorkTimeService = AndonWorkTimeService; + } + + /// + /// 查询安灯区域工作时间表列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "andonworktime:list")] + public IActionResult QueryAndonWorkTime([FromQuery] AndonWorkTimeQueryDto parm) + { + var response = _AndonWorkTimeService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询安灯区域工作时间表详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "andonworktime:query")] + public IActionResult GetAndonWorkTime(int Id) + { + var response = _AndonWorkTimeService.GetInfo(Id); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加安灯区域工作时间表 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "andonworktime:add")] + [Log(Title = "安灯区域工作时间表", BusinessType = BusinessType.INSERT)] + public IActionResult AddAndonWorkTime([FromBody] AndonWorkTimeDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _AndonWorkTimeService.AddAndonWorkTime(modal); + + return SUCCESS(response); + } + + /// + /// 更新安灯区域工作时间表 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "andonworktime:edit")] + [Log(Title = "安灯区域工作时间表", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateAndonWorkTime([FromBody] AndonWorkTimeDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _AndonWorkTimeService.UpdateAndonWorkTime(modal); + + return ToResponse(response); + } + + /// + /// 删除安灯区域工作时间表 + /// + /// + [HttpPost("delete/{ids}")] + [ActionPermissionFilter(Permission = "andonworktime:delete")] + [Log(Title = "安灯区域工作时间表", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteAndonWorkTime([FromRoute]string ids) + { + var idArr = Tools.SplitAndConvert(ids); + + return ToResponse(_AndonWorkTimeService.Delete(idArr)); + } + + } +} \ No newline at end of file diff --git a/ZR.Admin.WebApi/DataProtection/key-4c5a762f-ed89-4b83-9e83-1c6332c4533c.xml b/ZR.Admin.WebApi/DataProtection/key-4c5a762f-ed89-4b83-9e83-1c6332c4533c.xml new file mode 100644 index 00000000..5be50190 --- /dev/null +++ b/ZR.Admin.WebApi/DataProtection/key-4c5a762f-ed89-4b83-9e83-1c6332c4533c.xml @@ -0,0 +1,16 @@ + + + 2026-03-02T01:41:42.9641519Z + 2026-03-02T01:41:42.5206762Z + 2026-05-31T01:41:42.5206762Z + + + + + + + xfS+ygjRceZfpuNFbvY8bQrghrWegseQPBcKncW1jPTWeDqcSTdGFQDrwgGsUpK3jcoNVz8mQPy2/IQyhMH8QQ== + + + + \ No newline at end of file diff --git a/ZR.Admin.WebApi/Program.cs b/ZR.Admin.WebApi/Program.cs index a9d03142..23fe84a4 100644 --- a/ZR.Admin.WebApi/Program.cs +++ b/ZR.Admin.WebApi/Program.cs @@ -21,12 +21,12 @@ using ZR.Service.Utils.MyAlarmLigth; var builder = WebApplication.CreateBuilder(args); //后台定时任务 -//builder.Services.AddHostedService(); -//builder.Services.AddHostedService(); +builder.Services.AddHostedService(); +builder.Services.AddHostedService(); // Add services to the container. - builder.Services.AddControllers(); +builder.Services.AddControllers(); //配置中心 //builder.Configuration.AddNacosV2Configuration(builder.Configuration.GetSection("NacosConfig")); //服务注册 diff --git a/ZR.Admin.WebApi/appsettings.development.json b/ZR.Admin.WebApi/appsettings.development.json index 450a27a7..094f10b9 100644 --- a/ZR.Admin.WebApi/appsettings.development.json +++ b/ZR.Admin.WebApi/appsettings.development.json @@ -15,7 +15,8 @@ //外网连接服务器 // "Conn": "Data Source=47.116.122.230;Port=3307;User ID=root;Password=123456;Initial Catalog=ZrAdmin;", - "Conn": "Data Source=139.224.232.211;User ID=root;Password=doantech123;Initial Catalog=ZrAdmin;Port=3308;AllowLoadLocalInfile=true", + //"Conn": "Data Source=139.224.232.211;User ID=root;Password=doantech123;Initial Catalog=ZrAdmin;Port=3308;AllowLoadLocalInfile=true", + "Conn": "Data Source=47.101.40.214;User ID=root;Password=Rizo123456@;Initial Catalog=ZrAdmin;Port=3306;", //"Conn": "Data Source=192.168.1.48;User ID=root;Password=123456;Initial Catalog=ZrAdmin;Port=3306;AllowLoadLocalInfile=true", //"Conn": "Data Source=127.0.0.1;User ID=root;Password=123456;Initial Catalog=ZrAdmin;Port=3306;AllowLoadLocalInfile=true", // 干巷服务器 @@ -33,7 +34,8 @@ "CodeGenDbConfig": { //代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名 //"Conn": "Data Source=139.224.232.211;User ID=root;Password=doantech123;Initial Catalog={dbName};Port=3308", - "Conn": "Data Source=192.168.1.48;User ID=root;Password=123456;Initial Catalog={dbName};Port=3306", + //"Conn": "Data Source=192.168.1.48;User ID=root;Password=123456;Initial Catalog={dbName};Port=3306", + "Conn": "Data Source=47.101.40.214;User ID=root;Password=Rizo123456@;Initial Catalog={dbName};Port=3306", "DbType": 0, "IsAutoCloseConnection": true, "DbName": "ZrAdmin" //代码生成默认连接数据库 diff --git a/ZR.Model/MES/andon/AndonAlarmRecord.cs b/ZR.Model/MES/andon/AndonAlarmRecord.cs index 815f8474..949cf961 100644 --- a/ZR.Model/MES/andon/AndonAlarmRecord.cs +++ b/ZR.Model/MES/andon/AndonAlarmRecord.cs @@ -116,6 +116,12 @@ namespace ZR.Model.MES.andon [SugarColumn(ColumnName = "remarks")] public string Remarks { get; set; } + /// + /// 故障开始时间 + /// + [SugarColumn(ColumnName = "faulttime")] + public DateTime? FaultTime { get; set; } + /// /// 创建人 /// diff --git a/ZR.Model/MES/andon/AndonWorkTime.cs b/ZR.Model/MES/andon/AndonWorkTime.cs new file mode 100644 index 00000000..763ed815 --- /dev/null +++ b/ZR.Model/MES/andon/AndonWorkTime.cs @@ -0,0 +1,66 @@ + +namespace ZR.Model.MES.andon +{ + /// + /// 安灯区域工作时间表 + /// + [SugarTable("andon_work_time")] + public class AndonWorkTime + { + /// + /// 主键 + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 父区域 + /// + public string Area1 { get; set; } + + /// + /// 子区域 + /// + public string Area2 { get; set; } + + /// + /// 起始时间 + /// + public DateTime? Starttime { get; set; } + + /// + /// 停止时间 + /// + public DateTime? Endtime { get; set; } + + /// + /// 工作时长(分钟) + /// + public int? Workminute { get; set; } + + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "created_by")] + public string CreatedBy { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "created_time")] + public DateTime? CreatedTime { get; set; } + + /// + /// 更新人 + /// + [SugarColumn(ColumnName = "updated_by")] + public string UpdatedBy { get; set; } + + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "updated_time")] + public DateTime? UpdatedTime { get; set; } + + } +} \ No newline at end of file diff --git a/ZR.Model/MES/andon/Dto/AndonAlarmRecordDto.cs b/ZR.Model/MES/andon/Dto/AndonAlarmRecordDto.cs index 53c04c7a..d39f99be 100644 --- a/ZR.Model/MES/andon/Dto/AndonAlarmRecordDto.cs +++ b/ZR.Model/MES/andon/Dto/AndonAlarmRecordDto.cs @@ -57,6 +57,8 @@ namespace ZR.Model.MES.andon.Dto public string Receiver4 { get; set; } [ExcelColumn(Name = "四级接收人")] public string Receiver4Name { get; set; } + [ExcelColumn(Name = "故障开始时间")] + public DateTime? FaultTime { get; set; } [ExcelColumn(Ignore = true)] public int? Sequence { get; set; } [ExcelColumn(Name = "停机持续时间")] diff --git a/ZR.Model/MES/andon/Dto/AndonWorkTimeDto.cs b/ZR.Model/MES/andon/Dto/AndonWorkTimeDto.cs new file mode 100644 index 00000000..ad4fdbd8 --- /dev/null +++ b/ZR.Model/MES/andon/Dto/AndonWorkTimeDto.cs @@ -0,0 +1,42 @@ + +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.MES.andon.Dto +{ + /// + /// 安灯区域工作时间表查询对象 + /// + public class AndonWorkTimeQueryDto : PagerInfo + { + } + + /// + /// 安灯区域工作时间表输入输出对象 + /// + public class AndonWorkTimeDto + { + [Required(ErrorMessage = "主键不能为空")] + public int Id { get; set; } + + public string Area1 { get; set; } + + public string Area2 { get; set; } + + public DateTime Starttime { get; set; } + + public DateTime Endtime { get; set; } + + public int Workminute { get; set; } + + public string? CreatedBy { get; set; } + + public DateTime? CreatedTime { get; set; } + + public string? UpdatedBy { get; set; } + + public DateTime? UpdatedTime { get; set; } + + + + } +} \ No newline at end of file diff --git a/ZR.Model/ZR.Model.csproj b/ZR.Model/ZR.Model.csproj index acc685cb..360fce37 100644 --- a/ZR.Model/ZR.Model.csproj +++ b/ZR.Model/ZR.Model.csproj @@ -26,7 +26,6 @@ - diff --git a/ZR.Service/ZR.Service.csproj b/ZR.Service/ZR.Service.csproj index 79aa4f83..2f1cc866 100644 --- a/ZR.Service/ZR.Service.csproj +++ b/ZR.Service/ZR.Service.csproj @@ -24,7 +24,6 @@ - diff --git a/ZR.Service/mes/andon/AndonWorkTimeService.cs b/ZR.Service/mes/andon/AndonWorkTimeService.cs new file mode 100644 index 00000000..31ed3fe7 --- /dev/null +++ b/ZR.Service/mes/andon/AndonWorkTimeService.cs @@ -0,0 +1,83 @@ +using Infrastructure.Attribute; +using Infrastructure.Model; +using SqlSugar; +using System; +using ZR.Model; +using ZR.Model.MES.andon; +using ZR.Model.MES.andon.Dto; +using ZR.Repository; +using ZR.Service.mes.andon.Iservice; + + +namespace ZR.Service.mes.andon +{ + /// + /// 安灯区域工作时间表Service业务层处理 + /// + [AppService(ServiceType = typeof(IAndonWorkTimeService), ServiceLifetime = LifeTime.Transient)] + public class AndonWorkTimeService : BaseService, IAndonWorkTimeService + { + /// + /// 查询安灯区域工作时间表列表 + /// + /// + /// + public PagedInfo GetList(AndonWorkTimeQueryDto parm) + { + var predicate = QueryExp(parm); + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public AndonWorkTime GetInfo(int Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加安灯区域工作时间表 + /// + /// + /// + public AndonWorkTime AddAndonWorkTime(AndonWorkTime model) + { + return Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改安灯区域工作时间表 + /// + /// + /// + public int UpdateAndonWorkTime(AndonWorkTime model) + { + return Update(model, true); + } + + /// + /// 查询导出表达式 + /// + /// + /// + private static Expressionable QueryExp(AndonWorkTimeQueryDto parm) + { + var predicate = Expressionable.Create(); + + return predicate; + } + } +} \ No newline at end of file diff --git a/ZR.Service/mes/andon/IService/IAndonWorkTimeService.cs b/ZR.Service/mes/andon/IService/IAndonWorkTimeService.cs new file mode 100644 index 00000000..847471dd --- /dev/null +++ b/ZR.Service/mes/andon/IService/IAndonWorkTimeService.cs @@ -0,0 +1,25 @@ +using System; +using ZR.Model; +using System.Collections.Generic; +using ZR.Model.MES.andon; +using ZR.Model.MES.andon.Dto; +using Infrastructure.Model; + +namespace ZR.Service.mes.andon.Iservice +{ + /// + /// 安灯区域工作时间表service接口 + /// + public interface IAndonWorkTimeService : IBaseService + { + PagedInfo GetList(AndonWorkTimeQueryDto parm); + + AndonWorkTime GetInfo(int Id); + + + AndonWorkTime AddAndonWorkTime(AndonWorkTime parm); + int UpdateAndonWorkTime(AndonWorkTime parm); + + + } +}