feat: 新增收集式校验错误弹窗及工位报警语音播报
新增 ErrorListDialog 组件用于统一展示结构化校验错误信息,实现报错一次收全;新增工位报警语音播报功能,通过浏览器 SpeechSynthesis 播放本工位相关报警;调整物料类别及序列号字段文案,移除「其他」类别;新增工单实际开始字段及采集方式配置;优化 AGV 及 PlcSend 页签刷新逻辑;新增看板物料追溯及工位报警接口;删除 PLC 强制写 M 位及相关测试代码;同步数据库字段注释及补丁。
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
<el-form-item label="归属编号">
|
||||
<el-input v-model="query.contractNo" placeholder="合同号/科技项目号 模糊查询" clearable style="width:170px" @keyup.enter="load" />
|
||||
</el-form-item>
|
||||
<el-form-item label="完成日期">
|
||||
<el-form-item label="要求完成日期">
|
||||
<el-date-picker v-model="query.dueRange" type="daterange" value-format="YYYY-MM-DD"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" style="width:250px" @change="load" />
|
||||
</el-form-item>
|
||||
@@ -49,8 +49,13 @@
|
||||
<el-table-column prop="productSerial" label="产品序号" min-width="100" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.productSerial || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="quantity" label="数量" width="70" />
|
||||
<el-table-column prop="finishedNum" label="已完工" width="70" />
|
||||
<el-table-column prop="quantity" label="数量" width="70">
|
||||
<template #default="{ row }">{{ row.quantity ?? 0 }}</template>
|
||||
</el-table-column>
|
||||
<!-- finishedNum 走 ent omitempty:0 值被序列化省略,必须兜底显示 0(2026-10-19 修复"已完工"显示为空被误读) -->
|
||||
<el-table-column prop="finishedNum" label="已完工" width="70">
|
||||
<template #default="{ row }">{{ row.finishedNum ?? 0 }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="状态" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip :content="statusText(row.status)" placement="top">
|
||||
@@ -64,12 +69,21 @@
|
||||
<el-table-column label="创建日期" width="160">
|
||||
<template #default="{ row }">{{ fmtTime(row.createdAt) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="完成日期" width="110">
|
||||
<el-table-column label="要求完成日期" width="120">
|
||||
<template #default="{ row }">{{ fmtDateOnly(row.dueDate) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="开始时间" width="110">
|
||||
<el-table-column label="计划开始" width="110">
|
||||
<template #default="{ row }">{{ fmtDateOnly(row.planStart) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计划完成" width="110">
|
||||
<template #default="{ row }">{{ fmtDateOnly(row.planEnd) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="实际开始" width="110">
|
||||
<template #default="{ row }">{{ fmtDateOnly(row.actualStart) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="实际完成" width="110">
|
||||
<template #default="{ row }">{{ fmtDateOnly(row.completedAt) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="130" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<div style="display:flex;align-items:center;justify-content:center;gap:8px">
|
||||
@@ -83,6 +97,8 @@
|
||||
:disabled="!hasCombination(row)" command="schedule">自动排产</el-dropdown-item>
|
||||
<el-dropdown-item v-for="a in statusActions(row.status)" :key="a.v" :command="'st:' + a.v">{{ a.l }}</el-dropdown-item>
|
||||
<el-dropdown-item v-if="can('produce.workorder:edit') && row.status === 'CREATED'" command="edit" divided>编辑</el-dropdown-item>
|
||||
<el-dropdown-item v-if="can('produce.workorder:forcecomplete') && ['IN_PROGRESS','PAUSED'].includes(row.status)"
|
||||
command="force" style="color:#e6a23c">强制完工</el-dropdown-item>
|
||||
<el-dropdown-item v-if="can('produce.workorder:delete') && row.status === 'CREATED'"
|
||||
command="del" divided style="color:#f56c6c">删除</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
@@ -127,20 +143,24 @@
|
||||
<el-alert v-if="ppWarnings.length" type="warning" :closable="false" style="margin-top:6px"
|
||||
:title="ppWarnings.length > 1 ? ppWarnings.map((w, i) => (i + 1) + '. ' + w).join(';') : ppWarnings[0]" />
|
||||
<div v-else-if="dialog.productProcessId" class="combo-tip">
|
||||
已按产品工艺自动填入工艺组合(快捷选择,可手动增删工位;与产品工艺的工艺个数/顺序不符时保存会有偏差提示,不阻断)。
|
||||
已按产品工艺自动填入工艺组合(快捷选择,可手动增删工位)。工艺顺序须与产品工艺一致,不一致将无法保存;工艺个数不符仅保存后提示,不拦截。
|
||||
<el-link type="primary" :underline="false" style="margin-left:6px" @click="goProductProcess">查看产品工艺/路线卡</el-link>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" required><el-input-number v-model="dialog.quantity" :min="1" /></el-form-item>
|
||||
<el-form-item label="完成日期" required>
|
||||
<el-form-item label="要求完成日期" required>
|
||||
<el-date-picker v-model="dialog.dueDate" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="请选择完成日期(必填)" style="width:100%" />
|
||||
placeholder="请选择要求完成日期(必填)" style="width:100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间">
|
||||
<el-form-item label="计划开始">
|
||||
<el-date-picker v-model="dialog.planStart" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="计划开始日期(选填)" style="width:100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计划完成">
|
||||
<el-date-picker v-model="dialog.planEnd" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="计划完成日期(选填)" style="width:100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工艺组合">
|
||||
<div style="width:100%">
|
||||
<el-checkbox-group v-model="selStations" class="combo-group">
|
||||
@@ -238,7 +258,7 @@
|
||||
<el-table-column prop="materialName" label="物料名称" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="spec" label="规格" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="unit" label="单位" width="70" align="center" />
|
||||
<el-table-column label="管理方式" width="110" align="center">
|
||||
<el-table-column label="序列号" width="110" align="center">
|
||||
<template #default="{ row }">{{ row.snMode === 1 ? '序列号=是' : '序列号=否' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="unitQty" label="单台净用量" width="100" align="center" />
|
||||
@@ -250,6 +270,50 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 强制完工核对单(方案 A:剩余未完工显示不拦 / 排产自动取消 / PENDING 叫料自动取消、SHIPPED 人工处理 / 在制必须 0) -->
|
||||
<el-dialog v-model="fc.show" title="强制完工核对单" width="640px" :close-on-click-modal="false">
|
||||
<el-alert type="warning" :closable="false" style="margin-bottom:12px"
|
||||
title="强制完工用于「工单做不满必须关单」:未生产完即关单,绕过完工门禁,操作留痕(谁/何时/原因/清单快照),不可恢复。" />
|
||||
<div v-loading="fc.loading">
|
||||
<template v-if="fc.preview">
|
||||
<el-descriptions :column="2" border size="small" style="margin-bottom:12px">
|
||||
<el-descriptions-item label="工单号">{{ fc.preview.workOrderNo }}</el-descriptions-item>
|
||||
<el-descriptions-item label="完工进度">
|
||||
{{ fc.preview.finishedNum }} / {{ fc.preview.quantity }} 台
|
||||
<el-tag v-if="fc.preview.remaining > 0" type="warning" size="small" style="margin-left:6px">剩余 {{ fc.preview.remaining }} 台未完工(显示不拦)</el-tag>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="1" border size="small" style="margin-bottom:12px">
|
||||
<el-descriptions-item label="在制工件(必须为 0 才能关单)">
|
||||
<template v-if="fc.preview.inProduction > 0">
|
||||
<b style="color:#f56c6c">{{ fc.preview.inProduction }} 件在制 —— 请先下线完工或报废,不允许随单终止</b>
|
||||
</template>
|
||||
<template v-else><b style="color:#67c23a">0 件(可关单)</b></template>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="未完成排产(确认后自动取消)">
|
||||
<span v-if="fc.preview.plansToCancel && fc.preview.plansToCancel.length">{{ fc.preview.plansToCancel.join(';') }}</span>
|
||||
<span v-else style="color:#909399">无</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="待备料叫料单(确认后自动取消并释放占用)">
|
||||
<span v-if="fc.preview.pendingCalls && fc.preview.pendingCalls.length">{{ fc.preview.pendingCalls.join(';') }}</span>
|
||||
<span v-else style="color:#909399">无</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="已发货叫料单(不拦关单,需人工到终端签收或退库)">
|
||||
<span v-if="fc.preview.shippedCalls && fc.preview.shippedCalls.length">{{ fc.preview.shippedCalls.join(';') }}</span>
|
||||
<span v-else style="color:#909399">无</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-input v-model="fc.reason" type="textarea" :rows="2" maxlength="200" show-word-limit
|
||||
placeholder="强制完工原因(必填,写入操作日志,如:客户砍单 / 工艺变更终止)" />
|
||||
</template>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="fc.show = false">取消</el-button>
|
||||
<el-button type="warning" :disabled="!fc.preview || fc.preview.inProduction > 0"
|
||||
:loading="fc.submitting" @click="doForceComplete">确认强制完工</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 工单详情(只读):工单字段汇总 + 工件SN列表 -->
|
||||
<el-drawer v-model="detail.show" :title="`工单详情 - ${detail.row ? detail.row.workOrderNo : ''}`" size="780px">
|
||||
<template v-if="detail.row">
|
||||
@@ -257,21 +321,56 @@
|
||||
<el-descriptions-item label="产品工号">{{ detail.row.workOrderNo }}</el-descriptions-item>
|
||||
<el-descriptions-item label="图号">{{ detail.row.productCode || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="产品名称">{{ detail.row.productName || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="数量">共 {{ detail.row.quantity }} 台(已完工 {{ detail.row.finishedNum }})</el-descriptions-item>
|
||||
<el-descriptions-item label="数量">
|
||||
共 {{ detail.row.quantity ?? 0 }} 台(已完工 {{ detail.row.finishedNum ?? 0 }} 台 / 未完工 {{ Math.max(0, (detail.row.quantity ?? 0) - (detail.row.finishedNum ?? 0)) }} 台)
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="归属">
|
||||
{{ ownershipText(detail.row.ownershipType) }}{{ detail.row.contractNo ? ':' + detail.row.contractNo : '' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="状态">{{ statusText(detail.row.status) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="已排产量">{{ detail.row.scheduledQty ?? 0 }} 台</el-descriptions-item>
|
||||
<el-descriptions-item label="剩余未排产量">{{ detail.row.remainQty ?? 0 }} 台</el-descriptions-item>
|
||||
<el-descriptions-item label="产品序号">{{ detail.row.productSerial || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="完成日期">{{ fmtDateOnly(detail.row.dueDate) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="开始时间">{{ fmtDateOnly(detail.row.planStart) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="要求完成日期">{{ fmtDateOnly(detail.row.dueDate) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="计划开始">{{ fmtDateOnly(detail.row.planStart) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="计划完成">{{ fmtDateOnly(detail.row.planEnd) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="实际开始">{{ fmtDateOnly(detail.row.actualStart) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="实际完成">{{ fmtDateOnly(detail.row.completedAt) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建人 / 创建日期">
|
||||
{{ detail.row.createdBy || '-' }} / {{ fmtTime(detail.row.createdAt) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div class="detail-subtitle">工件SN列表({{ detail.pieces.length }} 台)</div>
|
||||
<div class="detail-subtitle">工艺路线({{ detailRoutes.length }} 道工艺,按工位号升序=执行顺序,不显示工位号)</div>
|
||||
<el-table :data="detailRoutes" border size="small" empty-text="该工单未配置工艺组合">
|
||||
<el-table-column type="index" label="序" width="50" align="center" />
|
||||
<el-table-column prop="flowName" label="工艺" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="步骤数" width="80" align="center">
|
||||
<template #default="{ row }">{{ row.steps.length }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="步骤明细" min-width="260">
|
||||
<template #default="{ row }">
|
||||
<template v-if="!row.steps.length">-</template>
|
||||
<template v-else>
|
||||
<span>{{ row.expanded ? row.steps.map((s, i) => `${i + 1}. ${s.name}`).join(';') : row.steps.slice(0, 3).map((s, i) => `${i + 1}. ${s.name}`).join(';') + (row.steps.length > 3 ? ' …' : '') }}</span>
|
||||
<el-button v-if="row.steps.length > 3" link type="primary" size="small" style="margin-left:6px"
|
||||
@click="row.expanded = !row.expanded">{{ row.expanded ? '收起' : '展开全部' }}</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="检测/签字要求" min-width="150">
|
||||
<template #default="{ row }">{{ stepReqText(row) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="detail-subtitle">工件SN列表({{ detail.total }} 台,按产品序号升序)</div>
|
||||
<div class="piece-toolbar">
|
||||
<el-select v-model="pieceQuery.status" clearable placeholder="状态:全部" style="width:140px" @change="onPieceFilter">
|
||||
<el-option v-for="(l, v) in pieceStatusMap" :key="v" :label="l" :value="v" />
|
||||
</el-select>
|
||||
</div>
|
||||
<el-table :data="detail.pieces" border size="small" v-loading="detail.loading" empty-text="该工单暂无工件进线记录">
|
||||
<el-table-column type="index" label="产品序号" width="80" align="center" />
|
||||
<el-table-column label="产品序号" width="80" align="center">
|
||||
<template #default="{ row }">{{ pieceSerialText(row) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sn" label="SN" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column label="类型" width="90" align="center">
|
||||
<template #default>{{ snModeText(detail.snMode) }}</template>
|
||||
@@ -283,6 +382,10 @@
|
||||
<template #default="{ row }">{{ stationText(row.currentStationNo) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination class="piece-pagination" background layout="total, sizes, prev, pager, next"
|
||||
:total="detail.total" :page-sizes="[100, 200, 500]"
|
||||
v-model:current-page="pieceQuery.page" v-model:page-size="pieceQuery.pageSize"
|
||||
@current-change="loadPieces" @size-change="onPieceSize" />
|
||||
</template>
|
||||
</el-drawer>
|
||||
</div>
|
||||
@@ -301,12 +404,12 @@ import { helpWorkOrder } from '../help'
|
||||
|
||||
const statusOptions = [
|
||||
{ v: 'CREATED', l: '已创建' },
|
||||
{ v: 'IN_PROGRESS', l: '下发并开工' },
|
||||
{ v: 'IN_PROGRESS', l: '执行中' },
|
||||
{ v: 'PAUSED', l: '已暂停' },
|
||||
{ v: 'DONE', l: '已完成' }, { v: 'CANCELLED', l: '已取消' }
|
||||
]
|
||||
const statusText = (s) => (statusOptions.find((x) => x.v === s) || {}).l || s
|
||||
// 状态固定配色(方案 A):已创建=灰(info) / 下发并开工=绿(success) / 已暂停=橙(warning) / 已完成=深绿(success) / 已取消=红(danger)
|
||||
// 状态固定配色(方案 A):已创建=灰(info) / 执行中=绿(success) / 已暂停=橙(warning) / 已完成=深绿(success) / 已取消=红(danger)
|
||||
const statusTagType = (s) => (
|
||||
{ CREATED: 'info', IN_PROGRESS: 'success', PAUSED: 'warning', CANCELLED: 'danger', DONE: 'success' }[s] || 'info'
|
||||
)
|
||||
@@ -414,9 +517,39 @@ async function openUsage(row) {
|
||||
}
|
||||
|
||||
// ---------- 工单详情(只读:字段汇总 + 工件SN列表) ----------
|
||||
// 数据源:既有工件查询 API(GET /workpieces?orderNo=,按工单精确过滤);
|
||||
// 类型列读物料档案 sn_mode(同工单同图号,按工单图号取一次,全行同值)。
|
||||
const detail = reactive({ show: false, row: null, pieces: [], loading: false, snMode: 0 })
|
||||
// 工件SN列表:GET /workpieces?orderNo=&page=&pageSize=&status= 后端 SQL 分页(2026-10-20),
|
||||
// 按 SN 升序(预生成 SN={工单号}-{3位序号},即产品序号小号在前);产品序号列取 SN 末段序号。
|
||||
const detail = reactive({ show: false, row: null, pieces: [], total: 0, loading: false, snMode: 0 })
|
||||
const pieceQuery = reactive({ page: 1, pageSize: 100, status: '' })
|
||||
// 产品序号=SN 末段数字(如 WO-20260918-001-001 → 1);扫入 SN(序列号=是)无该结构时显示 -
|
||||
function pieceSerialText(row) {
|
||||
const m = String(row.sn || '').match(/-(\d{1,4})$/)
|
||||
return m ? String(parseInt(m[1], 10)) : '-'
|
||||
}
|
||||
async function loadPieces() {
|
||||
if (!detail.row) return
|
||||
detail.loading = true
|
||||
try {
|
||||
const d = await request.get('/workpieces', { params: {
|
||||
orderNo: detail.row.workOrderNo, page: pieceQuery.page, pageSize: pieceQuery.pageSize, status: pieceQuery.status
|
||||
} })
|
||||
detail.pieces = d?.list || []
|
||||
detail.total = d?.total || 0
|
||||
} catch {
|
||||
detail.pieces = []
|
||||
detail.total = 0
|
||||
} finally {
|
||||
detail.loading = false
|
||||
}
|
||||
}
|
||||
function onPieceFilter() {
|
||||
pieceQuery.page = 1
|
||||
loadPieces()
|
||||
}
|
||||
function onPieceSize() {
|
||||
pieceQuery.page = 1
|
||||
loadPieces()
|
||||
}
|
||||
let materialsCache = null
|
||||
async function materialSnModeOf(code) {
|
||||
if (!code) return 0
|
||||
@@ -431,20 +564,54 @@ async function materialSnModeOf(code) {
|
||||
return m ? (m.snMode || 0) : 0
|
||||
}
|
||||
async function openDetail(row) {
|
||||
Object.assign(detail, { show: true, row, pieces: [], loading: true, snMode: 0 })
|
||||
Object.assign(detail, { show: true, row: null, pieces: [], total: 0, loading: false, snMode: 0 })
|
||||
Object.assign(pieceQuery, { page: 1, pageSize: 100, status: '' })
|
||||
try {
|
||||
const [pieces, snMode] = await Promise.all([
|
||||
request.get('/workpieces', { params: { orderNo: row.workOrderNo } }).catch(() => []),
|
||||
materialSnModeOf(row.productCode)
|
||||
])
|
||||
detail.pieces = pieces || []
|
||||
detail.snMode = snMode
|
||||
// 工单详情走 GET /work-orders/:id(含 已排产量/剩余未排产量 等统计字段)
|
||||
const wo = await request.get('/work-orders/' + row.id)
|
||||
detail.row = wo
|
||||
buildDetailRoutes(wo)
|
||||
await Promise.all([loadPieces(), materialSnModeOf(wo.productCode).then((m) => { detail.snMode = m })])
|
||||
} finally {
|
||||
detail.loading = false
|
||||
}
|
||||
}
|
||||
|
||||
const dialog = reactive({ show: false, id: 0, workOrderNo: '', productTypeId: null, productCode: '', productName: '', contractNo: '', ownershipType: '', productSerial: '', quantity: 1, dueDate: '', planStart: '', status: 'CREATED', productProcessId: 0 })
|
||||
// ---------- 工艺路线(详情抽屉,2026-10-19):按 flowCombination 去重、按工位号升序 ----------
|
||||
// 展示工艺名+步骤数,可展开步骤列表;不显示工位列(工位号仅作为排序口径)。
|
||||
const detailRoutes = ref([])
|
||||
function buildDetailRoutes(row) {
|
||||
const combo = Array.isArray(row?.flowCombination) ? row.flowCombination : []
|
||||
const minStation = new Map()
|
||||
for (const c of combo) {
|
||||
if (!c || !c.flowId) continue
|
||||
const cur = minStation.get(c.flowId)
|
||||
if (cur === undefined || c.stationNo < cur) minStation.set(c.flowId, c.stationNo)
|
||||
}
|
||||
const ids = [...minStation.keys()].sort((a, b) => minStation.get(a) - minStation.get(b))
|
||||
detailRoutes.value = ids.map((fid) => {
|
||||
const f = flows.value.find((x) => x.id === fid)
|
||||
return {
|
||||
flowId: fid,
|
||||
flowName: f ? f.name : `工艺${fid}`,
|
||||
steps: (f?.steps || []).slice().sort((a, b) => (a.seq || 0) - (b.seq || 0))
|
||||
.map((s) => ({ name: s.name, needCheck: !!s.needCheck, needOperatorSign: !!s.needOperatorSign, needInspectorSign: !!s.needInspectorSign })),
|
||||
expanded: false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 检测/签字要求(详情抽屉):汇总该工艺各步骤的门禁要求(2026-10-20 客户要求详情展示工艺门禁)
|
||||
function stepReqText(row) {
|
||||
const n = (fn) => row.steps.filter(fn).length
|
||||
const parts = []
|
||||
if (n((s) => s.needCheck)) parts.push(`检测确认 ${n((s) => s.needCheck)} 步`)
|
||||
if (n((s) => s.needOperatorSign)) parts.push(`操作工签字 ${n((s) => s.needOperatorSign)} 步`)
|
||||
if (n((s) => s.needInspectorSign)) parts.push(`检验员签字 ${n((s) => s.needInspectorSign)} 步`)
|
||||
return parts.length ? parts.join(';') : '—'
|
||||
}
|
||||
|
||||
const dialog = reactive({ show: false, id: 0, workOrderNo: '', productTypeId: null, productCode: '', productName: '', contractNo: '', ownershipType: '', productSerial: '', quantity: 1, dueDate: '', planStart: '', planEnd: '', status: 'CREATED', productProcessId: 0 })
|
||||
|
||||
// ---------- 产品工艺(2026-10-09):建单选产品自动带出默认产品工艺,自动填工艺组合(快捷选择+偏差提示) ----------
|
||||
const productProcesses = ref([])
|
||||
@@ -522,13 +689,13 @@ function onProductTypeChange(id) {
|
||||
loadProductProcesses()
|
||||
}
|
||||
function openCreate() {
|
||||
Object.assign(dialog, { show: true, id: 0, workOrderNo: genOrderNo(), productTypeId: null, productCode: '', productName: '', contractNo: '', ownershipType: '', productSerial: '', quantity: 1, dueDate: '', planStart: '', status: 'CREATED', productProcessId: 0 })
|
||||
Object.assign(dialog, { show: true, id: 0, workOrderNo: genOrderNo(), productTypeId: null, productCode: '', productName: '', contractNo: '', ownershipType: '', productSerial: '', quantity: 1, dueDate: '', planStart: '', planEnd: '', status: 'CREATED', productProcessId: 0 })
|
||||
productProcesses.value = []
|
||||
ppWarnings.value = []
|
||||
selStations.value = defaultSelStations()
|
||||
}
|
||||
async function openEdit(row) {
|
||||
Object.assign(dialog, { show: true, id: row.id, workOrderNo: row.workOrderNo, productTypeId: row.productTypeId, productCode: row.productCode, productName: row.productName, contractNo: row.contractNo || '', ownershipType: row.ownershipType || '', productSerial: row.productSerial || '', quantity: row.quantity, dueDate: row.dueDate ? String(row.dueDate).slice(0, 10) : '', planStart: row.planStart ? String(row.planStart).slice(0, 10) : '', status: row.status, productProcessId: row.productProcessId || 0 })
|
||||
Object.assign(dialog, { show: true, id: row.id, workOrderNo: row.workOrderNo, productTypeId: row.productTypeId, productCode: row.productCode, productName: row.productName, contractNo: row.contractNo || '', ownershipType: row.ownershipType || '', productSerial: row.productSerial || '', quantity: row.quantity, dueDate: row.dueDate ? String(row.dueDate).slice(0, 10) : '', planStart: row.planStart ? String(row.planStart).slice(0, 10) : '', planEnd: row.planEnd ? String(row.planEnd).slice(0, 10) : '', status: row.status, productProcessId: row.productProcessId || 0 })
|
||||
selStations.value = hasCombination(row)
|
||||
? [...new Set(row.flowCombination.map((c) => c.stationNo))].sort((a, b) => a - b)
|
||||
: defaultSelStations()
|
||||
@@ -544,7 +711,7 @@ async function openEdit(row) {
|
||||
}
|
||||
}
|
||||
async function save() {
|
||||
if (!dialog.dueDate) return ElMessage.warning('请选择完成日期(必填)')
|
||||
if (!dialog.dueDate) return ElMessage.warning('请选择要求完成日期(必填)')
|
||||
// 归属(一级编号)二选一口径:类型必选;合同号/科技项目号必填编号,其他可空
|
||||
if (!dialog.ownershipType) return ElMessage.warning('请选择归属类型(合同号/科技项目号/其他)')
|
||||
if (dialog.ownershipType !== 'other' && !String(dialog.contractNo || '').trim()) {
|
||||
@@ -552,12 +719,12 @@ async function save() {
|
||||
}
|
||||
// 建单不强制工艺组合(工单≠开工):排产/开工时由后端校验组合非空
|
||||
if (!flowCombination.value.length) ElMessage.warning('未选择工艺组合:排产/开工前须配置')
|
||||
const body = { id: dialog.id, workOrderNo: dialog.workOrderNo, productTypeId: dialog.productTypeId, productCode: dialog.productCode, productName: dialog.productName, contractNo: dialog.contractNo, ownershipType: dialog.ownershipType, productSerial: dialog.productSerial, quantity: dialog.quantity, dueDate: dialog.dueDate, planStart: dialog.planStart, flowCombination: flowCombination.value, productProcessId: dialog.productProcessId || 0 }
|
||||
const body = { id: dialog.id, workOrderNo: dialog.workOrderNo, productTypeId: dialog.productTypeId, productCode: dialog.productCode, productName: dialog.productName, contractNo: dialog.contractNo, ownershipType: dialog.ownershipType, productSerial: dialog.productSerial, quantity: dialog.quantity, dueDate: dialog.dueDate, planStart: dialog.planStart, planEnd: dialog.planEnd, flowCombination: flowCombination.value, productProcessId: dialog.productProcessId || 0 }
|
||||
let resp = null
|
||||
if (dialog.id) resp = await request.put('/work-orders', body)
|
||||
else resp = await request.post('/work-orders', body)
|
||||
ElMessage.success('保存成功')
|
||||
// 产品工艺偏差警告(仅提示不阻断,2026-10-09 定稿:覆盖/顺序/个数不符时警告提示)
|
||||
// 产品工艺偏差柔性警告(2026-10-20:顺序不符已由后端硬拦截不会保存成功,这里只剩覆盖/个数类提示)
|
||||
const ws = (resp && resp.warnings) || []
|
||||
if (ws.length) {
|
||||
ElMessageBox.alert(ws.map((w, i) => (i + 1) + '. ' + w).join('\n'), '与产品工艺存在偏差(已保存)', {
|
||||
@@ -598,15 +765,47 @@ async function del(row) {
|
||||
load()
|
||||
}
|
||||
|
||||
// 操作列「更多 ▾」菜单分发:用料 / 自动排产 / 状态操作 / 编辑 / 删除
|
||||
// 操作列「更多 ▾」菜单分发:用料 / 自动排产 / 状态操作 / 编辑 / 删除 / 强制完工
|
||||
function onRowCmd(row, cmd) {
|
||||
if (cmd === 'usage') return openUsage(row)
|
||||
if (cmd === 'schedule') return openAutoSchedule(row)
|
||||
if (cmd === 'edit') return openEdit(row)
|
||||
if (cmd === 'del') return del(row)
|
||||
if (cmd === 'force') return openForceComplete(row)
|
||||
if (cmd.startsWith('st:')) return changeStatus(row, cmd.slice(3))
|
||||
}
|
||||
|
||||
// ---- 强制完工(方案 A:终止+清单确认,2026-10-20 拍板)----
|
||||
// 四项核对单:剩余未完工(显示不拦)/ 未完成排产(自动取消)/ 在途叫料(PENDING 自动取消、SHIPPED 人工处理)/ 在制工件(必须 0)
|
||||
const fc = reactive({ show: false, id: 0, reason: '', preview: null, loading: false, submitting: false })
|
||||
async function openForceComplete(row) {
|
||||
fc.show = true; fc.id = row.id; fc.reason = ''; fc.preview = null; fc.loading = true
|
||||
try {
|
||||
fc.preview = await request.get(`/work-orders/${row.id}/force-complete/preview`)
|
||||
} finally {
|
||||
fc.loading = false
|
||||
}
|
||||
}
|
||||
async function doForceComplete() {
|
||||
if (!String(fc.reason || '').trim()) return ElMessage.warning('强制完工必须填写原因(写入操作日志)')
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确认强制完工工单「${fc.preview.workOrderNo}」?未完成排产将自动取消、待备料叫料单自动取消,此操作不可恢复。`,
|
||||
'强制完工', { type: 'warning', confirmButtonText: '确认强制完工', confirmButtonClass: 'el-button--warning' })
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
fc.submitting = true
|
||||
try {
|
||||
await request.post('/work-orders/force-complete', { id: fc.id, reason: String(fc.reason).trim() })
|
||||
ElMessage.success('工单已强制完工')
|
||||
fc.show = false
|
||||
load()
|
||||
} finally {
|
||||
fc.submitting = false
|
||||
}
|
||||
}
|
||||
|
||||
// ---- 自动排产(引导式,M9 定稿:预览逐日可调、总数据必须对上)----
|
||||
const sched = reactive({ show: false, orderNo: '', mode: 'AVG', dailyQty: 1, segments: [{ range: null }], planStart: '', dueDate: '', quantity: 0, finishedNum: 0, preview: null, previewing: false, applying: false })
|
||||
function openAutoSchedule(row) {
|
||||
@@ -661,6 +860,8 @@ onMounted(async () => { load(); loadProducts(); loadComboData() })
|
||||
|
||||
<style scoped>
|
||||
.sched-tip { font-size: 12px; color: #909399; margin-top: 4px; }
|
||||
.piece-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
|
||||
.piece-pagination { margin-top: 10px; justify-content: flex-end; }
|
||||
.detail-subtitle { font-size: 13px; font-weight: 600; color: #303133; margin: 14px 0 8px; }
|
||||
.combo-group { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: flex-start; width: 100%; }
|
||||
.combo-group-title { width: 100%; font-size: 12px; font-weight: 600; color: #303133; background: #f5f7fa; padding: 4px 8px; border-radius: 4px; margin-top: 4px; }
|
||||
|
||||
Reference in New Issue
Block a user