feat(物料管理): 添加出/入库记录的撤销功能

在出库和入库记录页面添加撤销按钮,支持撤销已提交的记录。对于已撤销或红单记录显示为禁用状态。新增撤销接口调用和相应处理逻辑。
This commit is contained in:
Tom
2026-01-16 09:59:41 +08:00
parent 5354594106
commit f2fcd6d28c
2 changed files with 80 additions and 27 deletions

View File

@@ -91,24 +91,30 @@
<el-table-column prop="warehouseCode" label="仓库编码" align="center" v-if="columns.showColumn('warehouseCode')" />
<el-table-column prop="batchNo" label="批次号" align="center" v-if="columns.showColumn('batchNo')" />
<el-table-column prop="operator" label="操作员" align="center" v-if="columns.showColumn('operator')" />
<!-- <el-table-column label="操作" width="160">
<el-table-column label="操作">
<template #default="scope">
<el-button
type="success"
v-if="scope.row.remarks == '已撤销' || scope.row.transactionType == '入库红单'"
type="info"
size="small"
icon="edit"
title="编辑"
v-hasPermi="['mmrecordinbound:edit']"
@click="handleUpdate(scope.row)"></el-button>
<el-button
type="danger"
size="small"
icon="delete"
title="删除"
title="撤销"
v-hasPermi="['mmrecordinbound:delete']"
@click="handleDelete(scope.row)"></el-button>
@click="handleCancel(scope.row)"
disabled
>已撤销</el-button
>
<el-button
v-else
type="info"
size="small"
icon="refresh-left"
title="撤销"
v-hasPermi="['mmrecordinbound:delete']"
@click="handleCancel(scope.row)"
>撤销</el-button
>
</template>
</el-table-column> -->
</el-table-column>
</el-table>
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
@@ -303,7 +309,7 @@ import {
getMmRecordInbound
} from '@/api/materialManagement/productionMaterial/mmrecordinbound.js'
import { listMmTransactionType } from '@/api/materialManagement/productionMaterial/mmtransactiontype.js'
import { getMaterialOption, getLocationOption } from '@/api/materialManagement/productionMaterial/mminventory.js'
import { getMaterialOption, getLocationOption, cancelMmInventory } from '@/api/materialManagement/productionMaterial/mminventory.js'
import { listUser } from '@/api/system/user.js'
import useUserStore from '@/store/modules/user'
import { exportMmRecordInbound } from '@/api/materialManagement/productionMaterial/mmrecordinbound.js'
@@ -664,6 +670,27 @@ function handleExport() {
})
}
/** 撤销出/入库记录 */
function handleCancel(row) {
proxy
.$confirm('是否确认撤销入库记录?', '警告', {
confirmButtonText: proxy.$t('common.ok'),
cancelButtonText: proxy.$t('common.cancel'),
type: 'warning'
})
.then(() => {
cancelMmInventory({ id: row.id, type: 1 }).then((res) => {
const { code, msg } = res
if (code == 200) {
proxy.$modal.msgSuccess('撤销成功')
queryRecord()
} else {
proxy.$modal.msgError(msg)
}
})
})
}
handleQuery()
getTypeOfWarehousingList()
getMaterialCodeList()

View File

@@ -93,24 +93,29 @@
<el-table-column prop="orderNo" label="订单号" align="center" v-if="columns.showColumn('orderNo')" />
<el-table-column prop="operator" label="操作员" align="center" v-if="columns.showColumn('operator')" />
<el-table-column prop="remarks" label="备注" align="center" v-if="columns.showColumn('remarks')" />
<!-- <el-table-column label="操作" width="160">
<el-table-column label="操作">
<template #default="scope">
<el-button
type="success"
v-if="scope.row.remarks == '已撤销' || scope.row.transactionType == '出库红单'"
type="info"
size="small"
icon="edit"
title="编辑"
v-hasPermi="['mmrecordoutbound:edit']"
@click="handleUpdate(scope.row)"></el-button>
title="已撤销"
v-hasPermi="['mmrecordinbound:delete']"
disabled
>已撤销</el-button
>
<el-button
type="danger"
v-else
icon="refresh-left"
type="info"
size="small"
icon="delete"
title="删除"
v-hasPermi="['mmrecordoutbound:delete']"
@click="handleDelete(scope.row)"></el-button>
title="撤销"
v-hasPermi="['mmrecordinbound:delete']"
@click="handleCancel(scope.row)"
>撤销</el-button
>
</template>
</el-table-column> -->
</el-table-column>
</el-table>
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
@@ -275,7 +280,7 @@ import {
} from '@/api/materialManagement/productionMaterial/mmrecordoutbound.js'
import { listMmTransactionType } from '@/api/materialManagement/productionMaterial/mmtransactiontype.js'
import { listMmMaterial } from '@/api/materialManagement/productionMaterial/mmmaterial.js'
import { getLocationOption } from '@/api/materialManagement/productionMaterial/mminventory.js'
import { getLocationOption, cancelMmInventory } from '@/api/materialManagement/productionMaterial/mminventory.js'
import { listUser } from '@/api/system/user.js'
import dateOptions from '@/utils/dateOptions.js'
import useUserStore from '@/store/modules/user'
@@ -630,6 +635,27 @@ function handleExport() {
})
}
/** 撤销出/入库记录 */
function handleCancel(row) {
proxy
.$confirm('是否确认撤销出库记录?', '警告', {
confirmButtonText: proxy.$t('common.ok'),
cancelButtonText: proxy.$t('common.cancel'),
type: 'warning'
})
.then(() => {
cancelMmInventory({ id: row.id, type: 2 }).then((res) => {
const { code, msg } = res
if (code == 200) {
proxy.$modal.msgSuccess('撤销成功')
queryRecord()
} else {
proxy.$modal.msgError(msg)
}
})
})
}
handleQuery()
getTypeOfWarehousingList()
getMaterialList()