From a3d2234b4a0279c8a4db5e7343c7fc02b0909b2c Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Wed, 22 May 2024 14:39:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=A3=80=E6=9F=A5=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Infrastructure/WebExtensions/LogoExtension.cs | 2 +- .../MES/dev/DeviceFormConfigController.cs | 109 ++++++++++++++++++ ZR.Model/MES/dev/DeviceFormConfig.cs | 56 +++++++++ ZR.Model/MES/dev/Dto/DeviceFormConfigDto.cs | 37 ++++++ ZR.Service/MES/dev/DeviceFormConfigService.cs | 84 ++++++++++++++ .../dev/IService/IDeviceFormConfigService.cs | 23 ++++ 6 files changed, 310 insertions(+), 1 deletion(-) create mode 100644 ZR.Admin.WebApi/Controllers/MES/dev/DeviceFormConfigController.cs create mode 100644 ZR.Model/MES/dev/DeviceFormConfig.cs create mode 100644 ZR.Model/MES/dev/Dto/DeviceFormConfigDto.cs create mode 100644 ZR.Service/MES/dev/DeviceFormConfigService.cs create mode 100644 ZR.Service/MES/dev/IService/IDeviceFormConfigService.cs diff --git a/Infrastructure/WebExtensions/LogoExtension.cs b/Infrastructure/WebExtensions/LogoExtension.cs index a8061cd..af2d75a 100644 --- a/Infrastructure/WebExtensions/LogoExtension.cs +++ b/Infrastructure/WebExtensions/LogoExtension.cs @@ -9,7 +9,7 @@ namespace Infrastructure { public static void AddLogo(this IServiceCollection services) { - Console.ForegroundColor = ConsoleColor.Red; + Console.ForegroundColor = ConsoleColor.White; var contentTpl = JnHelper.ReadTemplate("", "logo.txt"); var content = contentTpl?.Render(); var context = App.HttpContext; diff --git a/ZR.Admin.WebApi/Controllers/MES/dev/DeviceFormConfigController.cs b/ZR.Admin.WebApi/Controllers/MES/dev/DeviceFormConfigController.cs new file mode 100644 index 0000000..675496b --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/MES/dev/DeviceFormConfigController.cs @@ -0,0 +1,109 @@ +using Microsoft.AspNetCore.Mvc; +using ZR.Model.Dto; + +using ZR.Admin.WebApi.Filters; +using ZR.Service.MES.dev.IService; +using ZR.Model.MES.dev; + +//创建时间:2024-05-22 +namespace ZR.Admin.WebApi.Controllers +{ + /// + /// 设备检查项表单配置表 + /// + [Verify] + [Route("business/DeviceFormConfig")] + public class DeviceFormConfigController : BaseController + { + /// + /// 设备检查项表单配置表接口 + /// + private readonly IDeviceFormConfigService _DeviceFormConfigService; + + public DeviceFormConfigController(IDeviceFormConfigService DeviceFormConfigService) + { + _DeviceFormConfigService = DeviceFormConfigService; + } + + /// + /// 查询设备检查项表单配置表列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "business:deviceformconfig:list")] + public IActionResult QueryDeviceFormConfig([FromQuery] DeviceFormConfigQueryDto parm) + { + var response = _DeviceFormConfigService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询设备检查项表单配置表详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "business:deviceformconfig:query")] + public IActionResult GetDeviceFormConfig(string Id) + { + var response = _DeviceFormConfigService.GetInfo(Id); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加设备检查项表单配置表 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "business:deviceformconfig:add")] + [Log(Title = "设备检查项表单配置表", BusinessType = BusinessType.INSERT)] + public IActionResult AddDeviceFormConfig([FromBody] DeviceFormConfigDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _DeviceFormConfigService.AddDeviceFormConfig(modal); + + return SUCCESS(response); + } + + /// + /// 更新设备检查项表单配置表 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "business:deviceformconfig:edit")] + [Log(Title = "设备检查项表单配置表", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateDeviceFormConfig([FromBody] DeviceFormConfigDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _DeviceFormConfigService.UpdateDeviceFormConfig(modal); + + return ToResponse(response); + } + + /// + /// 删除设备检查项表单配置表 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "business:deviceformconfig:delete")] + [Log(Title = "设备检查项表单配置表", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteDeviceFormConfig(string ids) + { + int[] idsArr = Tools.SpitIntArrary(ids); + if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } + + var response = _DeviceFormConfigService.Delete(idsArr); + + return ToResponse(response); + } + + + + + } +} \ No newline at end of file diff --git a/ZR.Model/MES/dev/DeviceFormConfig.cs b/ZR.Model/MES/dev/DeviceFormConfig.cs new file mode 100644 index 0000000..bd2e06b --- /dev/null +++ b/ZR.Model/MES/dev/DeviceFormConfig.cs @@ -0,0 +1,56 @@ +namespace ZR.Model.MES.dev +{ + /// + /// 设备检查项表单配置表 + /// + [SugarTable("device_form_config")] + public class DeviceFormConfig + { + /// + /// id 雪花 + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false)] + public string Id { get; set; } + + /// + /// 设备检查项id + /// + [SugarColumn(ColumnName = "fk_device_inspect_id")] + public string FkDeviceInspectId { get; set; } + + /// + /// 表单类型 + /// + public int? Type { get; set; } + + /// + /// 表单选项内容 + /// + public string Content { 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/dev/Dto/DeviceFormConfigDto.cs b/ZR.Model/MES/dev/Dto/DeviceFormConfigDto.cs new file mode 100644 index 0000000..a4e58ab --- /dev/null +++ b/ZR.Model/MES/dev/Dto/DeviceFormConfigDto.cs @@ -0,0 +1,37 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.MES.dev +{ + /// + /// 设备检查项表单配置表查询对象 + /// + public class DeviceFormConfigQueryDto : PagerInfo + { + } + + /// + /// 设备检查项表单配置表输入输出对象 + /// + public class DeviceFormConfigDto + { + [Required(ErrorMessage = "id 雪花不能为空")] + public string Id { get; set; } + + public string FkDeviceInspectId { get; set; } + + public int? Type { get; set; } + + public string Content { 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.Service/MES/dev/DeviceFormConfigService.cs b/ZR.Service/MES/dev/DeviceFormConfigService.cs new file mode 100644 index 0000000..33e35dc --- /dev/null +++ b/ZR.Service/MES/dev/DeviceFormConfigService.cs @@ -0,0 +1,84 @@ +using System; +using SqlSugar; +using Infrastructure.Attribute; +using Infrastructure.Extensions; +using ZR.Model; +using ZR.Model.Dto; + +using ZR.Repository; +using ZR.Service.Business.IBusinessService; +using System.Linq; +using ZR.Service.MES.dev.IService; +using ZR.Model.MES.dev; + +namespace ZR.Service.MES.dev +{ + /// + /// 设备检查项表单配置表Service业务层处理 + /// + [AppService(ServiceType = typeof(IDeviceFormConfigService), ServiceLifetime = LifeTime.Transient)] + public class DeviceFormConfigService : BaseService, IDeviceFormConfigService + { + /// + /// 查询设备检查项表单配置表列表 + /// + /// + /// + public PagedInfo GetList(DeviceFormConfigQueryDto parm) + { + var predicate = Expressionable.Create(); + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public DeviceFormConfig GetInfo(string Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加设备检查项表单配置表 + /// + /// + /// + public DeviceFormConfig AddDeviceFormConfig(DeviceFormConfig model) + { + return Context.Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改设备检查项表单配置表 + /// + /// + /// + public int UpdateDeviceFormConfig(DeviceFormConfig model) + { + //var response = Update(w => w.Id == model.Id, it => new DeviceFormConfig() + //{ + // Type = model.Type, + // Content = model.Content, + // CreatedBy = model.CreatedBy, + // CreatedTime = model.CreatedTime, + // UpdatedBy = model.UpdatedBy, + // UpdatedTime = model.UpdatedTime, + //}); + //return response; + return Update(model, true); + } + + } +} \ No newline at end of file diff --git a/ZR.Service/MES/dev/IService/IDeviceFormConfigService.cs b/ZR.Service/MES/dev/IService/IDeviceFormConfigService.cs new file mode 100644 index 0000000..cf9fc98 --- /dev/null +++ b/ZR.Service/MES/dev/IService/IDeviceFormConfigService.cs @@ -0,0 +1,23 @@ +using System; +using ZR.Model; +using ZR.Model.Dto; +using System.Collections.Generic; +using ZR.Model.MES.dev; + +namespace ZR.Service.MES.dev.IService +{ + /// + /// 设备检查项表单配置表service接口 + /// + public interface IDeviceFormConfigService : IBaseService + { + PagedInfo GetList(DeviceFormConfigQueryDto parm); + + DeviceFormConfig GetInfo(string Id); + + DeviceFormConfig AddDeviceFormConfig(DeviceFormConfig parm); + + int UpdateDeviceFormConfig(DeviceFormConfig parm); + + } +}