refactor: 统一术语BOM为物料清单并补充工位扩展能力
主要变更: 1. 后端:重构工位管理逻辑,新增工位自定义扩展能力,将工位号上限调整为999并支持14+虚拟工位 2. 前后端:全量替换"BOM"术语为"物料清单",包括提示语、注释和文档 3. WMS模块:新增AGV任务取消接口与前端页面,对接海康RCS取消任务逻辑 4. 权限与种子数据:新增工位新增权限并更新权限配置 5. 修复错误校验逻辑,优化AGV客户端签名与请求处理
This commit is contained in:
@@ -107,7 +107,7 @@
|
||||
<el-tab-pane label="物料清单" name="bom">
|
||||
<el-empty v-if="!card.bomGroups || !card.bomGroups.length" description="该产品型号暂无物料清单" />
|
||||
<div v-for="g in card.bomGroups" :key="g.bomName" class="blk">
|
||||
<div class="blk-t">BOM:{{ g.bomName }}</div>
|
||||
<div class="blk-t">物料清单:{{ g.bomName }}</div>
|
||||
<el-table :data="g.items" border size="small">
|
||||
<el-table-column prop="materialCode" label="图号" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="materialName" label="物料名称" min-width="150" show-overflow-tooltip />
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<el-form :model="dialog" label-width="100px">
|
||||
<el-form-item label="图号">
|
||||
<el-select v-model="dialog.materialCode" filterable remote reserve-keyword
|
||||
placeholder="输入图号或名称检索 BOM 料" :remote-method="searchBom" :loading="bomLoading"
|
||||
placeholder="输入图号或名称检索物料清单" :remote-method="searchBom" :loading="bomLoading"
|
||||
style="width:100%" @change="onBomPick">
|
||||
<el-option v-for="b in bomOptions" :key="b.id"
|
||||
:label="`${b.materialCode} / ${b.materialName}`" :value="b.materialCode" />
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
<template>
|
||||
<el-card>
|
||||
<el-alert type="info" :closable="false" style="margin-bottom:12px"
|
||||
title="工位数以数据库为准(仅改名称,不增删工位)。本页为工位总览,每个工位的工艺流程在「关联工位」页维护:在下拉选择启用的工艺流程即绑定到该工位;一个工位只能有一个启用的工艺流程。" />
|
||||
title="工位数量以数据库为准。本页可新增工位(工位号自定义,可扩展到 14、15…)与改名;每个工位的工艺流程在「关联工位」页维护:在下拉选择启用的工艺流程即绑定到该工位;一个工位只能有一个启用的工艺流程。" />
|
||||
|
||||
<div style="margin-bottom:12px">
|
||||
<el-button v-if="can('produce.station:add')" type="primary" @click="openAdd">新增工位</el-button>
|
||||
<span style="margin-left:12px;color:#909399;font-size:12px">虚拟工位(如 0 上线位、13 下线位)类型选「线下位」,不连 PLC、仅记录上下线。</span>
|
||||
</div>
|
||||
|
||||
<el-table :data="rows" border size="small">
|
||||
<el-table-column prop="stationNo" label="工位号" width="90" align="center" />
|
||||
<el-table-column prop="name" label="工位名称" min-width="170" show-overflow-tooltip />
|
||||
<el-table-column label="类型" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="row.stationType === 'OFFLINE' ? 'info' : 'success'">
|
||||
{{ row.stationType === 'OFFLINE' ? '线下位' : '线上位' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="绑定工艺流程" min-width="240">
|
||||
<template #default="{ row }">
|
||||
<el-select :model-value="row.flowId" size="small" placeholder="未绑定" @change="(v) => bindFlow(row, v)" style="width:100%">
|
||||
@@ -21,11 +33,23 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-dialog v-model="dlg.show" :title="`工位${dlg.stationNo} - 修改名称`" width="420px">
|
||||
<el-dialog v-model="dlg.show" :title="dlg.title" width="440px">
|
||||
<el-form :model="dlg" label-width="90px">
|
||||
<el-form-item label="工位号" required>
|
||||
<el-input-number v-model="dlg.stationNo" :min="0" :max="999" :disabled="!dlg.isAdd" style="width:100%" />
|
||||
<div v-if="dlg.isAdd" style="color:#909399;font-size:12px;line-height:1.5;margin-top:4px">
|
||||
自定义工位号,可与现有工位不连续(如 14、15…);0 为上线位、13 为下线位以外的编号均按物理/虚拟位识别。
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="工位名称" required>
|
||||
<el-input v-model="dlg.name" placeholder="如 一号装配工位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工位类型">
|
||||
<el-radio-group v-model="dlg.stationType">
|
||||
<el-radio label="LINE">线上位(连 PLC)</el-radio>
|
||||
<el-radio label="OFFLINE">线下位(虚拟,不连 PLC)</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="dlg.show = false">取消</el-button>
|
||||
@@ -50,32 +74,42 @@ const flows = ref([])
|
||||
const rows = computed(() => {
|
||||
return [...stations.value]
|
||||
.sort((a, b) => (a.stationNo || 0) - (b.stationNo || 0))
|
||||
.map((s) => ({ id: s.id, stationNo: s.stationNo, name: s.name, flowId: s.flowId, flowName: s.flowName }))
|
||||
.map((s) => ({ id: s.id, stationNo: s.stationNo, name: s.name, flowId: s.flowId, flowName: s.flowName, stationType: s.stationType }))
|
||||
})
|
||||
|
||||
const dlg = reactive({ show: false, id: 0, stationNo: 1, name: '' })
|
||||
const dlg = reactive({ show: false, isAdd: false, title: '', id: 0, stationNo: 1, name: '', stationType: 'LINE' })
|
||||
|
||||
async function load() {
|
||||
stations.value = (await request.get('/stations')) || []
|
||||
}
|
||||
|
||||
function openAdd() {
|
||||
const used = new Set(stations.value.map((s) => s.stationNo))
|
||||
let next = 14
|
||||
while (used.has(next)) next++
|
||||
Object.assign(dlg, { show: true, isAdd: true, title: '新增工位', id: 0, stationNo: next, name: '', stationType: 'LINE' })
|
||||
}
|
||||
|
||||
function openName(row) {
|
||||
Object.assign(dlg, { show: true, id: row.id, stationNo: row.stationNo, name: row.name })
|
||||
Object.assign(dlg, { show: true, isAdd: false, title: `工位${row.stationNo} - 修改`, id: row.id, stationNo: row.stationNo, name: row.name, stationType: row.stationType || 'LINE' })
|
||||
}
|
||||
|
||||
async function save() {
|
||||
if (!dlg.name) return ElMessage.warning('请输入工位名称')
|
||||
if (dlg.isAdd && stations.value.some((s) => s.stationNo === dlg.stationNo)) {
|
||||
return ElMessage.warning(`工位${dlg.stationNo} 已存在,请换一个工位号`)
|
||||
}
|
||||
await request.post('/stations', {
|
||||
id: dlg.id, stationNo: dlg.stationNo, name: dlg.name
|
||||
id: dlg.id, stationNo: dlg.stationNo, name: dlg.name, stationType: dlg.stationType
|
||||
})
|
||||
ElMessage.success('已保存')
|
||||
ElMessage.success(dlg.isAdd ? '工位已新增' : '已保存')
|
||||
dlg.show = false
|
||||
load()
|
||||
}
|
||||
|
||||
async function bindFlow(row, fid) {
|
||||
try {
|
||||
await request.post('/stations', { id: row.id, stationNo: row.stationNo, name: row.name, flowId: fid })
|
||||
await request.post('/stations', { id: row.id, stationNo: row.stationNo, name: row.name, stationType: row.stationType || 'LINE', flowId: fid })
|
||||
ElMessage.success(fid ? '已绑定工艺流程' : '已解除绑定')
|
||||
} catch {
|
||||
// 拦截器已提示(如绑定到未启用的流程)
|
||||
|
||||
Reference in New Issue
Block a user