上元监控
This commit is contained in:
parent
6d41dadbb8
commit
9957478cb1
@ -0,0 +1,105 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using DOAN.Model.huate_group.CloudMonitor;
|
||||
using DOAN.Model.huate_group.CloudMonitor.Dto;
|
||||
|
||||
using DOAN.Service.huate_group.CloudMonitor;
|
||||
using DOAN.Service.huate_group.CloudMonitor.IService;
|
||||
using DOAN.Admin.WebApi.Filters;
|
||||
|
||||
//创建时间:2024-08-21
|
||||
namespace DOAN.Admin.WebApi.Controllers.Business
|
||||
{
|
||||
/// <summary>
|
||||
/// 小房间热熔焊接
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("huate_group/cloudMonitor/")]
|
||||
public class ZiyuanDevice01Controller : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// 小房间热熔焊接接口
|
||||
/// </summary>
|
||||
private readonly IZiyuanDevice01Service _ZiyuanDevice01Service;
|
||||
|
||||
public ZiyuanDevice01Controller(IZiyuanDevice01Service ZiyuanDevice01Service)
|
||||
{
|
||||
_ZiyuanDevice01Service = ZiyuanDevice01Service;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询小房间热熔焊接列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[ActionPermissionFilter(Permission = "ziyuandevice01:list")]
|
||||
public IActionResult QueryZiyuanDevice01([FromQuery] ZiyuanDevice01QueryDto parm)
|
||||
{
|
||||
if (parm.ReflexAccount_id == 0) { throw new ArgumentException($"{parm.ReflexAccount_id}不存在"); };
|
||||
var response = _ZiyuanDevice01Service.GetList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询小房间热熔焊接详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{Id}")]
|
||||
[ActionPermissionFilter(Permission = "ziyuandevice01:query")]
|
||||
public IActionResult GetZiyuanDevice01(int Id)
|
||||
{
|
||||
var response = _ZiyuanDevice01Service.GetInfo(Id);
|
||||
|
||||
var info = response.Adapt<ZiyuanDevice01Dto>();
|
||||
return SUCCESS(info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加小房间热熔焊接
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ActionPermissionFilter(Permission = "ziyuandevice01:add")]
|
||||
[Log(Title = "小房间热熔焊接", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult AddZiyuanDevice01([FromBody] ZiyuanDevice01Dto parm)
|
||||
{
|
||||
var modal = parm.Adapt<ZiyuanDevice01>().ToCreate(HttpContext);
|
||||
|
||||
var response = _ZiyuanDevice01Service.AddZiyuanDevice01(modal);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新小房间热熔焊接
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ActionPermissionFilter(Permission = "ziyuandevice01:edit")]
|
||||
[Log(Title = "小房间热熔焊接", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult UpdateZiyuanDevice01([FromBody] ZiyuanDevice01Dto parm)
|
||||
{
|
||||
var modal = parm.Adapt<ZiyuanDevice01>().ToUpdate(HttpContext);
|
||||
var response = _ZiyuanDevice01Service.UpdateZiyuanDevice01(modal);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除小房间热熔焊接
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete/{ids}")]
|
||||
[ActionPermissionFilter(Permission = "ziyuandevice01:delete")]
|
||||
[Log(Title = "小房间热熔焊接", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteZiyuanDevice01([FromRoute]string ids)
|
||||
{
|
||||
var idArr = Tools.SplitAndConvert<int>(ids);
|
||||
|
||||
return ToResponse(_ZiyuanDevice01Service.Delete(idArr));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
47
DOAN.Model/ReflexAccount.cs
Normal file
47
DOAN.Model/ReflexAccount.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DOAN.Model
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 设备表含义
|
||||
/// </summary>
|
||||
[SugarTable("reflex_account")]
|
||||
public class ReflexAccount
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// FkTenantId
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fk_tenant_id")]
|
||||
public int? FkTenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表名
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "table_code")]
|
||||
public string TableCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "table_name")]
|
||||
public string TableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Status
|
||||
/// </summary>
|
||||
public int? Status { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
87
DOAN.Model/huate_group/CloudMonitor/Dto/ZiyuanDevice01Dto.cs
Normal file
87
DOAN.Model/huate_group/CloudMonitor/Dto/ZiyuanDevice01Dto.cs
Normal file
@ -0,0 +1,87 @@
|
||||
namespace DOAN.Model.huate_group.CloudMonitor.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 小房间热熔焊接查询对象
|
||||
/// </summary>
|
||||
public class ZiyuanDevice01QueryDto : PagerInfo
|
||||
{
|
||||
public int ReflexAccount_id { get; set; }
|
||||
|
||||
public string Factory { get; set; }
|
||||
|
||||
public string Workshop { get; set; }
|
||||
|
||||
public string SupplierCode { get; set; }
|
||||
|
||||
public string SupplierName { get; set; }
|
||||
|
||||
public string Vehiclemodel { get; set; }
|
||||
|
||||
public string Partnumber { get; set; }
|
||||
|
||||
public string Partname { get; set; }
|
||||
|
||||
public string Configuration { get; set; }
|
||||
|
||||
public string Workstation { get; set; }
|
||||
|
||||
public string Paramter { get; set; }
|
||||
|
||||
public int? IsUpload { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 小房间热熔焊接输入输出对象
|
||||
/// </summary>
|
||||
public class ZiyuanDevice01Dto
|
||||
{
|
||||
[Required(ErrorMessage = "Id不能为空")]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Localtion { get; set; }
|
||||
|
||||
public string Factory { get; set; }
|
||||
|
||||
public string Workshop { get; set; }
|
||||
|
||||
public string SupplierCode { get; set; }
|
||||
|
||||
public string SupplierName { get; set; }
|
||||
|
||||
public string Vehiclemodel { get; set; }
|
||||
|
||||
public string Partnumber { get; set; }
|
||||
|
||||
public string Partname { get; set; }
|
||||
|
||||
public string Configuration { get; set; }
|
||||
|
||||
public string Workstation { get; set; }
|
||||
|
||||
public string Paramter { get; set; }
|
||||
|
||||
public decimal Value { get; set; }
|
||||
|
||||
public decimal MiddleValue { get; set; }
|
||||
|
||||
public decimal LowValue { get; set; }
|
||||
|
||||
public decimal UpValue { get; set; }
|
||||
|
||||
public DateTime? MeasureTime { get; set; }
|
||||
|
||||
public int? IsUpload { get; set; }
|
||||
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
|
||||
|
||||
[ExcelColumn(Name = "是否上传")]
|
||||
public string IsUploadLabel { get; set; }
|
||||
}
|
||||
}
|
||||
126
DOAN.Model/huate_group/CloudMonitor/ZiyuanDevice01.cs
Normal file
126
DOAN.Model/huate_group/CloudMonitor/ZiyuanDevice01.cs
Normal file
@ -0,0 +1,126 @@
|
||||
namespace DOAN.Model.huate_group.CloudMonitor
|
||||
{
|
||||
/// <summary>
|
||||
/// 小房间热熔焊接
|
||||
/// </summary>
|
||||
[Tenant(2)]
|
||||
[SugarTable("ziyuan_device_01")]
|
||||
public class ZiyuanDevice01
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地点
|
||||
/// </summary>
|
||||
public string Localtion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工厂
|
||||
/// </summary>
|
||||
public string Factory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 车间
|
||||
/// </summary>
|
||||
public string Workshop { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供应商代码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "supplier_code")]
|
||||
public string SupplierCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供应商名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "supplier_name")]
|
||||
public string SupplierName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 车型
|
||||
/// </summary>
|
||||
public string Vehiclemodel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 零件名称
|
||||
/// </summary>
|
||||
public string Partnumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 零件号
|
||||
/// </summary>
|
||||
public string Partname { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配置
|
||||
/// </summary>
|
||||
public string Configuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工位
|
||||
/// </summary>
|
||||
public string Workstation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数
|
||||
/// </summary>
|
||||
public string Paramter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public decimal Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 中值
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "middle_value")]
|
||||
public decimal MiddleValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 下公差
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "low_value")]
|
||||
public decimal LowValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上公差
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "up_value")]
|
||||
public decimal UpValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 测试时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "measure_time")]
|
||||
public DateTime? MeasureTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否上传
|
||||
/// </summary>
|
||||
public int? IsUpload { 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; }
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
using DOAN.Model.huate_group.CloudMonitor;
|
||||
using DOAN.Model.huate_group.CloudMonitor.Dto;
|
||||
|
||||
namespace DOAN.Service.huate_group.CloudMonitor.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// 小房间热熔焊接service接口
|
||||
/// </summary>
|
||||
public interface IZiyuanDevice01Service : IBaseService<ZiyuanDevice01>
|
||||
{
|
||||
PagedInfo<ZiyuanDevice01Dto> GetList(ZiyuanDevice01QueryDto parm);
|
||||
|
||||
ZiyuanDevice01 GetInfo(int Id);
|
||||
|
||||
|
||||
ZiyuanDevice01 AddZiyuanDevice01(ZiyuanDevice01 parm);
|
||||
int UpdateZiyuanDevice01(ZiyuanDevice01 parm);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
126
DOAN.Service/huate_group/CloudMonitor/ZiyuanDevice01Service.cs
Normal file
126
DOAN.Service/huate_group/CloudMonitor/ZiyuanDevice01Service.cs
Normal file
@ -0,0 +1,126 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Extensions;
|
||||
|
||||
using DOAN.Repository;
|
||||
using DOAN.Model.huate_group.CloudMonitor;
|
||||
using IP2Region.Ex.Models;
|
||||
using DOAN.Model.huate_group.CloudMonitor.Dto;
|
||||
using DOAN.Service.huate_group.CloudMonitor.IService;
|
||||
|
||||
namespace DOAN.Service.huate_group.CloudMonitor
|
||||
{
|
||||
/// <summary>
|
||||
/// 小房间热熔焊接Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IZiyuanDevice01Service), ServiceLifetime = LifeTime.Transient)]
|
||||
public class ZiyuanDevice01Service : BaseService<ZiyuanDevice01>, IZiyuanDevice01Service
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询小房间热熔焊接列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<ZiyuanDevice01Dto> GetList(ZiyuanDevice01QueryDto parm)
|
||||
{
|
||||
PagedInfo<ZiyuanDevice01Dto> result = null;
|
||||
//TODO 查询对应的表
|
||||
ReflexAccount reflex = Context.Queryable<ReflexAccount>().Where(it => it.Id == parm.ReflexAccount_id).First();
|
||||
if (reflex == null) {
|
||||
throw new ArgumentException($"这个表找不到{parm.ReflexAccount_id}");
|
||||
}
|
||||
Type type = null;
|
||||
try
|
||||
{
|
||||
type = Type.GetType($"DOAN.Model.huate_group.CloudMonitor.{reflex.TableCode}, DOAN.Model"); // 替换 "Namespace" 和 "AssemblyName"
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentException($"Type '{reflex.TableCode}' not found.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Error: {ex.Message}");
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
|
||||
case Type t when t == typeof(ZiyuanDevice01):
|
||||
result= QuerySubClass<ZiyuanDevice01>(parm);
|
||||
break;
|
||||
default: throw new ArgumentException("匹配不到表"); break;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public ZiyuanDevice01 GetInfo(int Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加小房间热熔焊接
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public ZiyuanDevice01 AddZiyuanDevice01(ZiyuanDevice01 model)
|
||||
{
|
||||
return Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改小房间热熔焊接
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateZiyuanDevice01(ZiyuanDevice01 model)
|
||||
{
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询导出表达式
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
private static Expressionable<ZiyuanDevice01> QueryExp(ZiyuanDevice01QueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<ZiyuanDevice01>();
|
||||
|
||||
return predicate;
|
||||
}
|
||||
|
||||
|
||||
private PagedInfo<ZiyuanDevice01Dto> QuerySubClass<T>(ZiyuanDevice01QueryDto parm) where T : ZiyuanDevice01, new()
|
||||
{
|
||||
var predicate = Expressionable.Create<T>()
|
||||
.AndIF(parm != null && !string.IsNullOrEmpty(parm.Factory), it => it.Factory.Contains(parm.Factory))
|
||||
.AndIF(parm != null && !string.IsNullOrEmpty(parm.Workshop), it => it.Workshop.Contains(parm.Workshop))
|
||||
.AndIF(parm != null && !string.IsNullOrEmpty(parm.SupplierCode), it => it.SupplierCode.Contains(parm.SupplierCode))
|
||||
.AndIF(parm != null && !string.IsNullOrEmpty(parm.SupplierName), it => it.SupplierName.Contains(parm.SupplierName))
|
||||
.AndIF(parm != null && !string.IsNullOrEmpty(parm.Vehiclemodel), it => it.Vehiclemodel.Contains(parm.Vehiclemodel))
|
||||
.AndIF(parm != null && !string.IsNullOrEmpty(parm.Partnumber), it => it.Partnumber.Contains(parm.Partnumber))
|
||||
.AndIF(parm != null && !string.IsNullOrEmpty(parm.Partname), it => it.Partname.Contains(parm.Partname))
|
||||
.AndIF(parm != null && !string.IsNullOrEmpty(parm.Configuration), it => it.Configuration.Contains(parm.Configuration))
|
||||
.AndIF(parm != null && !string.IsNullOrEmpty(parm.Workstation), it => it.Workstation.Contains(parm.Workstation))
|
||||
.AndIF(parm != null && !string.IsNullOrEmpty(parm.Paramter), it => it.Paramter.Contains(parm.Paramter))
|
||||
.AndIF(parm != null && parm.IsUpload > 0, it => it.IsUpload == parm.IsUpload)
|
||||
;
|
||||
|
||||
|
||||
return Context.Queryable<T>().Where(predicate.ToExpression()).ToPage<T, ZiyuanDevice01Dto>(parm);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user