提交 24045c6a 编写于 作者: W wq1234wq

规则接入点

上级 a6f9a9b5
using Microsoft.EntityFrameworkCore.Migrations;
namespace IoTSharp.Migrations
{
public partial class addrulemounttype : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "MountType",
table: "FlowRules",
type: "integer",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MountType",
table: "FlowRules");
}
}
}
using Microsoft.EntityFrameworkCore.Migrations;
namespace IoTSharp.Migrations
{
public partial class modifyrulemounttype : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}
......@@ -866,6 +866,9 @@ namespace IoTSharp.Migrations
b.Property<string>("ExecutableCode")
.HasColumnType("text");
b.Property<int>("MountType")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
......
......@@ -154,5 +154,14 @@ namespace IoTSharp.Data
CoAP,
HTTP
}
public enum MountType
{
Telemetry=1,
Attribute=2,
RAW=3
}
}
\ No newline at end of file
......@@ -23,5 +23,7 @@ namespace IoTSharp.Data
public string DefinitionsXml { get; set; }
public Guid ParentRuleId { get; set; }
public double SubVersion { get; set; }
public MountType MountType { get; set; }
}
}
......@@ -17,8 +17,8 @@ namespace IoTSharp.TaskAction
private dynamic _DynamicOutput;
private readonly ExpandoObjectConverter expConverter = new();
public Guid DeviceId { get; set; }
public bool ExxcutionStatus { get; set; }
public string ExxcutionInfo { get; set; }
public bool ExecutionStatus { get; set; }
public string ExecutionInfo { get; set; }
public dynamic DynamicOutput
{
get
......
......@@ -35,7 +35,7 @@ namespace IoTSharp.TaskAction
}
catch (Exception ex)
{
return new TaskActionOutput() {ExxcutionInfo = ex.Message, ExxcutionStatus = false};
return new TaskActionOutput() {ExecutionInfo = ex.Message, ExecutionStatus = false};
}
}
......
......@@ -82,98 +82,98 @@ export class HeaderNotifyComponent {
setTimeout(() => {
const now = new Date();
this.data = this.updateNoticeData([
{
id: '000000001',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
title: '你收到了 14 份新周报',
datetime: add(now, { days: 10 }),
type: '通知',
},
{
id: '000000002',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png',
title: '你推荐的 曲妮妮 已通过第三轮面试',
datetime: add(now, { days: -3 }),
type: '通知',
},
{
id: '000000003',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png',
title: '这种模板可以区分多种通知类型',
datetime: add(now, { months: -3 }),
read: true,
type: '通知',
},
{
id: '000000004',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png',
title: '左侧图标用于区分不同的类型',
datetime: add(now, { years: -1 }),
type: '通知',
},
{
id: '000000005',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
title: '内容不要超过两行字,超出时自动截断',
datetime: '2017-08-07',
type: '通知',
},
{
id: '000000006',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
title: '曲丽丽 评论了你',
description: '描述信息描述信息描述信息',
datetime: '2017-08-07',
type: '消息',
},
{
id: '000000007',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
title: '朱偏右 回复了你',
description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
datetime: '2017-08-07',
type: '消息',
},
{
id: '000000008',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
title: '标题',
description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
datetime: '2017-08-07',
type: '消息',
},
{
id: '000000009',
title: '任务名称',
description: '任务需要在 2017-01-12 20:00 前启动',
extra: '未开始',
status: 'todo',
type: '待办',
},
{
id: '000000010',
title: '第三方紧急代码变更',
description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
extra: '马上到期',
status: 'urgent',
type: '待办',
},
{
id: '000000011',
title: '信息安全考试',
description: '指派竹尔于 2017-01-09 前完成更新并发布',
extra: '已耗时 8 天',
status: 'doing',
type: '待办',
},
{
id: '000000012',
title: 'ABCD 版本发布',
description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
extra: '进行中',
status: 'processing',
type: '待办',
},
// {
// id: '000000001',
// avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
// title: '你收到了 14 份新周报',
// datetime: add(now, { days: 10 }),
// type: '通知',
// },
// {
// id: '000000002',
// avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png',
// title: '你推荐的 曲妮妮 已通过第三轮面试',
// datetime: add(now, { days: -3 }),
// type: '通知',
// },
// {
// id: '000000003',
// avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png',
// title: '这种模板可以区分多种通知类型',
// datetime: add(now, { months: -3 }),
// read: true,
// type: '通知',
// },
// {
// id: '000000004',
// avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png',
// title: '左侧图标用于区分不同的类型',
// datetime: add(now, { years: -1 }),
// type: '通知',
// },
// {
// id: '000000005',
// avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
// title: '内容不要超过两行字,超出时自动截断',
// datetime: '2017-08-07',
// type: '通知',
// },
// {
// id: '000000006',
// avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
// title: '曲丽丽 评论了你',
// description: '描述信息描述信息描述信息',
// datetime: '2017-08-07',
// type: '消息',
// },
// {
// id: '000000007',
// avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
// title: '朱偏右 回复了你',
// description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
// datetime: '2017-08-07',
// type: '消息',
// },
// {
// id: '000000008',
// avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg',
// title: '标题',
// description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
// datetime: '2017-08-07',
// type: '消息',
// },
// {
// id: '000000009',
// title: '任务名称',
// description: '任务需要在 2017-01-12 20:00 前启动',
// extra: '未开始',
// status: 'todo',
// type: '待办',
// },
// {
// id: '000000010',
// title: '第三方紧急代码变更',
// description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
// extra: '马上到期',
// status: 'urgent',
// type: '待办',
// },
// {
// id: '000000011',
// title: '信息安全考试',
// description: '指派竹尔于 2017-01-09 前完成更新并发布',
// extra: '已耗时 8 天',
// status: 'doing',
// type: '待办',
// },
// {
// id: '000000012',
// title: 'ABCD 版本发布',
// description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务',
// extra: '进行中',
// status: 'processing',
// type: '待办',
// },
]);
this.loading = false;
......
......@@ -20,7 +20,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component } from '@angular/
<div *ngIf="loading" class="mx-lg p-lg"><nz-spin></nz-spin></div>
<nz-card *ngIf="!loading" nzTitle="Notifications" nzBordered="false" class="ant-card__body-nopadding">
<ng-template #extra><i nz-icon nzType="plus"></i></ng-template>
<div nz-row [nzJustify]="'center'" [nzAlign]="'middle'" class="py-sm pr-md point bg-grey-lighter-h">
<!-- <div nz-row [nzJustify]="'center'" [nzAlign]="'middle'" class="py-sm pr-md point bg-grey-lighter-h">
<div nz-col [nzSpan]="4" class="text-center">
<nz-avatar [nzSrc]="'./assets/tmp/img/1.png'"></nz-avatar>
</div>
......@@ -64,7 +64,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component } from '@angular/
<strong>Jefferson</strong>
<p class="mb0">Please tell me what happened in a few words, don't go into details.</p>
</div>
</div>
</div> -->
<div nz-row>
<div nz-col [nzSpan]="24" class="pt-md border-top-1 text-center text-grey point">See All</div>
</div>
......
......@@ -22,8 +22,6 @@
<i nz-icon nzType="plus"></i>
<span>{{ 'button.new' | translate }}</span>
</button>-->
</form>
<div nz-col nzMd="8" nzSm="24">
......@@ -32,7 +30,6 @@
<span>{{ 'button.new' | translate }}</span>
</button>
<button nz-button [nzType]="'primary'" (click)="downlink([])" acl [acl-ability]="137">
<i nz-icon nzType="plus"></i>
<span>设置规则</span>
......@@ -40,18 +37,19 @@
</div>
</nz-card>
<st [expandAccordion]="true"
#st
[columns]="columns"
[data]="url"
ps="20"
[page]="page"
[req]="req"
[expand]="expand"
[res]="res"
expandAccordion
(change)="onchange($event)">
<st
[expandAccordion]="true"
#st
[columns]="columns"
[data]="url"
ps="20"
[page]="page"
[req]="req"
[expand]="expand"
[res]="res"
expandAccordion
(change)="onchange($event)"
>
<ng-template #expand let-item let-index="index" let-column="column">
<nz-card nzTitle="设备属性">
<table>
......@@ -72,20 +70,46 @@
</nz-card>
<nz-card nzTitle="遥测数据">
<table>
<tr>
<td>属性名称</td>
<td>属性值</td>
<td>时间</td>
</tr>
<tr *ngFor="let _item of item.telemetries; let i = index; let odd = odd">
<td>{{ _item.keyName }}</td>
<td>{{ _item.value }}</td>
<td>{{ _item.dateTime }}</td>
</tr>
</table>
</nz-card>
<nz-tabset>
<nz-tab [nzTitle]="titleTemplate">
<ng-template #titleTemplate>
<i nz-icon nzType="area-chart" nzTheme="outline"></i>
图表
</ng-template>
<div nz-row>
<!--不要直接绑定,会导致界面重绘 -->
<div *ngFor="let _item of cetd; let i = index; let odd = odd">
<g2-gauge [title]="_item.keyName" [height]="180" [percent]="_item.value" style="width: 200px;" ></g2-gauge>
</div>
</div>
</nz-tab>
<nz-tab [nzTitle]="titleTemplate">
<ng-template #titleTemplate>
<i nz-icon nzType="table" nzTheme="outline"></i>
数据
</ng-template>
<table>
<tr>
<td>属性名称</td>
<td>属性值</td>
<td>时间</td>
</tr>
<tr *ngFor="let _item of item.telemetries; let i = index; let odd = odd">
<td>{{ _item.keyName }}</td>
<td>{{ _item.value }}</td>
<td>{{ _item.dateTime }}</td>
</tr>
</table>
</nz-tab>
</nz-tabset>
</nz-card>
<nz-card nzTitle="规则">
<table>
......@@ -98,11 +122,17 @@
<td>{{ _item.name }}</td>
<td>{{ _item.ruleDesc }}</td>
<td>
<button nz-button nzType="text" nzDanger nz-popconfirm
nzPopconfirmTitle="确认删除规则?"
(nzOnConfirm)="removerule(item,_item)"
nzPopconfirmPlacement="topLeft">删除</button>
<button
nz-button
nzType="text"
nzDanger
nz-popconfirm
nzPopconfirmTitle="确认删除规则?"
(nzOnConfirm)="removerule(item, _item)"
nzPopconfirmPlacement="topLeft"
>
删除
</button>
</td>
</tr>
</table>
......
......@@ -18,6 +18,7 @@ import { HttpHeaders, HttpResponse } from '@angular/common/http';
import { saveAs, fileSaver } from 'file-saver';
import { ClipboardService } from 'ngx-clipboard';
import { DevicetokendialogComponent } from '../devicetokendialog/devicetokendialog.component';
import { fork } from 'child_process';
@Component({
selector: 'app-devicelist',
templateUrl: './devicelist.component.html',
......@@ -37,17 +38,16 @@ export class DevicelistComponent implements OnInit, OnDestroy {
private drawerService: NzDrawerService,
private settingService: SettingsService,
aclSrv: ACLService,
) { }
) {}
ngOnDestroy(): void {
if (this.obs) {
this.obs.unsubscribe();
}
}
url = 'api/Devices/Customers';
page: STPage = {
cetd : telemetryitem []= [];
page: STPage = {
front: false,
total: true,
zeroIndexed: true,
......@@ -60,12 +60,12 @@ export class DevicelistComponent implements OnInit, OnDestroy {
name: string;
// anothor query field:The type you expect
} = {
pi: 0,
ps: 10,
sorter: '',
customerId: '',
name: '',
};
pi: 0,
ps: 10,
sorter: '',
customerId: '',
name: '',
};
req: STReq = { method: 'GET', allInBody: true, reName: { pi: 'offset', ps: 'limit' }, params: this.q };
// 定义返回的参数
......@@ -86,8 +86,8 @@ export class DevicelistComponent implements OnInit, OnDestroy {
{ title: 'id', index: 'id' },
{ title: '名称', index: 'name', render: 'name' },
{ title: '设备类型', index: 'deviceType' },
{ title: '所有者', index: 'phone' },
{ title: '租户', index: 'country' },
{ title: '在线状态', index: 'online' },
{ title: '最后活动时间', index: 'lastActive' },
{ title: '客户', index: 'province' },
{
title: '操作',
......@@ -113,7 +113,7 @@ export class DevicelistComponent implements OnInit, OnDestroy {
acl: 111,
text: '设置规则',
click: (item: any) => {
this.download()
this.download();
this.downlink([item]);
},
},
......@@ -125,15 +125,9 @@ export class DevicelistComponent implements OnInit, OnDestroy {
modal: {
component: DevicetokendialogComponent,
},
click: (item: any) => {
}
click: (item: any) => {},
},
{
acl: 110,
text: '删除',
......@@ -148,37 +142,33 @@ export class DevicelistComponent implements OnInit, OnDestroy {
description = '';
totalCallNo = 0;
getbuttons(item) {
return []
return [];
}
couponFormat(value) {}
private download(){
private download() {
this.http
.get('./assets/tmp/demo.xlsx', {},{
responseType: 'blob',
})
.subscribe(res => {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
document.body.appendChild(a);
a.setAttribute('style', 'display: none');
a.href = url;
a.download = res.filename;
a.click();
window.URL.revokeObjectURL(url);
a.remove();
});
.get(
'./assets/tmp/demo.xlsx',
{},
{
responseType: 'blob',
},
)
.subscribe((res) => {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
document.body.appendChild(a);
a.setAttribute('style', 'display: none');
a.href = url;
a.download = res.filename;
a.click();
window.URL.revokeObjectURL(url);
a.remove();
});
}
ngOnInit(): void {
this.router.queryParams.subscribe(
......@@ -194,8 +184,8 @@ export class DevicelistComponent implements OnInit, OnDestroy {
this.url = 'api/Devices/Customers';
}
},
(y) => { },
() => { },
(y) => {},
() => {},
);
}
......@@ -229,7 +219,7 @@ export class DevicelistComponent implements OnInit, OnDestroy {
drawerRef.afterOpen.subscribe(() => {
this.getData();
});
drawerRef.afterClose.subscribe((data) => { });
drawerRef.afterClose.subscribe((data) => {});
}
edit(id: string): void {
var { nzMaskClosable, width } = this.settingService.getData('drawerconfig');
......@@ -255,7 +245,7 @@ export class DevicelistComponent implements OnInit, OnDestroy {
},
},
});
drawerRef.afterOpen.subscribe(() => { });
drawerRef.afterOpen.subscribe(() => {});
drawerRef.afterClose.subscribe((data) => {
this.getData();
});
......@@ -288,18 +278,18 @@ export class DevicelistComponent implements OnInit, OnDestroy {
drawerRef.afterOpen.subscribe(() => {
this.getData();
});
drawerRef.afterClose.subscribe((data) => { });
drawerRef.afterClose.subscribe((data) => {});
}
reset() { }
reset() {}
delete(id: string) {
this.http.delete('/api/Devices/' + id, {}).subscribe(
(x) => {
this.msg.info('设备已删除');
this.getData();
},
(y) => { },
() => { },
(y) => {},
() => {},
);
}
......@@ -320,31 +310,27 @@ export class DevicelistComponent implements OnInit, OnDestroy {
this.http.get<appmessage<attributeitem[]>>('api/Devices/' + $events.expand?.id + '/AttributeLatest'),
this.http.get<appmessage<ruleitem[]>>('api/Rules/GetDeviceRules?deviceId=' + $events.expand?.id),
this.http.get<appmessage<telemetryitem[]>>('api/Devices/' + $events.expand?.id + '/TelemetryLatest'),
).subscribe(
([
attributes,
rules,
telemetries
]) => {
$events.expand.attributes = attributes.data;
$events.expand.rules = rules.data;
$events.expand.telemetries = telemetries.data;
this.cdr.detectChanges();
},
);
).subscribe(([attributes, rules, telemetries]) => {
$events.expand.attributes = attributes.data;
$events.expand.rules = rules.data;
$events.expand.telemetries = telemetries.data;
if (this.cetd.length === 0) {
this.cetd = $events.expand.telemetries;
} else {
for (var i = 0; i < this.cetd.length; i++) {
this.cetd[i].value= telemetries.data[i].value
}
}
// this.cdr.detectChanges();
});
});
} else {
this.obs.unsubscribe();
}
break;
}
}
......@@ -354,8 +340,8 @@ export class DevicelistComponent implements OnInit, OnDestroy {
(next) => {
item.rules = item.rules.filter((x) => x.ruleId != rule.ruleId);
},
(error) => { },
() => { },
(error) => {},
() => {},
);
}
}
......
......@@ -4,7 +4,15 @@
<se label="规则名称" error="请输入规则名称" required>
<input nz-input formControlName="name" placeholder="规则名称" />
</se>
<se label="挂载点" error="请选择挂载点" required>
<nz-select formControlName="mountType" placeholder="设备类型">
<nz-option nzValue="1" nzLabel="遥测"></nz-option>
<nz-option nzValue="2" nzLabel="属性"></nz-option>
<nz-option nzValue="3" nzLabel="RAW"></nz-option>
</nz-select>
</se>
<se label="备注" error="备注">
<!-- <editor formControlName="RuleDesc"></editor> -->
......
......@@ -32,12 +32,14 @@ export class FlowformComponent implements OnInit {
this.form = this.fb.group({
name: [null, [Validators.required]],
ruleDesc: [null, []],
mountType: [null, [Validators.required]],
ruleId: [Guid.EMPTY, []],
});
if (this.id !== Guid.EMPTY) {
this._httpClient.get<AppMessage>('api/rules/get?id=' + this.id).subscribe(
(x) => {
x.data.mountType= x.data.mountType+'';
this.form.patchValue(x.data);
},
(y) => {},
......
......@@ -102,7 +102,7 @@
}}</a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="testunit(_item)">{{
_item.flowType==='bpmn:Task'?'条件测试':''
_item.flowType==='bpmn:Task'|| _item.flowType==='bpmn:StartEvent'?'条件测试':''
}}</a>
......
import { ChangeDetectorRef, Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { STColumn, STComponent, STData, STPage, STReq, STRes } from '@delon/abc/st';
import { STColumn, STColumnTag, STComponent, STData, STPage, STReq, STRes } from '@delon/abc/st';
import { ACLService } from '@delon/acl';
import { _HttpClient, ModalHelper, SettingsService } from '@delon/theme';
import { Guid } from 'guid-typescript';
......@@ -30,7 +30,11 @@ export class FlowlistComponent implements OnInit {
private settingService: SettingsService,
) {}
TAG: STColumnTag = {
1: { text: '遥测', color: 'green' },
2: { text: '属性', color: 'orange' },
3: { text: 'RAW', color: 'orange' },
};
page: STPage = {
front: false,
total: true,
......@@ -75,11 +79,12 @@ export class FlowlistComponent implements OnInit {
{ title: 'id', index: 'ruleId' },
{ title: '规则名称', index: 'name', render: 'name' },
{ title: '备注', index: 'ruledesc' },
{ title: '创建时间', type: 'date', index: 'CreatTime' },
{ title: '创建时间', type: 'date', index: 'creatTime' },
{ title: '挂载点', type: 'tag', index: 'mountType', tag:this.TAG },
{
title: { i18n: 'i18n.columns.Status' },
index: 'rulestatus',
render: 'rulestatus',
index: 'ruleStatus',
render: 'ruleStatus',
type: 'badge',
badge: {
0: { text: '禁用', color: 'error' },
......@@ -233,6 +238,7 @@ export class FlowlistComponent implements OnInit {
switch (flow.flowType) {
case 'bpmn:Task':
{
var { nzMaskClosable, width } = this.settingService.getData('drawerconfig');
var title = '测试' + (flow.flowname??flow.bpmnid);
const drawerRef = this.drawerService.create<SequenceflowtesterComponent, { flow: flow }, string>({
......@@ -249,8 +255,28 @@ export class FlowlistComponent implements OnInit {
if (typeof data === 'string') {
}
});
}
break;
case 'bpmn:SequenceFlow':
case 'bpmn:StartEvent':
{
var { nzMaskClosable, width } = this.settingService.getData('drawerconfig');
var title = '测试' + (flow.flowname??flow.bpmnid);
const drawerRef = this.drawerService.create<SequenceflowtesterComponent, { flow: flow }, string>({
nzTitle: title,
nzContent: SequenceflowtesterComponent,
nzWidth: width < 1280 ? 1280 : width,
nzMaskClosable: nzMaskClosable,
nzContentParams: {
flow: flow,
},
});
drawerRef.afterOpen.subscribe(() => {});
drawerRef.afterClose.subscribe((data) => {
if (typeof data === 'string') {
}
});
}
break;
}
}
......
......@@ -65,11 +65,12 @@ import { TaskexecutorformComponent } from './flow/taskexecutorform/taskexecutorf
import { SequenceflowtesterComponent } from './flow/sequenceflowtester/sequenceflowtester.component';
import { TasktesterComponent } from './flow/tasktester/tasktester.component';
import { ForkdialogComponent } from './flow/forkdialog/forkdialog.component';
import { G2BarModule,G2GaugeModule } from '@delon/chart';
const COMPONENTS: Type<null>[] = [];
const Directive: Type<void>[] = [fielddirective, controldirective];
@NgModule({
imports: [SharedModule, RouteRoutingModule, WidgetsModule,ClipboardModule, DelonFormModule.forRoot()],
imports: [SharedModule,G2BarModule,G2GaugeModule , RouteRoutingModule, WidgetsModule,ClipboardModule, DelonFormModule.forRoot()],
declarations: [
...COMPONENTS,
...Directive,
......
......@@ -242,6 +242,25 @@ namespace IoTSharp.Controllers
[ProducesDefaultResponseType]
public async Task<ApiResult<List<TelemetryDataDto>>> GetTelemetryLatest(Guid deviceId)
{
Random r = new Random((int) System.DateTime.Now.Ticks);
var l = new List<TelemetryDataDto>();
for (int i = 0; i < 10; i++)
{
TelemetryDataDto t= new TelemetryDataDto();
t.Value = r.Next(1,10);
t.KeyName = "tele"+i;
t.DateTime= DateTime.Now;
t.DataType = DataType.Double;
l.Add(t);
}
return new ApiResult<List<TelemetryDataDto>>(ApiCode.Success, "Ok",
l);
Device dev = Found(deviceId);
if (dev == null)
{
......
......@@ -104,7 +104,10 @@ namespace IoTSharp.Controllers
{
if (ModelState.IsValid)
{
m.MountType = m.MountType;
m.RuleStatus = 1;
m.CreatTime=DateTime.Now;
_context.FlowRules.Add(m);
_context.SaveChanges();
......@@ -122,6 +125,7 @@ namespace IoTSharp.Controllers
var flowrule = _context.FlowRules.SingleOrDefault(c => c.RuleId == m.RuleId);
if (flowrule != null)
{
flowrule.MountType = m.MountType;
flowrule.Name = m.Name;
flowrule.RuleDesc = m.RuleDesc;
_context.FlowRules.Update(flowrule);
......
......@@ -95,6 +95,7 @@
<PackageReference Include="PinusDB.HealthChecks" Version="1.0.10" />
<PackageReference Include="ProxyKit" Version="2.3.4" />
<PackageReference Include="Quartz.Serialization.Json" Version="3.3.3" />
<PackageReference Include="RestSharp" Version="106.13.0" />
<PackageReference Include="RulesEngine" Version="3.4.0" />
<PackageReference Include="Savorboard.CAP.InMemoryMessageQueue" Version="5.1.1" />
<PackageReference Include="Silkier" Version="1.0.424" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册