Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dwsproject
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dws
dwsproject
Commits
3d3bbfe2
Commit
3d3bbfe2
authored
Jun 26, 2025
by
柏宁宁
Browse files
Options
Browse Files
Download
Plain Diff
合并分支 'tht-nn' 到 'tht-project'
add 报警信息接口 查看合并请求
!20
parents
06f00976
cb425818
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
2 deletions
+45
-2
tht_project/controllers/big_screen.py
+45
-2
No files found.
tht_project/controllers/big_screen.py
View file @
3d3bbfe2
# -*- coding: utf-8 -*-
from
odoo
import
http
,
fields
from
odoo
import
http
,
fields
,
SUPERUSER_ID
from
odoo.http
import
request
from
odoo.addons.roke_mes_three_colour_light.controller.main
import
RokeMesThreeColourLight
import
os
import
math
from
datetime
import
datetime
,
time
from
datetime
import
datetime
,
time
,
timedelta
from
jinja2
import
Environment
,
FileSystemLoader
import
logging
import
requests
...
...
@@ -164,3 +164,46 @@ class ResMesBigScreen(http.Controller):
def
get_lishibaozhuang_data
(
self
):
body
=
http
.
request
.
jsonrequest
return
self
.
common_dws_interface
(
body
,
'/get_real_time_device_data'
,
cate
=
"制袋包装机"
)
@http.route
(
'/roke/tht/get_abnormal_alarm_list'
,
type
=
'json'
,
auth
=
"none"
,
methods
=
[
'POST'
,
'OPTIONS'
],
csrf
=
False
,
cors
=
'*'
)
def
get_abnormal_alarm_list
(
self
):
"""
获取异常表单列表
:return:
"""
jsonrequest
=
http
.
request
.
jsonrequest
domain
=
[]
abnormal_alarm_id
=
jsonrequest
.
get
(
'abnormal_alarm_id'
,
False
)
#表单id
if
abnormal_alarm_id
:
domain
.
append
((
'id'
,
'='
,
abnormal_alarm_id
))
abnormal_id
=
jsonrequest
.
get
(
'abnormal_id'
,
False
)
#异常类型id
if
abnormal_id
:
domain
.
append
((
'abnormal_id'
,
'='
,
abnormal_id
))
page_size
=
int
(
http
.
request
.
jsonrequest
.
get
(
'page_size'
,
20
))
page_no
=
int
(
http
.
request
.
jsonrequest
.
get
(
'page_no'
,
1
))
abnormal_alarm_ids
=
http
.
request
.
env
(
user
=
SUPERUSER_ID
)[
'roke.abnormal.alarm'
]
.
search
(
domain
,
limit
=
page_size
,
offset
=
(
page_no
-
1
)
*
page_size
,
order
=
"originating_time desc"
)
abnormal_alarm_list
=
[]
for
item
in
abnormal_alarm_ids
:
note
=
''
if
item
.
abnormal_id
.
name
==
'设备异常'
:
note
=
f
"{item.equipment_id.name or ''}发生了故障"
elif
item
.
abnormal_id
.
name
==
'缺料断料'
:
note
=
f
"{item.sponsor.name or item.create_uid.name or ''} 发起了缺料申请"
abnormal_alarm_list
.
append
({
"id"
:
item
.
id
,
# 异常表单id
"abnormal_name"
:
item
.
abnormal_id
.
name
,
# 异常类型
"originating_time"
:
(
item
.
originating_time
+
timedelta
(
hours
=
8
))
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
if
item
.
originating_time
else
''
,
#发起时间
"note"
:
note
,
#报警表述
})
total
=
http
.
request
.
env
(
user
=
SUPERUSER_ID
)[
'roke.abnormal.alarm'
]
.
search_count
(
domain
)
return
{
"state"
:
"success"
,
"msgs"
:
"获取成功"
,
"total"
:
total
,
"abnormal_alarm_list"
:
abnormal_alarm_list
}
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