提交
This commit is contained in:
@@ -6,8 +6,9 @@
|
||||
defineOptions({ name: 'InboundEntry' })
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import axios from 'axios'
|
||||
import request from '../utils/request'
|
||||
import { getRealName } from '../utils/auth'
|
||||
import { getRealName, getToken } from '../utils/auth'
|
||||
import MaterialSelect from './MaterialSelect.vue'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -18,6 +19,26 @@ const emit = defineEmits(['submitted'])
|
||||
const operator = getRealName()
|
||||
const isOther = computed(() => props.manageMode === 3)
|
||||
|
||||
/* ---------- 产品工号软校验(B1):失焦异步查 MES 工单存在性,红字提示、不阻断保存 ---------- */
|
||||
const workNoState = ref('') // ''=未校验 / ok / miss=查不到 / net=接口异常
|
||||
let workNoSeq = 0
|
||||
async function checkWorkNo() {
|
||||
const v = form.productWorkNo.trim()
|
||||
if (!v) { workNoState.value = ''; return }
|
||||
const seq = ++workNoSeq
|
||||
try {
|
||||
const res = await axios.get('/api/workorder/exists', {
|
||||
params: { orderNo: v },
|
||||
headers: { Authorization: `Bearer ${getToken()}` },
|
||||
validateStatus: () => true
|
||||
})
|
||||
if (seq !== workNoSeq) return // 已发起更新的校验,丢弃旧结果
|
||||
workNoState.value = res.status === 200 ? 'ok' : (res.status === 404 ? 'miss' : 'net')
|
||||
} catch {
|
||||
if (seq === workNoSeq) workNoState.value = 'net'
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- 表单 ---------- */
|
||||
const formRef = ref()
|
||||
const submitting = ref(false)
|
||||
@@ -261,9 +282,7 @@ onMounted(() => loadZones())
|
||||
|
||||
<!-- 序列号=否(按批次记账,sn_mode=否):批次号 + 数量;生产日期仅结构件页签展示,供应商结构件/其他展示 -->
|
||||
<template v-if="!isSn">
|
||||
<el-form-item label="批次号">
|
||||
<el-input v-model="form.batchNo" placeholder="留空则自动生成" clearable />
|
||||
</el-form-item>
|
||||
<!-- 批次号改为系统内部编号(留空自动生成),录入界面不再出现(C1) -->
|
||||
<el-form-item label="数量" required>
|
||||
<el-input-number v-model="form.quantity" :min="1" :step="1" step-strictly style="width:100%" />
|
||||
</el-form-item>
|
||||
@@ -276,19 +295,6 @@ onMounted(() => loadZones())
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<!-- 序列号=是(按 SN 记账,sn_mode=是):SN 扫码录入 -->
|
||||
<template v-else>
|
||||
<el-form-item label="扫码录入">
|
||||
<div style="width:100%">
|
||||
<el-input v-model="snInput" type="textarea" :rows="4"
|
||||
placeholder="扫入或粘贴 SN,可用 逗号/分号/顿号/空格/回车 分隔,一次可录入多条" />
|
||||
<el-button type="primary" plain style="margin-top:6px" :disabled="!snInput.trim()"
|
||||
@click="addSnLines">录入到列表</el-button>
|
||||
<span style="margin-left:8px;color:#909399;font-size:12px">点【录入到列表】加入下方清单,回车只是换行</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<el-form-item label="区域" prop="zoneCode">
|
||||
<el-select v-model="form.zoneCode" placeholder="请选择入库区域(必填)" clearable style="width:100%"
|
||||
@change="onZoneChange" @visible-change="(v) => v && loadZones(true)">
|
||||
@@ -322,7 +328,12 @@ onMounted(() => loadZones())
|
||||
</el-form-item>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品工号">
|
||||
<el-input v-model="form.productWorkNo" placeholder="手填(可空)" clearable style="width:260px" />
|
||||
<div style="width:100%">
|
||||
<el-input v-model="form.productWorkNo" placeholder="手填(可空)" clearable style="width:260px"
|
||||
@blur="checkWorkNo" @clear="checkWorkNo" />
|
||||
<div v-if="workNoState === 'miss'" style="color:#f56c6c;font-size:12px;line-height:1.6">未找到对应的工单,请确认产品工号是否正确</div>
|
||||
<div v-else-if="workNoState === 'net'" style="color:#f56c6c;font-size:12px;line-height:1.6">网络异常,未能校验工单号,请稍后确认</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="入库单号">
|
||||
<el-input v-model="form.inboundNo" placeholder="留空自动生成(如 IB20260921-001)" clearable />
|
||||
@@ -342,15 +353,23 @@ onMounted(() => loadZones())
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-form-item v-if="!isSn">
|
||||
<el-button type="primary" :loading="submitting" @click="submit">提交入库</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-alert v-if="lastInboundNo" type="success" :closable="false"
|
||||
:title="`最近入库单号:${lastInboundNo}`" style="max-width:620px" />
|
||||
|
||||
<!-- SN 清单(序列号=是(按 SN 记账)) -->
|
||||
<!-- SN 录入区 + 已录入清单(序列号=是(按 SN 记账):扫码区与已录入计数上下相邻,不隔其他内容) -->
|
||||
<template v-if="isSn">
|
||||
<el-card shadow="never" style="max-width:620px;margin-bottom:12px">
|
||||
<div style="font-weight:600;margin-bottom:6px">SN 扫码录入</div>
|
||||
<el-input v-model="snInput" type="textarea" :rows="4"
|
||||
placeholder="扫入或粘贴 SN,可用 逗号/分号/顿号/空格/回车 分隔,一次可录入多条" />
|
||||
<el-button type="primary" plain style="margin-top:6px" :disabled="!snInput.trim()"
|
||||
@click="addSnLines">录入到列表</el-button>
|
||||
<span style="margin-left:8px;color:#909399;font-size:12px">点【录入到列表】加入下方清单,回车只是换行</span>
|
||||
</el-card>
|
||||
<div style="margin:8px 0">已录入 <b>{{ snList.length }}</b> 条 SN</div>
|
||||
<el-table :data="snList.map((v, i) => ({ i, v }))" size="small" border max-height="320" empty-text="暂无 SN" style="max-width:620px">
|
||||
<el-table-column type="index" label="#" width="56" align="center" />
|
||||
|
||||
Reference in New Issue
Block a user