Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cdy816
Mars
提交
e5970666
Mars
项目概览
cdy816
/
Mars
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mars
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e5970666
编写于
5月 17, 2020
作者:
cdy816
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
完成历史数据查询接口
上级
f8d9aa03
变更
24
展开全部
隐藏空白更改
内联
并排
Showing
24 changed file
with
2180 addition
and
296 deletion
+2180
-296
Cdy.Tag/Interface/HisQueryResult.cs
Cdy.Tag/Interface/HisQueryResult.cs
+49
-15
Cdy.Tag/Real/RealDatabase.cs
Cdy.Tag/Real/RealDatabase.cs
+5
-0
Cdy.Tag/Real/RealDatabaseSerise.cs
Cdy.Tag/Real/RealDatabaseSerise.cs
+2
-0
DBHisData/HisQuery/DataFileManager.cs
DBHisData/HisQuery/DataFileManager.cs
+0
-2
DBHisData/HisQuery/QuerySerivce.cs
DBHisData/HisQuery/QuerySerivce.cs
+17
-9
DBRunTimeServiceApi/ApiClient.cs
DBRunTimeServiceApi/ApiClient.cs
+83
-34
DBRuntime.Proxy/Config/ProxyClientConfig.xml
DBRuntime.Proxy/Config/ProxyClientConfig.xml
+2
-2
DBRuntime.Proxy/DatabaseRunner.cs
DBRuntime.Proxy/DatabaseRunner.cs
+43
-3
DBRuntime.Proxy/DbServerProxy.cs
DBRuntime.Proxy/DbServerProxy.cs
+476
-77
DBRuntime.Proxy/Driver/NetTransformDriver.cs
DBRuntime.Proxy/Driver/NetTransformDriver.cs
+41
-6
DataRunner/Api/HisDataServerProcess.cs
DataRunner/Api/HisDataServerProcess.cs
+758
-96
DataRunner/Api/TagInfoServerProcess.cs
DataRunner/Api/TagInfoServerProcess.cs
+1
-1
DataRunner/Runner.cs
DataRunner/Runner.cs
+10
-4
DbInRunWebApi/Config/DbWebApiProxy.cfg
DbInRunWebApi/Config/DbWebApiProxy.cfg
+2
-2
DbInRunWebApi/Controllers/HisDataController.cs
DbInRunWebApi/Controllers/HisDataController.cs
+270
-30
DbInRunWebApi/Controllers/HomeController.cs
DbInRunWebApi/Controllers/HomeController.cs
+3
-6
DbInRunWebApi/DbWebApiProxy.csproj
DbInRunWebApi/DbWebApiProxy.csproj
+19
-0
DbInRunWebApi/Model/RealValue.cs
DbInRunWebApi/Model/RealValue.cs
+43
-2
DbInRunWebApi/Model/Requestbase.cs
DbInRunWebApi/Model/Requestbase.cs
+10
-5
DbInRunWebApi/Properties/Resources.Designer.cs
DbInRunWebApi/Properties/Resources.Designer.cs
+72
-0
DbInRunWebApi/Properties/Resources.resx
DbInRunWebApi/Properties/Resources.resx
+123
-0
DbInRunWebApi/Properties/Resources.zh-CN.resx
DbInRunWebApi/Properties/Resources.zh-CN.resx
+123
-0
DbInRunWebApi/Res.cs
DbInRunWebApi/Res.cs
+24
-0
DbInRunWebApi/WebAPIStartup.cs
DbInRunWebApi/WebAPIStartup.cs
+4
-2
未找到文件。
Cdy.Tag/Interface/HisQueryResult.cs
浏览文件 @
e5970666
...
...
@@ -43,6 +43,8 @@ namespace Cdy.Tag
public
static
byte
[]
zoreData
=
new
byte
[
1024
*
10
];
private
int
mSize
;
#
endregion
...
Variables
...
#
region
...
Events
...
...
...
@@ -60,21 +62,21 @@ namespace Cdy.Tag
Init
(
count
);
}
/// <summary>
///
/// </summary>
/// <param name="handle"></param>
/// <param name="count"></param>
public
HisQueryResult
(
IntPtr
handle
,
int
count
)
{
this
.
handle
=
handle
;
mCount
=
count
;
mTimeAddr
=
count
*
mDataSize
;
mQulityAddr
=
count
*
(
mDataSize
+
8
);
mLenght
=
count
;
mLimite
=
count
;
mPosition
=
0
;
}
///
//
<summary>
///
//
///
//
</summary>
///
//
<param name="handle"></param>
///
//
<param name="count"></param>
//
public HisQueryResult(IntPtr handle,int count)
//
{
//
this.handle = handle;
//
mCount = count;
//
mTimeAddr = count * mDataSize;
//
mQulityAddr = count * (mDataSize + 8);
//
mLenght = count;
//
mLimite = count;
//
mPosition = 0;
//
}
#
endregion
...
Constructor
...
...
...
@@ -101,6 +103,10 @@ namespace Cdy.Tag
{
return
mCount
;
}
set
{
mCount
=
value
;
}
}
/// <summary>
...
...
@@ -123,14 +129,41 @@ namespace Cdy.Tag
{
return
mPosition
;
}
set
{
mPosition
=
value
;
}
}
public
int
Size
{
get
{
return
mSize
;
}
}
#
endregion
...
Properties
...
#
region
...
Methods
...
/// <summary>
///
/// </summary>
/// <returns></returns>
public
HisQueryResult
<
T
>
Contracts
()
{
HisQueryResult
<
T
>
re
=
new
HisQueryResult
<
T
>(
this
.
Count
);
Buffer
.
MemoryCopy
((
void
*)
this
.
handle
,
(
void
*)
re
.
handle
,
re
.
Size
,
mDataSize
*
Count
);
Buffer
.
MemoryCopy
((
void
*)(
this
.
handle
+
mTimeAddr
),
(
void
*)(
re
.
handle
+
re
.
mTimeAddr
),
re
.
Size
,
8
*
Count
);
Buffer
.
MemoryCopy
((
void
*)(
this
.
handle
+
mQulityAddr
),
(
void
*)(
re
.
handle
+
re
.
mQulityAddr
),
re
.
Size
,
Count
);
re
.
mCount
=
this
.
mCount
;
return
re
;
}
/// <summary>
///
/// </summary>
...
...
@@ -156,6 +189,7 @@ namespace Cdy.Tag
handle
=
Marshal
.
AllocHGlobal
(
csize
);
// handle = (void*)System.Runtime.InteropServices.Marshal.UnsafeAddrOfPinnedArrayElement(mDataBuffer, 0);
mLimite
=
count
;
mSize
=
csize
;
}
/// <summary>
...
...
Cdy.Tag/Real/RealDatabase.cs
浏览文件 @
e5970666
...
...
@@ -33,6 +33,11 @@ namespace Cdy.Tag
/// </summary>
public
string
Name
{
get
;
set
;
}
=
"local"
;
/// <summary>
/// 最后生成时间
/// </summary>
public
string
UpdateTime
{
get
;
set
;
}
=
""
;
/// <summary>
///
/// </summary>
...
...
Cdy.Tag/Real/RealDatabaseSerise.cs
浏览文件 @
e5970666
...
...
@@ -74,6 +74,8 @@ namespace Cdy.Tag
RealDatabase
db
=
new
RealDatabase
();
if
(
System
.
IO
.
File
.
Exists
(
path
))
{
db
.
UpdateTime
=
new
System
.
IO
.
FileInfo
(
path
).
LastWriteTimeUtc
.
ToString
();
XElement
xe
=
XElement
.
Load
(
path
);
db
.
Name
=
xe
.
Attribute
(
"Name"
).
Value
;
...
...
DBHisData/HisQuery/DataFileManager.cs
浏览文件 @
e5970666
...
...
@@ -126,8 +126,6 @@ namespace Cdy.Tag
/// </summary>
public
async
Task
Int
()
{
string
datapath
=
GetPrimaryHisDataPath
();
await
Scan
(
datapath
);
if
(
System
.
IO
.
Directory
.
Exists
(
datapath
))
...
...
DBHisData/HisQuery/QuerySerivce.cs
浏览文件 @
e5970666
...
...
@@ -180,17 +180,25 @@ namespace Cdy.Tag
/// <param name="result"></param>
public
void
ReadAllValue
<
T
>(
int
id
,
DateTime
startTime
,
DateTime
endTime
,
HisQueryResult
<
T
>
result
)
{
Tuple
<
DateTime
,
DateTime
>
mLogFileTimes
;
var
vfiles
=
GetFileManager
().
GetDataFiles
(
startTime
,
endTime
,
out
mLogFileTimes
,
id
);
vfiles
.
ForEach
(
e
=>
{
DateTime
sstart
=
e
.
StartTime
>
startTime
?
e
.
StartTime
:
startTime
;
DateTime
eend
=
e
.
EndTime
>
endTime
?
endTime
:
endTime
;
e
.
ReadAllValue
(
id
,
sstart
,
eend
,
result
);
});
try
{
Tuple
<
DateTime
,
DateTime
>
mLogFileTimes
;
var
vfiles
=
GetFileManager
().
GetDataFiles
(
startTime
,
endTime
,
out
mLogFileTimes
,
id
);
vfiles
.
ForEach
(
e
=>
{
DateTime
sstart
=
e
.
StartTime
>
startTime
?
e
.
StartTime
:
startTime
;
DateTime
eend
=
e
.
EndTime
>
endTime
?
endTime
:
endTime
;
e
.
ReadAllValue
(
id
,
sstart
,
eend
,
result
);
});
if
(
mLogFileTimes
.
Item1
!=
DateTime
.
MinValue
)
if
(
mLogFileTimes
.
Item1
!=
DateTime
.
MinValue
)
{
ReadLogFileAllValue
(
id
,
mLogFileTimes
.
Item1
,
mLogFileTimes
.
Item2
,
result
);
}
}
catch
(
Exception
ex
)
{
ReadLogFileAllValue
(
id
,
mLogFileTimes
.
Item1
,
mLogFileTimes
.
Item2
,
result
);
LoggerService
.
Service
.
Erro
(
"QueryService"
,
ex
.
StackTrace
);
}
}
...
...
DBRunTimeServiceApi/
Db
Client.cs
→
DBRunTimeServiceApi/
Api
Client.cs
浏览文件 @
e5970666
...
...
@@ -252,13 +252,17 @@ namespace DBRunTime.ServiceApi
mb
.
WriteString
(
loginid
);
infoRequreEvent
.
Reset
();
Send
(
mb
);
if
(
infoRequreEvent
.
WaitOne
(
timeout
))
try
{
return
mInfoRequreData
.
ReadString
();
if
(
infoRequreEvent
.
WaitOne
(
timeout
))
{
return
mInfoRequreData
.
ReadString
();
}
}
finally
{
mInfoRequreData
?.
ReleaseBuffer
();
}
mInfoRequreData
?.
ReleaseBuffer
();
return
string
.
Empty
;
}
...
...
@@ -281,12 +285,17 @@ namespace DBRunTime.ServiceApi
mb
.
WriteInt
(
maxid
);
this
.
realRequreEvent
.
Reset
();
Send
(
mb
);
if
(
realRequreEvent
.
WaitOne
(
timeout
))
try
{
return
mRealRequreData
.
ReadByte
()
>
0
;
if
(
realRequreEvent
.
WaitOne
(
timeout
))
{
return
mRealRequreData
.
ReadByte
()
>
0
;
}
}
finally
{
mRealRequreData
?.
ReleaseBuffer
();
}
mRealRequreData
?.
ReleaseBuffer
();
return
true
;
}
...
...
@@ -303,11 +312,17 @@ namespace DBRunTime.ServiceApi
realRequreEvent
.
Reset
();
Send
(
mb
);
if
(
realRequreEvent
.
WaitOne
(
timeout
))
try
{
return
mRealRequreData
.
ReadByte
()
>
0
;
if
(
realRequreEvent
.
WaitOne
(
timeout
))
{
return
mRealRequreData
.
ReadByte
()
>
0
;
}
}
finally
{
mRealRequreData
?.
ReleaseBuffer
();
}
mRealRequreData
?.
ReleaseBuffer
();
return
true
;
}
...
...
@@ -328,11 +343,18 @@ namespace DBRunTime.ServiceApi
realRequreEvent
.
Reset
();
Send
(
mb
);
if
(
realRequreEvent
.
WaitOne
(
timeout
))
try
{
return
mRealRequreData
;
if
(
realRequreEvent
.
WaitOne
(
timeout
))
{
return
mRealRequreData
;
}
}
mRealRequreData
?.
Release
();
finally
{
mRealRequreData
?.
ReleaseBuffer
();
}
return
null
;
}
...
...
@@ -352,7 +374,7 @@ namespace DBRunTime.ServiceApi
{
return
mRealRequreData
;
}
mRealRequreData
?.
Release
();
mRealRequreData
?.
Release
Buffer
();
return
null
;
}
...
...
@@ -448,10 +470,16 @@ namespace DBRunTime.ServiceApi
}
realRequreEvent
.
Reset
();
Send
(
mb
);
if
(
realRequreEvent
.
WaitOne
(
timeout
))
try
{
return
mRealRequreData
.
ReadByte
()>
0
;
if
(
realRequreEvent
.
WaitOne
(
timeout
))
{
return
mRealRequreData
.
ReadByte
()
>
0
;
}
}
finally
{
mRealRequreData
?.
ReleaseBuffer
();
}
return
false
;
}
...
...
@@ -551,10 +579,16 @@ namespace DBRunTime.ServiceApi
}
realRequreEvent
.
Reset
();
Send
(
mb
);
if
(
realRequreEvent
.
WaitOne
(
timeout
))
try
{
return
mRealRequreData
.
ReadByte
()
>
0
;
if
(
realRequreEvent
.
WaitOne
(
timeout
))
{
return
mRealRequreData
.
ReadByte
()
>
0
;
}
}
finally
{
mRealRequreData
?.
ReleaseBuffer
();
}
return
false
;
}
...
...
@@ -582,12 +616,17 @@ namespace DBRunTime.ServiceApi
this
.
hisRequreEvent
.
Reset
();
Send
(
mb
);
if
(
hisRequreEvent
.
WaitOne
(
timeout
)
&&
mHisRequreData
.
ReadableBytes
>
1
)
try
{
return
mHisRequreData
;
if
(
hisRequreEvent
.
WaitOne
(
timeout
)
&&
mHisRequreData
.
ReadableBytes
>
1
)
{
return
mHisRequreData
;
}
}
finally
{
mHisRequreData
?.
ReleaseBuffer
();
}
mHisRequreData
?.
ReleaseBuffer
();
return
null
;
}
...
...
@@ -613,12 +652,17 @@ namespace DBRunTime.ServiceApi
this
.
hisRequreEvent
.
Reset
();
Send
(
mb
);
if
(
hisRequreEvent
.
WaitOne
(
timeout
)
&&
mHisRequreData
.
ReadableBytes
>
1
)
try
{
return
mHisRequreData
;
if
(
hisRequreEvent
.
WaitOne
(
timeout
)
&&
mHisRequreData
.
ReadableBytes
>
1
)
{
return
mHisRequreData
;
}
}
finally
{
mHisRequreData
?.
ReleaseBuffer
();
}
mHisRequreData
?.
ReleaseBuffer
();
return
null
;
}
...
...
@@ -643,12 +687,17 @@ namespace DBRunTime.ServiceApi
mb
.
WriteLong
(
span
.
Ticks
);
this
.
hisRequreEvent
.
Reset
();
Send
(
mb
);
if
(
hisRequreEvent
.
WaitOne
(
timeout
)
&&
mHisRequreData
.
ReadableBytes
>
1
)
try
{
if
(
hisRequreEvent
.
WaitOne
(
timeout
)
&&
mHisRequreData
.
ReadableBytes
>
1
)
{
return
mHisRequreData
;
}
}
finally
{
return
mHisRequreData
;
mHisRequreData
?.
ReleaseBuffer
()
;
}
mHisRequreData
?.
ReleaseBuffer
();
return
null
;
}
...
...
DBRuntime.Proxy/Config/ProxyClientConfig.xml
浏览文件 @
e5970666
<?xml version="1.0" encoding="utf-8" ?>
<Config
Ip=
"127.0.0.1"
Port=
"14330"
LoginUser=
"Admin"
LoginPassword=
"Admin"
>
<Config>
<ProxyClient
Ip=
"127.0.0.1"
Port=
"14330"
LoginUser=
"Admin"
LoginPassword=
"Admin"
WorkMode=
"0"
PollCircle=
"1000"
/>
</Config>
\ No newline at end of file
DBRuntime.Proxy/DatabaseRunner.cs
浏览文件 @
e5970666
...
...
@@ -46,6 +46,10 @@ namespace DBRuntime.Proxy
private
bool
mIsClosed
=
false
;
private
NetTransformWorkMode
mWorkMode
=
NetTransformWorkMode
.
Poll
;
private
int
mPollCircle
=
1000
;
#
endregion
...
Variables
...
#
region
...
Events
...
...
...
@@ -54,6 +58,12 @@ namespace DBRuntime.Proxy
#
region
...
Constructor
...
static
DatabaseRunner
()
{
//注册日志
ServiceLocator
.
Locator
.
Registor
<
ILog
>(
new
ConsoleLogger
());
}
#
endregion
...
Constructor
...
#
region
...
Properties
...
...
...
@@ -89,6 +99,9 @@ namespace DBRuntime.Proxy
if
(
System
.
IO
.
File
.
Exists
(
sfileName
))
{
XElement
xe
=
XElement
.
Load
(
sfileName
);
if
(
xe
.
Element
(
"ProxyClient"
)
==
null
)
return
;
xe
=
xe
.
Element
(
"ProxyClient"
);
if
(
xe
.
Attribute
(
"Ip"
)!=
null
)
{
mIp
=
xe
.
Attribute
(
"Ip"
).
Value
;
...
...
@@ -108,6 +121,16 @@ namespace DBRuntime.Proxy
{
mPassword
=
xe
.
Attribute
(
"LoginPassword"
).
Value
;
}
if
(
xe
.
Attribute
(
"WorkMode"
)
!=
null
)
{
mWorkMode
=
(
NetTransformWorkMode
)
int
.
Parse
(
xe
.
Attribute
(
"WorkMode"
).
Value
);
}
if
(
xe
.
Attribute
(
"PollCircle"
)
!=
null
)
{
mPollCircle
=
int
.
Parse
(
xe
.
Attribute
(
"PollCircle"
).
Value
);
}
}
}
...
...
@@ -174,7 +197,7 @@ namespace DBRuntime.Proxy
string
sname
=
mProxy
.
GetRunnerDatabase
();
if
(!
string
.
IsNullOrEmpty
(
sname
))
{
Load
(
sname
);
CheckAndLoadDatabase
(
sname
);
break
;
}
}
...
...
@@ -184,11 +207,20 @@ namespace DBRuntime.Proxy
}
}
/// <summary>
///
/// </summary>
private
void
CheckAndLoadDatabase
(
string
database
)
{
string
[]
sbase
=
database
.
Split
(
new
char
[]
{
','
});
Load
(
sbase
[
0
],
sbase
[
1
]
+
sbase
[
2
]);
}
/// <summary>
///
/// </summary>
/// <param name="database"></param>
public
void
Load
(
string
database
)
public
void
Load
(
string
database
,
string
checkKey
)
{
if
(
database
==
mDatabaseName
)
return
;
...
...
@@ -207,6 +239,14 @@ namespace DBRuntime.Proxy
if
(
CheckDatabaseExist
(
mDatabaseName
))
{
var
mDatabase
=
new
DatabaseSerise
().
Load
(
mDatabaseName
);
string
skey
=
mDatabase
.
RealDatabase
.
Version
+
mDatabase
.
RealDatabase
.
UpdateTime
;
if
(
skey
!=
checkKey
)
{
LoggerService
.
Service
.
Warn
(
"Proxy"
,
"代理使用的数据库和服务器使用的数据库不一致."
);
}
this
.
mRealDatabase
=
mDatabase
.
RealDatabase
;
mSecurityRunner
=
new
SecurityRunner
()
{
Document
=
mDatabase
.
Security
};
}
...
...
@@ -216,7 +256,7 @@ namespace DBRuntime.Proxy
RegistorInterface
();
IsReady
=
true
;
mDriver
=
new
NetTransformDriver
()
{
Client
=
mProxy
.
NetworkClient
};
mDriver
=
new
NetTransformDriver
()
{
Client
=
mProxy
.
NetworkClient
,
WorkMode
=
mWorkMode
,
PollCircle
=
mPollCircle
};
mDriver
.
Start
(
realEnginer
);
}
...
...
DBRuntime.Proxy/DbServerProxy.cs
浏览文件 @
e5970666
此差异已折叠。
点击以展开。
DBRuntime.Proxy/Driver/NetTransformDriver.cs
浏览文件 @
e5970666
...
...
@@ -12,6 +12,14 @@ using System.Threading.Tasks;
namespace
DBRuntime.Proxy
{
public
enum
NetTransformWorkMode
{
//主动获取模式
Poll
,
//服务器主动推送
Push
}
public
class
NetTransformDriver
:
Cdy
.
Tag
.
Driver
.
IProducterDriver
{
...
...
@@ -27,6 +35,8 @@ namespace DBRuntime.Proxy
private
Thread
mScanThread
;
#
endregion
...
Variables
...
#
region
...
Events
...
...
...
@@ -44,6 +54,17 @@ namespace DBRuntime.Proxy
/// </summary>
public
ApiClient
Client
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
NetTransformWorkMode
WorkMode
{
get
;
set
;
}
/// <summary>
/// 查询周期
/// </summary>
public
int
PollCircle
{
get
;
set
;
}
=
1000
;
#
endregion
...
Properties
...
#
region
...
Methods
...
...
...
@@ -72,12 +93,23 @@ namespace DBRuntime.Proxy
{
while
(!
mIsClosed
)
{
resetEvent
.
WaitOne
();
if
(
mIsClosed
)
break
;
resetEvent
.
Reset
();
while
(
mCachDatas
.
Count
>
0
)
if
(
WorkMode
==
NetTransformWorkMode
.
Push
)
{
resetEvent
.
WaitOne
();
if
(
mIsClosed
)
break
;
resetEvent
.
Reset
();
while
(
mCachDatas
.
Count
>
0
)
{
ProcessSingleBufferData
(
mCachDatas
.
Dequeue
());
}
}
else
{
ProcessSingleBufferData
(
mCachDatas
.
Dequeue
());
DateTime
stime
=
DateTime
.
Now
;
ReadAllData
();
double
span
=
(
DateTime
.
Now
-
stime
).
TotalMilliseconds
;
int
sleeptime
=
span
>
PollCircle
?
1
:
(
int
)(
PollCircle
-
span
);
Thread
.
Sleep
(
sleeptime
);
}
}
}
...
...
@@ -218,7 +250,10 @@ namespace DBRuntime.Proxy
ServiceLocator
.
Locator
.
Resolve
<
IRealDataNotifyForProducter
>().
SubscribeProducter
(
"NetTransformDriver"
,
ProcessValueChanged
,
new
Func
<
List
<
int
>>(()
=>
{
return
new
List
<
int
>()
{
-
1
};
})
);
RegistorTag
();
if
(
WorkMode
==
NetTransformWorkMode
.
Push
)
RegistorTag
();
ReadAllData
();
mScanThread
=
new
Thread
(
RemoteDataudpatePro
);
mScanThread
.
IsBackground
=
true
;
...
...
DataRunner/Api/HisDataServerProcess.cs
浏览文件 @
e5970666
此差异已折叠。
点击以展开。
DataRunner/Api/TagInfoServerProcess.cs
浏览文件 @
e5970666
...
...
@@ -103,7 +103,7 @@ namespace DBRuntime.Api
loginId
=
data
.
ReadString
();
if
(
Cdy
.
Tag
.
ServiceLocator
.
Locator
.
Resolve
<
IRuntimeSecurity
>().
CheckLogin
(
loginId
))
{
Parent
.
AsyncCallback
(
client
,
ToByteBuffer
(
ApiFunConst
.
TagInfoRequest
,
Runner
.
mCurrentDatabas
e
));
Parent
.
AsyncCallback
(
client
,
ToByteBuffer
(
ApiFunConst
.
TagInfoRequest
,
Runner
.
CurrentDatabase
+
","
+
Runner
.
CurrentDatabaseVersion
+
","
+
Runner
.
CurrentDatabaseLastUpdateTim
e
));
}
break
;
...
...
DataRunner/Runner.cs
浏览文件 @
e5970666
...
...
@@ -21,7 +21,11 @@ namespace Cdy.Tag
#
region
...
Variables
...
public
static
string
mCurrentDatabase
=
""
;
public
static
string
CurrentDatabase
=
""
;
public
static
string
CurrentDatabaseVersion
=
""
;
public
static
string
CurrentDatabaseLastUpdateTime
=
""
;
/// <summary>
///
...
...
@@ -124,10 +128,12 @@ namespace Cdy.Tag
/// </summary>
private
void
LoadDatabase
()
{
this
.
mDatabase
=
new
DatabaseSerise
().
Load
(
mDatabaseName
);
this
.
mRealDatabase
=
this
.
mDatabase
.
RealDatabase
;
this
.
mHisDatabase
=
this
.
mDatabase
.
HisDatabase
;
CurrentDatabaseVersion
=
this
.
mRealDatabase
.
Version
;
CurrentDatabase
=
mRealDatabase
.
Name
;
CurrentDatabaseLastUpdateTime
=
mRealDatabase
.
UpdateTime
;
}
/// <summary>
...
...
@@ -182,6 +188,8 @@ namespace Cdy.Tag
DriverManager
.
Manager
.
Init
(
realEnginer
);
HisQueryManager
.
Instance
.
Registor
(
mDatabaseName
);
await
task
;
return
true
;
...
...
@@ -253,8 +261,6 @@ namespace Cdy.Tag
hisEnginer
.
Start
();
mSecurityRunner
.
Start
();
DriverManager
.
Manager
.
Start
();
mCurrentDatabase
=
database
;
mIsStarted
=
true
;
LoggerService
.
Service
.
Info
(
"Runner"
,
" 数据库 "
+
database
+
" 启动完成"
);
...
...
DbInRunWebApi/Config/DbWebApiProxy.cfg
浏览文件 @
e5970666
<?xml version="1.0" encoding="utf-8" ?>
<Config
Ip=
"127.0.0.1"
Port=
"14330"
LoginUser=
"Admin"
LoginPassword=
"Admin"
>
<Config>
<ProxyClient
Ip=
"127.0.0.1"
Port=
"14330"
LoginUser=
"Admin"
LoginPassword=
"Admin"
WorkMode=
"0"
PollCircle=
"1000"
/>
</Config>
\ No newline at end of file
DbInRunWebApi/Controllers/HisDataController.cs
浏览文件 @
e5970666
此差异已折叠。
点击以展开。
DbInRunWebApi/Controllers/HomeController.cs
浏览文件 @
e5970666
...
...
@@ -7,17 +7,14 @@ using Microsoft.AspNetCore.Mvc;
namespace
DbWebApiProxy.Controllers
{
[
Route
(
"[controller]"
)]
[
ApiController
]
public
class
HomeController
:
ControllerBase
public
class
HomeController
:
Controller
{
// GET: api/Home
[
HttpGet
]
public
string
Index
()
{
return
"welcome to mar realtime datase web api."
;
return
Res
.
Get
(
"WelcomeMsg"
)
;
}
}
}
DbInRunWebApi/DbWebApiProxy.csproj
浏览文件 @
e5970666
...
...
@@ -17,6 +17,25 @@
<ProjectReference Include="..\DBRuntime.Proxy\DBRuntime.Proxy.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.zh-CN.resx">
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<Generator>ResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Update="Config\DbWebApiProxy.cfg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
...
...
DbInRunWebApi/Model/RealValue.cs
浏览文件 @
e5970666
...
...
@@ -79,7 +79,7 @@ namespace DbInRunWebApi.Model
/// <summary>
///
/// </summary>
public
Dictionary
<
DateTime
,
object
>
Data
s
{
get
;
set
;
}
public
List
<
ValueItem
>
Value
s
{
get
;
set
;
}
#
endregion
...
Properties
...
#
region
...
Methods
...
...
...
@@ -91,6 +91,47 @@ namespace DbInRunWebApi.Model
#
endregion
...
Interfaces
...
}
public
class
ValueItem
{
#
region
...
Variables
...
#
endregion
...
Variables
...
#
region
...
Events
...
#
endregion
...
Events
...
#
region
...
Constructor
...
#
endregion
...
Constructor
...
#
region
...
Properties
...
/// <summary>
///
/// </summary>
public
DateTime
Time
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
Value
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
byte
Quality
{
get
;
set
;
}
#
endregion
...
Properties
...
#
region
...
Methods
...
#
endregion
...
Methods
...
#
region
...
Interfaces
...
#
endregion
...
Interfaces
...
}
/// <summary>
///
...
...
@@ -180,7 +221,7 @@ namespace DbInRunWebApi.Model
/// <summary>
///
/// </summary>
public
List
<
HisValue
>
Datas
{
get
;
set
;
}
public
HisValue
Datas
{
get
;
set
;
}
#
endregion
...
Properties
...
#
region
...
Methods
...
...
...
DbInRunWebApi/Model/Requestbase.cs
浏览文件 @
e5970666
...
...
@@ -217,7 +217,7 @@ namespace DbInRunWebApi.Model
/// <summary>
///
/// </summary>
public
List
<
DateTime
>
Times
{
get
;
set
;
}
public
List
<
string
>
Times
{
get
;
set
;
}
#
endregion
...
Properties
...
...
...
@@ -263,13 +263,18 @@ namespace DbInRunWebApi.Model
/// <summary>
///
/// </summary>
public
DateTime
StartTime
{
get
;
set
;
}
public
string
StartTime
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
DateTime
EndTime
{
get
;
set
;
}
public
string
EndTime
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
Duration
{
get
;
set
;
}
#
endregion
...
Properties
...
...
...
@@ -308,13 +313,13 @@ namespace DbInRunWebApi.Model
/// <summary>
///
/// </summary>
public
DateTime
StartTime
{
get
;
set
;
}
public
string
StartTime
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
DateTime
EndTime
{
get
;
set
;
}
public
string
EndTime
{
get
;
set
;
}
#
endregion
...
Properties
...
...
...
DbInRunWebApi/Properties/Resources.Designer.cs
0 → 100644
浏览文件 @
e5970666
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace
DbWebApiProxy.Properties
{
using
System
;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"System.Resources.Tools.StronglyTypedResourceBuilder"
,
"16.0.0.0"
)]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
internal
class
Resources
{
private
static
global
::
System
.
Resources
.
ResourceManager
resourceMan
;
private
static
global
::
System
.
Globalization
.
CultureInfo
resourceCulture
;
[
global
::
System
.
Diagnostics
.
CodeAnalysis
.
SuppressMessageAttribute
(
"Microsoft.Performance"
,
"CA1811:AvoidUncalledPrivateCode"
)]
internal
Resources
()
{
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[
global
::
System
.
ComponentModel
.
EditorBrowsableAttribute
(
global
::
System
.
ComponentModel
.
EditorBrowsableState
.
Advanced
)]
internal
static
global
::
System
.
Resources
.
ResourceManager
ResourceManager
{
get
{
if
(
object
.
ReferenceEquals
(
resourceMan
,
null
))
{
global
::
System
.
Resources
.
ResourceManager
temp
=
new
global
::
System
.
Resources
.
ResourceManager
(
"DbWebApiProxy.Properties.Resources"
,
typeof
(
Resources
).
Assembly
);
resourceMan
=
temp
;
}
return
resourceMan
;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[
global
::
System
.
ComponentModel
.
EditorBrowsableAttribute
(
global
::
System
.
ComponentModel
.
EditorBrowsableState
.
Advanced
)]
internal
static
global
::
System
.
Globalization
.
CultureInfo
Culture
{
get
{
return
resourceCulture
;
}
set
{
resourceCulture
=
value
;
}
}
/// <summary>
/// 查找类似 Welcome to Web Api of Mars high performance realtime iot database 的本地化字符串。
/// </summary>
internal
static
string
WelcomeMsg
{
get
{
return
ResourceManager
.
GetString
(
"WelcomeMsg"
,
resourceCulture
);
}
}
}
}
DbInRunWebApi/Properties/Resources.resx
0 → 100644
浏览文件 @
e5970666
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema
id=
"root"
xmlns=
""
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:msdata=
"urn:schemas-microsoft-com:xml-msdata"
>
<xsd:import
namespace=
"http://www.w3.org/XML/1998/namespace"
/>
<xsd:element
name=
"root"
msdata:IsDataSet=
"true"
>
<xsd:complexType>
<xsd:choice
maxOccurs=
"unbounded"
>
<xsd:element
name=
"metadata"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
use=
"required"
type=
"xsd:string"
/>
<xsd:attribute
name=
"type"
type=
"xsd:string"
/>
<xsd:attribute
name=
"mimetype"
type=
"xsd:string"
/>
<xsd:attribute
ref=
"xml:space"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"assembly"
>
<xsd:complexType>
<xsd:attribute
name=
"alias"
type=
"xsd:string"
/>
<xsd:attribute
name=
"name"
type=
"xsd:string"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"data"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"1"
/>
<xsd:element
name=
"comment"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"2"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
use=
"required"
msdata:Ordinal=
"1"
/>
<xsd:attribute
name=
"type"
type=
"xsd:string"
msdata:Ordinal=
"3"
/>
<xsd:attribute
name=
"mimetype"
type=
"xsd:string"
msdata:Ordinal=
"4"
/>
<xsd:attribute
ref=
"xml:space"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"resheader"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"1"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
use=
"required"
/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader
name=
"resmimetype"
>
<value>
text/microsoft-resx
</value>
</resheader>
<resheader
name=
"version"
>
<value>
2.0
</value>
</resheader>
<resheader
name=
"reader"
>
<value>
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader
name=
"writer"
>
<value>
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<data
name=
"WelcomeMsg"
xml:space=
"preserve"
>
<value>
Welcome to Web Api of Mars high performance realtime iot database
</value>
</data>
</root>
\ No newline at end of file
DbInRunWebApi/Properties/Resources.zh-CN.resx
0 → 100644
浏览文件 @
e5970666
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema
id=
"root"
xmlns=
""
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:msdata=
"urn:schemas-microsoft-com:xml-msdata"
>
<xsd:import
namespace=
"http://www.w3.org/XML/1998/namespace"
/>
<xsd:element
name=
"root"
msdata:IsDataSet=
"true"
>
<xsd:complexType>
<xsd:choice
maxOccurs=
"unbounded"
>
<xsd:element
name=
"metadata"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
use=
"required"
type=
"xsd:string"
/>
<xsd:attribute
name=
"type"
type=
"xsd:string"
/>
<xsd:attribute
name=
"mimetype"
type=
"xsd:string"
/>
<xsd:attribute
ref=
"xml:space"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"assembly"
>
<xsd:complexType>
<xsd:attribute
name=
"alias"
type=
"xsd:string"
/>
<xsd:attribute
name=
"name"
type=
"xsd:string"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"data"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"1"
/>
<xsd:element
name=
"comment"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"2"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
use=
"required"
msdata:Ordinal=
"1"
/>
<xsd:attribute
name=
"type"
type=
"xsd:string"
msdata:Ordinal=
"3"
/>
<xsd:attribute
name=
"mimetype"
type=
"xsd:string"
msdata:Ordinal=
"4"
/>
<xsd:attribute
ref=
"xml:space"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"resheader"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"1"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
use=
"required"
/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader
name=
"resmimetype"
>
<value>
text/microsoft-resx
</value>
</resheader>
<resheader
name=
"version"
>
<value>
2.0
</value>
</resheader>
<resheader
name=
"reader"
>
<value>
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader
name=
"writer"
>
<value>
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<data
name=
"WelcomeMsg"
xml:space=
"preserve"
>
<value>
欢迎来到Mars高性能实时物联数据库 Web Api
</value>
</data>
</root>
\ No newline at end of file
DbInRunWebApi/Res.cs
0 → 100644
浏览文件 @
e5970666
//==============================================================
// Copyright (C) 2020 Inc. All rights reserved.
//
//==============================================================
// Create by 种道洋 at 2020/3/29 11:05:05.
// Version 1.0
// 种道洋
//==============================================================
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Threading
;
namespace
DbWebApiProxy
{
public
class
Res
{
public
static
string
Get
(
string
name
)
{
return
Properties
.
Resources
.
ResourceManager
.
GetString
(
name
,
Thread
.
CurrentThread
.
CurrentCulture
);
}
}
}
DbInRunWebApi/WebAPIStartup.cs
浏览文件 @
e5970666
...
...
@@ -40,8 +40,10 @@ namespace DbInRunWebApi
app
.
UseEndpoints
(
endpoints
=>
{
endpoints
.
MapControllers
();
endpoints
.
MapDefaultControllerRoute
();
endpoints
.
MapControllerRoute
(
name
:
"default"
,
pattern
:
"{controller=Home}/{action=Index}/{id?}"
);
});
DatabaseRunner
.
Manager
.
Load
();
DatabaseRunner
.
Manager
.
Start
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录