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
8cd6f1ee
Commit
8cd6f1ee
authored
Jan 21, 2025
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 领料单数据
parent
82b26169
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
1 deletions
+65
-1
sdddl_project/__manifest__.py
+1
-1
sdddl_project/models/inherit_production_task.py
+53
-0
sdddl_project/views/inherit_roke_production_task.xml
+11
-0
No files found.
sdddl_project/__manifest__.py
View file @
8cd6f1ee
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
'version'
:
'14.0'
,
'version'
:
'14.0'
,
'category'
:
'mes'
,
'category'
:
'mes'
,
'depends'
:
[
'roke_mes_purchase'
,
'roke_mes_sale'
,
'roke_mes_documents'
,
'roke_mes_stock'
,
'roke_workstation_api'
,
'depends'
:
[
'roke_mes_purchase'
,
'roke_mes_sale'
,
'roke_mes_documents'
,
'roke_mes_stock'
,
'roke_workstation_api'
,
'roke_mes_workshop_inspect'
,
'roke_mes_quality'
,
'roke_mes_entrust_order'
],
'roke_mes_workshop_inspect'
,
'roke_mes_quality'
,
'roke_mes_entrust_order'
,
"roke_workstation_sync_ps"
],
'author'
:
'www.rokedata.com'
,
'author'
:
'www.rokedata.com'
,
'website'
:
'http://www.rokedata.com'
,
'website'
:
'http://www.rokedata.com'
,
'description'
:
"""
'description'
:
"""
...
...
sdddl_project/models/inherit_production_task.py
View file @
8cd6f1ee
...
@@ -5,6 +5,7 @@ import math
...
@@ -5,6 +5,7 @@ import math
from
codecs
import
encode
from
codecs
import
encode
from
datetime
import
timedelta
from
datetime
import
timedelta
import
pymssql
from
odoo
import
models
,
fields
,
api
,
_
from
odoo
import
models
,
fields
,
api
,
_
from
odoo.exceptions
import
ValidationError
from
odoo.exceptions
import
ValidationError
...
@@ -24,6 +25,8 @@ class InheritProductionTask(models.Model):
...
@@ -24,6 +25,8 @@ class InheritProductionTask(models.Model):
main_task_code
=
fields
.
Char
(
string
=
'主任务编号'
,
compute
=
'_compute_main_task_code'
,
index
=
True
)
main_task_code
=
fields
.
Char
(
string
=
'主任务编号'
,
compute
=
'_compute_main_task_code'
,
index
=
True
)
flowing_water
=
fields
.
Char
(
string
=
"物料流水"
)
@api.depends
(
'work_order_ids'
)
@api.depends
(
'work_order_ids'
)
def
_compute_work_order_hours
(
self
):
def
_compute_work_order_hours
(
self
):
for
record
in
self
:
for
record
in
self
:
...
@@ -128,3 +131,53 @@ class InheritProductionTask(models.Model):
...
@@ -128,3 +131,53 @@ class InheritProductionTask(models.Model):
"controller"
:
f
"/roke/craft_design/index?product_id={self.product_id.id}&routing_id={routing_id.id}"
"controller"
:
f
"/roke/craft_design/index?product_id={self.product_id.id}&routing_id={routing_id.id}"
}
}
}
}
def
create_bom_stock_picking
(
self
):
"""
BOM领料
:return:
"""
self
.
ensure_one
()
system_id
=
self
.
env
.
ref
(
"roke_workstation_sync_ps.roke_workstation_sync_ps_integrate_system"
)
sync_address
=
system_id
.
sync_address
sync_port
=
system_id
.
sync_port
sync_uname
=
system_id
.
sync_uname
sync_passwd
=
system_id
.
sync_passwd
db_name
=
system_id
.
db_name
try
:
conn
=
pymssql
.
connect
(
host
=
sync_address
,
user
=
sync_uname
,
password
=
sync_passwd
,
database
=
db_name
)
cur
=
conn
.
cursor
()
except
Exception
as
e
:
raise
ValidationError
(
"数据库链接失败,请检查数据库链接参数"
)
try
:
cur
.
execute
(
f
"""
select jswlzd_wlbh as wlbh,(jsbom_zxsl /jsbom_fxsl) as compare
from JSBOM, jswlzd
where JSBOM_FXLS = '{self.flowing_water}'
and JSBOM_ZXLS =JSWLZD_LSBH
"""
)
rows
=
cur
.
fetchall
()
except
Exception
as
e
:
raise
ValidationError
(
"数据库查询失败"
)
finally
:
cur
.
close
()
conn
.
close
()
bom_res
=
[]
for
v
in
rows
:
product
=
self
.
env
[
"roke.product"
]
.
sudo
()
.
search
([(
"code"
,
"="
,
v
.
get
(
"wlbh"
,
""
))],
limit
=
1
)
bom_res
.
append
({
"material_id"
:
product
.
id
,
"demand_qty"
:
self
.
plan_qty
*
v
.
get
(
"compare"
,
1
),
"qty"
:
self
.
plan_qty
*
v
.
get
(
"compare"
,
1
)
})
res
=
self
.
env
[
"roke.bom.create.picking.wizard"
]
.
create
({
"line_ids"
:
bom_res
})
return
{
'name'
:
'bom领料'
,
'type'
:
'ir.actions.act_window'
,
'view_mode'
:
'form'
,
'target'
:
'new'
,
'res_id'
:
res
.
id
,
'res_model'
:
'roke.bom.create.picking.wizard'
}
sdddl_project/views/inherit_roke_production_task.xml
View file @
8cd6f1ee
...
@@ -29,4 +29,15 @@
...
@@ -29,4 +29,15 @@
</xpath>
</xpath>
</field>
</field>
</record>
</record>
<record
id=
"inherit_view_roke_production_task_tree"
model=
"ir.ui.view"
>
<field
name=
"name"
>
inherit.roke.production.tree.view
</field>
<field
name=
"model"
>
roke.production.task
</field>
<field
name=
"inherit_id"
ref=
"roke_mes_stock.view_roke_stock_inherit_pt_form_view"
/>
<field
name=
"arch"
type=
"xml"
>
<xpath
expr=
"//button[@name='create_bom_stock_picking']"
position=
"replace"
>
<field
name=
"flowing_water"
invisible=
"1"
/>
<button
name=
"create_bom_stock_picking"
type=
"object"
string=
"BOM领料"
class=
"oe_highlight"
attrs=
"{'invisible': ['|', '|',('state', '!=', '未完工'),('work_order_ids','=',[]),('flowing_water', '=', False)]}"
/>
</xpath>
</field>
</record>
</odoo>
</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