feat: 新增装机绑定功能与权限、BOM工序配置
1. 新增装机绑定实体与相关CRUD逻辑,支持工件工序物料绑定/解绑 2. 为BOM物料新增装配工序字段,支持按工序校验绑定 3. 扩展权限表,新增父权限码字段支持菜单按钮关联 4. 统一各页面帮助弹窗参数,新增角色管理帮助文档 5. 新增公共格式化工具函数,优化侧边栏菜单展开逻辑 6. 新增工位终端绑定代理接口与MES内部绑定API 7. 修复主入口数据库连接与schema初始化逻辑,新增一键迁移工具
This commit is contained in:
@@ -10,6 +10,15 @@ export const getConfig = () => request.get('/api/config')
|
||||
export const getTaskCurrent = (stationNo) =>
|
||||
request.get('/api/task/current', { params: { stationNo } })
|
||||
|
||||
// 装机绑定面板(代理 MES):sn+processCode → 应绑/已绑清单
|
||||
export const getBindPanel = (params) => request.get('/api/bind/panel', { params })
|
||||
|
||||
// 装机绑定一条(代理 MES):{sn, processCode, stationNo, items:[{materialCode, bindValue}]}
|
||||
export const bindRecord = (data) => request.post('/api/bind/record', data)
|
||||
|
||||
// 撤销一条绑定(代理 MES):{sn, processCode, materialCode, bindValue}
|
||||
export const bindRemove = (data) => request.post('/api/bind/remove', data)
|
||||
|
||||
// 我的工作量(代理 MES,按当前登录人查询)
|
||||
export const getWorkload = (params) => request.get('/api/workload', { params })
|
||||
|
||||
|
||||
@@ -40,6 +40,42 @@
|
||||
<span class="screw-progress">已拧 {{ tightRows.length }} 颗</span>
|
||||
</section>
|
||||
|
||||
<!-- 装机绑定卡:扫工件后自动拉取本工序应装物料,扫一个绑一个(精密件必须扫码SN),齐套后可报工 -->
|
||||
<section v-if="bindShow" class="card bind-card">
|
||||
<div class="bind-head">
|
||||
<h3 class="card-title">工序 {{ processCodeText }} 装机绑定(装配物料)</h3>
|
||||
<el-tag v-if="bindPanel && bindPanel.enabled && bindPanel.complete" type="success" size="large" effect="dark">已绑齐 ✓</el-tag>
|
||||
<el-tag v-else-if="bindPanel && bindPanel.enabled" type="danger" size="large" effect="dark">未绑齐({{ bindPanel.missing || '缺料' }})</el-tag>
|
||||
<el-tag v-else type="info" size="large">该产品本工序未配置需绑物料</el-tag>
|
||||
</div>
|
||||
<div v-if="bindPanel && bindPanel.required && bindPanel.required.length" class="bind-list">
|
||||
<div v-for="r in bindPanel.required" :key="r.materialCode" class="bind-item">
|
||||
<div class="bind-meta">
|
||||
<span class="bind-name">{{ r.materialName || r.materialCode }}</span>
|
||||
<span class="bind-code">{{ r.materialCode }}</span>
|
||||
<el-tag size="small" :type="r.manageMode === '2' ? 'primary' : 'warning'">
|
||||
{{ r.manageMode === '2' ? '精密件·扫码SN' : '结构件·批次' }}
|
||||
</el-tag>
|
||||
<span class="bind-count" :class="r.complete ? 'ok' : 'ng'">{{ r.boundCount }}/{{ r.need }}</span>
|
||||
</div>
|
||||
<div class="bind-bound">
|
||||
<el-tag v-for="b in r.bound" :key="b" size="small" closable @close="removeBind(r, b)">{{ b }}</el-tag>
|
||||
<span v-if="!r.bound.length" style="color:#909399">未绑定</span>
|
||||
</div>
|
||||
<div class="bind-input-row">
|
||||
<el-input
|
||||
v-model.trim="bindInputs[r.materialCode]"
|
||||
size="large"
|
||||
:placeholder="r.manageMode === '2' ? '扫描精密件SN(必扫)' : '扫描/输入批次号'"
|
||||
clearable
|
||||
@keyup.enter="doBind(r)"
|
||||
/>
|
||||
<el-button type="primary" size="large" :loading="binding" @click="doBind(r)">绑定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 三区布局:A 任务卡 / C 步骤采集 / 右 拧紧结果 -->
|
||||
<main class="content">
|
||||
<!-- A. 左侧任务卡(流程名 + 工序号 + 工单号 + 工艺PDF) -->
|
||||
@@ -222,6 +258,9 @@ import {
|
||||
getTaskCurrent,
|
||||
getTighteningList,
|
||||
getWorkload,
|
||||
getBindPanel,
|
||||
bindRecord,
|
||||
bindRemove,
|
||||
pdfOpenUrl,
|
||||
reportProcessDone,
|
||||
reportTempStore,
|
||||
@@ -299,9 +338,77 @@ function onScan() {
|
||||
currentSn.value = sn
|
||||
scanInput.value = ''
|
||||
loadTight()
|
||||
loadBindPanel()
|
||||
focusScan()
|
||||
}
|
||||
|
||||
// ---------- 装机绑定(装配物料:精密件必须扫码SN / 结构件扫批次) ----------
|
||||
const bindShow = ref(false)
|
||||
const bindPanel = ref(null)
|
||||
const bindInputs = reactive({})
|
||||
const binding = ref(false)
|
||||
|
||||
function loadBindPanel() {
|
||||
const code = Number(processCode.value)
|
||||
if (!currentSn.value || !code) {
|
||||
bindShow.value = false
|
||||
bindPanel.value = null
|
||||
return
|
||||
}
|
||||
bindShow.value = true
|
||||
getBindPanel({ sn: currentSn.value, processCode: code })
|
||||
.then((p) => {
|
||||
bindPanel.value = p
|
||||
// 预填各料输入框为空
|
||||
;(p?.required || []).forEach((r) => { if (bindInputs[r.materialCode] === undefined) bindInputs[r.materialCode] = '' })
|
||||
})
|
||||
.catch(() => {
|
||||
bindPanel.value = null
|
||||
})
|
||||
}
|
||||
|
||||
async function doBind(r) {
|
||||
const v = (bindInputs[r.materialCode] || '').trim()
|
||||
if (!v) return ElMessage.warning('请先扫描/输入' + (r.manageMode === '2' ? '精密件SN' : '批次号'))
|
||||
if (!currentSn.value) return ElMessage.warning('请先扫描工件SN')
|
||||
binding.value = true
|
||||
try {
|
||||
await bindRecord({
|
||||
sn: currentSn.value,
|
||||
orderNo: orderNo.value || '',
|
||||
processCode: Number(processCode.value),
|
||||
stationNo: stationNo.value,
|
||||
items: [{ materialCode: r.materialCode, bindValue: v }]
|
||||
})
|
||||
ElMessage.success(`绑定成功:${r.materialName || r.materialCode}`)
|
||||
bindInputs[r.materialCode] = ''
|
||||
loadBindPanel()
|
||||
} catch (e) {
|
||||
/* 错误已提示:SN重复/料不匹配/离线等 */
|
||||
}
|
||||
binding.value = false
|
||||
}
|
||||
|
||||
async function removeBind(r, b) {
|
||||
try {
|
||||
await ElMessageBox.confirm(`撤销绑定「${b}」?`, '撤销绑定', { type: 'warning' })
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await bindRemove({
|
||||
sn: currentSn.value,
|
||||
processCode: Number(processCode.value),
|
||||
materialCode: r.materialCode,
|
||||
bindValue: b
|
||||
})
|
||||
ElMessage.success('已撤销')
|
||||
loadBindPanel()
|
||||
} catch (e) {
|
||||
/* 错误已提示(报工后不可撤销) */
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- 步骤采集与判定 ----------
|
||||
const stepValues = reactive({})
|
||||
|
||||
@@ -451,6 +558,11 @@ async function onProcessDone() {
|
||||
ElMessage.warning('请选择工单号')
|
||||
return
|
||||
}
|
||||
// 强校验:本工序装配物料须绑齐(精密件按用量逐颗SN、结构件至少一批次)
|
||||
if (bindPanel.value && bindPanel.value.enabled && !bindPanel.value.complete) {
|
||||
ElMessage.warning('装配物料未绑齐,不能上报:' + (bindPanel.value.missing || '缺料'))
|
||||
return
|
||||
}
|
||||
const allOk = !manualNg.value && !autoNg.value
|
||||
if (!allOk) {
|
||||
try {
|
||||
@@ -477,6 +589,8 @@ async function onProcessDone() {
|
||||
} else {
|
||||
ElMessage.success(allOk ? '工序完成上报成功' : '工序完成上报成功(含NG)')
|
||||
}
|
||||
bindPanel.value = null
|
||||
bindShow.value = false
|
||||
loadTask()
|
||||
loadStats()
|
||||
} catch (e) {
|
||||
@@ -1073,6 +1187,64 @@ onBeforeUnmount(() => {
|
||||
.big-btn.success { background: #2aa861; }
|
||||
.big-btn.success:hover { background: #239154; }
|
||||
|
||||
/* ---- 装机绑定卡 ---- */
|
||||
.bind-card {
|
||||
flex-shrink: 0;
|
||||
margin: 0 20px 12px;
|
||||
padding: 14px 18px;
|
||||
background: #fff;
|
||||
border: 2px solid #d9e4ff;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.bind-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.bind-head .card-title { margin: 0; }
|
||||
.bind-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
max-height: 150px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.bind-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 8px 10px;
|
||||
background: #f7f9fc;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.bind-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 300px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.bind-name { font-size: 17px; font-weight: bold; color: #16324f; }
|
||||
.bind-code { color: #909399; font-size: 13px; }
|
||||
.bind-count { font-size: 16px; font-weight: bold; }
|
||||
.bind-count.ok { color: #2aa861; }
|
||||
.bind-count.ng { color: #d80f16; }
|
||||
.bind-bound {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
flex: 1;
|
||||
min-width: 140px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.bind-input-row {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
min-width: 300px;
|
||||
}
|
||||
.bind-input-row .el-input { flex: 1; }
|
||||
|
||||
/* ---- 我的工作量弹窗 ---- */
|
||||
.wl-stat { text-align: center; }
|
||||
.wl-label { color: #909399; font-size: 14px; margin-bottom: 6px; }
|
||||
|
||||
Reference in New Issue
Block a user