feat(mqtt): 添加设备数据上传功能及相关服务
实现设备数据通过MQTT上传功能,包括: 1. 新增DeviceUploadData实体及DTO 2. 添加MQTT服务处理设备消息 3. 实现设备数据存储逻辑 4. 创建相关控制器和服务接口
This commit is contained in:
89
ZR.Service/mes/dc/DeviceUploadDataService.cs
Normal file
89
ZR.Service/mes/dc/DeviceUploadDataService.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using Infrastructure.Attribute;
|
||||
using SqlSugar;
|
||||
using ZR.Model;
|
||||
using ZR.Model.dc;
|
||||
using ZR.Model.Dto;
|
||||
using ZR.Repository;
|
||||
using ZR.Service.MES.dc.IService;
|
||||
|
||||
namespace ZR.Service.Business
|
||||
{
|
||||
/// <summary>
|
||||
/// Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IDeviceUploadDataService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class DeviceUploadDataService : BaseService<DeviceUploadData>, IDeviceUploadDataService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<DeviceUploadDataDto> GetList(DeviceUploadDataQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<DeviceUploadData>();
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<DeviceUploadData, DeviceUploadDataDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public DeviceUploadData GetInfo(long Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public DeviceUploadData AddDeviceUploadData(DeviceUploadData model)
|
||||
{
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateDeviceUploadData(DeviceUploadData model)
|
||||
{
|
||||
//var response = Update(w => w.Id == model.Id, it => new DeviceUploadData()
|
||||
//{
|
||||
// FactoryCode = model.FactoryCode,
|
||||
// WorkshopCode = model.WorkshopCode,
|
||||
// LineCode = model.LineCode,
|
||||
// DeviceCode = model.DeviceCode,
|
||||
// DictCode = model.DictCode,
|
||||
// Remark = model.Remark,
|
||||
// Value01 = model.Value01,
|
||||
// Value02 = model.Value02,
|
||||
// Value03 = model.Value03,
|
||||
// Value04 = model.Value04,
|
||||
// Value05 = model.Value05,
|
||||
// Value06 = model.Value06,
|
||||
// Value07 = model.Value07,
|
||||
// Value08 = model.Value08,
|
||||
// Value09 = model.Value09,
|
||||
// Value10 = model.Value10,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
21
ZR.Service/mes/dc/IService/IDeviceUploadDataService.cs
Normal file
21
ZR.Service/mes/dc/IService/IDeviceUploadDataService.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using ZR.Model;
|
||||
using ZR.Model.dc;
|
||||
using ZR.Model.Dto;
|
||||
|
||||
namespace ZR.Service.MES.dc.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// service接口
|
||||
/// </summary>
|
||||
public interface IDeviceUploadDataService : IBaseService<DeviceUploadData>
|
||||
{
|
||||
PagedInfo<DeviceUploadDataDto> GetList(DeviceUploadDataQueryDto parm);
|
||||
|
||||
DeviceUploadData GetInfo(long Id);
|
||||
|
||||
DeviceUploadData AddDeviceUploadData(DeviceUploadData parm);
|
||||
|
||||
int UpdateDeviceUploadData(DeviceUploadData parm);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user