新增一键虚拟入库

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 receivingListLoading.value = true
try { try {
const res = await getReceivingList({ const params: Record<string, unknown> = {
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize }, pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
filterDepleted: true, filterDepleted: true,
where: { where: {
@ -643,7 +643,14 @@ async function loadReceivingList() {
is_review: { operator: 'eq', value: 1, type: 'number' }, is_review: { operator: 'eq', value: 1, type: 'number' },
storage_status: { operator: 'in', value: ['none', 'partial'], type: 'text' }, 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)) { if (!isApiSuccess(res)) {
receivingList.value = [] receivingList.value = []
pagination.total = 0 pagination.total = 0

View File

@ -211,7 +211,7 @@ export const entryColums = [
{ prop: 'remark',label:'备注',width:'160' }, { prop: 'remark',label:'备注',width:'160' },
// { prop: '',label:'',width:'160',fixed: 'left' }, // { prop: '',label:'',width:'160',fixed: 'left' },
// { 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> = { const entryInventoryTypeLabelMap: Record<string, string> = {

View File

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