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
d9c4951b
Commit
d9c4951b
authored
Nov 16, 2024
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 新增补件工单逻辑
parent
fddf4697
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
112 additions
and
4 deletions
+112
-4
jzjx_project/__manifest__.py
+2
-1
jzjx_project/controllers/inherit_product_task.py
+2
-2
jzjx_project/controllers/roke_work_order.py
+43
-1
jzjx_project/models/__init__.py
+1
-0
jzjx_project/models/inherit_roke_scrap_order.py
+17
-0
jzjx_project/views/inherit_roke_scrap_order_view.xml
+47
-0
No files found.
jzjx_project/__manifest__.py
View file @
d9c4951b
...
@@ -21,7 +21,8 @@
...
@@ -21,7 +21,8 @@
'views/iniherit_work_order_view.xml'
,
'views/iniherit_work_order_view.xml'
,
'views/roke_work_log_views.xml'
,
'views/roke_work_log_views.xml'
,
'views/iniherit_work_center_view.xml'
,
'views/iniherit_work_center_view.xml'
,
'wizard/inherit_roke_create_work_record_wizard_view.xml'
'wizard/inherit_roke_create_work_record_wizard_view.xml'
,
'views/inherit_roke_scrap_order_view.xml'
],
],
'qweb'
:
[
'qweb'
:
[
],
],
...
...
jzjx_project/controllers/inherit_product_task.py
View file @
d9c4951b
...
@@ -49,10 +49,10 @@ class JzjxInheritRokeWorkstationProductionTask(RokeWorkstationProductionTask):
...
@@ -49,10 +49,10 @@ class JzjxInheritRokeWorkstationProductionTask(RokeWorkstationProductionTask):
union all''' if work_order.ids else ""}
union all''' if work_order.ids else ""}
SELECT id, 'work' as "type", create_date
SELECT id, 'work' as "type", create_date
FROM roke_work_order
FROM roke_work_order
WHERE type
= '返修'
WHERE type
in ('返修', '补件')
and process_id in ({" , ".join([f"{v}" for v in process_list])})
and process_id in ({" , ".join([f"{v}" for v in process_list])})
and state = '未完工'
and state = '未完工'
and
repair_task_id is not
null
and
task_id is
null
) as task_repair_work
) as task_repair_work
ORDER BY create_date desc
ORDER BY create_date desc
LIMIT {limit}
LIMIT {limit}
...
...
jzjx_project/controllers/roke_work_order.py
View file @
d9c4951b
...
@@ -35,6 +35,7 @@ class RokeWorkstationWorkOrderModel(http.Controller):
...
@@ -35,6 +35,7 @@ class RokeWorkstationWorkOrderModel(http.Controller):
"unqualified_qty"
:
v
.
unqualified_qty
or
0
,
"unqualified_qty"
:
v
.
unqualified_qty
or
0
,
"scrap_qty"
:
sum
(
v
.
scrap_line_ids
.
mapped
(
"qty"
)),
"scrap_qty"
:
sum
(
v
.
scrap_line_ids
.
mapped
(
"qty"
)),
"repair_qty"
:
sum
(
v
.
repair_line_ids
.
mapped
(
"qty"
)),
"repair_qty"
:
sum
(
v
.
repair_line_ids
.
mapped
(
"qty"
)),
"is_rfe"
:
v
.
scrap_order_id
.
is_rfe
,
"work_time"
:
pytz_conversion
(
_self
,
v
.
work_time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M'
))
"work_time"
:
pytz_conversion
(
_self
,
v
.
work_time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M'
))
})
})
return
{
"code"
:
0
,
"message"
:
f
"获取成功!"
,
"data"
:
data
}
return
{
"code"
:
0
,
"message"
:
f
"获取成功!"
,
"data"
:
data
}
...
@@ -42,7 +43,7 @@ class RokeWorkstationWorkOrderModel(http.Controller):
...
@@ -42,7 +43,7 @@ class RokeWorkstationWorkOrderModel(http.Controller):
@http.route
(
'/roke/workstation/work_record/get_workstation_work_process'
,
type
=
'json'
,
auth
=
'user'
,
csrf
=
False
,
cors
=
"*"
)
@http.route
(
'/roke/workstation/work_record/get_workstation_work_process'
,
type
=
'json'
,
auth
=
'user'
,
csrf
=
False
,
cors
=
"*"
)
def
get_workstation_work_process
(
self
):
def
get_workstation_work_process
(
self
):
"""
"""
获取工单的
不良报工记录
获取工单的
任务内的工序
"""
"""
_self
=
http
.
request
_self
=
http
.
request
work_order_id
=
_self
.
jsonrequest
.
get
(
"work_order_id"
,
0
)
work_order_id
=
_self
.
jsonrequest
.
get
(
"work_order_id"
,
0
)
...
@@ -58,3 +59,44 @@ class RokeWorkstationWorkOrderModel(http.Controller):
...
@@ -58,3 +59,44 @@ class RokeWorkstationWorkOrderModel(http.Controller):
"name"
:
v
.
process_id
.
name
or
""
"name"
:
v
.
process_id
.
name
or
""
})
})
return
{
"code"
:
0
,
"message"
:
f
"获取成功!"
,
"data"
:
data
}
return
{
"code"
:
0
,
"message"
:
f
"获取成功!"
,
"data"
:
data
}
@http.route
(
'/roke/workstation/scrap_order/get_workstation_work_process'
,
type
=
'json'
,
auth
=
'user'
,
csrf
=
False
,
cors
=
"*"
)
def
get_workstation_work_process
(
self
):
"""
生成补件工单
"""
_self
=
http
.
request
work_record_id
=
_self
.
jsonrequest
.
get
(
"work_record_id"
,
0
)
process_list
=
_self
.
jsonrequest
.
get
(
"process_list"
,
[])
if
not
work_record_id
:
return
{
"code"
:
1
,
"message"
:
f
"入参错误! “报工记录ID”为必传数据。"
}
if
not
process_list
:
return
{
"code"
:
1
,
"message"
:
f
"入参错误! “工序”为必传数据。"
}
work_record
=
_self
.
env
[
"roke.work.record"
]
.
search
([(
"id"
,
"="
,
work_record_id
)])
if
not
work_record_id
:
return
{
"code"
:
1
,
"message"
:
f
"校验错误! 没找到对应的报工记录。"
}
work_order_ids
=
[]
index
=
1
for
v
in
process_list
:
plan_qty
=
v
.
get
(
"qty"
,
0
)
process_id
=
v
.
get
(
"process_id"
,
0
)
work_order_ids
.
append
((
0
,
0
,
{
"process_id"
:
process_id
,
"product_id"
:
work_record
.
work_order_id
.
product_id
.
id
,
"plan_qty"
:
plan_qty
,
"sequence"
:
index
,
"planned_start_time"
:
work_record
.
work_order_id
.
planned_start_time
,
"plan_date"
:
work_record
.
work_order_id
.
plan_date
,
"repair_task_id"
:
work_record
.
pt_id
.
id
,
"type"
:
"补件"
}))
index
+=
1
for
v
in
work_record
.
scrap_line_ids
:
v
.
write
({
"scrap_work_order_ids"
:
work_order_ids
,
"is_rfe"
:
True
})
break
work_record
.
scrap_order_id
.
write
({
"is_rfe"
:
True
})
return
{
"code"
:
0
,
"message"
:
f
"补件工单创建成功!"
}
jzjx_project/models/__init__.py
View file @
d9c4951b
...
@@ -4,3 +4,4 @@ from . import inherit_workcenter
...
@@ -4,3 +4,4 @@ from . import inherit_workcenter
from
.
import
work_log
from
.
import
work_log
from
.
import
inherit_res_config_settings
from
.
import
inherit_res_config_settings
from
.
import
inheirt_roke_repair_order
from
.
import
inheirt_roke_repair_order
from
.
import
inherit_roke_scrap_order
jzjx_project/models/inherit_roke_scrap_order.py
0 → 100644
View file @
d9c4951b
import
logging
from
.
import
generator
from
odoo
import
models
,
fields
,
api
,
_
_logger
=
logging
.
getLogger
(
__name__
)
class
JzjxInheritScrapOrder
(
models
.
Model
):
_inherit
=
"roke.scrap.order"
is_rfe
=
fields
.
Boolean
(
string
=
"是否工单补件"
)
class
JzjxInheritScrapOrderLine
(
models
.
Model
):
_inherit
=
"roke.scrap.order.line"
scrap_work_order_ids
=
fields
.
Many2many
(
"roke.work.order"
,
string
=
"返修工单"
)
is_rfe
=
fields
.
Boolean
(
string
=
"是否工单补件"
)
jzjx_project/views/inherit_roke_scrap_order_view.xml
0 → 100644
View file @
d9c4951b
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record
id=
"inherit_view_roke_repair_order_form"
model=
"ir.ui.view"
>
<field
name=
"name"
>
inherit.roke.scrap.order.line.form
</field>
<field
name=
"model"
>
roke.scrap.order.line
</field>
<field
name=
"inherit_id"
ref=
"roke_mes_quality.view_roke_scrap_order_line_form"
/>
<field
name=
"arch"
type=
"xml"
>
<xpath
expr=
"//page[@name='eplenish_pt_ids']"
position=
"after"
>
<page
string=
"补件工单"
name=
"scrap_work_order_ids"
>
<field
name=
"scrap_work_order_ids"
readonly=
"1"
/>
</page>
</xpath>
</field>
</record>
<record
id=
"inherit_view_roke_scrap_order_form"
model=
"ir.ui.view"
>
<field
name=
"name"
>
inherit.roke.scrap.order.form
</field>
<field
name=
"model"
>
roke.scrap.order
</field>
<field
name=
"inherit_id"
ref=
"roke_mes_quality.view_roke_scrap_order_form"
/>
<field
name=
"arch"
type=
"xml"
>
<xpath
expr=
"//field[@name='line_ids']/tree//button[@name='execute_replenish']"
position=
"replace"
>
<field
name=
"is_rfe"
invisible=
"1"
/>
<field
name=
"allow_replenish_qty"
invisible=
"1"
/>
<button
name=
"execute_replenish"
type=
"object"
string=
"执行补件"
class=
"oe_highlight"
attrs=
"{'invisible': ['|', ('allow_replenish_qty', '<=', 0), '|', ('state', 'in', ['取消', '待确认']), ('is_rfe', '=', True)]}"
/>
</xpath>
<xpath
expr=
"//button[@name='multi_execute_replenish']"
position=
"replace"
>
<field
name=
"is_rfe"
invisible=
"1"
/>
<button
name=
"multi_execute_replenish"
type=
"object"
string=
"批量执行补件"
class=
"oe_highlight"
attrs=
"{'invisible': ['|', ('state', 'in', ['取消', '待确认']), '|', ('can_replenish', '!=', True), ('is_rfe', '=', True)]}"
/>
</xpath>
</field>
</record>
<record
id=
"inherit_view_roke_scrap_order_line_tree"
model=
"ir.ui.view"
>
<field
name=
"name"
>
inherit.roke.scrap.order.line.tree
</field>
<field
name=
"model"
>
roke.scrap.order.line
</field>
<field
name=
"inherit_id"
ref=
"roke_mes_quality.view_roke_scrap_order_line_tree"
/>
<field
name=
"arch"
type=
"xml"
>
<xpath
expr=
"//button[@name='execute_replenish']"
position=
"replace"
>
<field
name=
"is_rfe"
invisible=
"1"
/>
<button
name=
"execute_replenish"
type=
"object"
string=
"执行补件"
class=
"oe_highlight"
attrs=
"{'invisible': ['|', ('allow_replenish_qty', '<=', 0), '|', ('state', 'in', ['取消', '待确认']), ('is_rfe', '=', True)]}"
/>
</xpath>
</field>
</record>
</odoo>
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