设备检查下

This commit is contained in:
qianhao.xu 2024-05-22 14:39:35 +08:00
parent 339695dad0
commit a3d2234b4a
6 changed files with 310 additions and 1 deletions

View File

@ -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;

View File

@ -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
{
/// <summary>
/// 设备检查项表单配置表
/// </summary>
[Verify]
[Route("business/DeviceFormConfig")]
public class DeviceFormConfigController : BaseController
{
/// <summary>
/// 设备检查项表单配置表接口
/// </summary>
private readonly IDeviceFormConfigService _DeviceFormConfigService;
public DeviceFormConfigController(IDeviceFormConfigService DeviceFormConfigService)
{
_DeviceFormConfigService = DeviceFormConfigService;
}
/// <summary>
/// 查询设备检查项表单配置表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "business:deviceformconfig:list")]
public IActionResult QueryDeviceFormConfig([FromQuery] DeviceFormConfigQueryDto parm)
{
var response = _DeviceFormConfigService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询设备检查项表单配置表详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "business:deviceformconfig:query")]
public IActionResult GetDeviceFormConfig(string Id)
{
var response = _DeviceFormConfigService.GetInfo(Id);
var info = response.Adapt<DeviceFormConfig>();
return SUCCESS(info);
}
/// <summary>
/// 添加设备检查项表单配置表
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "business:deviceformconfig:add")]
[Log(Title = "设备检查项表单配置表", BusinessType = BusinessType.INSERT)]
public IActionResult AddDeviceFormConfig([FromBody] DeviceFormConfigDto parm)
{
var modal = parm.Adapt<DeviceFormConfig>().ToCreate(HttpContext);
var response = _DeviceFormConfigService.AddDeviceFormConfig(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新设备检查项表单配置表
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "business:deviceformconfig:edit")]
[Log(Title = "设备检查项表单配置表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateDeviceFormConfig([FromBody] DeviceFormConfigDto parm)
{
var modal = parm.Adapt<DeviceFormConfig>().ToUpdate(HttpContext);
var response = _DeviceFormConfigService.UpdateDeviceFormConfig(modal);
return ToResponse(response);
}
/// <summary>
/// 删除设备检查项表单配置表
/// </summary>
/// <returns></returns>
[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);
}
}
}

View File

@ -0,0 +1,56 @@
namespace ZR.Model.MES.dev
{
/// <summary>
/// 设备检查项表单配置表
/// </summary>
[SugarTable("device_form_config")]
public class DeviceFormConfig
{
/// <summary>
/// id 雪花
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
public string Id { get; set; }
/// <summary>
/// 设备检查项id
/// </summary>
[SugarColumn(ColumnName = "fk_device_inspect_id")]
public string FkDeviceInspectId { get; set; }
/// <summary>
/// 表单类型
/// </summary>
public int? Type { get; set; }
/// <summary>
/// 表单选项内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 创建人
/// </summary>
[SugarColumn(ColumnName = "cREATED_BY")]
public string CreatedBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnName = "cREATED_TIME")]
public DateTime? CreatedTime { get; set; }
/// <summary>
/// 更新人
/// </summary>
[SugarColumn(ColumnName = "uPDATED_BY")]
public string UpdatedBy { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[SugarColumn(ColumnName = "uPDATED_TIME")]
public DateTime? UpdatedTime { get; set; }
}
}

View File

@ -0,0 +1,37 @@
using System.ComponentModel.DataAnnotations;
namespace ZR.Model.MES.dev
{
/// <summary>
/// 设备检查项表单配置表查询对象
/// </summary>
public class DeviceFormConfigQueryDto : PagerInfo
{
}
/// <summary>
/// 设备检查项表单配置表输入输出对象
/// </summary>
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; }
}
}

View File

@ -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
{
/// <summary>
/// 设备检查项表单配置表Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IDeviceFormConfigService), ServiceLifetime = LifeTime.Transient)]
public class DeviceFormConfigService : BaseService<DeviceFormConfig>, IDeviceFormConfigService
{
/// <summary>
/// 查询设备检查项表单配置表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<DeviceFormConfigDto> GetList(DeviceFormConfigQueryDto parm)
{
var predicate = Expressionable.Create<DeviceFormConfig>();
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<DeviceFormConfig, DeviceFormConfigDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public DeviceFormConfig GetInfo(string Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加设备检查项表单配置表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public DeviceFormConfig AddDeviceFormConfig(DeviceFormConfig model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改设备检查项表单配置表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
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);
}
}
}

View File

@ -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
{
/// <summary>
/// 设备检查项表单配置表service接口
/// </summary>
public interface IDeviceFormConfigService : IBaseService<DeviceFormConfig>
{
PagedInfo<DeviceFormConfigDto> GetList(DeviceFormConfigQueryDto parm);
DeviceFormConfig GetInfo(string Id);
DeviceFormConfig AddDeviceFormConfig(DeviceFormConfig parm);
int UpdateDeviceFormConfig(DeviceFormConfig parm);
}
}