新增一键虚拟入库

This commit is contained in:
liufumingren 2026-06-26 17:14:40 +08:00
parent d1c87cb752
commit af3c6ba6e6
3 changed files with 49 additions and 58 deletions

View File

@ -635,7 +635,7 @@ async function loadReceivingList() {
receivingListLoading.value = true
try {
const res = await getReceivingList({
const params: Record<string, unknown> = {
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
filterDepleted: true,
where: {
@ -643,7 +643,14 @@ async function loadReceivingList() {
is_review: { operator: 'eq', value: 1, type: 'number' },
storage_status: { operator: 'in', value: ['none', 'partial'], type: 'text' },
},
})
}
// 传入入库单 ID,按商品交集过滤,只拉取有交集产品的收货单
if (entryOrderId.value) {
params.entry_order_id = entryOrderId.value
}
const res = await getReceivingList(params)
if (!isApiSuccess(res)) {
receivingList.value = []
pagination.total = 0

View File

@ -211,7 +211,7 @@ export const entryColums = [
{ prop: 'remark',label:'备注',width:'160' },
// { prop: '',label:'',width:'160',fixed: 'left' },
// { prop: '',label:'',width:'160',fixed: 'left' },
{ prop: 'row_action', label: '操作', width: '80', fixed: 'right' },
{ prop: 'row_action', label: '操作', width: '300', fixed: 'right' },
]
const entryInventoryTypeLabelMap: Record<string, string> = {

View File

@ -19,14 +19,6 @@
<div class="toolbar-left">
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
<!-- <el-button size="small" @click="handleCreateEntry">新建入库单</el-button> -->
<el-button
size="small"
type="success"
:disabled="!canQuickInboundAction"
@click="openQuickInboundDialog"
>
快捷直入
</el-button>
<el-button size="small" @click="handleCompleteEntry">完成入库</el-button>
<el-button size="small" :disabled="!hasSelection" @click="confirmBatchCancel">批量作废</el-button>
<ExportModeDropdown :loading="exportLoading" @action="handleExportAction" />
@ -55,6 +47,7 @@
default-align="center"
table-id="storage-entry-list"
:enable-column-config="true"
:column-config-schema-version="2"
:data="list"
:columns="columns"
:table-size="tableSize"
@ -117,6 +110,15 @@
</template>
<template #column-row_action="{ row }">
<el-button
v-if="canQuickInbound(row.order_status)"
link
type="success"
size="small"
@click.stop="handleRowQuickInbound(row)"
>
虚拟直入
</el-button>
<el-button
v-if="canBindEntryOrder(row.order_status)"
link
@ -174,24 +176,6 @@
</div>
</div>
<!-- 快捷直入对话框 -->
<el-dialog
v-model="quickInboundDialogVisible"
title="快捷直入"
width="720px"
align-center
destroy-on-close
@closed="handleQuickInboundDialogClosed"
>
<QuickInboundForm
v-if="quickInboundDialogVisible"
:id="quickInboundTarget?.id"
:row="quickInboundTarget"
@success="handleQuickInboundDialogSuccess"
@cancel="quickInboundDialogVisible = false"
/>
</el-dialog>
<BindReceivingToEntryDialog
v-model="bindDialogVisible"
:row="bindTargetRow"
@ -258,7 +242,6 @@ import {
import entrydetail from './component/entrydetail.vue'
import log from './component/log.vue'
import entryoperate from './component/entryoperate.vue'
import QuickInboundForm from './component/QuickInboundForm.vue'
import BindReceivingToEntryDialog from './component/BindReceivingToEntryDialog.vue'
import DirectInboundLogs from './component/DirectInboundLogs.vue'
import EntryBindingRelations from './component/EntryBindingRelations.vue'
@ -355,8 +338,7 @@ const selectedRow = computed(() => {
return list.value.find((i: any) => i.id === selectedEntryId.value) || null
})
const quickInboundDialogVisible = ref(false)
const quickInboundTarget = ref<any>(null)
const bindDialogVisible = ref(false)
const bindTargetRow = ref<any>(null)
@ -711,11 +693,6 @@ function getActionTargetRows(): any[] {
return []
}
const canQuickInboundAction = computed(() => {
const targets = getActionTargetRows()
return targets.length === 1 && canQuickInbound(targets[0]?.order_status)
})
async function handleRowClick(row: any) {
selectedEntryId.value = row?.id || null
}
@ -751,30 +728,37 @@ function handleCreateEntry() {
ElMessage.warning('接口已下线:入库单不再支持手工新建,请使用快捷入库/匹配入库流程')
}
function openQuickInboundDialog() {
const targets = getActionTargetRows()
if (targets.length !== 1) {
ElMessage.warning('请选择一个入库单进行快捷直入')
return
}
const row = targets[0]
async function handleRowQuickInbound(row: any) {
if (!canQuickInbound(row.order_status)) {
ElMessage.warning('仅「已创建」状态的入库单可执行快捷直入')
ElMessage.warning('仅「已创建」状态的入库单可执行虚拟直入')
return
}
quickInboundTarget.value = row
quickInboundDialogVisible.value = true
}
function handleQuickInboundDialogClosed() {
quickInboundTarget.value = null
}
async function handleQuickInboundDialogSuccess() {
quickInboundDialogVisible.value = false
quickInboundTarget.value = null
await loadData()
entryDetailRefreshTick.value += 1
const code = row.entry_order_code || row.id
try {
await ElMessageBox.confirm(
`确定对入库单「${code}」执行虚拟直入?\n将跳过收货/质检,所有商品按明细数量直入虚拟库位,入库单状态变为「已完成」。`,
'确认虚拟直入',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
)
} catch {
return
}
try {
const res = await entryApi.quickInbound({ id: Number(row.id) })
if (res && (res.code === 1 || res.code === 200)) {
ElMessage.success('虚拟直入成功')
await loadData()
entryDetailRefreshTick.value += 1
} else {
ElMessage.error(res?.message || '虚拟直入失败')
}
} catch (e: any) {
ElMessage.error(e?.message || '虚拟直入失败')
}
}
async function handleCompleteEntry() {