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
add84e69
Commit
add84e69
authored
Jan 21, 2025
by
夏超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] 领料单数据上传
parent
c7813fe2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
sdddl_project/wizard/__init__.py
+1
-0
sdddl_project/wizard/inherit_roke_bom_create_picking_wizard.py
+47
-0
No files found.
sdddl_project/wizard/__init__.py
View file @
add84e69
from
.
import
assign_workcenter_wizard
from
.
import
assign_workcenter_wizard
from
.
import
product_import_wizard
from
.
import
product_import_wizard
from
.
import
inherit_roke_bom_create_picking_wizard
sdddl_project/wizard/inherit_roke_bom_create_picking_wizard.py
0 → 100644
View file @
add84e69
import
logging
import
datetime
import
pymssql
from
odoo.exceptions
import
ValidationError
from
odoo
import
models
,
fields
,
api
,
_
,
SUPERUSER_ID
_logger
=
logging
.
getLogger
(
__name__
)
_s_date
=
datetime
.
date
(
1899
,
12
,
31
)
.
toordinal
()
-
1
class
InheritRokeBomCreatePickingWizard
(
models
.
TransientModel
):
_inherit
=
"roke.bom.create.picking.wizard"
def
confirm
(
self
):
res
=
super
(
InheritRokeBomCreatePickingWizard
,
self
)
.
confirm
()
task_id
=
self
.
env
[
"roke.production.task"
]
.
browse
(
self
.
_context
.
get
(
'active_id'
))
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
(
"数据库链接失败,请检查数据库链接参数"
)
sql
=
"""
INSERT INTO WBLLD (WBLLB_RWBH, WBLLB_CPBH, WBLLB_XQSL, WBLLB_LLSL)
VALUES
"""
sql_list
=
[]
for
v
in
self
.
line_ids
:
sql_list
.
append
(
f
"""
('{task_id.code}', '{v.material_id.code}', '{v.demand_qty}', '{v.qty}')
"""
)
if
not
sql_list
:
raise
ValidationError
(
"数据错误"
)
sql
+=
" , "
.
join
(
sql_list
)
try
:
cur
.
execute
()
conn
.
commit
()
except
Exception
as
e
:
raise
ValidationError
(
"数据库查询失败"
)
finally
:
cur
.
close
()
conn
.
close
()
return
res
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