(no commit message provided)
Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
This commit is contained in:
@ -33,6 +33,8 @@ def save_bom():
|
||||
'code': 200,
|
||||
'msg': '保存成功'
|
||||
})
|
||||
except ValueError as e:
|
||||
return jsonify({'code': 400, 'msg': str(e)}), 400
|
||||
except Exception as e:
|
||||
current_app.logger.error(f'保存BOM失败: {str(e)}')
|
||||
return jsonify({'code': 500, 'msg': '内部服务器错误'}), 500
|
||||
|
||||
@ -11,6 +11,10 @@ class BomService:
|
||||
保存/更新父件的BOM子件关系
|
||||
child_list: [{"child_id": int, "dosage": float, "remark": str}, ...]
|
||||
"""
|
||||
# 校验父件不能与子件相同
|
||||
for item in child_list:
|
||||
if item['child_id'] == parent_id:
|
||||
raise ValueError('父件与子件不能是同一物料')
|
||||
# 删除该父件原有的BOM记录
|
||||
BomTable.query.filter_by(parent_id=parent_id).delete()
|
||||
# 插入新的
|
||||
|
||||
@ -298,7 +298,7 @@ const confirmPrint = async () => {
|
||||
// 5. BOM 操作
|
||||
const handleImportBom = () => {
|
||||
// TODO: 打开上传文件的 Dialog 或者跳转页面
|
||||
ElMessage.info('点击了导入BOM,请实现具体逻辑')
|
||||
console.log('导入BOM功能开发中')
|
||||
}
|
||||
|
||||
const handleCreateBom = async () => {
|
||||
@ -321,7 +321,6 @@ const addChildRow = () => {
|
||||
bomForm.value.children.push({
|
||||
child_id: null,
|
||||
dosage: 0,
|
||||
loss_rate: 0,
|
||||
remark: ''
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user