车间生产服务
This commit is contained in:
parent
eebcd74b3b
commit
85214ab407
@ -37,13 +37,12 @@
|
|||||||
"TreeModelClusterList": [ "47.110.53.196:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
|
"TreeModelClusterList": [ "47.110.53.196:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
|
||||||
"TableModelClusterList": [ "47.110.53.196:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
|
"TableModelClusterList": [ "47.110.53.196:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
|
||||||
"PoolSize": 32,
|
"PoolSize": 32,
|
||||||
"TableModelDataBaseName": "energy",
|
"DataBaseName": "jisheiotdata",
|
||||||
"OpenDebugMode": true,
|
"OpenDebugMode": true,
|
||||||
"UseTableSessionPoolByDefault": false
|
"UseTableSessionPoolByDefault": false
|
||||||
},
|
},
|
||||||
"ServerApplicationOptions": {
|
"ServerApplicationOptions": {
|
||||||
"ServerTagName": "JiSheCollectBus10",
|
"ServerTagName": "JiSheCollectBus10",
|
||||||
"SystemType": "Energy",
|
|
||||||
"FirstCollectionTime": "2025-04-28 15:07:00",
|
"FirstCollectionTime": "2025-04-28 15:07:00",
|
||||||
"AutomaticVerificationTime": "16:07:00",
|
"AutomaticVerificationTime": "16:07:00",
|
||||||
"AutomaticTerminalVersionTime": "17:07:00",
|
"AutomaticTerminalVersionTime": "17:07:00",
|
||||||
|
|||||||
@ -56,7 +56,7 @@
|
|||||||
"TreeModelClusterList": [ "172.21.40.198:6667", "172.21.40.197:6667", "172.21.40.199:6667" ],
|
"TreeModelClusterList": [ "172.21.40.198:6667", "172.21.40.197:6667", "172.21.40.199:6667" ],
|
||||||
"TableModelClusterList": [ "172.21.40.198:6667", "172.21.40.197:6667", "172.21.40.199:6667" ],
|
"TableModelClusterList": [ "172.21.40.198:6667", "172.21.40.197:6667", "172.21.40.199:6667" ],
|
||||||
"PoolSize": 32,
|
"PoolSize": 32,
|
||||||
"TableModelDataBaseName": "energy",
|
"DataBaseName": "jisheiotdata",
|
||||||
"OpenDebugMode": false,
|
"OpenDebugMode": false,
|
||||||
"UseTableSessionPoolByDefault": false
|
"UseTableSessionPoolByDefault": false
|
||||||
},
|
},
|
||||||
|
|||||||
@ -18,16 +18,23 @@ namespace JiShe.IoT.Workshop.Dto
|
|||||||
/// 表计类型
|
/// 表计类型
|
||||||
/// 电表= 1,水表= 2,燃气表= 3,热能表= 4,水表流量计=5,燃气表流量计=6,特殊电表=7
|
/// 电表= 1,水表= 2,燃气表= 3,热能表= 4,水表流量计=5,燃气表流量计=6,特殊电表=7
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MeterTypeEnum MeterType { get; set; }
|
public MeterTypeEnum? MeterType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 集中器地址
|
/// 设备地址
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FocusAddress { get; set; }
|
public string DeviceAddress { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 表通信地址
|
/// 物联网平台唯一设备标识
|
||||||
|
/// CTWing唯一设备标识为:设备Id=CTWing产品Id+推送的设备序列号(集中器地址)
|
||||||
|
/// OneNET唯一设备标识为:推送的设备名称,为了保持统一,因此推送的设备名称=OneNET产品Id+推送的设备序列号(集中器地址)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MeterAddress { get; set; }
|
public string DeviceOpenInfo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物联网平台对应的产品Id
|
||||||
|
/// </summary>
|
||||||
|
public string IoTPlatformProductId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,13 +19,13 @@ namespace JiShe.IoT.Workshop
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<HttpDataResult> ReceiveWorkshopProductionEquipment(ProductionEquipmentInput input);
|
Task<HttpDataResult> ReceiveOneNetProductionEquipmentInfoAsync(ProductionEquipmentInput input);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生产车间获取OneNET产品列表
|
/// 生产车间获取OneNET产品列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<HttpDataResult<List<OneNetWorkshopProductListOutput>>> OneNetProductListForWorkshopAsync(OneNetWorkshopProductListInput input);
|
Task<HttpDataResult<List<OneNetWorkshopProductListOutput>>> GetOneNetProductListAsync(OneNetWorkshopProductListInput input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,15 @@
|
|||||||
using JiShe.IoT.Workshop.Dto;
|
using JiShe.IoT.Workshop.Dto;
|
||||||
using JiShe.ServicePro;
|
using JiShe.ServicePro;
|
||||||
|
using JiShe.ServicePro.Core;
|
||||||
using JiShe.ServicePro.DeviceManagement.Focuses;
|
using JiShe.ServicePro.DeviceManagement.Focuses;
|
||||||
using JiShe.ServicePro.DeviceManagement.Meters;
|
using JiShe.ServicePro.DeviceManagement.Meters;
|
||||||
using JiShe.ServicePro.Encrypt;
|
using JiShe.ServicePro.Encrypt;
|
||||||
using JiShe.ServicePro.Enums;
|
using JiShe.ServicePro.Enums;
|
||||||
|
using JiShe.ServicePro.OneNET.Provider.Interface;
|
||||||
using JiShe.ServicePro.OneNETManagement.OneNETProducts;
|
using JiShe.ServicePro.OneNETManagement.OneNETProducts;
|
||||||
using JiShe.ServicePro.ServerOptions;
|
using JiShe.ServicePro.ServerOptions;
|
||||||
using Mapster.Utils;
|
using Mapster.Utils;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -20,7 +23,7 @@ namespace JiShe.IoT.Workshop
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生产车间服务
|
/// 生产车间服务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ProductionWorkshopService(IFocusAppService focusAppService, IMeterAppService meterAppService, IOptions<ServerApplicationOptions> options ) : IoTAppService,IProductionWorkshopService
|
public class ProductionWorkshopService(IFocusAppService focusAppService, IMeterAppService meterAppService, IOneNETRequestService oneNETRequestService, IOptions<ServerApplicationOptions> options, ILogger<ProductionWorkshopService> logger) : IoTAppService, IProductionWorkshopService
|
||||||
{
|
{
|
||||||
ServerApplicationOptions srverOptions = options.Value;
|
ServerApplicationOptions srverOptions = options.Value;
|
||||||
|
|
||||||
@ -30,7 +33,7 @@ namespace JiShe.IoT.Workshop
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<HttpDataResult> ReceiveWorkshopProductionEquipment(ProductionEquipmentInput input)
|
public async Task<HttpDataResult> ReceiveOneNetProductionEquipmentInfoAsync(ProductionEquipmentInput input)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -40,12 +43,70 @@ namespace JiShe.IoT.Workshop
|
|||||||
{
|
{
|
||||||
return HttpDataResultExtensions.Failed("签名校验失败", -101, ResponeResultEnum.NotAllowed);
|
return HttpDataResultExtensions.Failed("签名校验失败", -101, ResponeResultEnum.NotAllowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProductionEquipmentMessageBody productionEquipmentMessageBody = input.Message.Deserialize<ProductionEquipmentMessageBody>();
|
||||||
|
|
||||||
|
if (productionEquipmentMessageBody.MeterType.HasValue == false)
|
||||||
|
{
|
||||||
|
return HttpDataResultExtensions.Failed("设备类型不能为空", -103, ResponeResultEnum.Fail);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(productionEquipmentMessageBody.IoTPlatformProductId))
|
||||||
|
{
|
||||||
|
return HttpDataResultExtensions.Failed("物联网平台产品Id不能为空", -104, ResponeResultEnum.Fail);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(productionEquipmentMessageBody.IoTPlatformProductId))
|
||||||
|
{
|
||||||
|
return HttpDataResultExtensions.Failed("物联网平台产品Id不能为空", -105, ResponeResultEnum.Fail);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(productionEquipmentMessageBody.DeviceAddress))
|
||||||
|
{
|
||||||
|
return HttpDataResultExtensions.Failed("设备地址不能为空", -106, ResponeResultEnum.Fail);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(productionEquipmentMessageBody.DeviceOpenInfo))
|
||||||
|
{
|
||||||
|
return HttpDataResultExtensions.Failed("物联网平台唯一设备标识,不能为空", -107, ResponeResultEnum.Fail);
|
||||||
|
}
|
||||||
|
|
||||||
|
var productInfo = await FreeSqlDbContext.Instance.Select<OneNETProductInfos>()
|
||||||
|
.Where(e => e.IsEnabled == true && e.IoTPlatformProductId == productionEquipmentMessageBody.IoTPlatformProductId)
|
||||||
|
.FirstAsync();
|
||||||
|
|
||||||
|
if (productInfo == null)
|
||||||
|
{
|
||||||
|
return HttpDataResultExtensions.Failed("没有找到对应的产品信息", -108, ResponeResultEnum.Fail);
|
||||||
|
}
|
||||||
|
|
||||||
|
FocusInfo focusInfoEntity = new FocusInfo() {
|
||||||
|
FocusAddress = productionEquipmentMessageBody.DeviceAddress,
|
||||||
|
Name = productionEquipmentMessageBody.DeviceOpenInfo,
|
||||||
|
IoTPlatformProductId = productionEquipmentMessageBody.IoTPlatformProductId,
|
||||||
|
BusinessSystem = BusinessSystemEnum.Energy,
|
||||||
|
IoTPlatform = IoTPlatformTypeEnum.OneNET,
|
||||||
|
IoTPlatformDeviceOpenInfo = productionEquipmentMessageBody.DeviceOpenInfo,
|
||||||
|
PlatformPassword = productInfo.ProductAccesskey,
|
||||||
|
};
|
||||||
|
focusInfoEntity.CreateId(GuidGenerator.Create());
|
||||||
|
|
||||||
|
MeterInfo meterInfoEntity = new MeterInfo() { MeterAddress = productionEquipmentMessageBody.DeviceAddress,
|
||||||
|
Password = productInfo.ProductAccesskey,
|
||||||
|
BusinessSystem = BusinessSystemEnum.Energy,
|
||||||
|
IoTPlatformProductId = productionEquipmentMessageBody.IoTPlatformProductId,
|
||||||
|
IoTPlatformDeviceOpenInfo = productionEquipmentMessageBody.DeviceOpenInfo,
|
||||||
|
};
|
||||||
|
|
||||||
|
//oneNETRequestService
|
||||||
|
|
||||||
return HttpDataResultExtensions.Failed("签名校验失败", -101, ResponeResultEnum.NotAllowed);
|
return HttpDataResultExtensions.Failed("签名校验失败", -101, ResponeResultEnum.NotAllowed);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
logger.LogError($"{nameof(ReceiveOneNetProductionEquipmentInfoAsync)} 生产车间数据推送发生异常:{ex.Serialize()}");
|
||||||
throw;
|
return HttpDataResultExtensions.Failed("生产车间数据推送发生异常", -101, ResponeResultEnum.Exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +114,7 @@ namespace JiShe.IoT.Workshop
|
|||||||
/// 生产车间获取OneNET产品列表
|
/// 生产车间获取OneNET产品列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<HttpDataResult<List<OneNetWorkshopProductListOutput>>> OneNetProductListForWorkshopAsync(OneNetWorkshopProductListInput input)
|
public async Task<HttpDataResult<List<OneNetWorkshopProductListOutput>>> GetOneNetProductListAsync(OneNetWorkshopProductListInput input)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -64,6 +125,8 @@ namespace JiShe.IoT.Workshop
|
|||||||
return HttpDataResultExtensions.Failed<List<OneNetWorkshopProductListOutput>>("签名校验失败", -101, ResponeResultEnum.NotAllowed);
|
return HttpDataResultExtensions.Failed<List<OneNetWorkshopProductListOutput>>("签名校验失败", -101, ResponeResultEnum.NotAllowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProductionEquipmentMessageBody productionEquipmentMessageBody = input.Message.Deserialize<ProductionEquipmentMessageBody>();
|
||||||
|
|
||||||
var pageListQuery = FreeSqlDbContext.Instance.Select<OneNETProductInfos>()
|
var pageListQuery = FreeSqlDbContext.Instance.Select<OneNETProductInfos>()
|
||||||
.Where(e => e.IsEnabled == true)
|
.Where(e => e.IsEnabled == true)
|
||||||
.OrderByDescending(e => e.CreationTime);
|
.OrderByDescending(e => e.CreationTime);
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
//"TreeModelClusterList": [ "192.168.111.37:6667" ],
|
//"TreeModelClusterList": [ "192.168.111.37:6667" ],
|
||||||
//"TableModelClusterList": [ "192.168.111.37:6667" ],
|
//"TableModelClusterList": [ "192.168.111.37:6667" ],
|
||||||
"PoolSize": 32,
|
"PoolSize": 32,
|
||||||
"TableModelDataBaseName": "energy",
|
"DataBaseName": "jisheiotdata",
|
||||||
"OpenDebugMode": true,
|
"OpenDebugMode": true,
|
||||||
"UseTableSessionPoolByDefault": false
|
"UseTableSessionPoolByDefault": false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,25 +26,25 @@ namespace JiShe.IoT.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 接收车间生产设备信息
|
/// 接收车间生产OneNET设备信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("WorkshopProductionEquipment")]
|
[HttpPost(nameof(ReceiveOneNetProductionEquipmentInfoAsync))]
|
||||||
[SwaggerOperation(summary: "车间生产设备信息", Tags = new[] { "Workshop" })]
|
[SwaggerOperation(summary: "接收车间生产OneNET设备信息", Tags = new[] { "Workshop" })]
|
||||||
public async Task ReceiveWorkshopProductionEquipment(ProductionEquipmentInput input)
|
public async Task ReceiveOneNetProductionEquipmentInfoAsync(ProductionEquipmentInput input)
|
||||||
{
|
{
|
||||||
await _productionWorkshopService.ReceiveWorkshopProductionEquipment(input);
|
await _productionWorkshopService.ReceiveOneNetProductionEquipmentInfoAsync(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生产车间获取OneNET产品列表
|
/// 生产车间获取OneNET产品列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpPost(nameof(OneNetProductListForWorkshopAsync))]
|
[HttpPost(nameof(GetOneNetProductListAsync))]
|
||||||
[SwaggerOperation(summary: "生产车间获取OneNET产品列表", Tags = new[] { "Workshop" })]
|
[SwaggerOperation(summary: "生产车间获取OneNET产品列表", Tags = new[] { "Workshop" })]
|
||||||
public async Task<HttpDataResult<List<OneNetWorkshopProductListOutput>>> OneNetProductListForWorkshopAsync(OneNetWorkshopProductListInput input)
|
public async Task<HttpDataResult<List<OneNetWorkshopProductListOutput>>> GetOneNetProductListAsync(OneNetWorkshopProductListInput input)
|
||||||
{
|
{
|
||||||
return await _productionWorkshopService.OneNetProductListForWorkshopAsync(input);
|
return await _productionWorkshopService.GetOneNetProductListAsync(input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user