feat: AGV三段链安全机制、补料/损耗/下班闭环、接驳台左右互换
AGV 调度: - 任务重构为 GO_LOAD/TRANSPORT/EMPTY_RETURN/FREE 三段链,到位即停(ARRIVED)需人工确认装卸 - 自由调度单点步进,每段强制弹"请确保路径畅通无杂物";托盘回收独立工作台 - 接驳台 PLC 传感器检测到托盘即自动卸货放行,传感器故障由人工按钮兜底(无轮询) - 车辆状态只读展示(海康3.1.7 queryAgvStatus),调度仍由 RCS 负责 物料闭环: - 补料管理(SHORTAGE):工位申请 + 主管审批调增叫料池额度,与借料/差异补发三轨并行 - 损耗台账(loss_ledger):退料实际 < 理论必填原因、后审核,工单不记损耗 - 退料强制指定左/右接驳台,WMS 库管可代工位退料 下班闭环: - 工位终端自检接驳台剩余物料后下班;库管收货 + 托盘拉走后事件驱动自动结班 - 退出登录未下班仅作安全提示(不强制拦截、不新增责任审批) 接驳台左右按操作员朝向建模(dock.side 字段),废除"奇左偶右"隐式约定; 看板标签 / seed / 迁移补丁 / 布局文档统一为中文左/右。 产线布局说明:C1 前线头 AGV 点、C15 后线尾 AGV 点、外部 O1/O2/O3 散点, 清理修订痕迹为最终态描述。
This commit is contained in:
@@ -31,9 +31,20 @@ async function loadDocks() {
|
||||
loadingDocks.value = false
|
||||
}
|
||||
|
||||
// 显示层统一(2026-10-17 裁定):库房接驳台一律显示「库房接驳台」,不显示 DOCK21/JBT21 编号
|
||||
// (DOCK21 仅作后端映射/提交值;PLC 侧对应点位于监控页同样只显示「库房接驳台」)
|
||||
const dockLabel = (code) => (String(code || '') === 'DOCK21' ? '库房接驳台' : code || '—')
|
||||
// 显示层统一(2026-11-03 左右互换拍板):接驳台按 side(操作员朝向 left/right)显示「工位X左/右」;
|
||||
// 库房接驳台一律显示「库房接驳台」,不显示 DOCK21/JBT21 编号。
|
||||
const dockCn = (d) => {
|
||||
if (!d) return '—'
|
||||
if (String(d.dockCode || '') === 'DOCK21') return '库房接驳台'
|
||||
const s = d.side === 'left' ? '左' : d.side === 'right' ? '右' : ''
|
||||
return `工位${d.stationNo || ''}${s}`
|
||||
}
|
||||
const dockCnMap = computed(() => {
|
||||
const m = {}
|
||||
docks.value.forEach((d) => { m[d.dockCode] = dockCn(d) })
|
||||
return m
|
||||
})
|
||||
const dockLabel = (d) => dockCn(typeof d === 'string' ? { dockCode: d } : d)
|
||||
|
||||
/* ===================== AGV 点位(独立点位表,硬件真源) ===================== */
|
||||
const agvPoints = ref([])
|
||||
@@ -53,7 +64,11 @@ const pointMap = computed(() => {
|
||||
agvPoints.value.forEach((p) => { m[p.positionCode] = p })
|
||||
return m
|
||||
})
|
||||
const pointLabel = (code) => (pointMap.value[String(code)]?.name) || String(code || '—')
|
||||
const pointLabel = (code) => {
|
||||
const p = pointMap.value[String(code)]
|
||||
if (p?.isDock && dockCnMap.value[p.dockCode]) return dockCnMap.value[p.dockCode]
|
||||
return p?.name || String(code || '—')
|
||||
}
|
||||
const savingPoint = ref(0)
|
||||
async function savePoint(p) {
|
||||
savingPoint.value = p.id
|
||||
@@ -74,11 +89,71 @@ const loadingTasks = ref(false)
|
||||
const statusOptions = [
|
||||
{ v: 'PENDING', l: '待下发' }, { v: 'FAILED', l: '下发失败' },
|
||||
{ v: '1', l: '已创建' }, { v: '2', l: '执行中' },
|
||||
{ v: 'ARRIVED', l: '到位待令' },
|
||||
{ v: '5', l: '已取消' }, { v: '9', l: '已完成' }
|
||||
]
|
||||
const statusText = (s) => (statusOptions.find((x) => x.v === s) || {}).l || s
|
||||
const statusTag = (s) =>
|
||||
s === '9' ? 'success' : s === 'FAILED' || s === '5' ? 'info' : s === '2' ? 'warning' : s === '1' ? 'primary' : ''
|
||||
s === '9' ? 'success' : s === 'ARRIVED' ? 'danger' : s === 'FAILED' || s === '5' ? 'info' : s === '2' ? 'warning' : s === '1' ? 'primary' : ''
|
||||
const kindText = (k) => ({ GO_LOAD: '空车去程', TRANSPORT: '重载运输', EMPTY_RETURN: '空车回充', FREE: '自由调度' }[k] || k)
|
||||
|
||||
/* ===================== 到位待令确认(2026-11-03 三层安全机制) ===================== */
|
||||
// 到位即停:GO_LOAD 段→「确认装车并送货」;TRANSPORT 段→「卸货完成并放行」(放行后空车自动回充);
|
||||
// FREE 段→「开始下一段」/「结束回充」。自由调度每次「开始搬运」强制弹「请确保路径畅通无杂物」。
|
||||
const freeTarget = ref('')
|
||||
const freeSource = ref('')
|
||||
const confirmBusy = ref(false)
|
||||
async function confirmLoadGo(row) {
|
||||
let def = ''
|
||||
try {
|
||||
const mats = typeof row.materialsJson === 'string' ? JSON.parse(row.materialsJson) : row.materialsJson
|
||||
def = mats?.[0]?.TargetDock || ''
|
||||
} catch { /* ignore */ }
|
||||
try {
|
||||
const { value } = await ElMessageBox.prompt('请输入送货目标接驳台/点位(默认取叫料单目标)', '确认装车并送货', {
|
||||
inputValue: def, inputPlaceholder: '如 DOCK03 或 AGV-WAIT01', type: 'warning',
|
||||
inputValidator: (v) => !!v || '目标必填'
|
||||
})
|
||||
await confirmAgv(row, 'load_go', (value || '').trim())
|
||||
} catch { /* 取消 */ }
|
||||
}
|
||||
async function confirmAgv(row, action, nextDock) {
|
||||
const tips = {
|
||||
load_go: '确认已装车并送货?AGV 将背着托盘前往目标接驳台。',
|
||||
unload_release: '确认卸货完成并放行?托盘将落位当前接驳台,AGV 空车自动回充电位。',
|
||||
finish_return: '确认结束本任务并让 AGV 回充电位?'
|
||||
}
|
||||
const isFree = action !== 'load_go' && action !== 'unload_release'
|
||||
try {
|
||||
if (isFree) {
|
||||
await ElMessageBox.confirm('请确保路径畅通无杂物,确认后 AGV 出发。', '开始 AGV 搬运', { type: 'warning' })
|
||||
} else {
|
||||
await ElMessageBox.confirm(tips[action], '到位待令确认', { type: 'warning' })
|
||||
}
|
||||
} catch { return }
|
||||
confirmBusy.value = true
|
||||
try {
|
||||
await request.post('/agv/confirm', { taskNo: row.taskNo, action, nextDock: nextDock || '' })
|
||||
ElMessage.success('已确认')
|
||||
loadTasks()
|
||||
} catch (e) {
|
||||
ElMessage.error('确认失败:' + (e?.message || e))
|
||||
} finally { confirmBusy.value = false }
|
||||
}
|
||||
async function freeDispatch(target) {
|
||||
if (!target) { ElMessage.warning('请选择目标点位'); return }
|
||||
try {
|
||||
await ElMessageBox.confirm('请确保路径畅通无杂物,确认后 AGV 出发前往 ' + (pointLabel(target) || target) + '。', '开始 AGV 搬运', { type: 'warning' })
|
||||
} catch { return }
|
||||
confirmBusy.value = true
|
||||
try {
|
||||
await request.post('/agv/free-dispatch', { target, source: freeSource.value || '' })
|
||||
ElMessage.success('已派车')
|
||||
loadTasks()
|
||||
} catch (e) {
|
||||
ElMessage.error('派车失败:' + (e?.message || e))
|
||||
} finally { confirmBusy.value = false }
|
||||
}
|
||||
|
||||
async function loadTasks() {
|
||||
loadingTasks.value = true
|
||||
@@ -249,7 +324,24 @@ async function loadMode() {
|
||||
} catch { /* 忽略 */ }
|
||||
}
|
||||
|
||||
onMounted(() => { loadDocks(); loadTasks(); loadMode(); loadAgvPoints() })
|
||||
onMounted(() => { loadDocks(); loadTasks(); loadMode(); loadAgvPoints(); loadVehicles() })
|
||||
|
||||
// 车辆状态只读(海康 3.1.7,2026-11-03 拍板:纯只读展示,不干预调度)
|
||||
const vehicles = ref([])
|
||||
const loadingVehicles = ref(false)
|
||||
const vehicleUnavailable = ref(false)
|
||||
const vehicleReason = ref('')
|
||||
async function loadVehicles() {
|
||||
loadingVehicles.value = true
|
||||
try {
|
||||
const d = await request.get('/agv/vehicles')
|
||||
vehicles.value = d?.list || []
|
||||
vehicleUnavailable.value = !!d?.unavailable
|
||||
vehicleReason.value = d?.reason || ''
|
||||
} catch { vehicles.value = [] }
|
||||
loadingVehicles.value = false
|
||||
}
|
||||
const vehicleStateCn = (s) => ({ '4': '空闲', '2': '执行中', '7': '充电', '1': '任务完成', '5': '异常', '3': '异常', '6': '举升中' }[s] || ('状态' + s))
|
||||
|
||||
// 切 tab 重新加载对应数据(2026-10-19:lazy 页签切回不 reload,状态/叫料单会停留在旧数据)
|
||||
function onTabChange(name) {
|
||||
@@ -257,6 +349,7 @@ function onTabChange(name) {
|
||||
else if (name === 'tasks') loadTasks()
|
||||
else if (name === 'dispatch') loadMrs()
|
||||
else if (name === 'points') loadAgvPoints()
|
||||
else if (name === 'vehicles') loadVehicles()
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -289,6 +382,29 @@ function onTabChange(name) {
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<!-- ②B 车辆状态(只读,海康 3.1.7;2026-11-03 拍板:调度完全交给 RCS,本页仅展示闲忙/充电/电量) -->
|
||||
<el-tab-pane label="车辆状态" name="vehicles" lazy>
|
||||
<div class="toolbar">
|
||||
<el-button type="primary" :loading="loadingVehicles" @click="loadVehicles">刷新车辆</el-button>
|
||||
<span class="tip">● 本页仅只读展示车辆状态,不改变任何调度(AGV 自己判定闲忙与优先级,RCS 内部完成)</span>
|
||||
</div>
|
||||
<el-alert v-if="vehicleUnavailable" type="info" :closable="false" show-icon class="mb8"
|
||||
:title="'车辆状态暂不可用:' + (vehicleReason || 'RCS 未配置或未对接')" />
|
||||
<div class="veh-grid">
|
||||
<div v-for="v in vehicles" :key="v.robotCode" class="veh-card"
|
||||
:class="{ idle: v.status === '4', busy: v.status === '2', charge: v.status === '7' }">
|
||||
<div class="veh-code">AGV {{ v.robotCode }}</div>
|
||||
<div class="veh-state">{{ vehicleStateCn(v.status) }}</div>
|
||||
<div class="veh-batt">
|
||||
<el-progress type="dashboard" :width="70" :percentage="Math.round(v.battery || 0)"
|
||||
:color="v.battery < 20 ? '#f56c6c' : '#67c23a'" />
|
||||
</div>
|
||||
<div class="veh-meta">电量 {{ Math.round(v.battery || 0) }}% · {{ v.podCode && v.podCode !== '0' ? '载货 ' + v.podCode : '空载' }}</div>
|
||||
</div>
|
||||
<el-empty v-if="!vehicles.length && !vehicleUnavailable && !loadingVehicles" description="暂无车辆数据" />
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<!-- ② AGV 任务列表 -->
|
||||
<el-tab-pane label="AGV任务" name="tasks" lazy>
|
||||
<div class="toolbar">
|
||||
@@ -335,15 +451,26 @@ function onTabChange(name) {
|
||||
<el-table-column prop="operator" label="下发人" width="100" />
|
||||
<el-table-column prop="hikTaskCode" label="RCS任务码" width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="remark" label="备注" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="110" align="center" fixed="right">
|
||||
<el-table-column label="操作" width="150" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<template v-if="row.status === 'ARRIVED'">
|
||||
<el-button v-if="row.kind === 'GO_LOAD'" size="small" type="success" :loading="confirmBusy"
|
||||
@click="confirmLoadGo(row)">确认装车并送货</el-button>
|
||||
<el-button v-else-if="row.kind === 'TRANSPORT'" size="small" type="success" :loading="confirmBusy"
|
||||
@click="confirmAgv(row, 'unload_release')">卸货完成并放行</el-button>
|
||||
<template v-else>
|
||||
<el-button size="small" type="primary" :loading="confirmBusy"
|
||||
@click="confirmAgv(row, 'finish_return')">结束回充电位</el-button>
|
||||
<div style="color:#909399;font-size:11px">或到「自由调度」页选下一段</div>
|
||||
</template>
|
||||
</template>
|
||||
<el-popconfirm v-if="canCancel(row.status)" title="确认取消该 AGV 任务?" @confirm="cancelTask(row)">
|
||||
<template #reference>
|
||||
<el-button size="small" type="danger" link>取消</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
<el-button v-if="canRetry(row.status)" size="small" type="warning" link @click="retryTask(row)">重试</el-button>
|
||||
<span v-if="!canCancel(row.status) && !canRetry(row.status)">-</span>
|
||||
<span v-if="row.status !== 'ARRIVED' && !canCancel(row.status) && !canRetry(row.status)">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -353,7 +480,24 @@ function onTabChange(name) {
|
||||
@size-change="(s) => { taskPage.size = s; taskPage.current = 1; loadTasks() }" />
|
||||
</el-tab-pane>
|
||||
|
||||
<!-- ③ 手动派车(补派/重试;主链路已由 MES 在仓库完成备料时自动派车) -->
|
||||
<!-- ②B 自由调度(2026-11-03 三层机制第三层):单点步进——每次派一段,到位停住待令,
|
||||
人工确认后再走下一段或结束回充;每段派车强制弹「请确保路径畅通无杂物」。 -->
|
||||
<el-tab-pane label="自由调度" name="free" lazy>
|
||||
<el-alert type="info" :closable="false" show-icon class="mb8"
|
||||
title="单点步进操作:选择一个点位让 AGV 过来(到位后停住,状态=到位待令)→ 装卸作业 → 再选下一段(本页派车或回充电位结束)。每次开始搬运都会提示“请确保路径畅通无杂物”。" />
|
||||
<div class="toolbar" style="margin-top:10px">
|
||||
<el-select v-model="freeTarget" style="width: 220px" placeholder="选择目标点位(让 AGV 前往)">
|
||||
<el-option v-for="d in pointOptions" :key="d" :label="pointLabel(d)" :value="d" />
|
||||
</el-select>
|
||||
<el-button type="primary" :loading="confirmBusy" @click="freeDispatch(freeTarget)">开始 AGV 搬运</el-button>
|
||||
<el-select v-model="freeSource" style="width: 220px; margin-left: 16px" placeholder="起点(可空=AGV 当前位置)" clearable>
|
||||
<el-option v-for="d in pointOptions" :key="'s'+d" :label="pointLabel(d)" :value="d" />
|
||||
</el-select>
|
||||
<span class="tip">空起点 = RCS 派最近空闲车前往目标</span>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<!-- ③ 手动派车(补派/重试;主链路已由 MES 在仓库完成备料时自动派空车) -->
|
||||
<el-tab-pane label="手动派车" name="dispatch" lazy>
|
||||
<div class="toolbar">
|
||||
<el-select v-model="mrQuery.status" style="width: 150px" placeholder="叫料单状态" @change="loadMrs()">
|
||||
@@ -454,6 +598,15 @@ function onTabChange(name) {
|
||||
.dock-status { font-size: 13px; font-weight: 600; color: #67c23a; }
|
||||
.dock-card.busy .dock-status { color: #e6a23c; }
|
||||
.dock-ref { font-size: 12px; color: #e6a23c; margin-top: 2px; }
|
||||
.mb8 { margin-bottom: 8px; }
|
||||
.veh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
|
||||
.veh-card { border: 1px solid #e4e7ed; border-radius: 8px; padding: 14px; text-align: center; }
|
||||
.veh-card.idle { border-left: 4px solid #67c23a; }
|
||||
.veh-card.busy { border-left: 4px solid #409eff; }
|
||||
.veh-card.charge { border-left: 4px solid #e6a23c; }
|
||||
.veh-code { font-size: 15px; font-weight: 700; }
|
||||
.veh-state { font-size: 13px; font-weight: 600; color: #409eff; margin: 4px 0 8px; }
|
||||
.veh-meta { font-size: 12px; color: #909399; margin-top: 6px; }
|
||||
.mono { font-family: Consolas, Monaco, monospace; }
|
||||
.disabled-text { color: #909399; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user