|
|
|
|
@ -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);
|
|
|
|
|
|