diff --git a/inventory-backend/app/services/bom_service.py b/inventory-backend/app/services/bom_service.py
index f556103..f6a5b05 100644
--- a/inventory-backend/app/services/bom_service.py
+++ b/inventory-backend/app/services/bom_service.py
@@ -320,13 +320,28 @@ class BomService:
parent_material = MaterialBase.query.get(parent_id)
children = []
+
+ # ★ 子件若本身是"自制件"(也是某 BOM 的父件),带出它的 BOM 编号与最新版本号(仅展示识别用)
+ child_self_bom = {}
+ self_ids = [bom.child_id for bom, _, _ in rows if bom.child_id]
+ if self_ids:
+ _self_q = (db.session.query(BomTable.parent_id, BomTable.bom_no, BomTable.version)
+ .filter(BomTable.parent_id.in_(self_ids))
+ .order_by(BomTable.parent_id, BomTable.id.desc()).all())
+ for _pid, _no, _ver in _self_q:
+ if _pid not in child_self_bom:
+ child_self_bom[_pid] = {'bom_no': _no, 'version': _ver}
+
for bom, child_name, child_spec in rows:
+ _ref = child_self_bom.get(bom.child_id) or {}
children.append({
'child_id': bom.child_id,
'child_name': child_name or '[已删除物料]',
'child_spec': child_spec or '',
'dosage': float(bom.dosage) if bom.dosage else 0.0,
- 'remark': bom.remark or ''
+ 'remark': bom.remark or '',
+ 'child_bom_no': _ref.get('bom_no', ''),
+ 'child_bom_version': _ref.get('version', '')
})
result = {
diff --git a/inventory-web/src/views/bom/BomManage.vue b/inventory-web/src/views/bom/BomManage.vue
index 8469075..89279ae 100644
--- a/inventory-web/src/views/bom/BomManage.vue
+++ b/inventory-web/src/views/bom/BomManage.vue
@@ -196,6 +196,10 @@
style="font-size: 16px; padding: 4px;"
/>
+
+
+ 自制{{ row.child_bom_version }}
+
@@ -290,6 +294,7 @@ interface ChildRow {
material_spec: string
dosage: number
remark: string
+ child_bom_version?: string // 自制件子件对应的 BOM 版本(仅展示识别)
}
const originalDraftHash = ref('')
@@ -649,7 +654,8 @@ const executeSaveDraftRequest = async (targetBomNo: string) => {
.map(child => ({
child_id: child.child_id,
dosage: child.dosage,
- remark: child.remark || ''
+ remark: child.remark || '',
+ child_bom_version: child.child_bom_version || ''
}))
saving.value = true
@@ -683,7 +689,8 @@ const restoreDraftToForm = (draftData: any) => {
material_name: child.child_name || '',
material_spec: child.child_spec || '',
dosage: child.dosage,
- remark: child.remark || ''
+ remark: child.remark || '',
+ child_bom_version: child.child_bom_version || ''
}))
if (draftData.parent_id) {
@@ -800,7 +807,8 @@ const handleSaveAs = async (row: any) => {
material_name: child.child_name || '未知物料',
material_spec: child.child_spec || '',
dosage: child.dosage,
- remark: child.remark || ''
+ remark: child.remark || '',
+ child_bom_version: child.child_bom_version || ''
}))
if (raw.parent_id) {
form.parent_id = raw.parent_id
@@ -836,7 +844,8 @@ const loadDetail = async (bomNo: string, version: string) => {
material_name: child.child_name || '未知物料',
material_spec: child.child_spec || '',
dosage: child.dosage,
- remark: child.remark || ''
+ remark: child.remark || '',
+ child_bom_version: child.child_bom_version || ''
}))
if (data.parent_id) {
diff --git a/inventory-web/src/views/borrow/apply/index.vue b/inventory-web/src/views/borrow/apply/index.vue
index 292b9d0..f1bfa2a 100644
--- a/inventory-web/src/views/borrow/apply/index.vue
+++ b/inventory-web/src/views/borrow/apply/index.vue
@@ -274,7 +274,7 @@
| {{ idx + 1 }} |
{{ row.name }} |
- {{ row.sku }} |
+ {{ row.sku }}(自制 {{ row.child_bom_version }}) |
{{ row.need }} |
{{ row.available }} |
{{ row.shortage > 0 ? row.shortage : '-' }} |
@@ -304,7 +304,7 @@
| {{ idx + 1 }} |
{{ row.name }} |
- {{ row.sku }} |
+ {{ row.sku }}(自制 {{ row.child_bom_version }}) |
{{ row.shortage }} |
|
|
@@ -610,7 +610,8 @@ const bomDetailList = computed(() => {
sku: bomItem.child_sku || bomItem.sku || '-',
need: totalNeed,
available: stock,
- shortage
+ shortage,
+ child_bom_version: bomItem.child_bom_version || ''
}
})
.sort((a, b) => {
diff --git a/inventory-web/src/views/outbound/Selection.vue b/inventory-web/src/views/outbound/Selection.vue
index a664f89..e9aafd8 100644
--- a/inventory-web/src/views/outbound/Selection.vue
+++ b/inventory-web/src/views/outbound/Selection.vue
@@ -280,7 +280,7 @@
| {{ idx + 1 }} |
{{ row.name }} |
- {{ row.sku }} |
+ {{ row.sku }}(自制 {{ row.child_bom_version }}) |
{{ row.need }} |
{{ row.available }} |
{{ row.shortage > 0 ? row.shortage : '-' }} |
@@ -310,7 +310,7 @@
| {{ idx + 1 }} |
{{ row.name }} |
- {{ row.sku }} |
+ {{ row.sku }}(自制 {{ row.child_bom_version }}) |
{{ row.shortage }} |
|
|
@@ -632,7 +632,8 @@ const bomDetailList = computed(() => {
sku: bomItem.child_spec || bomItem.spec_model || '-',
need: totalNeed,
available: stock,
- shortage
+ shortage,
+ child_bom_version: bomItem.child_bom_version || ''
}
})
.sort((a, b) => {