feat: 多系统新增扫码中间件与 AGV 对接,优化拧紧与退库流程
新增扫码中间件支持网络型扫码枪键盘注入,AGV 对接从 WMS 迁至 MES 统一管理;新增拧紧不合格人工处置与 PLC 对账机制,优化退库单关联与工位终端功能,同时清理旧 AGV 任务表,完善数据库与配置项。
This commit is contained in:
@@ -68,15 +68,27 @@ export const getLinePoints = () => request.get('/api/line/points')
|
||||
// 点位人工记账:{pointNo, sn, orderNo, action: 'IN'|'OUT'}(扫码即到位凭证:IN=上料到位、OUT=下料释放)
|
||||
export const occupyLinePoint = (data) => request.post('/api/line/occupy', data)
|
||||
|
||||
// 工位叫料:{stationNo, orderNo, items:[{materialCode, materialName, unit, snMode, qty}]}
|
||||
// 接驳台不由前端传入:服务端按配置文件(Station.Dock)自动填充目标接驳台
|
||||
export const callLineMaterial = (data) => request.post('/api/line/call-material', data)
|
||||
// ---------- B5 叫料(代理 MES 内部 API,2026-10-13 定稿) ----------
|
||||
// 叫料池(本工位物料行四数:需求/调整/已发/占用/可用)
|
||||
export const callPool = (params) => request.get('/api/call/pool', { params })
|
||||
|
||||
// 待接料列表(本工位):{stationNo, status, orderNo, planDate} → MES 备料单(待接料行)
|
||||
export const getMaterialRequests = (params) => request.get('/api/material-requests', { params })
|
||||
// 接驳台列表(本工位 R1/R2 下拉用)
|
||||
export const listDocks = (params) => request.get('/api/docks', { params })
|
||||
|
||||
// 接料确认(主入口:扫码接料):{requestNo, qty?} → MES 累加 sentQty
|
||||
export const receiveMaterialRequest = (data) => request.post('/api/material-request/receive', data)
|
||||
// 发起叫料:{stationNo, items:[{materialCode, qty, dock?}]} → 按物料行拆 N 张单(占用池子可用量)
|
||||
export const callCreate = (data) => request.post('/api/call/create', data)
|
||||
|
||||
// 叫料单列表(本工位):{stationNo, status, materialCode, requestNo, source}
|
||||
export const callList = (params) => request.get('/api/call/list', { params })
|
||||
|
||||
// 签收(仅已发货;签收=确认收到,系统不再对差异):{requestNo}
|
||||
export const callSign = (data) => request.post('/api/call/sign', data)
|
||||
|
||||
// 取消(仅待备料,工位本人):{requestNo}
|
||||
export const callCancel = (data) => request.post('/api/call/cancel', data)
|
||||
|
||||
// 申请退库(仅已发货/签收前;整单退):{requestNo}
|
||||
export const callReturn = (data) => request.post('/api/call/return', data)
|
||||
|
||||
// ---------- 工位终端巡检 / 应急 / 数量不符 / 退料(代理 MES 内部 API) ----------
|
||||
// 巡检提交:{category(CHECKIN/POINT/PROCESS/DONE/ALARM), stationNo, orderNo, sn, shift, result, items, photo, remark, processCode, stepId, stepName, measuredValue}
|
||||
@@ -113,6 +125,11 @@ export const onlineRegister = (data) => request.post('/api/workpiece/online', da
|
||||
// 下线完工入库:{sn, batchItems, serialItems, operator}
|
||||
export const offlineFinish = (data) => request.post('/api/workpiece/done', data)
|
||||
|
||||
// ---------- PLC↔MES 对账(#8 T2/T3 终端事件驱动检查,不轮询) ----------
|
||||
// 单工位检查:{stationNo, trigger:'terminal', orderNo, sn, operator}
|
||||
// → {hasMismatch, stationNo, plcBit, detail, options, graceWindow}
|
||||
export const mismatchCheck = (data) => request.post('/api/plc/mismatch/check', data)
|
||||
|
||||
// ---------- 工位停单 / 恢复接单(代理 MES 内部 API) ----------
|
||||
// 停单/恢复:{stationNo, paused, reason}(paused=true 停止接单,false 恢复)
|
||||
export const pauseStation = (data) => request.post('/api/station/pause', data)
|
||||
|
||||
@@ -48,103 +48,102 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ② 叫料(AGV 送达本工位固定接驳台:接驳台由服务端配置文件设定,工人不可选) -->
|
||||
<!-- ② 叫料(从叫料池发起:一行一物料一量一接驳台=一单一托盘) -->
|
||||
<section class="card">
|
||||
<div class="card-title">叫料(送到本工位接驳台)</div>
|
||||
<div class="call-row">
|
||||
<span class="dock-readonly">
|
||||
本工位接驳台:<b>{{ stationDock || '未配置' }}</b>(由工位终端配置文件设定,不可更改)
|
||||
</span>
|
||||
<el-button size="large" @click="fillFromBind">按缺料填充</el-button>
|
||||
<el-button size="large" @click="addRow">添加一行</el-button>
|
||||
<div class="card-title">
|
||||
叫料(送到本工位接驳台)
|
||||
<el-button size="small" @click="loadPool">刷新池子</el-button>
|
||||
</div>
|
||||
<el-alert v-if="crossDayWarn" type="warning" :closable="false" show-icon style="margin-bottom:10px"
|
||||
title="叫料池含非今日排产的料(跨日叫料):工位端预警提示;仓库可正常发,也可按「非当日」驳回。" />
|
||||
|
||||
<el-table :data="items" border size="large" class="call-table">
|
||||
<el-table-column label="图号" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model.trim="row.materialCode" size="large" placeholder="图号" />
|
||||
<el-table :data="pool" border size="large" class="call-table" v-loading="poolLoading" empty-text="本工位暂无叫料池(排产未启用或工艺无物料)">
|
||||
<el-table-column label="图号" prop="materialCode" min-width="120" />
|
||||
<el-table-column label="物料名称" prop="materialName" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column label="单位" prop="unit" width="60" align="center" />
|
||||
<el-table-column label="序列号方式" width="105" align="center">
|
||||
<template #default="{row}">{{ row.snMode === 1 ? '序列号=是' : '序列号=否' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="需求" width="80" align="center">
|
||||
<template #default="{row}">{{ fmtQty(row.reqQty + row.adjQty) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="已发" width="80" align="center">
|
||||
<template #default="{row}">{{ fmtQty(row.sentQty) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="占用中" width="90" align="center">
|
||||
<template #default="{row}">{{ fmtQty(row.reservedQty) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="可用" width="90" align="center">
|
||||
<template #default="{row}">
|
||||
<span :class="row.availQty > 0 ? 'ok' : 'ng'" style="font-weight:700">{{ fmtQty(row.availQty) }}</span>
|
||||
<el-tag v-if="row.crossDay" type="warning" size="small" style="margin-left:6px">非当日</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料名称" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model.trim="row.materialName" size="large" placeholder="物料名称" />
|
||||
<el-table-column label="叫料量" width="130" align="center">
|
||||
<template #default="{row}">
|
||||
<el-input-number v-model="row.callQty" size="large" :min="0" :max="row.availQty" :precision="0" controls-position="right" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" width="110">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model.trim="row.unit" size="large" placeholder="个/件" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" width="140">
|
||||
<template #default="{ row }">
|
||||
<el-input-number v-model="row.qty" size="large" :min="0" :precision="2" controls-position="right" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="90" align="center">
|
||||
<template #default="{ $index }">
|
||||
<el-button type="danger" size="large" @click="items.splice($index, 1)">删除</el-button>
|
||||
<el-table-column label="目标接驳台" width="150" align="center">
|
||||
<template #default="{row}">
|
||||
<el-select v-model="row.dock" size="large" placeholder="选接驳台" clearable>
|
||||
<el-option v-for="d in dockOptions" :key="d.value" :label="d.label" :value="d.value" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-empty v-if="!items.length" description="暂无叫料明细,可点「按缺料填充」或「添加一行」" :image-size="60" />
|
||||
|
||||
<div class="call-foot">
|
||||
<el-button type="primary" size="large" class="big-btn" :loading="calling" @click="doCall">提交叫料</el-button>
|
||||
<el-button type="primary" size="large" class="big-btn" :loading="calling" :disabled="!canCall" @click="doCall">提交叫料</el-button>
|
||||
<span class="block-tip" v-if="!canCall">填「叫料量」并选「目标接驳台」后可提交(量不能超过可用)</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ③ 待接料(扫码接料主入口;班组长补录见 MES 备料页) -->
|
||||
<!-- ③ 我的叫料单(签收/退库/取消) -->
|
||||
<section class="card">
|
||||
<div class="card-title">待接料(本工位)</div>
|
||||
<div class="call-row">
|
||||
<span class="lab">扫备料单号</span>
|
||||
<el-input
|
||||
v-model.trim="scanVal"
|
||||
size="large"
|
||||
class="dock-el"
|
||||
placeholder="扫描备料单号接料"
|
||||
clearable
|
||||
@keyup.enter="doScanReceive"
|
||||
/>
|
||||
<el-button size="large" :loading="receiving" @click="doScanReceive">接料确认</el-button>
|
||||
<el-button size="large" @click="loadPending">刷新</el-button>
|
||||
<div class="card-title">
|
||||
我的叫料单
|
||||
<el-radio-group v-model="listStatus" size="small" @change="loadList" style="margin-left:8px">
|
||||
<el-radio-button label="">全部</el-radio-button>
|
||||
<el-radio-button label="PENDING">待备料</el-radio-button>
|
||||
<el-radio-button label="SHIPPED">已发货</el-radio-button>
|
||||
<el-radio-button label="RETURNING">退库中</el-radio-button>
|
||||
</el-radio-group>
|
||||
<el-button size="small" @click="loadList">刷新</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :data="pending" border size="large" class="call-table" v-loading="pendingLoading">
|
||||
<el-table-column label="图号" prop="materialCode" min-width="130" />
|
||||
<el-table-column label="物料名称" prop="materialName" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column label="工艺" width="80" align="center">
|
||||
<template #default="{ row }">{{ row.flowId || row.processCode || '-' }}</template>
|
||||
<el-table :data="list" border size="large" class="call-table" v-loading="listLoading" empty-text="暂无叫料单">
|
||||
<el-table-column prop="requestNo" label="叫料单号" min-width="175" />
|
||||
<el-table-column prop="materialCode" label="图号" min-width="110" />
|
||||
<el-table-column prop="materialName" label="物料名称" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="targetDock" label="接驳台" width="100" align="center" />
|
||||
<el-table-column label="请求/实发" width="120" align="center">
|
||||
<template #default="{row}">{{ fmtQty(row.reqQty) }} / {{ row.sentQty > 0 ? fmtQty(row.sentQty) : '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="接驳台" prop="targetDock" width="110" align="center" />
|
||||
<el-table-column label="需求" width="100" align="center">
|
||||
<template #default="{ row }">{{ fmtQty(row.reqQty) }}</template>
|
||||
<el-table-column label="跨日" width="80" align="center">
|
||||
<template #default="{row}"><el-tag v-if="row.crossDay" type="warning" size="small">非当日</el-tag><span v-else>—</span></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="已接" width="100" align="center">
|
||||
<template #default="{ row }">{{ fmtQty(row.sentQty) }}</template>
|
||||
<el-table-column label="状态" width="100" align="center">
|
||||
<template #default="{row}"><el-tag :type="statusTag(row.status)" size="small">{{ statusText(row.status) }}</el-tag></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="批次" prop="batchNo" width="120" align="center" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="110" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
type="success"
|
||||
size="large"
|
||||
:loading="receiving && receivingNo === row.requestNo"
|
||||
:disabled="row.status === 'DONE'"
|
||||
@click="doReceive(row)"
|
||||
>{{ row.status === 'DONE' ? '已完结' : '已接料' }}</el-button>
|
||||
<el-table-column label="操作" width="230" align="center" fixed="right">
|
||||
<template #default="{row}">
|
||||
<el-button v-if="row.status === 'PENDING'" type="info" size="small" @click="doCancel(row)">取消</el-button>
|
||||
<el-button v-if="row.status === 'SHIPPED'" type="success" size="small" @click="doSign(row)">签收</el-button>
|
||||
<el-button v-if="row.status === 'SHIPPED'" type="warning" size="small" @click="doReturn(row)">退库</el-button>
|
||||
<span v-if="row.status === 'REJECTED'" style="color:#f56c6c;font-size:13px">{{ row.rejectReason || '已驳回' }}</span>
|
||||
<span v-if="row.status === 'RETURNING'" style="color:#e6a23c;font-size:13px">等待仓库收回</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-empty v-if="!pendingLoading && !pending.length" description="本工位暂无待接料" :image-size="60" />
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { bindRecord, bindRemove, callLineMaterial, getMaterialRequests, receiveMaterialRequest } from '../../api'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { bindRecord, bindRemove, callPool, callCreate, callList, callSign, callCancel, callReturn, listDocks } from '../../api'
|
||||
import {
|
||||
bindInputs,
|
||||
flowId,
|
||||
@@ -160,85 +159,138 @@ import {
|
||||
const bindPanel = computed(() => state.bindPanel)
|
||||
const required = computed(() => (bindPanel.value?.required || []))
|
||||
const binding = ref(false)
|
||||
const calling = ref(false)
|
||||
const items = ref([])
|
||||
|
||||
// ③ 待接料
|
||||
const scanVal = ref('')
|
||||
const pending = ref([])
|
||||
const pendingLoading = ref(false)
|
||||
const receiving = ref(false)
|
||||
const receivingNo = ref('')
|
||||
// ② 叫料池
|
||||
const pool = ref([])
|
||||
const poolLoading = ref(false)
|
||||
const calling = ref(false)
|
||||
const dockOptions = ref([])
|
||||
const crossDayWarn = computed(() => pool.value.some((r) => r.crossDay))
|
||||
const canCall = computed(() =>
|
||||
pool.value.some((r) => Number(r.callQty) > 0 && r.dock)
|
||||
)
|
||||
|
||||
function fmtQty(v) {
|
||||
const n = Number(v || 0)
|
||||
return Number.isInteger(n) ? String(n) : n.toFixed(2)
|
||||
}
|
||||
|
||||
async function loadPending() {
|
||||
pendingLoading.value = true
|
||||
async function loadPool() {
|
||||
poolLoading.value = true
|
||||
try {
|
||||
const res = await getMaterialRequests({ stationNo: stationNo.value, status: 'PENDING' })
|
||||
const list = res?.data?.data || res?.data || []
|
||||
// 仅展示未完结行(DONE 已送达)
|
||||
pending.value = (Array.isArray(list) ? list : []).filter((r) => r.status !== 'DONE')
|
||||
} catch (e) {
|
||||
pending.value = []
|
||||
}
|
||||
pendingLoading.value = false
|
||||
}
|
||||
|
||||
async function doScanReceive() {
|
||||
const no = scanVal.value.trim()
|
||||
if (!no) {
|
||||
ElMessage.warning('请扫描备料单号')
|
||||
return
|
||||
}
|
||||
await doReceive({ requestNo: no })
|
||||
scanVal.value = ''
|
||||
}
|
||||
|
||||
async function doReceive(row) {
|
||||
if (!row?.requestNo) {
|
||||
ElMessage.warning('缺少备料单号')
|
||||
return
|
||||
}
|
||||
receiving.value = true
|
||||
receivingNo.value = row.requestNo
|
||||
try {
|
||||
await receiveMaterialRequest({ requestNo: row.requestNo, operator: operatorName() })
|
||||
ElMessage.success('接料确认成功:' + row.requestNo)
|
||||
loadPending()
|
||||
} catch (e) {
|
||||
/* 统一错误提示 */
|
||||
}
|
||||
receiving.value = false
|
||||
receivingNo.value = ''
|
||||
}
|
||||
|
||||
onMounted(loadPending)
|
||||
|
||||
|
||||
function addRow() {
|
||||
items.value.push({ materialCode: '', materialName: '', unit: '个', snMode: 2, qty: 1 })
|
||||
}
|
||||
|
||||
// 按绑定面板的缺料情况一键填充(数量 = 需求 - 已绑)
|
||||
function fillFromBind() {
|
||||
const list = required.value
|
||||
.filter((r) => !r.complete)
|
||||
.map((r) => ({
|
||||
materialCode: r.materialCode,
|
||||
materialName: r.materialName || '',
|
||||
unit: r.unit || '个',
|
||||
snMode: r.snMode === 1 ? 1 : 2,
|
||||
qty: Math.max(Number(r.need || 0) - Number(r.boundCount || 0), 1)
|
||||
const rows = await callPool({ stationNo: stationNo.value })
|
||||
const list = Array.isArray(rows) ? rows : []
|
||||
// 每行:默认叫料量 0、接驳台默认本工位配置(yaml Station.Dock)
|
||||
pool.value = list.map((r) => ({
|
||||
...r,
|
||||
callQty: 0,
|
||||
dock: stationDock.value || ''
|
||||
}))
|
||||
if (!list.length) {
|
||||
ElMessage.warning('当前没有缺料')
|
||||
} catch {
|
||||
pool.value = []
|
||||
}
|
||||
poolLoading.value = false
|
||||
}
|
||||
|
||||
async function loadDocks() {
|
||||
try {
|
||||
const data = await listDocks()
|
||||
const list = (Array.isArray(data) ? data : data?.list || []).filter((d) => Number(d.stationNo) === Number(stationNo.value))
|
||||
dockOptions.value = list.map((d) => ({ value: d.dockCode, label: d.dockCode + (d.name ? '(' + d.name + ')' : '') }))
|
||||
// 本工位配置接驳台不在列表时也保留为可选(兜底)
|
||||
if (stationDock.value && !dockOptions.value.some((d) => d.value === stationDock.value)) {
|
||||
dockOptions.value.unshift({ value: stationDock.value, label: stationDock.value + '(本工位配置)' })
|
||||
}
|
||||
} catch {
|
||||
dockOptions.value = stationDock.value ? [{ value: stationDock.value, label: stationDock.value + '(本工位配置)' }] : []
|
||||
}
|
||||
}
|
||||
|
||||
// 提交叫料:按行拆单(每行=物料+量+接驳台=一单)
|
||||
async function doCall() {
|
||||
const items = pool.value
|
||||
.filter((r) => Number(r.callQty) > 0 && r.dock)
|
||||
.map((r) => ({ materialCode: r.materialCode, qty: Number(r.callQty), dock: r.dock }))
|
||||
if (!items.length) {
|
||||
ElMessage.warning('请填写叫料量并选择目标接驳台')
|
||||
return
|
||||
}
|
||||
items.value = list
|
||||
const over = pool.value.find((r) => Number(r.callQty) > Number(r.availQty))
|
||||
if (over) {
|
||||
ElMessage.warning(`「${over.materialName || over.materialCode}」叫料量超过可用量(${fmtQty(over.availQty)})`)
|
||||
return
|
||||
}
|
||||
calling.value = true
|
||||
try {
|
||||
const res = await callCreate({ stationNo: stationNo.value, items })
|
||||
ElMessage.success(`叫料已提交:${res?.count ?? items.length} 项(仓库完成备料后 AGV 配送)`)
|
||||
await Promise.all([loadPool(), loadList()])
|
||||
} catch {
|
||||
// 拦截器已提示(如:可用量不足/不允许跨日叫料)
|
||||
}
|
||||
calling.value = false
|
||||
}
|
||||
|
||||
// ③ 我的叫料单
|
||||
const list = ref([])
|
||||
const listLoading = ref(false)
|
||||
const listStatus = ref('')
|
||||
|
||||
const STATUS_TEXT = {
|
||||
PENDING: '待备料', SHIPPED: '已发货', DONE: '已完成', CANCELLED: '已取消',
|
||||
REJECTED: '已驳回', RETURNING: '退库中', RETURNED: '已退库'
|
||||
}
|
||||
const STATUS_TAG = {
|
||||
PENDING: 'warning', SHIPPED: 'primary', DONE: 'success', CANCELLED: 'info',
|
||||
REJECTED: 'danger', RETURNING: 'warning', RETURNED: 'info'
|
||||
}
|
||||
const statusText = (s) => STATUS_TEXT[s] || s || '—'
|
||||
const statusTag = (s) => STATUS_TAG[s] || 'info'
|
||||
|
||||
async function loadList() {
|
||||
listLoading.value = true
|
||||
try {
|
||||
const rows = await callList({ stationNo: stationNo.value, status: listStatus.value || undefined })
|
||||
list.value = Array.isArray(rows) ? rows : []
|
||||
} catch {
|
||||
list.value = []
|
||||
}
|
||||
listLoading.value = false
|
||||
}
|
||||
|
||||
async function doCancel(row) {
|
||||
try {
|
||||
await ElMessageBox.confirm(`确认取消叫料单「${row.requestNo}」?取消后释放占用额度。`, '取消叫料', { type: 'warning' })
|
||||
} catch { return }
|
||||
try {
|
||||
await callCancel({ requestNo: row.requestNo })
|
||||
ElMessage.success('已取消')
|
||||
await Promise.all([loadPool(), loadList()])
|
||||
} catch { /* 拦截器已提示 */ }
|
||||
}
|
||||
|
||||
async function doSign(row) {
|
||||
try {
|
||||
await ElMessageBox.confirm(`确认签收叫料单「${row.requestNo}」?签收=确认收到,系统不再对差异。`, '签收确认', { type: 'warning' })
|
||||
} catch { return }
|
||||
try {
|
||||
await callSign({ requestNo: row.requestNo })
|
||||
ElMessage.success('已签收')
|
||||
await Promise.all([loadPool(), loadList()])
|
||||
} catch { /* 拦截器已提示 */ }
|
||||
}
|
||||
|
||||
async function doReturn(row) {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确认对叫料单「${row.requestNo}」发起退库?\n\n整单退、不部分退:仓库取回并确认收回后,单关闭并回补叫料池额度;退回后如需料请重新叫。`,
|
||||
'申请退库', { type: 'warning' })
|
||||
} catch { return }
|
||||
try {
|
||||
await callReturn({ requestNo: row.requestNo })
|
||||
ElMessage.success('退库已申请,等待仓库收回')
|
||||
loadList()
|
||||
} catch { /* 拦截器已提示 */ }
|
||||
}
|
||||
|
||||
async function doBind(r) {
|
||||
@@ -280,26 +332,11 @@ async function removeBind(r, b) {
|
||||
} catch (e) { /* 统一错误提示 */ }
|
||||
}
|
||||
|
||||
async function doCall() {
|
||||
const list = items.value.filter((i) => i.materialCode && Number(i.qty) > 0)
|
||||
if (!list.length) {
|
||||
ElMessage.warning('请添加有效的叫料明细(图号 + 数量)')
|
||||
return
|
||||
}
|
||||
calling.value = true
|
||||
try {
|
||||
// 接驳台不再由用户选择/传入:服务端按工位配置文件自动填充目标接驳台
|
||||
const res = await callLineMaterial({
|
||||
stationNo: stationNo.value,
|
||||
orderNo: orderNo.value || '',
|
||||
operator: operatorName(),
|
||||
items: list
|
||||
})
|
||||
ElMessage.success('叫料已提交,共 ' + (res?.count ?? list.length) + ' 项')
|
||||
items.value = []
|
||||
} catch (e) { /* 统一错误提示 */ }
|
||||
calling.value = false
|
||||
}
|
||||
onMounted(() => {
|
||||
loadPool()
|
||||
loadList()
|
||||
loadDocks()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -382,6 +419,13 @@ async function doCall() {
|
||||
}
|
||||
.call-foot {
|
||||
margin-top: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.block-tip {
|
||||
color: #e6a23c;
|
||||
font-size: 15px;
|
||||
}
|
||||
.big-btn {
|
||||
min-width: 160px;
|
||||
|
||||
@@ -105,13 +105,22 @@
|
||||
</el-button>
|
||||
<div class="block-tip" v-if="blockTip">{{ blockTip }}</div>
|
||||
</footer>
|
||||
|
||||
<!-- #8 T3 PLC↔MES 对账提示(建档提交命中,弹两项,提示不拦) -->
|
||||
<el-dialog v-model="mmDlg.show" title="PLC↔MES 对账提示" width="540px" :close-on-click-modal="false" append-to-body>
|
||||
<div class="mm-detail">{{ mmDlg.detail }}</div>
|
||||
<div class="mm-opts">
|
||||
<el-button type="primary" size="large" @click="ackMismatch('new_workpiece')">新建工件(按新件处理)</el-button>
|
||||
<el-button size="large" @click="ackMismatch('bind_known')">绑定已知(关联到已有工件)</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { getBom, onlineRegister, queryOrder } from '../../api'
|
||||
import { getBom, mismatchCheck, onlineRegister, queryOrder } from '../../api'
|
||||
import { loadWip, operatorName, wip } from '../../store/station'
|
||||
|
||||
const form = reactive({ orderNo: '', sn: '', materialChecked: false })
|
||||
@@ -245,7 +254,13 @@ async function onSubmit() {
|
||||
workOrderId: product.workOrderId || undefined,
|
||||
operator: operatorName()
|
||||
})
|
||||
ElMessage.success(data?.queued ? 'MES 暂不可达,已离线缓存,稍后自动重传' : '建档上线成功')
|
||||
if (data && data.queued) {
|
||||
ElMessage.success('MES 暂不可达,已离线缓存,稍后自动重传')
|
||||
} else {
|
||||
ElMessage.success('建档上线成功')
|
||||
// #8 T3(建档提交):MES 已附 PLC↔MES 对账结果,命中则弹「两项」提示(不拦)
|
||||
if (data && data.hasMismatch) showMismatch(data)
|
||||
}
|
||||
form.sn = ''
|
||||
form.materialChecked = false
|
||||
loadWip(0)
|
||||
@@ -256,6 +271,20 @@ async function onSubmit() {
|
||||
// 进入面板即拉取工单列表与上线位在制品
|
||||
loadOrders()
|
||||
loadWip(0)
|
||||
|
||||
// #8 T3 PLC↔MES 对账提示弹窗(两项选择,仅前端确认,不调服务端 override——override 仅管理员级角色)
|
||||
const mmDlg = reactive({ show: false, detail: '', stationNo: 0 })
|
||||
function showMismatch(mm) {
|
||||
mmDlg.detail =
|
||||
mm.detail ||
|
||||
`工位 ${mm.stationNo || 0} 检测到 PLC↔MES 数据不一致(点位状态与系统记录不符),请确认本次建档的处理方式。`
|
||||
mmDlg.stationNo = mm.stationNo || 0
|
||||
mmDlg.show = true
|
||||
}
|
||||
function ackMismatch(choice) {
|
||||
mmDlg.show = false
|
||||
ElMessage.info(choice === 'new_workpiece' ? '已按「新建工件」继续' : '已按「绑定已知」继续')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -324,6 +353,17 @@ loadWip(0)
|
||||
color: #e6a23c;
|
||||
font-size: 15px;
|
||||
}
|
||||
.mm-detail {
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
color: #303133;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
.mm-opts {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
@media (max-width: 1100px) {
|
||||
.online-panel {
|
||||
grid-template-columns: 1fr;
|
||||
|
||||
@@ -198,13 +198,22 @@
|
||||
</div>
|
||||
<iframe v-if="fileDlg.url" :src="fileDlg.url" class="dlg-frame" title="步骤图纸"></iframe>
|
||||
</el-dialog>
|
||||
|
||||
<!-- #8 T3 PLC↔MES 对账提示(扫 SN 命中,弹两项,提示不拦) -->
|
||||
<el-dialog v-model="mmDlg.show" title="PLC↔MES 对账提示" width="540px" :close-on-click-modal="false" append-to-body>
|
||||
<div class="mm-detail">{{ mmDlg.detail }}</div>
|
||||
<div class="mm-opts">
|
||||
<el-button type="primary" size="large" @click="ackMismatch('new_workpiece')">新建工件(按新件处理)</el-button>
|
||||
<el-button size="large" @click="ackMismatch('bind_known')">绑定已知(关联到已有工件)</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, nextTick, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { fileNameFromUrl, getTrace, pdfOpenUrl, reportProcessDone, reportTempStore } from '../../api'
|
||||
import { fileNameFromUrl, getTrace, mismatchCheck, pdfOpenUrl, reportProcessDone, reportTempStore } from '../../api'
|
||||
import {
|
||||
autoTorqueState,
|
||||
bindBlocking,
|
||||
@@ -404,15 +413,15 @@ async function onScan() {
|
||||
setCurrentSn(v)
|
||||
markStationArrival()
|
||||
ElMessage.success('已装载工件 ' + v)
|
||||
return
|
||||
}
|
||||
if (onPoint) {
|
||||
} else if (onPoint) {
|
||||
setCurrentSn(v)
|
||||
ElMessage.warning('该工件在 ' + (onPoint.label || onPoint.pointNo) + ',请点「上料 / 取料到本工位」调入')
|
||||
return
|
||||
} else {
|
||||
setCurrentSn(v)
|
||||
ElMessage.warning('产线台账无该工件,请点「上料 / 取料到本工位」登记到本工位')
|
||||
}
|
||||
setCurrentSn(v)
|
||||
ElMessage.warning('产线台账无该工件,请点「上料 / 取料到本工位」登记到本工位')
|
||||
// #8 T3(扫 SN):事件驱动单工位对账,命中则弹「两项」提示(不拦)
|
||||
await scanMismatchCheck(v)
|
||||
}
|
||||
|
||||
async function onTakeIn() {
|
||||
@@ -504,6 +513,23 @@ async function onProcessDone() {
|
||||
ElMessage.warning(blockTip.value || '当前不满足报工条件')
|
||||
return
|
||||
}
|
||||
// #8 T2(报工前):事件驱动单工位对账软提示,提示不拦(不影响报工确认)
|
||||
try {
|
||||
const mm = await mismatchCheck({
|
||||
stationNo: stationNo.value,
|
||||
trigger: 'terminal',
|
||||
orderNo: orderNo.value,
|
||||
sn: sn.value,
|
||||
operator: operatorName()
|
||||
})
|
||||
if (mm && mm.hasMismatch) {
|
||||
ElMessage.warning(
|
||||
'PLC↔MES 对账提示:' +
|
||||
(mm.detail || '工位 ' + (mm.stationNo || stationNo.value) + ' 数据不一致') +
|
||||
'(不影响报工)'
|
||||
)
|
||||
}
|
||||
} catch { /* 静默:MES 不可达不阻断作业 */ }
|
||||
const allOk = !hasNg.value
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
@@ -603,6 +629,37 @@ function showDlgFile(i) {
|
||||
fileDlg.url = name ? pdfOpenUrl(name) : ''
|
||||
}
|
||||
|
||||
/* ---------- #8 PLC↔MES 对账(T2/T3 终端事件驱动,不轮询) ---------- */
|
||||
const mmDlg = reactive({ show: false, detail: '', stationNo: 0 })
|
||||
|
||||
// T3(扫 SN):单工位对账,命中则弹「两项」提示(不拦)
|
||||
async function scanMismatchCheck(snVal) {
|
||||
try {
|
||||
const mm = await mismatchCheck({
|
||||
stationNo: stationNo.value,
|
||||
trigger: 'terminal',
|
||||
orderNo: orderNo.value,
|
||||
sn: snVal,
|
||||
operator: operatorName()
|
||||
})
|
||||
if (mm && mm.hasMismatch) showMismatch(mm)
|
||||
} catch { /* 静默:MES 不可达不阻断作业 */ }
|
||||
}
|
||||
|
||||
function showMismatch(mm) {
|
||||
mmDlg.detail =
|
||||
mm.detail ||
|
||||
`工位 ${mm.stationNo || stationNo.value} 检测到 PLC↔MES 数据不一致(点位状态与系统记录不符),请确认本次作业的处理方式。`
|
||||
mmDlg.stationNo = mm.stationNo || 0
|
||||
mmDlg.show = true
|
||||
}
|
||||
|
||||
// 两项选择仅前端确认,不调服务端 override(override 仅管理员级角色);提示不拦
|
||||
function ackMismatch(choice) {
|
||||
mmDlg.show = false
|
||||
ElMessage.info(choice === 'new_workpiece' ? '已按「新建工件」继续' : '已按「绑定已知」继续')
|
||||
}
|
||||
|
||||
defineExpose({ focusScan })
|
||||
</script>
|
||||
|
||||
@@ -868,6 +925,17 @@ defineExpose({ focusScan })
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.mm-detail {
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
color: #303133;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
.mm-opts {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.action-bar {
|
||||
grid-column: 1 / -1;
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user