feat(mes): 新增盘点方案编码和任务编码常量,更新错误码提示

新增盘点方案编码和盘点任务编码常量,以支持新的盘点功能。同时,更新相关错误码提示,确保用户在操作时获得准确的信息。
pull/871/MERGE
YunaiV 2026-03-31 18:14:42 +08:00
parent 03bc24d3f7
commit abe63d39db
3 changed files with 50 additions and 35 deletions

View File

@ -441,6 +441,8 @@ export const MesAutoCodeRuleCode = {
WM_PRODUCT_SALES_CODE: 'WM_PRODUCT_SALES_CODE', // 销售出库单编码 WM_PRODUCT_SALES_CODE: 'WM_PRODUCT_SALES_CODE', // 销售出库单编码
WM_MISC_ISSUE_CODE: 'WM_MISC_ISSUE_CODE', // 杂项出库单编码 WM_MISC_ISSUE_CODE: 'WM_MISC_ISSUE_CODE', // 杂项出库单编码
WM_MISC_RECEIPT_CODE: 'WM_MISC_RECEIPT_CODE', // 杂项入库单编码 WM_MISC_RECEIPT_CODE: 'WM_MISC_RECEIPT_CODE', // 杂项入库单编码
WM_STOCK_TAKING_PLAN_CODE: 'WM_STOCK_TAKING_PLAN_CODE', // 盘点方案编码
WM_STOCK_TAKING_CODE: 'WM_STOCK_TAKING_CODE', // 盘点任务编码
TRANSFER_CODE: 'TRANSFER_CODE' // 转移调拨单编码 TRANSFER_CODE: 'TRANSFER_CODE' // 转移调拨单编码
} as const } as const

View File

