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
f814b607
Commit
f814b607
authored
Nov 27, 2024
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 修改手动下拉文件逻辑,添加到工作台中
parent
10995ff1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
23 deletions
+46
-23
jzjx_project/controllers/inherit_production.py
+23
-0
jzjx_project/models/work_log.py
+23
-23
jzjx_project/static/src/html/view/zdy_gdbg.html
+0
-0
No files found.
jzjx_project/controllers/inherit_production.py
View file @
f814b607
import
os
from
jinja2
import
FileSystemLoader
,
Environment
from
odoo
import
models
,
fields
,
api
,
http
,
SUPERUSER_ID
,
_
from
odoo.addons.roke_mes_quality.controller.inherit_production
import
InheritProduction
from
odoo.addons.roke_mes_production.controller.work_report
import
WorkReportKanban
import
logging
import
math
...
...
@@ -77,3 +81,22 @@ class JzjxRokeRefixAutoWorkOrder(http.Controller):
_self
=
http
.
request
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
}
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
))
templateloader
=
FileSystemLoader
(
searchpath
=
BASE_DIR
+
"/static/src/html/view"
)
env
=
Environment
(
loader
=
templateloader
)
class
JzjxRokeWorkReportKanban
(
WorkReportKanban
):
@http.route
(
'/roke/work/report/work_order_report'
,
type
=
'http'
,
auth
=
'public'
,
csrf
=
False
)
def
work_order_report
(
self
):
"""工单报工"""
values
=
{}
# 修改Jinja2 分隔符
env
.
variable_start_string
=
'[['
env
.
variable_end_string
=
']]'
template
=
env
.
get_template
(
'zdy_gdbg.html'
)
html
=
template
.
render
(
values
)
return
html
jzjx_project/models/work_log.py
View file @
f814b607
...
...
@@ -45,29 +45,29 @@ class RokeWorkLog(models.Model):
@api.model
def
create
(
self
,
vals
):
res
=
super
(
RokeWorkLog
,
self
)
.
create
(
vals
)
file_list
=
res
.
fileName
.
split
(
"
\\
"
)
if
not
file_list
:
return
res
file_name
=
file_list
[
-
1
]
.
split
(
"_"
)
if
not
file_name
:
return
res
task_code
=
file_name
[
0
]
task
=
self
.
env
[
"roke.production.task"
]
.
sudo
()
.
search
([(
"code"
,
"="
,
task_code
)])
if
not
task
:
return
res
work_order
=
self
.
env
[
"roke.work.order"
]
.
sudo
()
.
search
([(
"process_id.name"
,
"ilike"
,
"切割"
)],
limit
=
1
)
if
not
work_order
:
return
res
try
:
work_order
.
app_confirm
(
finish_qty
=
sum
(
res
.
part_ids
.
mapped
(
"amount"
)),
employee_id
=
self
.
env
.
user
.
employee_id
.
id
,
unqualified_qty
=
0
,
work_hours
=
round
(
res
.
timeTaken
/
3600
,
2
),
team_id
=
0
,
)
except
Exception
as
e
:
_logger
.
info
(
f
"{e}"
)
#
file_list = res.fileName.split("\\")
#
if not file_list:
#
return res
#
file_name = file_list[-1].split("_")
#
if not file_name:
#
return res
#
task_code = file_name[0]
#
task = self.env["roke.production.task"].sudo().search([("code", "=", task_code)])
#
if not task:
#
return res
#
work_order = self.env["roke.work.order"].sudo().search([("process_id.name", "ilike", "切割")], limit=1)
#
if not work_order:
#
return res
#
try:
#
work_order.app_confirm(
#
finish_qty=sum(res.part_ids.mapped("amount")),
#
employee_id=self.env.user.employee_id.id,
#
unqualified_qty=0,
#
work_hours=round(res.timeTaken / 3600, 2),
#
team_id=0,
#
)
#
except Exception as e:
#
_logger.info(f"{e}")
return
res
...
...
jzjx_project/static/src/html/view/zdy_gdbg.html
0 → 100644
View file @
f814b607
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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