feat: 完成产线与仓储系统多模块迭代升级
本次迭代覆盖MES与WMS核心业务: 1. 新增接驳台托盘传感器读取与AGV对接能力 2. 完善工单排产、备料流程与权限体系拆分 3. 优化看板接口与前端路由、样式 4. 新增操作日志、库存盘点与角色保护逻辑 5. 修复代理地址、BOM保存等已知问题
This commit is contained in:
@@ -35,21 +35,23 @@
|
||||
<el-table-column prop="status" label="状态" width="100">
|
||||
<template #default="{ row }">{{ statusText(row.status) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="320" fixed="right">
|
||||
<el-table-column label="操作" width="340" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button v-if="can('produce.workorder:edit')" size="small" type="primary" plain @click="openSeq(row)">工位组合</el-button>
|
||||
<el-button v-if="can('produce.workorder:edit')" size="small" type="warning" @click="openEdit(row)">编辑</el-button>
|
||||
<template v-if="row.status === 'CREATED'">
|
||||
<el-button v-if="can('produce.workorder:edit')" size="small" type="primary" plain @click="openSeq(row)">工位组合</el-button>
|
||||
<el-button v-if="can('produce.workorder:edit')" size="small" type="warning" @click="openEdit(row)">编辑</el-button>
|
||||
</template>
|
||||
<el-dropdown
|
||||
v-if="can('produce.workorder:edit') && statusActions(row.status).length"
|
||||
trigger="click" @command="(cmd) => changeStatus(row, cmd)">
|
||||
<el-button size="small">状态 ▾</el-button>
|
||||
<el-button size="small" type="primary">{{ statusActionBtn(row.status) }}</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-for="a in statusActions(row.status)" :key="a.v" :command="a.v">{{ a.l }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-button v-if="can('produce.workorder:delete')" size="small" type="danger" @click="del(row)">删除</el-button>
|
||||
<el-button v-if="can('produce.workorder:delete') && ['CREATED','PENDING','CONFIRMED'].includes(row.status)" size="small" type="danger" @click="del(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -70,11 +72,6 @@
|
||||
<el-form-item label="工位组合">
|
||||
<ProcessSeqPicker :model-value="dialog.processSeq" @update:model-value="dialog.processSeq = $event" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select v-model="dialog.status" placeholder="请选择状态" style="width:100%">
|
||||
<el-option v-for="s in statusOptions" :key="s.v" :label="s.l" :value="s.v" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="dialog.show=false">取消</el-button>
|
||||
@@ -114,19 +111,28 @@ import ProcessSeqPicker from '../components/ProcessSeqPicker.vue'
|
||||
import { helpWorkOrder } from '../help'
|
||||
|
||||
const statusOptions = [
|
||||
{ v: 'CREATED', l: '已创建' }, { v: 'RELEASED', l: '已发布' },
|
||||
{ v: 'IN_PROGRESS', l: '生产中' }, { v: 'DONE', l: '已完成' },
|
||||
{ v: 'PENDING', l: '待排产' }, { v: 'CONFIRMED', l: '已确认' }
|
||||
{ v: 'CREATED', l: '已创建' }, { v: 'RELEASED', 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
|
||||
|
||||
// 状态流转:给出当前状态可执行的下一个动作
|
||||
// 状态流转:给出当前状态可执行的下一个动作(按钮文案随当前状态变化)
|
||||
function statusActionBtn(status) {
|
||||
const map = {
|
||||
CREATED: '下发 ▾', PENDING: '下发 ▾', CONFIRMED: '开工 ▾',
|
||||
RELEASED: '开工 ▾', IN_PROGRESS: '执行中 ▾', PAUSED: '已暂停 ▾'
|
||||
}
|
||||
return map[status] || ''
|
||||
}
|
||||
function statusActions(status) {
|
||||
const map = {
|
||||
CREATED: [{ v: 'RELEASED', l: '发布' }],
|
||||
PENDING: [{ v: 'RELEASED', l: '发布' }],
|
||||
RELEASED: [{ v: 'IN_PROGRESS', l: '开工' }],
|
||||
IN_PROGRESS: [{ v: 'DONE', l: '完工' }]
|
||||
CREATED: [{ v: 'RELEASED', l: '下发工单' }, { v: 'CANCELLED', l: '取消工单' }],
|
||||
PENDING: [{ v: 'RELEASED', l: '下发工单' }, { v: 'CANCELLED', l: '取消工单' }],
|
||||
CONFIRMED: [{ v: 'IN_PROGRESS', l: '开始执行' }, { v: 'CANCELLED', l: '取消工单' }],
|
||||
RELEASED: [{ v: 'IN_PROGRESS', l: '开始执行' }, { v: 'CANCELLED', l: '取消工单' }],
|
||||
IN_PROGRESS: [{ v: 'PAUSED', l: '暂停' }, { v: 'DONE', l: '完工' }],
|
||||
PAUSED: [{ v: 'IN_PROGRESS', l: '恢复执行' }, { v: 'CANCELLED', l: '取消工单' }]
|
||||
}
|
||||
return map[status] || []
|
||||
}
|
||||
@@ -171,7 +177,7 @@ function openEdit(row) {
|
||||
Object.assign(dialog, { show: true, id: row.id, workOrderNo: row.workOrderNo, productTypeId: row.productTypeId, productCode: row.productCode, productName: row.productName, quantity: row.quantity, processSeq: row.processSeq || '1,2,3,4,5,6,7,8,9,10,11,12', status: row.status })
|
||||
}
|
||||
async function save() {
|
||||
const body = { id: dialog.id, workOrderNo: dialog.workOrderNo, productTypeId: dialog.productTypeId, productCode: dialog.productCode, productName: dialog.productName, quantity: dialog.quantity, processSeq: dialog.processSeq, status: dialog.status }
|
||||
const body = { id: dialog.id, workOrderNo: dialog.workOrderNo, productTypeId: dialog.productTypeId, productCode: dialog.productCode, productName: dialog.productName, quantity: dialog.quantity, processSeq: dialog.processSeq }
|
||||
if (dialog.id) await request.put('/work-orders', body)
|
||||
else await request.post('/work-orders', body)
|
||||
ElMessage.success('保存成功')
|
||||
@@ -201,15 +207,28 @@ async function saveSeq() {
|
||||
|
||||
async function changeStatus(row, status) {
|
||||
const label = statusText(status)
|
||||
await ElMessageBox.confirm(`确认将工单「${row.workOrderNo}」状态改为「${label}」?`, '提示', { type: 'warning' })
|
||||
await request.post('/work-orders/status', { id: row.id, status })
|
||||
ElMessage.success('状态已更新')
|
||||
// 取消/暂停允许填原因(可选),写入操作日志
|
||||
let reason = ''
|
||||
if (status === 'CANCELLED' || status === 'PAUSED') {
|
||||
try {
|
||||
const r = await ElMessageBox.prompt(
|
||||
`确认将工单「${row.workOrderNo}」${label}?可填写原因(用于操作日志,可留空)。`,
|
||||
label, { type: 'warning', confirmButtonText: '确认' })
|
||||
reason = (r.value || '').trim()
|
||||
} catch {
|
||||
return // 用户取消输入 → 放弃本次操作
|
||||
}
|
||||
} else {
|
||||
await ElMessageBox.confirm(`确认将工单「${row.workOrderNo}」${label}?`, '提示', { type: 'warning' })
|
||||
}
|
||||
await request.post('/work-orders/status', { id: row.id, status, reason })
|
||||
ElMessage.success(`已${label}`)
|
||||
load()
|
||||
}
|
||||
|
||||
async function del(row) {
|
||||
await ElMessageBox.confirm(
|
||||
`确认删除工单「${row.workOrderNo}」?\n仅「已创建/待排产/已发布」且无排产、备料、生产数据的工单可删除。`,
|
||||
`确认删除工单「${row.workOrderNo}」?\n仅「已创建」状态且无排产、备料、生产数据的工单可删除。`,
|
||||
'删除工单', { type: 'warning', confirmButtonText: '删除', confirmButtonClass: 'el-button--danger' })
|
||||
await request.delete(`/work-orders/${row.id}`)
|
||||
ElMessage.success('工单已删除')
|
||||
|
||||
Reference in New Issue
Block a user