feat(wms): 添加入库质检发起功能

- 在入库打印页面增加发起质检按钮
- 集成createInspection接口调用
- 添加检验类型路由参数获取逻辑
- 实现质检记录过滤和验证机制
- 添加批量发起质检的确认提示
- 实现质检结果反馈和列表刷新
- 在质检结果类型定义中增加methodName字段
master
zangch@mesnac.com 3 weeks ago
parent f9eec1e421
commit 986acda9d7

@ -104,6 +104,7 @@ export interface QcInspectionResultVO {
*/
description: string;
methodName?: string;
}
export interface QcInspectionResultForm extends BaseEntity {
@ -211,6 +212,7 @@ export interface QcInspectionResultForm extends BaseEntity {
*
*/
description?: string;
methodName?: string;
}
@ -325,6 +327,8 @@ export interface QcInspectionResultQuery extends PageQuery {
*
*/
params?: any;
methodName?: string;
}

@ -89,6 +89,9 @@
<!-- <el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handlePrint"></el-button>
</el-col>-->
<el-col :span="1.5">
<el-button type="success" plain icon="Check" :disabled="multiple" @click="handleCreateInspection" v-hasPermi="['wms:instockPrint:add']"></el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" :columns="columns" :search="true" @queryTable="getList"></right-toolbar>
</el-row>
</template>
@ -202,7 +205,7 @@
</template>
<script setup name="InstockPrint" lang="ts">
import { listInstockPrint, getInstockPrint, delInstockPrint, addInstockPrint, updateInstockPrint, printInstockPrint } from '@/api/wms/instockPrint';
import { listInstockPrint, getInstockPrint, delInstockPrint, addInstockPrint, updateInstockPrint, printInstockPrint, createInspection } from '@/api/wms/instockPrint';
import { InstockPrintVO, InstockPrintQuery, InstockPrintForm } from '@/api/wms/instockPrint/types';
import {
getMaterialList
@ -336,6 +339,16 @@ if (route.query.inboundStatus ) {
inboundStatusdVisble.value = true;
}
//
//=0, =1, =2, =3, =4, =5, =6, =7=8
let routeInspectionTypeParam = '4'; // 4
if (route.query.inspectionType) {
routeInspectionTypeParam = Array.isArray(route.query.inspectionType)
? route.query.inspectionType[0] as string
: route.query.inspectionType as string;
}
const dialog = reactive<DialogOption>({
visible: false,
title: ''
@ -466,6 +479,65 @@ const handleExport = () => {
}, `instockPrint_${new Date().getTime()}.xlsx`)
}
/** 发起质检按钮操作 */
const handleCreateInspection = async () => {
if (vos.value.length === 0) {
proxy?.$modal.msgWarning('请先选择要发起质检的批次');
return;
}
// inspectionRequest='0'() inspectionType='0'()
const validRecords = vos.value.filter(item =>
item.inspectionRequest === '0' && item.inspectionType === '0'
);
if (validRecords.length === 0) {
proxy?.$modal.msgWarning('所选记录中没有可发起质检的批次(需要必检且未发起状态)');
return;
}
const skippedCount = vos.value.length - validRecords.length;
let confirmMsg = `确认要为选中的 ${validRecords.length} 个批次发起质检吗?`;
if (skippedCount > 0) {
confirmMsg += `\n${skippedCount} 个记录因免检或已发起质检将被跳过)`;
}
await proxy?.$modal.confirm(confirmMsg);
loading.value = true;
try {
//
const requestData = validRecords.map(item => ({
instockPrintId: item.instockPrintId,
instockCode: item.instockCode,
batchCode: item.batchCode,
materialCode: item.materialCode,
materialName: item.materialName,
apportionQty: item.apportionQty,
inspectionRequest: item.inspectionRequest, //
inspectionType: item.inspectionType, //
inspectionTypeParam: routeInspectionTypeParam //
}));
const res = await createInspection(requestData);
// R res.data Map
if (res.data) {
const resultMap = res.data;
const count = Object.keys(resultMap).length;
proxy?.$modal.msgSuccess(`成功发起 ${count} 个质检任务`);
} else {
proxy?.$modal.msgSuccess('质检任务发起成功');
}
await getList();
} catch (error) {
console.error('发起质检失败:', error);
} finally {
loading.value = false;
}
}
let mategoryOptions = ref([]);
const getMaterialCategorySelect = async () => {
const res = await getBaseMaterialCategoryListInWMS(null);

Loading…
Cancel
Save