@ -86,10 +86,10 @@
</el-row> </el-row>
</el-form> </el-form>
<!-- 编辑时展示盘点参数 --> <!-- 编辑或详情时展示盘点参数 -->
<template v-if="formType === 'update' && formData.id"> <template v-if="(formType === 'update' || formType === 'detail') && formData.id">
<el-divider content-position="center">盘点参数</el-divider> <el-divider content-position="center">盘点参数</el-divider>
<StockTakingPlanParamList :plan-id="formData.id" /> <StockTakingPlanParamList :plan-id="formData.id" :disabled="formType === 'detail'" />
</template> </template>
<template #footer> <template #footer>
@ -102,11 +102,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { generateRandomStr } from '@/utils'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { AutoCodeRecordApi } from '@/api/mes/md/autocode/record'
import { StockTakingPlanApi, type StockTakingPlanVO } from '@/api/mes/wm/stocktaking/plan/index' import { StockTakingPlanApi, type StockTakingPlanVO } from '@/api/mes/wm/stocktaking/plan/index'
import StockTakingPlanParamList from './StockTakingPlanParamList.vue' import StockTakingPlanParamList from './StockTakingPlanParamList.vue'
import { MesWmStockTakingTypeEnum } from '@/views/mes/utils/constants' import { MesAutoCodeRuleCode, MesWmStockTakingTypeEnum } from '@/views/mes/utils/constants'
defineOptions({ name: 'StockTakingPlanForm' }) defineOptions({ name: 'StockTakingPlanForm' })
@ -115,6 +115,9 @@ const message = useMessage() // 消息弹窗
const { t } = useI18n() // const { t } = useI18n() //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const formLoading = ref(false) // 12
const formType = ref('create') // create - update - detail -
const isDetail = computed(() => formType.value === 'detail') //
const dialogTitle = computed(() => { const dialogTitle = computed(() => {
const titles = { const titles = {
create: '新增盘点方案', create: '新增盘点方案',
@ -123,10 +126,6 @@ const dialogTitle = computed(() => {
} }
return titles[formType.value] || formType.value return titles[formType.value] || formType.value
}) // }) //
const formLoading = ref(false) // 12
const formType = ref('create') // create - update - detail -
const isDetail = computed(() => formType.value === 'detail') //
const formRef = ref() // Ref
const formData = ref<StockTakingPlanVO>({ const formData = ref<StockTakingPlanVO>({
id: undefined, id: undefined,
code: undefined, code: undefined,
@ -143,10 +142,13 @@ const formRules = reactive({
name: [{ required: true, message: '方案名称不能为空', trigger: 'blur' }], name: [{ required: true, message: '方案名称不能为空', trigger: 'blur' }],
type: [{ required: true, message: '盘点类型不能为空', trigger: 'change' }] type: [{ required: true, message: '盘点类型不能为空', trigger: 'change' }]
}) })
const formRef = ref() // Ref
/** 生成方案编码 */ /** 生成方案编码 */
const generateCode = () => { const generateCode = async () => {
formData.value.code = 'STP' + generateRandomStr(10) formData.value.code = await AutoCodeRecordApi.generateAutoCode(
MesAutoCodeRuleCode.WM_STOCK_TAKING_PLAN_CODE
)
} }
/** 打开弹窗 */ /** 打开弹窗 */

View File

@ -116,24 +116,40 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="220" fixed="right"> <el-table-column label="操作" align="center" width="220" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-tooltip
v-if="scope.row.status === CommonStatusEnum.DISABLE" :disabled="scope.row.status === CommonStatusEnum.DISABLE"
link content="仅关闭状态,才可以操作"
type="primary" placement="top"
@click="openForm('update', scope.row.id)"
v-hasPermi="['mes:wm-stock-taking-plan:update']"
> >
编辑 <span class="inline-block cursor-not-allowed">
</el-button> <el-button
<el-button link
v-if="scope.row.status === CommonStatusEnum.DISABLE" type="primary"
link @click="openForm('update', scope.row.id)"
type="danger" v-hasPermi="['mes:wm-stock-taking-plan:update']"
@click="handleDelete(scope.row.id)" :disabled="scope.row.status !== CommonStatusEnum.DISABLE"
v-hasPermi="['mes:wm-stock-taking-plan:delete']" >
编辑
</el-button>
</span>
</el-tooltip>
<el-tooltip
:disabled="scope.row.status === CommonStatusEnum.DISABLE"
content="仅关闭状态,才可以操作"
placement="top"
> >
删除 <span class="inline-block cursor-not-allowed ml-10px">
</el-button> <el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['mes:wm-stock-taking-plan:delete']"
:disabled="scope.row.status !== CommonStatusEnum.DISABLE"
>
删除
</el-button>
</span>
</el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -163,8 +179,9 @@ const message = useMessage() // 消息弹窗
const { t } = useI18n() // const { t } = useI18n() //
const loading = ref(true) // const loading = ref(true) //
const total = ref(0) //
const list = ref<StockTakingPlanVO[]>([]) // const list = ref<StockTakingPlanVO[]>([]) //
const total = ref(0) //
const exportLoading = ref(false) //
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
@ -173,6 +190,7 @@ const queryParams = reactive({
type: undefined type: undefined
}) })
const queryFormRef = ref() // const queryFormRef = ref() //
const formRef = ref() //
/** 查询列表 */ /** 查询列表 */
const getList = async () => { const getList = async () => {
@ -199,7 +217,6 @@ const resetQuery = () => {
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => { const openForm = (type: string, id?: number) => {
formRef.value.open(type, id) formRef.value.open(type, id)
} }
@ -222,23 +239,17 @@ const handleStatusChange = async (row: StockTakingPlanVO) => {
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {
try { try {
//
await message.delConfirm() await message.delConfirm()
//
await StockTakingPlanApi.deleteStockTakingPlan(id) await StockTakingPlanApi.deleteStockTakingPlan(id)
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
//
await getList() await getList()
} catch {} } catch {}
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
const exportLoading = ref(false)
const handleExport = async () => { const handleExport = async () => {
try { try {
//
await message.exportConfirm() await message.exportConfirm()
//
exportLoading.value = true exportLoading.value = true
const data = await StockTakingPlanApi.exportStockTakingPlan(queryParams) const data = await StockTakingPlanApi.exportStockTakingPlan(queryParams)
download.excel(data, '盘点方案.xls') download.excel(data, '盘点方案.xls')