生产车间设备信息上报服务接口
This commit is contained in:
parent
85214ab407
commit
3e639cb1e4
@ -95,5 +95,5 @@
|
||||
<PackageReference Update="DistributedLock.Redis" Version="1.0.3" />
|
||||
|
||||
|
||||
</ItemGroup>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -1 +1 @@
|
||||
Subproject commit bcf2fe561c8b143835214e0974f640cc40cbe84f
|
||||
Subproject commit 163b1c303938c7e2d8f343fc456b7f091014426d
|
||||
@ -2,28 +2,23 @@
|
||||
using JiShe.ServicePro;
|
||||
using JiShe.ServicePro.Core;
|
||||
using JiShe.ServicePro.DeviceManagement.Focuses;
|
||||
using JiShe.ServicePro.DeviceManagement.Focuses.Dto;
|
||||
using JiShe.ServicePro.DeviceManagement.Meters;
|
||||
using JiShe.ServicePro.DeviceManagement.Meters.Dto;
|
||||
using JiShe.ServicePro.Encrypt;
|
||||
using JiShe.ServicePro.Enums;
|
||||
using JiShe.ServicePro.OneNET.Provider.Interface;
|
||||
using JiShe.ServicePro.OneNETManagement.OneNETDevices;
|
||||
using JiShe.ServicePro.OneNETManagement.OneNETProducts;
|
||||
using JiShe.ServicePro.ServerOptions;
|
||||
using Mapster.Utils;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace JiShe.IoT.Workshop
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产车间服务
|
||||
/// </summary>
|
||||
public class ProductionWorkshopService(IFocusAppService focusAppService, IMeterAppService meterAppService, IOneNETRequestService oneNETRequestService, IOptions<ServerApplicationOptions> options, ILogger<ProductionWorkshopService> logger) : IoTAppService, IProductionWorkshopService
|
||||
public class ProductionWorkshopService(IFocusAppService focusAppService, IMeterAppService meterAppService, IOneNETDeviceService oneNETDeviceService, IOptions<ServerApplicationOptions> options, ILogger<ProductionWorkshopService> logger) : IoTAppService, IProductionWorkshopService
|
||||
{
|
||||
ServerApplicationOptions srverOptions = options.Value;
|
||||
|
||||
@ -81,25 +76,35 @@ namespace JiShe.IoT.Workshop
|
||||
return HttpDataResultExtensions.Failed("没有找到对应的产品信息", -108, ResponeResultEnum.Fail);
|
||||
}
|
||||
|
||||
FocusInfo focusInfoEntity = new FocusInfo() {
|
||||
CreateFocusInput focusInfoEntity = new CreateFocusInput()
|
||||
{
|
||||
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,
|
||||
CreateMeterInput meterInfoEntity = new CreateMeterInput()
|
||||
{
|
||||
MeterAddress = productionEquipmentMessageBody.DeviceAddress,
|
||||
Password = productInfo.ProductAccesskey,
|
||||
BusinessSystem = BusinessSystemEnum.Energy,
|
||||
IoTPlatformProductId = productionEquipmentMessageBody.IoTPlatformProductId,
|
||||
IoTPlatformDeviceOpenInfo = productionEquipmentMessageBody.DeviceOpenInfo,
|
||||
FocusAddress = productionEquipmentMessageBody.DeviceAddress,//todo: 集中器地址
|
||||
};
|
||||
|
||||
//oneNETRequestService
|
||||
//创建本地设备信息
|
||||
await focusAppService.CreateAsync(focusInfoEntity);
|
||||
await meterAppService.CreateAsync(meterInfoEntity);
|
||||
|
||||
//推送至OneNET平台
|
||||
await oneNETDeviceService.CreateDeviceInfoAsync(new CreateDeviceInfoInput() {
|
||||
DeviceName = productionEquipmentMessageBody.DeviceOpenInfo,
|
||||
ProductId = productionEquipmentMessageBody.IoTPlatformProductId,
|
||||
OneNETAccountId = productInfo.OneNETAccountId,
|
||||
Description = productionEquipmentMessageBody.DeviceOpenInfo,
|
||||
});
|
||||
|
||||
return HttpDataResultExtensions.Failed("签名校验失败", -101, ResponeResultEnum.NotAllowed);
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
|
||||
namespace JiShe.IoT.Migrations
|
||||
{
|
||||
[DbContext(typeof(IoTDbContext))]
|
||||
[Migration("20250722081519_InitialCreate")]
|
||||
[Migration("20250723054349_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@ -510,10 +510,6 @@ namespace JiShe.IoT.Migrations
|
||||
.HasColumnType("varchar(20)")
|
||||
.HasComment("APN");
|
||||
|
||||
b.Property<int>("BusinessSystem")
|
||||
.HasColumnType("int")
|
||||
.HasComment("业务系统");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
@ -724,10 +720,6 @@ namespace JiShe.IoT.Migrations
|
||||
.HasColumnType("varchar(128)")
|
||||
.HasComment("品牌类型");
|
||||
|
||||
b.Property<int>("BusinessSystem")
|
||||
.HasColumnType("int")
|
||||
.HasComment("业务系统");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
@ -840,7 +840,6 @@ namespace JiShe.IoT.Migrations
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
BusinessSystem = table.Column<int>(type: "int", nullable: false, comment: "业务系统"),
|
||||
Name = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false, comment: "集中器名称")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
FocusAddress = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false, comment: "集中器地址")
|
||||
@ -955,7 +954,6 @@ namespace JiShe.IoT.Migrations
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
BusinessSystem = table.Column<int>(type: "int", nullable: false, comment: "业务系统"),
|
||||
MeterName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false, comment: "表计名称")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
MeterAddress = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "表计地址")
|
||||
@ -507,10 +507,6 @@ namespace JiShe.IoT.Migrations
|
||||
.HasColumnType("varchar(20)")
|
||||
.HasComment("APN");
|
||||
|
||||
b.Property<int>("BusinessSystem")
|
||||
.HasColumnType("int")
|
||||
.HasComment("业务系统");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
@ -721,10 +717,6 @@ namespace JiShe.IoT.Migrations
|
||||
.HasColumnType("varchar(128)")
|
||||
.HasComment("品牌类型");
|
||||
|
||||
b.Property<int>("BusinessSystem")
|
||||
.HasColumnType("int")
|
||||
.HasComment("业务系统");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.IsRequired()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user