提交
This commit is contained in:
@@ -4,7 +4,7 @@ import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import request from '../utils/request'
|
||||
import { getRealName } from '../utils/auth'
|
||||
import { fmtTime } from '../utils/format'
|
||||
import { fmtTime, fmtDateOnly, friendlyBatchLabel } from '../utils/format'
|
||||
import { exportXlsxFetch } from '../utils/export'
|
||||
import { can } from '../utils/perm'
|
||||
import { confirmAction } from '../utils/confirm'
|
||||
@@ -24,7 +24,7 @@ const CATEGORY_OPTIONS = [
|
||||
{ value: 'deliver', label: '发货' },
|
||||
{ value: 'other', label: '其他' }
|
||||
]
|
||||
// 归属口径(需求22):合同号/科技项目号/其他,默认其他;合同号是独立维度标签,非 MES 工单号
|
||||
// 归属口径(需求22):合同号/科技项目号/其他,默认其他;合同号是独立维度标签,非 MES 产品工号
|
||||
const OWNERSHIP_OPTIONS = [
|
||||
{ value: 'workorder', label: '合同号' },
|
||||
{ value: 'project', label: '科技项目号' },
|
||||
@@ -83,10 +83,24 @@ async function loadBatchOptions(code) {
|
||||
if (!code) { batchOptions.value = []; return }
|
||||
try {
|
||||
const stock = await request.get('/stock/details', { params: { materialCode: code, snMode: 2, page: 1, pageSize: 200 } })
|
||||
batchOptions.value = (stock?.list || [])
|
||||
const rows = (stock?.list || [])
|
||||
.map(b => ({ ...b, avail: (b.quantity || 0) - (b.lockedQty || 0) }))
|
||||
.filter(b => b.avail > 0)
|
||||
.sort((a, b) => String(a.batchNo).localeCompare(String(b.batchNo)))
|
||||
// 选批显示改友好标签(2026-10-21 批次号收口):{入库日期}入库 · 可用{数量}件 · {供应商},同日多批加「第N批」;
|
||||
// 批次号仅作 value 传后端,界面不出现
|
||||
const dayCount = {}
|
||||
const daySeen = {}
|
||||
for (const b of rows) {
|
||||
const d = fmtDateOnly(b.createdAt)
|
||||
dayCount[d] = (dayCount[d] || 0) + 1
|
||||
}
|
||||
for (const b of rows) {
|
||||
const d = fmtDateOnly(b.createdAt)
|
||||
daySeen[d] = (daySeen[d] || 0) + 1
|
||||
b.label = friendlyBatchLabel(b, dayCount[d] > 1 ? daySeen[d] : 0)
|
||||
}
|
||||
batchOptions.value = rows
|
||||
if (batchOptions.value.length && !genForm.batchNo) genForm.batchNo = batchOptions.value[0].batchNo
|
||||
} catch { batchOptions.value = [] }
|
||||
}
|
||||
@@ -353,11 +367,11 @@ onMounted(loadDicts)
|
||||
</el-form-item>
|
||||
|
||||
<template v-if="genForm.mode === 1">
|
||||
<el-form-item label="批次号">
|
||||
<el-form-item label="出库批次">
|
||||
<el-select v-model="genForm.batchNo" filterable clearable
|
||||
placeholder="从该物料可用批次中选择(默认带出 FIFO 首个)" style="width:100%">
|
||||
<el-option v-for="b in batchOptions" :key="b.batchNo" :value="b.batchNo"
|
||||
:label="`${b.batchNo}(可用 ${b.avail}|${b.qualityStatus || '未检'}${b.zoneCode ? '|' + b.zoneCode : ''})`" />
|
||||
:label="b.label" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" required>
|
||||
@@ -455,7 +469,7 @@ onMounted(loadDicts)
|
||||
<el-input v-model="recFilters.boxNo" placeholder="按箱号查询" clearable style="width:160px" @keyup.enter="searchRec" />
|
||||
</el-form-item>
|
||||
<el-form-item label="归属单号">
|
||||
<el-input v-model="recFilters.ownershipNo" placeholder="工单号/科技项目号" clearable style="width:160px" @keyup.enter="searchRec" />
|
||||
<el-input v-model="recFilters.ownershipNo" placeholder="产品工号/科技项目号" clearable style="width:160px" @keyup.enter="searchRec" />
|
||||
</el-form-item>
|
||||
<el-form-item label="检测单号">
|
||||
<el-input v-model="recFilters.inspectionNo" placeholder="检测单号(模糊)" clearable style="width:180px" @keyup.enter="searchRec" />
|
||||
@@ -490,7 +504,7 @@ onMounted(loadDicts)
|
||||
<el-tag :type="row.status === '已送达' ? 'success' : 'info'" size="small">{{ row.status || '已出库' }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="orderNo" label="工单号" min-width="130">
|
||||
<el-table-column prop="orderNo" label="产品工号" min-width="130">
|
||||
<template #default="{ row }">{{ row.orderNo || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="出库类别" width="100" align="center">
|
||||
@@ -500,9 +514,6 @@ onMounted(loadDicts)
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="materialCode" label="物料" min-width="120" />
|
||||
<el-table-column prop="batchNo" label="批次号" min-width="110">
|
||||
<template #default="{ row }">{{ row.batchNo || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="库位" min-width="120" align="center">
|
||||
<template #default="{ row }">{{ row.zoneCode ? row.zoneCode + ' ' + locText(row) : '-' }}</template>
|
||||
</el-table-column>
|
||||
|
||||
Reference in New Issue
Block a user