Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openXG-WIC-Opencpc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alex037yang
openXG-WIC-Opencpc
Commits
efa386eb
Commit
efa386eb
authored
Apr 16, 2018
by
joliu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改部分代码没有返回值的问题
parent
8ec7de46
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
10 deletions
+38
-10
hfv/controllMatrix.py
hfv/controllMatrix.py
+38
-10
No files found.
hfv/controllMatrix.py
View file @
efa386eb
...
...
@@ -12,7 +12,32 @@ import numpy as np
import
json
import
time
# ~~~~~~~~~~~~~~~~~~~inputDB操作函数~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 更新任务执行控制表
def
updateDeviceTask
(
data
,
dstIP
,
ctime
):
sql
=
"select * from decidedestination"
(
status
,
output
)
=
sendToDB
(
sql
)
if
status
==
-
1
:
return
(
status
,
output
)
if
output
==
[]:
sql
=
"insert into decidedestination (data,dst,ctime) values
\
('%s','%s',%d)"
%
(
data
,
dstIP
,
ctime
)
else
:
sql
=
"update decidedestination set data='%s',dst='%s',ctime=%d"
%
\
(
data
,
dstIP
,
ctime
)
return
sendToDB
(
sql
)
# 获取任务执行控制表
def
getDeviceTask
():
sql
=
"select * from decidedestination"
(
status
,
output
)
=
sendToDB
(
sql
)
if
status
==
-
1
:
return
(
status
,
output
)
return
(
status
,
output
[
0
])
# ~~~~~~~~~~~~~~~~~~~dataCach操作函数~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 更新设备输入数据信息
def
updateDataCach
(
device
,
decideValue
):
# 检查是否存在该设备在预接收的列表中,如果不存在则丢弃
...
...
@@ -54,7 +79,8 @@ def insertDB(taskMatrix, inputTypeList, deviceList, status, ctime):
sql
=
"insert into resulovetable
\
(taskmatrix,inputtype, status, devicelist, ctime) values
\
('%s','%s',%d,'%s',%d)"
%
(
taskMatrix
,
inputTypeList
,
status
,
deviceList
,
ctime
)
print
(
sendToDB
(
sql
))
return
sendToDB
(
sql
)
def
sendToDB
(
sql
):
...
...
@@ -112,20 +138,22 @@ def getCircleTime():
return
data
[
5
]
def
showDB
():
def
showDB
(
tableName
):
# 打印数据库内容
# sql = "select * from resulovetable"
sql
=
"select * from datacach"
print
(
sendToDB
(
sql
)
)
sql
=
"select * from %s"
%
tableName
return
sendToDB
(
sql
)
def
clearDB
():
# 清空数据库
sql
=
"delete from resulovetable"
print
(
sendToDB
(
sql
))
sql
=
"delete from datacach"
print
(
sendToDB
(
sql
))
dbNames
=
[
'resulovetable'
,
'datacach'
,
'decidedestination'
]
for
name
in
dbNames
:
sql
=
"delete from %s"
%
name
(
status
,
output
)
=
sendToDB
(
sql
)
if
status
==
-
1
:
break
return
(
status
,
output
)
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment