From b59a522e19cdb5b103b7876dfcf55bdf6eb5f200 Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Tue, 21 May 2024 18:58:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MES/dev/DeviceInspectController.cs | 109 ++++++++++++++++++ ZR.Admin.WebApi/appsettings.Development.json | 4 +- ZR.Model/MES/dev/DeviceInspect.cs | 78 +++++++++++++ ZR.Model/MES/dev/DeviceRelAccountInspect.cs | 57 +++++++++ ZR.Model/MES/dev/Dto/DeviceInspectDto.cs | 47 ++++++++ ZR.Service/MES/dev/DeviceAccountService.cs | 2 +- ZR.Service/MES/dev/DeviceInspectService.cs | 88 ++++++++++++++ ZR.Service/MES/dev/DeviceTypeService.cs | 10 +- .../MES/dev/IService/IDeviceInspectService.cs | 24 ++++ .../MES/dev/IService/IDeviceTypeService.cs | 4 - 10 files changed, 410 insertions(+), 13 deletions(-) create mode 100644 ZR.Admin.WebApi/Controllers/MES/dev/DeviceInspectController.cs create mode 100644 ZR.Model/MES/dev/DeviceInspect.cs create mode 100644 ZR.Model/MES/dev/DeviceRelAccountInspect.cs create mode 100644 ZR.Model/MES/dev/Dto/DeviceInspectDto.cs create mode 100644 ZR.Service/MES/dev/DeviceInspectService.cs create mode 100644 ZR.Service/MES/dev/IService/IDeviceInspectService.cs diff --git a/ZR.Admin.WebApi/Controllers/MES/dev/DeviceInspectController.cs b/ZR.Admin.WebApi/Controllers/MES/dev/DeviceInspectController.cs new file mode 100644 index 0000000..da93161 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/MES/dev/DeviceInspectController.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-21 +namespace ZR.Admin.WebApi.Controllers +{ + /// + /// 设备检查项 + /// + [Verify] + [Route("mes/deviceManagement/DeviceInspect")] + public class DeviceInspectController : BaseController + { + /// + /// 设备检查项接口 + /// + private readonly IDeviceInspectService _DeviceInspectService; + + public DeviceInspectController(IDeviceInspectService DeviceInspectService) + { + _DeviceInspectService = DeviceInspectService; + } + + /// + /// 查询设备检查项列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:list")] + public IActionResult QueryDeviceInspect([FromQuery] DeviceInspectQueryDto parm) + { + var response = _DeviceInspectService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询设备检查项详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:query")] + public IActionResult GetDeviceInspect(int Id) + { + var response = _DeviceInspectService.GetInfo(Id); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加设备检查项 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:add")] + [Log(Title = "设备检查项", BusinessType = BusinessType.INSERT)] + public IActionResult AddDeviceInspect([FromBody] DeviceInspectDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _DeviceInspectService.AddDeviceInspect(modal); + + return SUCCESS(response); + } + + /// + /// 更新设备检查项 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:edit")] + [Log(Title = "设备检查项", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateDeviceInspect([FromBody] DeviceInspectDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _DeviceInspectService.UpdateDeviceInspect(modal); + + return ToResponse(response); + } + + /// + /// 删除设备检查项 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "deviceManagement:deviceinspect:delete")] + [Log(Title = "设备检查项", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteDeviceInspect(string ids) + { + int[] idsArr = Tools.SpitIntArrary(ids); + if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } + + var response = _DeviceInspectService.Delete(idsArr); + + return ToResponse(response); + } + + + + + } +} \ No newline at end of file diff --git a/ZR.Admin.WebApi/appsettings.Development.json b/ZR.Admin.WebApi/appsettings.Development.json index 6df804e..6b89bf0 100644 --- a/ZR.Admin.WebApi/appsettings.Development.json +++ b/ZR.Admin.WebApi/appsettings.Development.json @@ -8,7 +8,7 @@ }, "dbConfigs": [ { - "Conn": "Data Source=192.168.0.36;User ID=root;Password=doantech123;Initial Catalog=GXAssembly;Port=3306", + "Conn": "Data Source=192.168.0.10;User ID=root;Password=doantech123;Initial Catalog=GXAssembly;Port=3306", "DbType": 0, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3,PgSql = 4 "ConfigId": "0", //多租户唯一标识 "IsAutoCloseConnection": true @@ -18,7 +18,7 @@ //代码生成数据库配置 "CodeGenDbConfig": { //代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名 - "Conn": "Data Source=192.168.0.36;User ID=root;Password=doantech123;Initial Catalog={dbName};", + "Conn": "Data Source=192.168.0.10;User ID=root;Password=doantech123;Initial Catalog={dbName};", "DbType": 0, "IsAutoCloseConnection": true, "DbName": "GXAssembly" //代码生成默认连接数据库,Oracle库是实例的名称 diff --git a/ZR.Model/MES/dev/DeviceInspect.cs b/ZR.Model/MES/dev/DeviceInspect.cs new file mode 100644 index 0000000..3276c95 --- /dev/null +++ b/ZR.Model/MES/dev/DeviceInspect.cs @@ -0,0 +1,78 @@ + +namespace ZR.Model.MES.dev +{ + /// + /// 设备检查项 + /// + [SugarTable("device_inspect")] + public class DeviceInspect + { + /// + /// id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + + + /// + /// 图片 + /// + public string Image { get; set; } + + /// + /// 检查顺序 + /// + public int? Sort { get; set; } + + /// + /// 检查项类型(重点) + /// + public string Type { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + + /// + /// 检查项状态 + /// + public string Status { get; set; } + + /// + /// 描述 + /// + public string Descride { get; set; } + + /// + /// 检查项名称 + /// + public string Name { 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/DeviceRelAccountInspect.cs b/ZR.Model/MES/dev/DeviceRelAccountInspect.cs new file mode 100644 index 0000000..a60739b --- /dev/null +++ b/ZR.Model/MES/dev/DeviceRelAccountInspect.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ZR.Model.MES.dev +{ + /// + /// 设备检查项与设备台账关联表 + /// + [SugarTable("device_rel_account_inspect")] + public class DeviceRelAccountInspect + { + /// + /// 设备检项id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_inspect_id")] + public int FkInspectId { get; set; } + + /// + /// 设备台账id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_account_id")] + public int FkAccountId { get; set; } + + /// + /// 序号 + /// + public int? Sort { 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/DeviceInspectDto.cs b/ZR.Model/MES/dev/Dto/DeviceInspectDto.cs new file mode 100644 index 0000000..925c051 --- /dev/null +++ b/ZR.Model/MES/dev/Dto/DeviceInspectDto.cs @@ -0,0 +1,47 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.MES.dev +{ + /// + /// 设备检查项查询对象 + /// + public class DeviceInspectQueryDto : PagerInfo + { + } + + /// + /// 设备检查项输入输出对象 + /// + public class DeviceInspectDto + { + [Required(ErrorMessage = "id不能为空")] + public int Id { get; set; } + + + + public string Image { get; set; } + + public int? Sort { get; set; } + + public string Type { get; set; } + + public string Remark { get; set; } + + public string Status { get; set; } + + public string Descride { get; set; } + + public string Name { 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/DeviceAccountService.cs b/ZR.Service/MES/dev/DeviceAccountService.cs index edc0f53..58d4879 100644 --- a/ZR.Service/MES/dev/DeviceAccountService.cs +++ b/ZR.Service/MES/dev/DeviceAccountService.cs @@ -10,7 +10,7 @@ using System.Linq; using ZR.Model.MES.dev; using ZR.Model.MES.dev.Dto; -namespace ZR.Service.Business +namespace ZR.Service.MES.dev { /// /// 设备台账Service业务层处理 diff --git a/ZR.Service/MES/dev/DeviceInspectService.cs b/ZR.Service/MES/dev/DeviceInspectService.cs new file mode 100644 index 0000000..651c0d6 --- /dev/null +++ b/ZR.Service/MES/dev/DeviceInspectService.cs @@ -0,0 +1,88 @@ +using System; +using SqlSugar; +using Infrastructure.Attribute; +using Infrastructure.Extensions; +using ZR.Model; + + +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(IDeviceInspectService), ServiceLifetime = LifeTime.Transient)] + public class DeviceInspectService : BaseService, IDeviceInspectService + { + /// + /// 查询设备检查项列表 + /// + /// + /// + public PagedInfo GetList(DeviceInspectQueryDto parm) + { + var predicate = Expressionable.Create(); + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public DeviceInspect GetInfo(int Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加设备检查项 + /// + /// + /// + public DeviceInspect AddDeviceInspect(DeviceInspect model) + { + return Context.Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改设备检查项 + /// + /// + /// + public int UpdateDeviceInspect(DeviceInspect model) + { + //var response = Update(w => w.Id == model.Id, it => new DeviceInspect() + //{ + // Image = model.Image, + // Sort = model.Sort, + // Type = model.Type, + // Remark = model.Remark, + // Status = model.Status, + // Name = model.Name, + // 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/DeviceTypeService.cs b/ZR.Service/MES/dev/DeviceTypeService.cs index 552fc36..11db466 100644 --- a/ZR.Service/MES/dev/DeviceTypeService.cs +++ b/ZR.Service/MES/dev/DeviceTypeService.cs @@ -21,7 +21,7 @@ namespace ZR.Service.MES.dev [AppService(ServiceType = typeof(IDeviceTypeService), ServiceLifetime = LifeTime.Transient)] public class DeviceTypeService : BaseService, IDeviceTypeService { - + /// /// 查询1.设备类型列表 /// @@ -40,11 +40,8 @@ namespace ZR.Service.MES.dev return response.Adapt>(); } - public int UpdateDeviceType(DeviceType parm) - { - throw new NotImplementedException(); - } - } + + /// /// 获取详情 @@ -95,4 +92,5 @@ namespace ZR.Service.MES.dev } } + } \ No newline at end of file diff --git a/ZR.Service/MES/dev/IService/IDeviceInspectService.cs b/ZR.Service/MES/dev/IService/IDeviceInspectService.cs new file mode 100644 index 0000000..f20de55 --- /dev/null +++ b/ZR.Service/MES/dev/IService/IDeviceInspectService.cs @@ -0,0 +1,24 @@ +using System; +using ZR.Model; + + +using System.Collections.Generic; +using ZR.Model.MES.dev; + +namespace ZR.Service.MES.dev.IService +{ + /// + /// 设备检查项service接口 + /// + public interface IDeviceInspectService : IBaseService + { + PagedInfo GetList(DeviceInspectQueryDto parm); + + DeviceInspect GetInfo(int Id); + + DeviceInspect AddDeviceInspect(DeviceInspect parm); + + int UpdateDeviceInspect(DeviceInspect parm); + + } +} diff --git a/ZR.Service/MES/dev/IService/IDeviceTypeService.cs b/ZR.Service/MES/dev/IService/IDeviceTypeService.cs index 522f794..7545491 100644 --- a/ZR.Service/MES/dev/IService/IDeviceTypeService.cs +++ b/ZR.Service/MES/dev/IService/IDeviceTypeService.cs @@ -15,10 +15,6 @@ namespace ZR.Service.MES.dev.IService { List GetList(DeviceTypeQueryDto parm); - - - - DeviceType GetInfo(int Id); DeviceType AddDeviceType(DeviceType parm);