Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
IoTSharp
提交
b613f076
I
IoTSharp
项目概览
jobily
/
IoTSharp
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
IoTSharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b613f076
编写于
9月 22, 2022
作者:
麦壳饼
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
加入产品 字典 和 加入 图标文件路径 加入 文件上传扩展等。
上级
7218a9b8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
150 addition
and
8 deletion
+150
-8
IoTSharp.Contracts/Enums.cs
IoTSharp.Contracts/Enums.cs
+10
-0
IoTSharp.Data/ApplicationDbContext.cs
IoTSharp.Data/ApplicationDbContext.cs
+2
-0
IoTSharp.Data/Produce.cs
IoTSharp.Data/Produce.cs
+34
-6
IoTSharp.Data/ProduceDictionary.cs
IoTSharp.Data/ProduceDictionary.cs
+86
-0
IoTSharp/Controllers/ProducesController.cs
IoTSharp/Controllers/ProducesController.cs
+2
-2
IoTSharp/Extensions/JwtControllerExtension.cs
IoTSharp/Extensions/JwtControllerExtension.cs
+16
-0
未找到文件。
IoTSharp.Contracts/Enums.cs
浏览文件 @
b613f076
...
...
@@ -138,6 +138,16 @@ namespace IoTSharp.Contracts
Device
=
0
,
Gateway
=
1
}
public
enum
GatewayType
{
Unknow
=
0
,
Customize
,
Modbus
,
Bacnet
,
OPC_UA
,
CanOpen
,
}
[
System
.
Text
.
Json
.
Serialization
.
JsonConverter
(
typeof
(
System
.
Text
.
Json
.
Serialization
.
JsonStringEnumConverter
))]
[
JsonConverter
(
typeof
(
StringEnumConverter
))]
public
enum
CoApRes
...
...
IoTSharp.Data/ApplicationDbContext.cs
浏览文件 @
b613f076
...
...
@@ -100,6 +100,8 @@ namespace IoTSharp.Data
public
DbSet
<
Produce
>
Produces
{
get
;
set
;
}
public
DbSet
<
ProduceData
>
ProduceDatas
{
get
;
set
;
}
public
DbSet
<
ProduceDictionary
>
ProduceDictionaries
{
get
;
set
;
}
}
}
\ No newline at end of file
IoTSharp.Data/Produce.cs
浏览文件 @
b613f076
...
...
@@ -8,7 +8,6 @@ using System.Threading.Tasks;
namespace
IoTSharp.Data
{
public
class
Produce
{
[
Key
]
...
...
@@ -20,27 +19,56 @@ namespace IoTSharp.Data
public
string
Name
{
get
;
set
;
}
/// <summary>
///
超时时间 秒数
///
ICON file full path
/// </summary>
public
int
DefaultTimeout
{
get
;
set
;
}
=
300
;
public
string
Icon
{
get
;
set
;
}
/// <summary>
/// 网关类型 根据不通网关来处理相关配置
/// </summary>
public
GatewayType
GatewayType
{
get
;
set
;
}
=
GatewayType
.
Unknow
;
/// <summary>
/// 网关配置信息, 如果是Unknow 则不使用, 如果是自定义 ,则这里是json字符串。
/// 如果是其他对应的网关, 则这里是 对应的配置文件名。
/// </summary>
public
string
GatewayConfiguration
{
get
;
set
;
}
=
string
.
Empty
;
/// <summary>
/// 超时时间 秒数
/// </summary>
public
int
DefaultTimeout
{
get
;
set
;
}
=
300
;
/// <summary>
/// 租户
/// </summary>
public
Tenant
Tenant
{
get
;
set
;
}
/// <summary>
/// 客户
/// </summary>
public
Customer
Customer
{
get
;
set
;
}
/// <summary>
/// 默认认证类型
/// </summary>
[
EnumDataType
(
typeof
(
IdentityType
))]
public
IdentityType
DefaultIdentityType
{
get
;
set
;
}
=
IdentityType
.
AccessToken
;
/// <summary>
/// 描述
/// </summary>
public
string
Description
{
get
;
set
;
}
/// <summary>
/// 默认属性
/// </summary>
public
List
<
ProduceData
>
DefaultAttributes
{
get
;
set
;
}
/// <summary>
/// 所属设备
/// </summary>
public
List
<
Device
>
Devices
{
get
;
set
;
}
/// <summary>
/// 默认设备类型
/// </summary>
public
DeviceType
DefaultDeviceType
{
get
;
set
;
}
/// <summary>
/// 产品字典
/// </summary>
public
List
<
ProduceDictionary
>
Dictionaries
{
get
;
set
;
}
}
}
IoTSharp.Data/ProduceDictionary.cs
0 → 100644
浏览文件 @
b613f076
using
IoTSharp.Contracts
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel.DataAnnotations
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
DataType
=
IoTSharp
.
Contracts
.
DataType
;
namespace
IoTSharp.Data
{
public
class
ProduceDictionary
{
[
Key
]
public
Guid
Id
{
get
;
set
;
}
/// <summary>
/// 字段名称
/// </summary>
public
string
KeyName
{
get
;
set
;
}
/// <summary>
/// 字段显示名称
/// </summary>
public
string
DisplayName
{
get
;
set
;
}
/// <summary>
/// 单位
/// </summary>
public
string
Unit
{
get
;
set
;
}
/// <summary>
/// 单位转换表达式
/// </summary>
public
string
UnitExpression
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
bool
UnitConvert
{
get
;
set
;
}
/// <summary>
/// 字段备注
/// </summary>
public
string
?
KeyDesc
{
get
;
set
;
}
/// <summary>
/// 默认值
/// </summary>
public
string
?
DefaultValue
{
get
;
set
;
}
/// <summary>
/// 是否显示
/// </summary>
public
bool
Display
{
get
;
set
;
}
/// <summary>
/// 位置名称
/// </summary>
public
string
Place0
{
get
;
set
;
}
/// <summary>
/// 此位置顺序
/// </summary>
public
string
PlaceOrder0
{
get
;
set
;
}
public
string
Place1
{
get
;
set
;
}
public
string
PlaceOrder1
{
get
;
set
;
}
public
string
Place2
{
get
;
set
;
}
public
string
PlaceOrder2
{
get
;
set
;
}
public
string
Place3
{
get
;
set
;
}
public
string
PlaceOrder3
{
get
;
set
;
}
public
string
Place4
{
get
;
set
;
}
public
string
PlaceOrder4
{
get
;
set
;
}
public
string
Place5
{
get
;
set
;
}
public
string
PlaceOrder5
{
get
;
set
;
}
/// <summary>
/// 数据类型
/// </summary>
public
DataType
DataType
{
get
;
set
;
}
public
string
?
Tag
{
get
;
set
;
}
public
Guid
?
Customer
{
get
;
set
;
}
}
}
IoTSharp/Controllers/PrducesController.cs
→
IoTSharp/Controllers/Pr
o
ducesController.cs
浏览文件 @
b613f076
...
...
@@ -19,13 +19,13 @@ namespace IoTSharp.Controllers
{
[
Route
(
"api/[controller]/[action]"
)]
[
ApiController
]
public
class
PrducesController
:
ControllerBase
public
class
Pr
o
ducesController
:
ControllerBase
{
private
readonly
ApplicationDbContext
_context
;
private
readonly
ILogger
_logger
;
public
Pr
ducesController
(
ApplicationDbContext
context
,
ILogger
<
Pr
ducesController
>
logger
)
public
Pr
oducesController
(
ApplicationDbContext
context
,
ILogger
<
Pro
ducesController
>
logger
)
{
_context
=
context
;
_logger
=
logger
;
...
...
IoTSharp/Extensions/JwtControllerExtension.cs
浏览文件 @
b613f076
...
...
@@ -31,5 +31,21 @@ namespace IoTSharp.Extensions
Comstomer
=
@this
.
User
.
GetCustomerId
()
};
}
public
static
string
GetStorageRoot
(
this
ControllerBase
@this
)
{
return
$"/
{
@this
.
User
.
GetTenantId
()}
/
{
@this
.
User
.
GetCustomerId
()}
/"
;
}
public
static
string
GetStorageRoot
(
this
ControllerBase
@this
,
Produce
produce
)
{
return
$"/
{
@this
.
User
.
GetTenantId
()}
/
{
@this
.
User
.
GetCustomerId
()}
/
{
produce
.
Id
}
"
;
}
public
static
string
GetStorageRoot
(
this
ControllerBase
@this
,
Device
device
)
{
return
$"/
{
@this
.
User
.
GetTenantId
()}
/
{
@this
.
User
.
GetCustomerId
()}
/
{
device
.
Id
}
"
;
}
public
static
string
GetStorageRoot
(
this
ControllerBase
@this
,
Gateway
device
)
{
return
$"/
{
@this
.
User
.
GetTenantId
()}
/
{
@this
.
User
.
GetCustomerId
()}
/
{
device
.
Id
}
"
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录