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
1c3fec83
Commit
1c3fec83
authored
Nov 28, 2024
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 新增获取返修/报废工单的反馈图片接口
parent
2f10754b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
jzjx_project/controllers/inherit_production.py
+34
-0
No files found.
jzjx_project/controllers/inherit_production.py
View file @
1c3fec83
...
@@ -82,6 +82,40 @@ class JzjxRokeRefixAutoWorkOrder(http.Controller):
...
@@ -82,6 +82,40 @@ class JzjxRokeRefixAutoWorkOrder(http.Controller):
refix_params
=
_self
.
env
[
'ir.config_parameter'
]
.
sudo
()
.
get_param
(
"refix_auto_work_order"
)
refix_params
=
_self
.
env
[
'ir.config_parameter'
]
.
sudo
()
.
get_param
(
"refix_auto_work_order"
)
return
{
"code"
:
0
,
"message"
:
"成功!"
,
"state"
:
refix_params
==
"True"
or
refix_params
is
True
}
return
{
"code"
:
0
,
"message"
:
"成功!"
,
"state"
:
refix_params
==
"True"
or
refix_params
is
True
}
@http.route
(
'/roke/work_record/get_image_data'
,
type
=
'json'
,
auth
=
'user'
,
csrf
=
False
,
cors
=
"*"
)
def
work_record_get_image_data
(
self
):
"""
获取返修/报废工单的反馈图片
"""
_self
=
http
.
request
work_order_id
=
_self
.
jsonrequest
.
get
(
"work_order_id"
,
0
)
if
not
work_order_id
:
return
{
"code"
:
1
,
"message"
:
"入参错误!工单ID为必传参数。"
,
"data"
:
[]}
work_order
=
_self
.
env
[
"roke.work.order"
]
.
search
([(
"id"
,
"="
,
work_order_id
)])
if
not
work_order
:
return
{
"code"
:
1
,
"message"
:
"校验失败!未找到该工单数据。"
,
"data"
:
[]}
if
work_order
.
type
==
"返修"
:
scrap_order_line
=
_self
.
env
[
"roke.repair.order.line"
]
.
search
([
(
"repair_work_order_id"
,
"="
,
work_order
.
id
)
],
limit
=
1
)
record_id
=
scrap_order_line
.
wr_id
elif
work_order
.
type
==
"补件"
:
scrap_order_line
=
_self
.
env
[
"roke.scrap.order.line"
]
.
search
([(
"scrap_work_order_ids"
,
"="
,
work_order
.
id
)],
limit
=
1
)
record_id
=
scrap_order_line
.
wr_id
else
:
return
{
"code"
:
1
,
"message"
:
"校验失败!该工单不是返修/报废工单。"
,
"data"
:
[]}
data_list
=
[]
attachment
=
_self
.
env
[
'ir.attachment'
]
.
search
([
(
"res_model"
,
"="
,
"roke.work.record"
),
(
"res_id"
,
"="
,
record_id
.
id
)
])
for
v
in
attachment
:
if
not
v
.
access_token
:
v
.
generate_access_token
()
url
=
f
"/web/image/{v.id}?access_token={v.access_token}&unique={str(fields.Datetime.now().timestamp())}"
data_list
.
append
(
url
)
return
{
"code"
:
0
,
"message"
:
"获取成功!"
,
"data"
:
data_list
}
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
))
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
))
templateloader
=
FileSystemLoader
(
searchpath
=
BASE_DIR
+
"/static/src/html/view"
)
templateloader
=
FileSystemLoader
(
searchpath
=
BASE_DIR
+
"/static/src/html/view"
)
...
...
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