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
aed9d6e7
Commit
aed9d6e7
authored
Nov 22, 2024
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 修改问题
parent
b90cb138
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
2 deletions
+91
-2
jzjx_project/controllers/inherit_production.py
+30
-0
jzjx_project/controllers/roke_work_order.py
+42
-0
jzjx_project/models/inherit_production_task.py
+9
-2
jzjx_project/static/src/html/view/craft_design.html
+0
-0
jzjx_project/wizard/inherit_roke_create_work_record_wizard.py
+10
-0
No files found.
jzjx_project/controllers/inherit_production.py
View file @
aed9d6e7
...
@@ -25,6 +25,36 @@ class JzjxInheritProduction(InheritProduction):
...
@@ -25,6 +25,36 @@ class JzjxInheritProduction(InheritProduction):
res
.
update
({
"repair_process_id"
:
repair_process_id
})
res
.
update
({
"repair_process_id"
:
repair_process_id
})
return
res
return
res
def
check_join_in_data
(
self
,
values
):
work_order_id
=
values
.
get
(
'work_order_id'
,
False
)
# 工单ID
product_id
=
values
.
get
(
'product_id'
,
False
)
# 产品
process_id
=
values
.
get
(
'process_id'
,
False
)
# 工序
finish_qty
=
float
(
values
.
get
(
'finish_qty'
)
or
0
)
# 合格数量
unqualified_qty
=
float
(
values
.
get
(
'unqualified_qty'
)
or
0
)
# 不合格数量
work_hours
=
float
(
values
.
get
(
'work_hours'
)
or
0
)
# 工时数
employee_list
=
values
.
get
(
'employee_list'
,
[])
# 人员分配:[{'employee_id':1, 'weighted': 1}]
repair_qty
=
values
.
get
(
'repair_qty'
,
False
)
# 人员分配:[{'employee_id':1, 'weighted': 1}]
# 校验入参工单ID、产品、工序、人员列表、不合格数和报废数、返修数
if
not
work_order_id
and
(
not
product_id
or
not
process_id
):
return
{
"state"
:
"error"
,
"msgs"
:
"无工单ID时表示无工单报工,必须入参产品ID和工序ID"
}
if
not
employee_list
or
type
(
employee_list
)
not
in
(
list
,
tuple
):
return
{
"state"
:
"error"
,
"msgs"
:
"请选择人员"
}
if
not
repair_qty
or
(
float
(
finish_qty
)
<
0
or
float
(
unqualified_qty
)
<
0
):
return
{
"state"
:
"error"
,
"msgs"
:
"合格数或不合格数不得小于0"
}
# 判断是否能获取到辅计量数据
aux_list
=
values
.
get
(
'aux_list'
,
[])
# 合格数量辅计量数据
unaux_list
=
values
.
get
(
'unaux_list'
,
[])
# 不合格辅计量数据
if
aux_list
or
unaux_list
:
finish_aux_list
=
[
aux
.
get
(
'aux_qty'
,
0
)
for
aux
in
aux_list
if
aux
.
get
(
'aux_qty'
,
0
)
>
0
]
unqualified_aux_list
=
[
aux
.
get
(
'aux_qty'
,
0
)
for
aux
in
unaux_list
if
aux
.
get
(
'aux_qty'
,
0
)
>
0
]
if
not
float
(
finish_qty
)
and
not
float
(
unqualified_qty
)
and
not
float
(
work_hours
)
and
not
finish_aux_list
and
not
unqualified_aux_list
:
return
{
"state"
:
"error"
,
"msgs"
:
"合格数或不合格数或工时数不可同时为0"
}
else
:
if
not
repair_qty
and
not
float
(
finish_qty
)
and
not
float
(
unqualified_qty
)
and
not
float
(
work_hours
):
return
{
"state"
:
"error"
,
"msgs"
:
"合格数或不合格数或工时数不可同时为0"
}
return
False
class
JzjxRokeRefixAutoWorkOrder
(
http
.
Controller
):
class
JzjxRokeRefixAutoWorkOrder
(
http
.
Controller
):
...
...
jzjx_project/controllers/roke_work_order.py
View file @
aed9d6e7
...
@@ -132,6 +132,48 @@ class RokeWorkstationWorkOrderModel(http.Controller):
...
@@ -132,6 +132,48 @@ class RokeWorkstationWorkOrderModel(http.Controller):
}
}
return
{
"code"
:
0
,
"message"
:
f
"获取成功!"
,
"data"
:
data
}
return
{
"code"
:
0
,
"message"
:
f
"获取成功!"
,
"data"
:
data
}
@http.route
(
'/roke/workstation/craft_design/workstation_process/save'
,
type
=
'json'
,
auth
=
"user"
,
cors
=
'*'
,
csrf
=
False
)
def
save_craft_design_workstation_process
(
self
):
kwargs
=
http
.
request
.
jsonrequest
routing_id
=
kwargs
.
get
(
"routing_id"
,
False
)
lines
=
kwargs
.
get
(
"lines"
,
[])
if
not
routing_id
:
return
{
"code"
:
1
,
"message"
:
"入参错误,工艺路线ID位必传参数。"
,
"data"
:
None
}
routing_obj
=
http
.
request
.
env
(
user
=
SUPERUSER_ID
)[
'roke.routing'
]
.
search
([
(
"id"
,
"="
,
int
(
routing_id
))
])
if
not
routing_obj
:
return
{
"code"
:
1
,
"message"
:
"工艺路线不存在或已删除"
,
"data"
:
None
}
for
line
in
lines
:
if
line
[
"type"
]
==
"delete"
:
line_id
=
line
[
"line_id"
]
routing_obj
.
line_ids
.
filtered
(
lambda
l
:
l
.
id
==
line_id
)
.
unlink
()
elif
line
[
"type"
]
==
"add"
:
sequence
=
line
[
"sequence"
]
process_id
=
line
[
"process_id"
]
routing_obj
.
write
({
"line_ids"
:
[(
0
,
0
,
{
"process_id"
:
process_id
,
"sequence"
:
sequence
})]
})
elif
line
[
"type"
]
==
"update"
:
line_id
=
line
[
"line_id"
]
sequence
=
line
[
"sequence"
]
routing_obj
.
line_ids
.
filtered
(
lambda
l
:
l
.
id
==
line_id
)
.
write
({
"sequence"
:
sequence
})
else
:
pass
return
{
"code"
:
0
,
"message"
:
"工序信息添加成功"
,
"data"
:
{
"routing_id"
:
routing_obj
.
id
}}
@http.route
(
'/roke/workstation/work_record/workstation_work_record'
,
type
=
'json'
,
auth
=
'user'
,
csrf
=
False
,
cors
=
"*"
)
@http.route
(
'/roke/workstation/work_record/workstation_work_record'
,
type
=
'json'
,
auth
=
'user'
,
csrf
=
False
,
cors
=
"*"
)
def
get_workstation_work_record
(
self
):
def
get_workstation_work_record
(
self
):
"""
"""
...
...
jzjx_project/models/inherit_production_task.py
View file @
aed9d6e7
...
@@ -98,8 +98,15 @@ class InheritProductionTask(models.Model):
...
@@ -98,8 +98,15 @@ class InheritProductionTask(models.Model):
def
craft_design
(
self
):
def
craft_design
(
self
):
if
not
self
.
routing_id
:
if
not
self
.
routing_id
:
raise
ValidationError
(
"该任务没有工艺路线!请先选择工艺路线。"
)
routing_id
=
self
.
env
[
"roke.routing"
]
.
create
({
if
not
self
.
routing_id
.
routing_task_id
or
self
.
routing_id
.
routing_task_id
.
id
!=
self
.
id
:
"name"
:
self
.
product_id
.
name
or
""
,
"state"
:
"确认"
,
"routing_task_id"
:
self
.
id
})
self
.
write
({
"routing_id"
:
routing_id
.
id
,
})
elif
not
self
.
routing_id
.
routing_task_id
or
self
.
routing_id
.
routing_task_id
.
id
!=
self
.
id
:
routing_id
=
self
.
routing_id
.
copy
()
routing_id
=
self
.
routing_id
.
copy
()
routing_id
.
update
({
routing_id
.
update
({
"state"
:
"确认"
,
"state"
:
"确认"
,
...
...
jzjx_project/static/src/html/view/craft_design.html
View file @
aed9d6e7
This diff is collapsed.
Click to expand it.
jzjx_project/wizard/inherit_roke_create_work_record_wizard.py
View file @
aed9d6e7
...
@@ -83,6 +83,16 @@ class InheritRokeCreateWorkRecordWizard(models.TransientModel):
...
@@ -83,6 +83,16 @@ class InheritRokeCreateWorkRecordWizard(models.TransientModel):
"""
"""
...
# 去掉返修和报废的逻辑关系
...
# 去掉返修和报废的逻辑关系
def
check_create_value
(
self
):
"""
检查完成数、不合格数、工时数
:return:
"""
if
not
self
.
finish_qty
and
not
self
.
unqualified_qty
and
not
self
.
work_hours
and
not
self
.
repair_qty
:
return
False
else
:
return
True
def
confirm
(
self
,
center
=
False
):
def
confirm
(
self
,
center
=
False
):
"""
"""
生成报工记录
生成报工记录
...
...
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