2026-10-17 17:49:47 +08:00
|
|
|
|
<script setup>
|
|
|
|
|
|
defineOptions({ name: 'LineManagement' })
|
|
|
|
|
|
import { computed, onMounted, reactive, ref } from 'vue'
|
|
|
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
|
|
|
import request from '../utils/request'
|
|
|
|
|
|
import { can } from '../utils/perm'
|
|
|
|
|
|
import { fmtTime } from '../utils/format'
|
|
|
|
|
|
import PageHelp from '../components/PageHelp.vue'
|
|
|
|
|
|
import { helpLineManagement } from '../help'
|
2026-11-10 23:42:50 +08:00
|
|
|
|
import { dockCn } from '../utils/dockLabel'
|
2026-10-17 17:49:47 +08:00
|
|
|
|
|
|
|
|
|
|
// 产线管理(块 E):顶部 4 个页签
|
|
|
|
|
|
// ① 工位状态 G1~G12 ② 缓存状态 C1~C15 ③ 接驳台维护(CRUD) ④ 工件位置纠正
|
|
|
|
|
|
// ①/②/④ 读 PLC 实时点位(§4.1,一次性读取不轮询);③ 为接驳台主数据维护。
|
|
|
|
|
|
|
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
|
const lastRefresh = ref('')
|
|
|
|
|
|
|
2026-10-20 16:36:26 +08:00
|
|
|
|
// 工件六态映射(2026-10-19:原列直显英文枚举,与全项目口径统一)
|
2026-11-15 12:17:39 +08:00
|
|
|
|
const pieceStatusMap = { NEW: '待上线', ONLINE: '已上线', PROCESSING: '在制', SEMI_STORED: '在制品入库', DONE: '完工', SCRAPPED: '报废' }
|
2026-11-05 19:18:18 +08:00
|
|
|
|
const pieceStatusText = (s) => pieceStatusMap[s] || '—'
|
2026-10-20 16:36:26 +08:00
|
|
|
|
|
2026-10-17 17:49:47 +08:00
|
|
|
|
/* ===================== ① ② ④ PLC 点位(工位 / 主线缓存) ===================== */
|
|
|
|
|
|
const stations = ref([])
|
|
|
|
|
|
const mains = ref([])
|
|
|
|
|
|
const docksBits = ref([])
|
|
|
|
|
|
const jbt = ref(null)
|
|
|
|
|
|
// ④ 工件位置核对
|
|
|
|
|
|
const mismatches = ref([])
|
2026-11-15 12:17:39 +08:00
|
|
|
|
// ④ 末端取件释放(末端下料检测位有工位在位信号,但无工位终端/接驳台、不下发装配工序码;取件无完成信号,占用台账须人工确认释放)
|
2026-10-17 17:49:47 +08:00
|
|
|
|
const endPoints = ref([])
|
|
|
|
|
|
const selectedEnd = ref([])
|
|
|
|
|
|
const releasing = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
async function loadBits() {
|
|
|
|
|
|
const d = await request.get('/plc/monitor/bits')
|
|
|
|
|
|
stations.value = d.station || []
|
|
|
|
|
|
mains.value = d.main || []
|
|
|
|
|
|
docksBits.value = d.dock || []
|
|
|
|
|
|
jbt.value = d.jbt || null
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function loadPositionCheck() {
|
|
|
|
|
|
const d = await request.get('/plc/monitor/position-check')
|
|
|
|
|
|
mismatches.value = d?.mismatches || []
|
|
|
|
|
|
if (!stations.value.length && d?.stations) stations.value = d.stations
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function loadEndPoints() {
|
|
|
|
|
|
const d = await request.get('/plc/monitor/end-points')
|
|
|
|
|
|
endPoints.value = d?.list || []
|
|
|
|
|
|
selectedEnd.value = []
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function refreshAll() {
|
|
|
|
|
|
loading.value = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
await Promise.all([loadBits(), loadPositionCheck(), loadEndPoints()])
|
|
|
|
|
|
lastRefresh.value = new Date().toLocaleString()
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
loading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 末端取件释放:人工确认工件已从 G11/G12 取走,释放点位占用并写操作日志
|
|
|
|
|
|
async function releaseEndPoints() {
|
|
|
|
|
|
const rows = selectedEnd.value
|
|
|
|
|
|
if (!rows.length) {
|
|
|
|
|
|
ElMessage.warning('请先勾选要释放的点位记录')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2026-11-05 19:18:18 +08:00
|
|
|
|
const lines = rows.map((r) => `${r.pointNo}(${r.label})· ${r.sn || '无序列号'}`).join('\n')
|
2026-10-17 17:49:47 +08:00
|
|
|
|
try {
|
|
|
|
|
|
await ElMessageBox.confirm(
|
|
|
|
|
|
`确认以下工件已从末端取走并释放点位?\n\n${lines}\n\n释放后点位台账置为「空闲」,并写入操作日志(point_release_manual)。`,
|
|
|
|
|
|
'末端取件释放',
|
|
|
|
|
|
{ type: 'warning', confirmButtonText: '确认已取件', cancelButtonText: '取消' }
|
|
|
|
|
|
)
|
|
|
|
|
|
} catch { return }
|
|
|
|
|
|
releasing.value = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
for (const r of rows) {
|
|
|
|
|
|
await request.post('/plc/monitor/release-end-point', { pointNo: r.pointNo })
|
|
|
|
|
|
}
|
|
|
|
|
|
ElMessage.success(`已释放 ${rows.length} 个点位`)
|
|
|
|
|
|
await loadEndPoints()
|
|
|
|
|
|
} catch { /* 拦截器已提示 */ }
|
|
|
|
|
|
finally { releasing.value = false }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 位置纠正:MES 记录在工位、PLC 该工位无托盘 → 清为不在工位
|
|
|
|
|
|
const correcting = ref(0)
|
|
|
|
|
|
async function correctPosition(row) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await ElMessageBox.confirm(
|
|
|
|
|
|
`确认纠正工件 ${row.sn} 的位置?\n\nMES 记录:在工位 ${row.atStationNo}\nPLC 实际:工位 ${row.atStationNo} 无托盘\n\n纠正后该工件位置将置为「不在工位」,并写入操作日志。`,
|
|
|
|
|
|
'纠正工件位置',
|
|
|
|
|
|
{ type: 'warning', confirmButtonText: '确认纠正', cancelButtonText: '取消' }
|
|
|
|
|
|
)
|
|
|
|
|
|
} catch { return }
|
|
|
|
|
|
correcting.value = row.workpieceId
|
|
|
|
|
|
try {
|
|
|
|
|
|
await request.post('/plc/monitor/position-correct', { workpieceId: row.workpieceId })
|
|
|
|
|
|
ElMessage.success('已纠正')
|
|
|
|
|
|
await refreshAll()
|
|
|
|
|
|
} catch { /* 拦截器已提示 */ }
|
|
|
|
|
|
finally { correcting.value = 0 }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ===================== ③ 接驳台维护(CRUD) ===================== */
|
|
|
|
|
|
const list = ref([])
|
|
|
|
|
|
const filter = reactive({ dockCode: '', name: '', dockType: '', status: '' })
|
|
|
|
|
|
const dlg = reactive({
|
2026-11-15 12:17:39 +08:00
|
|
|
|
show: false,
|
2026-10-29 18:16:53 +08:00
|
|
|
|
dockCode: '', name: '', dockType: 'line', status: 'ENABLED'
|
2026-10-17 17:49:47 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const TYPE_LABEL = { line: '产线', store: '库房', other: '其他' }
|
|
|
|
|
|
function typeLabel(t) { return TYPE_LABEL[t] || '其他' }
|
|
|
|
|
|
function tagType(t) { return t === 'line' ? 'success' : (t === 'store' ? 'warning' : 'info') }
|
2026-11-04 19:06:03 +08:00
|
|
|
|
// 显示层统一(2026-10-17 裁定):库房接驳台一律显示「库房接驳台」,不显示 JBT21 编号
|
|
|
|
|
|
// (JBT21 仅作后端映射,T7 2026-11-03 统一代号;PLC 侧对应点位于 PLC 监控页同样只显示「库房接驳台」)
|
2026-11-10 23:42:50 +08:00
|
|
|
|
function dockCodeLabel(code) { return dockCn(code, list.value) }
|
2026-10-17 17:49:47 +08:00
|
|
|
|
|
2026-10-29 18:16:53 +08:00
|
|
|
|
// 接驳台编码格式校验(运行期禁用正则:仅大写字母与数字,长度 2~16)。
|
|
|
|
|
|
function isDockCodeAlnum(code) {
|
|
|
|
|
|
const s = String(code || '').trim().toUpperCase()
|
|
|
|
|
|
if (s.length < 2 || s.length > 16) return false
|
|
|
|
|
|
for (let i = 0; i < s.length; i++) {
|
|
|
|
|
|
const c = s.charCodeAt(i)
|
|
|
|
|
|
const isUpper = c >= 65 && c <= 90 // A-Z
|
|
|
|
|
|
const isDigit = c >= 48 && c <= 57 // 0-9
|
|
|
|
|
|
if (!isUpper && !isDigit) return false
|
|
|
|
|
|
}
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
// 接驳台编码规范(产线类必须为 DOCK 开头 + 数字,如 DOCK05;对应硬件工位,由末位编号派生)。
|
|
|
|
|
|
function isDockCodeStandard(code) {
|
|
|
|
|
|
const s = String(code || '').trim().toUpperCase()
|
|
|
|
|
|
if (s.length < 5 || s.slice(0, 4) !== 'DOCK') return false
|
|
|
|
|
|
for (let i = 4; i < s.length; i++) {
|
|
|
|
|
|
const c = s.charCodeAt(i)
|
|
|
|
|
|
if (c < 48 || c > 57) return false // 末段必须全为数字
|
|
|
|
|
|
}
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 接驳台↔工位为硬件级对应关系:stationNo 由 dockCode 末位编号派生(DOCKnn → 工位 (nn+1)/2),不可人工编辑。
|
|
|
|
|
|
// 运行期不使用正则,用 charCodeAt 取末位连续数字。
|
|
|
|
|
|
function trailingNum(s) {
|
|
|
|
|
|
s = s || ''
|
|
|
|
|
|
let i = s.length
|
|
|
|
|
|
while (i > 0 && s.charCodeAt(i - 1) >= 48 && s.charCodeAt(i - 1) <= 57) i--
|
|
|
|
|
|
if (i === s.length) return 0
|
|
|
|
|
|
return parseInt(s.slice(i), 10)
|
|
|
|
|
|
}
|
|
|
|
|
|
const lineStationNo = computed(() => {
|
|
|
|
|
|
const n = trailingNum(dlg.dockCode)
|
|
|
|
|
|
if (!n) return 0
|
|
|
|
|
|
const s = Math.floor((n + 1) / 2)
|
|
|
|
|
|
return s >= 1 && s <= 12 ? s : 0
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2026-10-17 17:49:47 +08:00
|
|
|
|
async function loadDocks() {
|
|
|
|
|
|
const params = {}
|
|
|
|
|
|
if (filter.dockCode.trim()) params.dockCode = filter.dockCode.trim()
|
|
|
|
|
|
if (filter.name.trim()) params.name = filter.name.trim()
|
|
|
|
|
|
if (filter.dockType) params.dockType = filter.dockType
|
|
|
|
|
|
if (filter.status) params.status = filter.status
|
|
|
|
|
|
const data = await request.get('/docks/maint', { params })
|
|
|
|
|
|
list.value = (data || []).slice().sort((a, b) => String(a.dockCode || '').localeCompare(String(b.dockCode || '')))
|
|
|
|
|
|
}
|
|
|
|
|
|
function search() { loadDocks() }
|
|
|
|
|
|
function reset() {
|
|
|
|
|
|
filter.dockCode = ''
|
|
|
|
|
|
filter.name = ''
|
|
|
|
|
|
filter.dockType = ''
|
|
|
|
|
|
filter.status = ''
|
|
|
|
|
|
loadDocks()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function openAdd() {
|
|
|
|
|
|
dlg.dockCode = ''
|
|
|
|
|
|
dlg.name = ''
|
|
|
|
|
|
dlg.dockType = 'line'
|
|
|
|
|
|
dlg.status = 'ENABLED'
|
|
|
|
|
|
dlg.show = true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function save() {
|
2026-10-29 18:16:53 +08:00
|
|
|
|
const code = String(dlg.dockCode || '').trim().toUpperCase()
|
|
|
|
|
|
if (!isDockCodeAlnum(code)) {
|
2026-10-17 17:49:47 +08:00
|
|
|
|
return ElMessage.warning('接驳台编码必填,仅支持大写字母与数字(2~16 位),如 DOCK05')
|
|
|
|
|
|
}
|
2026-10-29 18:16:53 +08:00
|
|
|
|
if (dlg.dockType === 'line' && !isDockCodeStandard(code)) {
|
|
|
|
|
|
return ElMessage.warning('接驳台编码不规范(必须为 DOCK 开头+数字),请修正')
|
2026-10-17 17:49:47 +08:00
|
|
|
|
}
|
2026-10-29 18:16:53 +08:00
|
|
|
|
if (!String(dlg.name || '').trim()) return ElMessage.warning('接驳台名称必填')
|
2026-10-17 17:49:47 +08:00
|
|
|
|
try {
|
|
|
|
|
|
await request.post('/docks', {
|
2026-10-29 18:16:53 +08:00
|
|
|
|
dockCode: code,
|
2026-10-17 17:49:47 +08:00
|
|
|
|
name: String(dlg.name).trim(),
|
|
|
|
|
|
dockType: dlg.dockType,
|
|
|
|
|
|
status: dlg.status
|
|
|
|
|
|
})
|
2026-11-15 12:17:39 +08:00
|
|
|
|
ElMessage.success('新增成功')
|
2026-10-17 17:49:47 +08:00
|
|
|
|
dlg.show = false
|
|
|
|
|
|
await Promise.all([loadDocks(), loadBits()])
|
|
|
|
|
|
} catch { /* 拦截器已提示(编码重复等) */ }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function del(row) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await ElMessageBox.confirm(`确认删除接驳台 ${dockCodeLabel(row.dockCode)}(${row.name})?`, '删除确认',
|
|
|
|
|
|
{ type: 'warning', confirmButtonText: '确认删除', cancelButtonText: '取消' })
|
|
|
|
|
|
} catch { return }
|
|
|
|
|
|
try {
|
|
|
|
|
|
await request.delete(`/docks/${row.id}`)
|
|
|
|
|
|
ElMessage.success('已删除')
|
|
|
|
|
|
await loadDocks()
|
|
|
|
|
|
} catch { /* 拦截器已提示 */ }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function toggleStatus(row) {
|
|
|
|
|
|
const next = row.status === 'ENABLED' ? 'DISABLED' : 'ENABLED'
|
|
|
|
|
|
try {
|
|
|
|
|
|
await request.post('/docks/status', { id: row.id, status: next })
|
|
|
|
|
|
ElMessage.success(next === 'ENABLED' ? '已启用' : '已停用')
|
|
|
|
|
|
await loadDocks()
|
|
|
|
|
|
} catch { /* 拦截器已提示 */ }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 接驳台占用态(PLC 实时):按 dockCode 关联 ①/② 中的位信号
|
|
|
|
|
|
const palletByDock = computed(() => {
|
|
|
|
|
|
const m = {}
|
|
|
|
|
|
docksBits.value.forEach((b) => { m[b.code] = b.has })
|
|
|
|
|
|
if (jbt.value) m[jbt.value.code] = jbt.value.has
|
|
|
|
|
|
return m
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { refreshAll(); loadDocks() })
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<div class="page">
|
|
|
|
|
|
<PageHelp :data="helpLineManagement" page="LineManagement" />
|
|
|
|
|
|
|
|
|
|
|
|
<el-card class="block">
|
|
|
|
|
|
<template #header>
|
|
|
|
|
|
<div class="card-head">
|
|
|
|
|
|
<span>产线点位(PLC 实时,一次性读取,不轮询)</span>
|
|
|
|
|
|
<el-button size="small" :loading="loading" @click="refreshAll">刷新</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<el-alert type="info" :closable="false" class="tip">
|
|
|
|
|
|
读产线布局说明 §4.1 的 48 位点位信号。● 表示有托盘,○ 表示空。打开页面自动读取一次,需最新状态点「刷新」。
|
|
|
|
|
|
</el-alert>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="group">
|
|
|
|
|
|
<div class="group-title">① 工位托盘位(G1~G12)</div>
|
|
|
|
|
|
<div class="chips">
|
|
|
|
|
|
<div class="chip" v-for="b in stations" :key="b.code">
|
|
|
|
|
|
<span class="dot" :class="b.has ? 'on' : 'off'"></span>{{ b.code }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<el-empty v-if="!stations.length" description="暂无数据" :image-size="40" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="group">
|
|
|
|
|
|
<div class="group-title">② 主线缓存位(C1~C15)</div>
|
|
|
|
|
|
<div class="chips">
|
|
|
|
|
|
<div class="chip" v-for="b in mains" :key="b.code">
|
|
|
|
|
|
<span class="dot" :class="b.has ? 'on' : 'off'"></span>{{ b.code }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<el-empty v-if="!mains.length" description="暂无数据" :image-size="40" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ③ 接驳台维护 -->
|
|
|
|
|
|
<el-card class="block">
|
|
|
|
|
|
<template #header>
|
|
|
|
|
|
<div class="card-head">
|
|
|
|
|
|
<span>③ 接驳台维护</span>
|
|
|
|
|
|
<el-button v-if="can('produce.line.manage')" size="small" type="primary" @click="openAdd">新增接驳台</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<el-alert type="info" :closable="false" class="tip">
|
|
|
|
|
|
接驳台是产线与库房之间供 AGV 取送货的物理停靠位,为产线主数据(真源在 MES)。占用状态由 PLC 传感器实时读取,不可人工维护。
|
|
|
|
|
|
</el-alert>
|
|
|
|
|
|
<el-form inline :model="filter">
|
|
|
|
|
|
<el-form-item label="接驳台编码">
|
|
|
|
|
|
<el-input v-model="filter.dockCode" clearable style="width:160px" placeholder="精确匹配,如 DOCK01" @keyup.enter="search" />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="接驳台名称">
|
|
|
|
|
|
<el-input v-model="filter.name" clearable style="width:180px" placeholder="名称模糊匹配" @keyup.enter="search" />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="类型">
|
|
|
|
|
|
<el-select v-model="filter.dockType" clearable style="width:120px" placeholder="全部">
|
|
|
|
|
|
<el-option label="产线" value="line" />
|
|
|
|
|
|
<el-option label="库房" value="store" />
|
|
|
|
|
|
<el-option label="其他" value="other" />
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="状态">
|
|
|
|
|
|
<el-select v-model="filter.status" clearable style="width:110px" placeholder="全部">
|
|
|
|
|
|
<el-option label="启用" value="ENABLED" />
|
|
|
|
|
|
<el-option label="停用" value="DISABLED" />
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item>
|
|
|
|
|
|
<el-button type="primary" @click="search">查询</el-button>
|
|
|
|
|
|
<el-button @click="reset">重置</el-button>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
|
|
<el-table :data="list" border size="small">
|
|
|
|
|
|
<el-table-column label="接驳台编码" width="140">
|
|
|
|
|
|
<template #default="{ row }">{{ dockCodeLabel(row.dockCode) }}</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column prop="name" label="接驳台名称" min-width="200" show-overflow-tooltip />
|
|
|
|
|
|
<el-table-column label="类型" width="100" align="center">
|
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
<el-tag size="small" :type="tagType(row.dockType)">{{ typeLabel(row.dockType) }}</el-tag>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="绑定工位" width="110" align="center">
|
|
|
|
|
|
<template #default="{ row }">{{ row.stationNo > 0 ? '工位' + row.stationNo : '—' }}</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="占用状态" width="110" align="center">
|
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
<el-tag size="small" :type="palletByDock[row.dockCode] ? 'warning' : 'info'">
|
|
|
|
|
|
{{ palletByDock[row.dockCode] ? '有托盘' : '空闲' }}
|
|
|
|
|
|
</el-tag>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column prop="palletRef" label="托盘关联" min-width="160" show-overflow-tooltip>
|
|
|
|
|
|
<template #default="{ row }">{{ row.palletRef || '—' }}</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="启用状态" width="90" align="center">
|
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
<el-tag size="small" :type="row.status === 'ENABLED' ? 'success' : 'info'">
|
|
|
|
|
|
{{ row.status === 'ENABLED' ? '启用' : '停用' }}
|
|
|
|
|
|
</el-tag>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="创建时间" width="170">
|
|
|
|
|
|
<template #default="{ row }">{{ fmtTime(row.createdAt) }}</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="操作" width="150" align="center" fixed="right">
|
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
<el-button v-if="can('produce.line.manage')" link size="small"
|
|
|
|
|
|
:type="row.status === 'ENABLED' ? 'warning' : 'success'"
|
|
|
|
|
|
@click="toggleStatus(row)">{{ row.status === 'ENABLED' ? '停用' : '启用' }}</el-button>
|
|
|
|
|
|
<el-popconfirm v-if="can('produce.line.manage')" :title="`确认删除接驳台 ${dockCodeLabel(row.dockCode)}?`" @confirm="del(row)">
|
|
|
|
|
|
<template #reference>
|
|
|
|
|
|
<el-button link type="danger" size="small">删除</el-button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-popconfirm>
|
|
|
|
|
|
<span v-if="!can('produce.line.manage')">—</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<template #empty>
|
|
|
|
|
|
<el-empty description="暂无接驳台数据" />
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
</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>
|
|
|
|
|
|
<el-alert type="info" :closable="false" class="tip">
|
|
|
|
|
|
核对「MES 记录的工件物理位置」与「PLC 实际托盘位」:MES 记录工件在工位 n,但 PLC 工位 n 无托盘
|
|
|
|
|
|
⇒ 记录已过期/错位,可一键纠正为「不在工位」。纠正写入操作日志(plc_position_correct)。
|
|
|
|
|
|
当前待纠正 {{ mismatches.length }} 条。最后核对时间:{{ lastRefresh || '—' }}
|
|
|
|
|
|
</el-alert>
|
|
|
|
|
|
<el-table :data="mismatches" border size="small">
|
2026-11-05 19:18:18 +08:00
|
|
|
|
<el-table-column prop="sn" label="工件序列号" width="200" show-overflow-tooltip />
|
2026-10-17 17:49:47 +08:00
|
|
|
|
<el-table-column prop="orderNo" label="所属工单" min-width="150" show-overflow-tooltip />
|
2026-10-20 16:36:26 +08:00
|
|
|
|
<el-table-column prop="status" label="工件状态" width="110" align="center">
|
|
|
|
|
|
<template #default="{ row }">{{ pieceStatusText(row.status) }}</template>
|
|
|
|
|
|
</el-table-column>
|
2026-10-17 17:49:47 +08:00
|
|
|
|
<el-table-column label="记录位置" width="110" align="center">
|
|
|
|
|
|
<template #default="{ row }">工位 {{ row.atStationNo }}</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="PLC 实际" width="110" align="center">
|
|
|
|
|
|
<template #default="{ row }">无托盘</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="业务位置" width="120" align="center">
|
|
|
|
|
|
<template #default="{ row }">{{ row.curStationNo > 0 ? '工位 ' + row.curStationNo : '—' }}</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="操作" width="120" align="center" fixed="right">
|
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
<el-button v-if="can('produce.line.manage')" link type="warning" size="small"
|
|
|
|
|
|
:loading="correcting === row.workpieceId" @click="correctPosition(row)">纠正</el-button>
|
|
|
|
|
|
<span v-else>—</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<template #empty>
|
|
|
|
|
|
<el-empty description="无待纠正工件(MES 记录与 PLC 实际一致)" />
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
|
|
<el-divider class="sub-divider" />
|
|
|
|
|
|
|
2026-11-15 12:17:39 +08:00
|
|
|
|
<!-- ④-2 末端取件释放子块:末端下料检测位有工位在位信号但无工位终端/接驳台/装配工序码,取件无完成信号,须人工确认释放 -->
|
2026-10-17 17:49:47 +08:00
|
|
|
|
<div class="sub-title">末端取件释放(G11 / G12 下料检测位)</div>
|
|
|
|
|
|
<el-alert type="warning" :closable="false" class="tip">
|
2026-11-15 12:17:39 +08:00
|
|
|
|
末端下料检测位有工位在位信号,但没有工位终端、没有接驳台,也不下发 PLC 装配工序码(人工确认工位);取件动作没有「已取走」完成信号,点位台账不会自动清,必须确认实物已取走后人工释放。释放写入操作日志。当前占用 {{ endPoints.length }} 条。
|
2026-10-17 17:49:47 +08:00
|
|
|
|
</el-alert>
|
|
|
|
|
|
<el-table :data="endPoints" border size="small" @selection-change="(rows) => (selectedEnd = rows)">
|
|
|
|
|
|
<el-table-column type="selection" width="42" />
|
|
|
|
|
|
<el-table-column label="点位" width="220" align="center">
|
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
{{ row.pointNo === 'END-U' ? '下料检测位 G11(上排)' : '下料检测位 G12(下排)' }}({{ row.pointNo }})
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
2026-11-05 19:18:18 +08:00
|
|
|
|
<el-table-column prop="sn" label="工件序列号" min-width="180" show-overflow-tooltip>
|
2026-10-17 17:49:47 +08:00
|
|
|
|
<template #default="{ row }">{{ row.sn || '—' }}</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="来源(所属工单)" min-width="160" show-overflow-tooltip>
|
|
|
|
|
|
<template #default="{ row }">{{ row.orderNo || '—' }}</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="占用时间" width="170">
|
|
|
|
|
|
<template #default="{ row }">{{ row.updatedAt ? fmtTime(row.updatedAt) : '—' }}</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<template #empty>
|
|
|
|
|
|
<el-empty description="末端下料检测位均空闲" :image-size="40" />
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
<div class="sub-actions">
|
|
|
|
|
|
<el-button v-if="can('produce.line.manage')" type="warning" size="small"
|
|
|
|
|
|
:disabled="!selectedEnd.length" :loading="releasing" @click="releaseEndPoints">
|
|
|
|
|
|
确认已取件{{ selectedEnd.length ? `(${selectedEnd.length})` : '' }}
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<span v-if="!can('produce.line.manage')" class="no-perm">无「产线管理」权限,不可释放</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-card>
|
|
|
|
|
|
|
2026-11-15 12:17:39 +08:00
|
|
|
|
<!-- ③ 接驳台新增弹窗 -->
|
|
|
|
|
|
<el-dialog v-model="dlg.show" title="新增接驳台" width="480px">
|
2026-10-17 17:49:47 +08:00
|
|
|
|
<el-form :model="dlg" label-width="100px">
|
|
|
|
|
|
<el-form-item label="接驳台编码" required>
|
|
|
|
|
|
<el-input v-model="dlg.dockCode" maxlength="16" placeholder="如 DOCK05(大写字母与数字)" />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="接驳台名称" required>
|
|
|
|
|
|
<el-input v-model="dlg.name" maxlength="64" placeholder="如 产线接驳台 DOCK05(工位3)" />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="类型" required>
|
|
|
|
|
|
<el-radio-group v-model="dlg.dockType">
|
|
|
|
|
|
<el-radio value="line">产线</el-radio>
|
|
|
|
|
|
<el-radio value="store">库房</el-radio>
|
|
|
|
|
|
<el-radio value="other">其他</el-radio>
|
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="绑定工位" required>
|
|
|
|
|
|
<template v-if="dlg.dockType === 'line'">
|
2026-10-29 18:16:53 +08:00
|
|
|
|
<span style="color:#303133">工位 {{ lineStationNo || '—' }}</span>
|
|
|
|
|
|
<div style="color:#909399;font-size:12px;margin-top:4px">由接驳台编码派生(DOCKnn → 工位),硬件级对应关系,不可编辑</div>
|
2026-10-17 17:49:47 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<span v-else style="color:#909399">非产线类型不绑定工位</span>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="启用状态">
|
|
|
|
|
|
<el-radio-group v-model="dlg.status">
|
|
|
|
|
|
<el-radio value="ENABLED">启用</el-radio>
|
|
|
|
|
|
<el-radio value="DISABLED">停用</el-radio>
|
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<el-button @click="dlg.show = false">取消</el-button>
|
|
|
|
|
|
<el-button type="primary" @click="save">保存</el-button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.block { margin-bottom: 16px; }
|
|
|
|
|
|
.card-head { display: flex; justify-content: space-between; align-items: center; }
|
|
|
|
|
|
.tip { margin-bottom: 12px; }
|
|
|
|
|
|
.sub-title { font-weight: 600; margin: 4px 0 8px; color: #303133; }
|
|
|
|
|
|
.sub-divider { margin: 16px 0 12px; }
|
|
|
|
|
|
.sub-actions { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
|
|
|
|
|
|
.no-perm { color: #909399; font-size: 12px; }
|
|
|
|
|
|
.group { margin-bottom: 10px; }
|
|
|
|
|
|
.group-title { font-weight: 600; margin: 6px 0; color: #606266; }
|
|
|
|
|
|
.chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 28px; align-items: center; }
|
|
|
|
|
|
.chip {
|
|
|
|
|
|
display: inline-flex; align-items: center; gap: 6px;
|
|
|
|
|
|
border: 1px solid #dcdfe6; border-radius: 4px; padding: 4px 8px; font-size: 13px; background: #fafafa;
|
|
|
|
|
|
}
|
|
|
|
|
|
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
|
|
|
|
|
|
.dot.on { background: #67c23a; box-shadow: 0 0 0 2px rgba(103,194,58,.25); }
|
|
|
|
|
|
.dot.off { background: #c0c4cc; }
|
|
|
|
|
|
</style>
|