feat: 看板管理屏专属面板与追溯查询三合一 + AGV状态WS实时推送 + 数据库错误友好文案分层
This commit is contained in:
@@ -9,8 +9,8 @@ import PageHelp from '../components/PageHelp.vue'
|
||||
import { helpLineManagement } from '../help'
|
||||
import { dockCn } from '../utils/dockLabel'
|
||||
|
||||
// 产线管理(块 E):顶部 4 个页签
|
||||
// ① 工位状态 G1~G12 ② 缓存状态 C1~C15 ③ 接驳台维护(CRUD) ④ 工件位置纠正
|
||||
// 产线管理(块 E):页面区块
|
||||
// ① 工位状态 G1~G12 ② 缓存状态 C1~C15 ③ 接驳台维护(CRUD) ④ 当前产线可生产成品(混产配置) ⑤ 工件位置纠正
|
||||
// ①/②/④ 读 PLC 实时点位(§4.1,一次性读取不轮询);③ 为接驳台主数据维护。
|
||||
|
||||
const loading = ref(false)
|
||||
@@ -238,7 +238,62 @@ const palletByDock = computed(() => {
|
||||
return m
|
||||
})
|
||||
|
||||
onMounted(() => { refreshAll(); loadDocks() })
|
||||
/* ===================== ④ 混产配置:当前产线可生产成品 ===================== */
|
||||
// 2026-11-16 纠偏:混产配置从工位编辑弹窗移到产线管理,明确为全产线共用配置(底层仍是全局单一在用混产模板)。
|
||||
const productOptions = ref([])
|
||||
const mixProducts = ref([])
|
||||
const mixSavedCodes = ref([])
|
||||
const mixSaving = ref(false)
|
||||
const activeMix = reactive({ id: 0, name: '', remark: '' })
|
||||
const mixChanged = computed(() => {
|
||||
const a = mixProducts.value
|
||||
const b = mixSavedCodes.value
|
||||
return a.length !== b.length || a.some((c, i) => c !== b[i])
|
||||
})
|
||||
async function loadProductOptions() {
|
||||
try {
|
||||
const list = (await request.get('/product-types', { params: { isActive: 'true' } })) || []
|
||||
productOptions.value = Array.isArray(list) ? list.filter((p) => p && p.code) : []
|
||||
} catch { productOptions.value = [] }
|
||||
}
|
||||
async function loadMixProducts() {
|
||||
try {
|
||||
const list = (await request.get('/mix-templates'))?.list || []
|
||||
const cur = list.find((r) => r.isActive) || list.find((r) => r.status === 'ACTIVE') || null
|
||||
activeMix.id = cur ? Number(cur.id) : 0
|
||||
activeMix.name = cur ? (cur.name || '') : ''
|
||||
activeMix.remark = cur ? (cur.remark || '') : ''
|
||||
const codes = cur ? (Array.isArray(cur.products) ? cur.products : String(cur.productCodes || '').split(',').map((s) => s.trim()).filter(Boolean)) : []
|
||||
mixProducts.value = [...codes]
|
||||
mixSavedCodes.value = [...codes]
|
||||
} catch { /* 拦截器已提示 */ }
|
||||
}
|
||||
async function saveMixProducts() {
|
||||
const codes = (mixProducts.value || []).filter(Boolean)
|
||||
if (codes.length < 2) {
|
||||
ElMessage.warning('可生产成品至少选 2 个')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
'此配置为全产线共用配置,修改后将影响所有工位的可混产范围。',
|
||||
'保存确认',
|
||||
{ type: 'warning', confirmButtonText: '确认保存', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch { return }
|
||||
mixSaving.value = true
|
||||
try {
|
||||
await request.post('/mix-templates/save', {
|
||||
id: activeMix.id, name: activeMix.name || '产线混产模板',
|
||||
productCodes: codes.join(','), remark: activeMix.remark, status: 'ACTIVE'
|
||||
})
|
||||
await loadMixProducts()
|
||||
ElMessage.success('已保存')
|
||||
} catch { /* 拦截器已提示 */ }
|
||||
finally { mixSaving.value = false }
|
||||
}
|
||||
|
||||
onMounted(() => { refreshAll(); loadDocks(); loadProductOptions(); loadMixProducts() })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -366,11 +421,29 @@ onMounted(() => { refreshAll(); loadDocks() })
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<!-- ④ 工件位置纠正 -->
|
||||
<!-- ④ 混产配置:当前产线可生产成品(写入现有在用混产模板,底层表/清线逻辑不动,产线级口径) -->
|
||||
<el-card class="block">
|
||||
<template #header>
|
||||
<div class="card-head">
|
||||
<span>④ 工件位置纠正</span>
|
||||
<span>④ 当前产线可生产成品</span>
|
||||
<el-button size="small" :loading="mixSaving" type="primary" :disabled="!mixChanged" @click="saveMixProducts">保存配置</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<el-alert type="info" :closable="false" class="tip">
|
||||
全产线共用一套配置:勾选的成品可在同一套工位绑定下生产;换到清单外的成品需先清线。保存后立即生效(影响建单校验与清线校验),至少 2 个成品。
|
||||
</el-alert>
|
||||
<el-select v-model="mixProducts" multiple filterable collapse-tags collapse-tags-tooltip
|
||||
placeholder="选择本产线可生产的成品(至少 2 个)" style="width:100%;margin-top:8px">
|
||||
<el-option v-for="p in productOptions" :key="p.code" :value="p.code"
|
||||
:label="p.name + (p.code ? ' / ' + p.code : '')" />
|
||||
</el-select>
|
||||
</el-card>
|
||||
|
||||
<!-- ⑤ 工件位置纠正 -->
|
||||
<el-card class="block">
|
||||
<template #header>
|
||||
<div class="card-head">
|
||||
<span>⑤ 工件位置纠正</span>
|
||||
<el-button size="small" :loading="loading" @click="refreshAll">核对</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user