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
367abafd
Commit
367abafd
authored
Jan 22, 2025
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 上推数据修改
parent
21d2435b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
1 deletions
+74
-1
sdddl_project/wizard/__init__.py
+1
-0
sdddl_project/wizard/inherit_result_put_warehose_wizard.py
+72
-0
sdddl_project/wizard/inherit_roke_bom_create_picking_wizard.py
+1
-1
No files found.
sdddl_project/wizard/__init__.py
View file @
367abafd
from
.
import
assign_workcenter_wizard
from
.
import
product_import_wizard
from
.
import
inherit_roke_bom_create_picking_wizard
from
.
import
inherit_result_put_warehose_wizard
sdddl_project/wizard/inherit_result_put_warehose_wizard.py
0 → 100644
View file @
367abafd
import
pymssql
from
odoo
import
models
,
fields
,
api
,
_
from
odoo.exceptions
import
ValidationError
# 修正数量
class
InheritRokeResultPutWarehouseWizard
(
models
.
TransientModel
):
_inherit
=
"roke.result.put.warehouse.wizard"
@api.model
def
default_get
(
self
,
field_names
):
default
=
super
()
.
default_get
(
field_names
)
if
self
.
env
.
context
.
get
(
'active_model'
)
!=
"roke.production.result"
:
return
default
results
=
self
.
env
[
'roke.production.result'
]
.
browse
(
self
.
env
.
context
.
get
(
'active_ids'
))
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
(
"数据库链接失败,请检查数据库链接参数"
)
ids
=
results
.
ids
if
not
ids
:
return
super
(
InheritRokeResultPutWarehouseWizard
,
self
)
.
default_get
()
try
:
cur
.
execute
(
f
"""
select WBCCB_CCID
from WBCCB
where WBCCB_CCID not in ('{"', '".join(ids)}')
"""
)
rows
=
cur
.
fetchall
()
rowdesc
=
cur
.
description
except
Exception
as
e
:
raise
ValidationError
(
"数据库查询失败"
)
finally
:
cur
.
close
()
conn
.
close
()
rows_data
=
[
dict
(
zip
([
col
[
0
]
for
col
in
rowdesc
],
row
))
for
row
in
rows
]
insert_id
=
[]
for
v
in
rows_data
:
insert_id
.
append
(
v
.
get
(
"WBCCB_CCID"
,
0
))
insert_sql_data
=
[]
for
v
in
results
:
if
v
.
id
not
in
insert_id
:
continue
insert_sql_data
.
append
(
f
"""
('{v.product_id.code}', '{v.wo_id.code}', {v.qty or 0}, {v.id}, '{v.pt_id.code}', '{v.pt_id.task_type}')
"""
)
sql
=
"""
INSERT INTO WBCCB (WBCCB_CPBH, WBCCB_GDBH, WBCCB_CCSL, WBCCB_CCID, WBCCB_RWBH, WBCCB_RWLX)
VALUES
"""
if
not
insert_sql_data
:
raise
ValidationError
(
"数据错误"
)
sql
+=
" , "
.
join
(
insert_sql_data
)
try
:
cur
.
execute
(
sql
)
conn
.
commit
()
except
Exception
as
e
:
raise
ValidationError
(
"数据库查询失败"
)
finally
:
cur
.
close
()
conn
.
close
()
return
super
(
InheritRokeResultPutWarehouseWizard
,
self
)
.
default_get
()
sdddl_project/wizard/inherit_roke_bom_create_picking_wizard.py
View file @
367abafd
...
...
@@ -31,7 +31,7 @@ class InheritRokeBomCreatePickingWizard(models.TransientModel):
sql_list
=
[]
for
v
in
self
.
line_ids
:
sql_list
.
append
(
f
"""
('{task_id.code}', '{v.material_id.code}',
'{v.demand_qty}', '{v.qty}'
)
('{task_id.code}', '{v.material_id.code}',
{v.demand_qty or 0}, {v.qty or 0}
)
"""
)
if
not
sql_list
:
raise
ValidationError
(
"数据错误"
)
...
...
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