Compare commits
2 Commits
179726379a
...
66bdb8944b
Author | SHA1 | Date |
---|---|---|
anerx | 66bdb8944b | 4 months ago |
anerx | fb851cf256 | 4 months ago |
29 changed files with 628 additions and 27 deletions
@ -0,0 +1,13 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net8.0</TargetFramework> |
|||
<ImplicitUsings>enable</ImplicitUsings> |
|||
<Nullable>enable</Nullable> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
@ -0,0 +1,10 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
namespace Admin.NET.Bodk.Core.Devices; |
|||
|
|||
public enum DeviceType |
|||
{ |
|||
M9 = 1, |
|||
} |
@ -0,0 +1,19 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
namespace Admin.NET.Bodk.Core.Devices; |
|||
|
|||
public interface IDevice |
|||
{ |
|||
long? Id { get; } |
|||
DeviceType Type { get; } |
|||
|
|||
string SerialNumber { get; } |
|||
|
|||
object Summary { get; } |
|||
|
|||
public long? ProjectId { get; } |
|||
|
|||
string Name { get; } |
|||
} |
@ -0,0 +1,10 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
namespace Admin.NET.Bodk.Core; |
|||
|
|||
public interface IRuntime |
|||
{ |
|||
|
|||
} |
@ -0,0 +1,13 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net8.0</TargetFramework> |
|||
<ImplicitUsings>enable</ImplicitUsings> |
|||
<Nullable>enable</Nullable> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
@ -0,0 +1,15 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
using Furion.DependencyInjection; |
|||
using Furion.DynamicApiController; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace Admin.NET.Bodk.Customer; |
|||
|
|||
[ApiDescriptionSettings(GroupName = "Bodk Groups",Description = "客户接口服务")] |
|||
public class CustomerService: IDynamicApiController, ITransient |
|||
{ |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
using Admin.NET.Core; |
|||
using Nest; |
|||
|
|||
namespace Admin.NET.Bodk.Customer.Entities; |
|||
|
|||
public class CustomerEntity : EntityBase, IRepositorySettings |
|||
{ |
|||
public string Name { get; set; } |
|||
|
|||
public string IdCard { get; set; } |
|||
|
|||
public string Phone { get; set; } |
|||
|
|||
public bool IsMale { get; set; } |
|||
} |
@ -0,0 +1,13 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net8.0</TargetFramework> |
|||
<ImplicitUsings>enable</ImplicitUsings> |
|||
<Nullable>enable</Nullable> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Admin.NET.Web.Core\Admin.NET.Web.Core.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
@ -0,0 +1,54 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
using System.ComponentModel; |
|||
using Admin.NET.Bodk.Device.Controllers.Dto; |
|||
using Admin.NET.Core; |
|||
using Furion.DependencyInjection; |
|||
using Furion.DynamicApiController; |
|||
using Microsoft.AspNetCore.Authentication.JwtBearer; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using NewLife.Caching; |
|||
|
|||
namespace Admin.NET.Bodk.Device.Controllers; |
|||
|
|||
[ApiDescriptionSettings(Groups = new[] { "Bodk Groups" },Name = "DeviceController",Description = "设备接口服务")] |
|||
public class DeviceController : IDynamicApiController, ITransient |
|||
{ |
|||
private readonly ICache _cache; |
|||
|
|||
public DeviceController(ICache cache) |
|||
{ |
|||
_cache = cache; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 上传设备摘要
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[DisplayName("上传设备摘要")] |
|||
[Authorize(AuthenticationSchemes = |
|||
JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)] |
|||
public Task UploadDeviceSummary(DeviceInput input) |
|||
{ |
|||
_cache.Set($"bodk:device:{input.SerialNumber}:summary", input.Summary); |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取设备摘要
|
|||
/// </summary>
|
|||
/// <param name="serialNumber"></param>
|
|||
/// <returns></returns>
|
|||
[DisplayName("获取设备摘要")] |
|||
[Authorize(AuthenticationSchemes = |
|||
JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)] |
|||
public Task<object> GetDeviceSummary(string serialNumber) |
|||
{ |
|||
return Task.Run(() => _cache.Get<object>($"bodk:device:{serialNumber}:summary")); |
|||
} |
|||
} |
@ -0,0 +1,18 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
using Admin.NET.Bodk.Device.Devices; |
|||
using Admin.NET.Bodk.Device.Devices.Summary; |
|||
|
|||
namespace Admin.NET.Bodk.Device.Controllers.Dto; |
|||
|
|||
public class DeviceInput |
|||
{ |
|||
public string SerialNumber { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
public DeviceType DeviceType { get; set; } |
|||
public object? Summary { get; set; } |
|||
} |
@ -0,0 +1,10 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
namespace Admin.NET.Bodk.Device.Devices; |
|||
|
|||
public enum DeviceType |
|||
{ |
|||
M9 = 1 |
|||
} |
@ -0,0 +1,18 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
using Admin.NET.Bodk.Device.Devices.Summary; |
|||
|
|||
namespace Admin.NET.Bodk.Device.Devices; |
|||
|
|||
public interface IDevice |
|||
{ |
|||
object Summary { get; } |
|||
|
|||
string SerialNumber { get; } |
|||
|
|||
long? Id { get; } |
|||
|
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
namespace Admin.NET.Bodk.Device.Devices.Summary; |
|||
|
|||
public class M9Summary |
|||
{ |
|||
public bool Online { get; set; } |
|||
|
|||
public float CavityHumidity { get; set; } |
|||
|
|||
public float CavityTemperature { get; set; } |
|||
|
|||
public float LiquidHeight { get; set; } |
|||
|
|||
public float LiquidFillingPortTemperature { get; set; } |
|||
|
|||
public float ExhaustPortTemperature { get; set; } |
|||
|
|||
public float TankTopTemperature { get; set; } |
|||
} |
@ -0,0 +1,13 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net8.0</TargetFramework> |
|||
<ImplicitUsings>enable</ImplicitUsings> |
|||
<Nullable>enable</Nullable> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
@ -0,0 +1,10 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
namespace Admin.NET.Bodk.Genetic.Entities; |
|||
|
|||
public class GeneticTestAgencyEntity |
|||
{ |
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
namespace Admin.NET.Bodk.Genetic.Entities; |
|||
|
|||
public class GeneticTestResultEntity |
|||
{ |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net8.0</TargetFramework> |
|||
<ImplicitUsings>enable</ImplicitUsings> |
|||
<Nullable>enable</Nullable> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Folder Include="Services\" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
@ -0,0 +1,87 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
using System.ComponentModel; |
|||
using Admin.NET.Bodk.Project.Entities; |
|||
using Admin.NET.Bodk.Project.Models; |
|||
using Admin.NET.Core; |
|||
using Furion.DependencyInjection; |
|||
using Furion.DynamicApiController; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace Admin.NET.Bodk.Project.Controllers; |
|||
|
|||
[ApiDescriptionSettings(GroupName = "Bodk Groups", Description = "项目接口服务")] |
|||
public class ProjectController : IDynamicApiController, ITransient |
|||
{ |
|||
private readonly SqlSugarRepository<ProjectEntity> _repository; |
|||
|
|||
public ProjectController(SqlSugarRepository<ProjectEntity> repository) |
|||
{ |
|||
_repository = repository; |
|||
} |
|||
|
|||
[ApiDescriptionSettings(Name = "GetList"), HttpPost] |
|||
[DisplayName("获取项目列表")] |
|||
public async Task<SqlSugarPagedList<Project.Models.Project>> GetList(ProjectQueryInput input) |
|||
{ |
|||
return await _repository.AsQueryable() |
|||
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), |
|||
m => input.Name != null && m.Name.Contains(input.Name)) |
|||
.WhereIF(input.Id is not null, m => m.Id == input.Id) |
|||
.WhereIF(!string.IsNullOrWhiteSpace(input.Manager), |
|||
m => input.Manager != null && m.Manager.Contains(input.Manager)) |
|||
.WhereIF(!string.IsNullOrWhiteSpace(input.Phone), |
|||
m => input.Phone != null && m.Phone.Contains(input.Phone)) |
|||
.WhereIF(!string.IsNullOrWhiteSpace(input.Position), |
|||
m => input.Position != null && m.Position.Contains(input.Position)) |
|||
.WhereIF(input.IsDeleted is not null, |
|||
m => m.IsDelete == input.IsDeleted) |
|||
.Select<Models.Project>((u) => new Models.Project() |
|||
{ |
|||
Id = u.Id, |
|||
Name = u.Name, |
|||
Manager = u.Manager, |
|||
Position = u.Position, |
|||
Phone = u.Phone, |
|||
IsDeleted = u.IsDelete, |
|||
CreateTime = u.CreateTime, |
|||
}) |
|||
.ToPagedListAsync(input.Page, input.PageSize); |
|||
} |
|||
|
|||
[ApiDescriptionSettings(Name = "Add"), HttpPost] |
|||
[DisplayName("新增项目")] |
|||
public async Task AddProject(ProjectInput project) |
|||
{ |
|||
await _repository.InsertAsync(new ProjectEntity() |
|||
{ |
|||
Name = project.Name, |
|||
Position = project.Position, |
|||
Manager = project.Manager, |
|||
Phone = project.Phone |
|||
}); |
|||
} |
|||
|
|||
[ApiDescriptionSettings(Name = "Delete"), HttpPost] |
|||
[DisplayName("删除项目")] |
|||
public async Task DeleteProject(long id) |
|||
{ |
|||
var project = await _repository.GetSingleAsync(d => d.Id == id); |
|||
project.IsDelete = true; |
|||
await _repository.UpdateAsync(project); |
|||
} |
|||
|
|||
[ApiDescriptionSettings(Name = "Update"), HttpPost] |
|||
[DisplayName("修改项目")] |
|||
public async Task UpdateProject(ProjectInput projectInput) |
|||
{ |
|||
var project = await _repository.GetSingleAsync(d => d.Id == projectInput.Id); |
|||
project.Manager = projectInput.Manager; |
|||
project.Name = projectInput.Name; |
|||
project.Phone = projectInput.Phone; |
|||
project.Position = projectInput.Position; |
|||
await _repository.UpdateAsync(project); |
|||
} |
|||
} |
@ -0,0 +1,21 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
using Admin.NET.Core; |
|||
using Nest; |
|||
using SqlSugar; |
|||
|
|||
namespace Admin.NET.Bodk.Project.Entities; |
|||
|
|||
[SugarTable("bodk_project", "项目表")] |
|||
public class ProjectEntity : EntityTenant, IRepositorySettings |
|||
{ |
|||
public string Name { get; set; } |
|||
|
|||
public string Position { get; set; } |
|||
|
|||
public string Manager { get; set; } |
|||
|
|||
public string Phone { get; set; } |
|||
} |
@ -0,0 +1,50 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
using Admin.NET.Core; |
|||
|
|||
namespace Admin.NET.Bodk.Project.Models; |
|||
|
|||
public class Project |
|||
{ |
|||
public long? Id { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
public string Position { get; set; } |
|||
|
|||
public string Manager { get; set; } |
|||
|
|||
public string Phone { get; set; } |
|||
|
|||
public bool IsDeleted { get; set; } |
|||
|
|||
public DateTime CreateTime { get; set; } |
|||
} |
|||
|
|||
public class ProjectQueryInput : BasePageInput |
|||
{ |
|||
public long? Id { get; set; } |
|||
|
|||
public string? Name { get; set; } |
|||
|
|||
public string? Position { get; set; } |
|||
|
|||
public string? Manager { get; set; } |
|||
|
|||
public string? Phone { get; set; } |
|||
|
|||
public bool? IsDeleted { get; set; } |
|||
} |
|||
|
|||
public class ProjectInput : BaseIdInput |
|||
{ |
|||
public string Name { get; set; } |
|||
|
|||
public string Position { get; set; } |
|||
|
|||
public string Manager { get; set; } |
|||
|
|||
public string Phone { get; set; } |
|||
} |
@ -0,0 +1,58 @@ |
|||
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|||
//
|
|||
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|||
|
|||
using Bodk.Device.Storage.EventArgs; |
|||
|
|||
namespace Bodk.Device.Storage.Modules; |
|||
|
|||
public class Valves( |
|||
Action<object?, AlarmChangedEventArg> alarmEventHandler, |
|||
Action<object?, MotionTimeoutAlarmChangedEventArg> motionTimeoutAlarmEventHandler, |
|||
Func<ushort, bool[], Task> writeCoilRegisterFunc, |
|||
Func<ushort, ushort, Task<bool[]>> readCoilRegisterFunc, |
|||
Func<ushort, ushort, Task<ushort[]>> readHoldingRegistersFunc, |
|||
Func<ushort, ushort[], Task> writeHoldingRegistersFunc) |
|||
: ModuleBase(alarmEventHandler, motionTimeoutAlarmEventHandler, writeCoilRegisterFunc, readCoilRegisterFunc, |
|||
readHoldingRegistersFunc, writeHoldingRegistersFunc) |
|||
{ |
|||
public override string Name => "Valves"; |
|||
public override string Descirption => "阀门控制"; |
|||
public override int Id => 1001; |
|||
|
|||
private static ushort MainValve => 490; |
|||
|
|||
private static ushort InletValve => 491; |
|||
|
|||
private static ushort ExhaustValve => 492; |
|||
|
|||
/// <summary>
|
|||
/// 总阀控制
|
|||
/// </summary>
|
|||
/// <param name="open"></param>
|
|||
/// <returns></returns>
|
|||
public Task MainValveSwitch(bool open) |
|||
{ |
|||
return writeCoilRegisterFunc(MainValve, new[] { open }); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 进液阀控制
|
|||
/// </summary>
|
|||
/// <param name="open"></param>
|
|||
/// <returns></returns>
|
|||
public Task InletValveSwitch(bool open) |
|||
{ |
|||
return writeCoilRegisterFunc(InletValve, new[] { open }); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 排气阀控制
|
|||
/// </summary>
|
|||
/// <param name="open"></param>
|
|||
/// <returns></returns>
|
|||
public Task ExhaustValveSwitch(bool open) |
|||
{ |
|||
return writeCoilRegisterFunc(ExhaustValve, new[] { open }); |
|||
} |
|||
} |
Loading…
Reference in new issue