fix: save_bom add db.session.flush() to fix unique constraint conflict
This commit is contained in:
@ -194,6 +194,9 @@ class BomService:
|
|||||||
for rec in old_records:
|
for rec in old_records:
|
||||||
db.session.delete(rec)
|
db.session.delete(rec)
|
||||||
|
|
||||||
|
# 【核心修复】:强制立即执行 DELETE 语句,为后续的 INSERT 腾出唯一键空间
|
||||||
|
db.session.flush()
|
||||||
|
|
||||||
for child in children:
|
for child in children:
|
||||||
bom = BomTable(
|
bom = BomTable(
|
||||||
bom_no=bom_no,
|
bom_no=bom_no,
|
||||||
|
|||||||
Reference in New Issue
Block a user